Bitmap background

Hi Guys’

I have a simple shaped bitmap i want to display on the background layer. When i display it im getting the background portion of the bitmap. So i display a 32x32 bitmap with a circle shape and i get the colored circle but also the black background it was on or white or whatever color the bitmap was on…

How do i display a bitmap without the background of that bitmap? or can i choose what part of the background is shown and what is not say like leaving a one pixel black background boarder all around the actual image i want displayed?


Are you starting from the Bitmaps example? There is no support for transparency in bitmaps. There’s also no support for transparency in the background layer.

You could choose a specific color or range of colors that you don’t draw to the background layer. e.g. to not draw black to the background layer, change this code:

backgroundLayer.drawPixel(x + j, y + i, pixel);

to this:

if( != 0x00 || != 0x00 || != 0x00) backgroundLayer.drawPixel(x + j, y + i, pixel);

A better way to do this in the future would be to add support for transparent graphical layers to SmartMatrix, and use an image format that supports transparency (e.g. GIF). A transparent graphical layer is pretty low on my list of priorities right now, so hopefully the workaround works for you.

Thanks Louis, yes i started from the example… Ill try your workaround thanks for that…

Workaround works like a charm, thanks Louis

1 Like