Bitmaps on Indexed layer


#1

Hi everyone’

Was wondering if its possible to display colored bitmaps on the indexed layer?

Thanks
Daniel


#2

Hi Dann,

Currently the indexed layer only supports a single color (and transparent). In the future it should support up to 8-bit color, which might work for displaying multi-color bitmaps. That’s not going to be in the next couple releases though, where I’m focusing on adding support for APA102 LED strips and more chipsets (e.g. Particle Photon)


#3

Cool, no problem just hoping… Wanted to add some shading to text on the indexed layer to stop it from being lost in the background but not a big deal i can work around…
Thanks for the update.


#4

Is the indexed layer able to support multiple colors yet ?
Also im playing with bitmaps on the indexed layer and was wondering if there is a converter that will output the required format that is used as below ?

        _______X, ________,
        ______XX, X_______,
        ______XX, X_______,
        ______XX, X_______,
        _____XXX, XX______,

Thanks
Daniel


#5

Hi Daniel, sorry, no progress on this.

That format isn’t required, it’s just added as a convenience to make simple bitmaps with text instead of numbers. You can see in MatrixFontCommon.h how those macros convert to numbers, e.g.:

0x01, 0x00,
0x03, 0x80,
0x03, 0x80,
0x03, 0x80,
0x07, 0xC0

You can probably find a converter that outputs bitmaps in numbers like that.


#6

cool, thanks for that Louis.


#7

Ok i found a good converter and i now can display mono bitmaps but im a little stuck. I have multiple bitmaps ( 60 ) which form animations when displayed one after another and rite now im just drawing them one after the other with: indexedLayer.drawMonoBitmap

Is there a way to select each bitmap without having 60 seperate drawMonoBitmap lines ??

Thanks
Daniel


#8

Hi Daniel,

I’m not exactly sure how you’re defining the bitmaps, but if you put them in an array then you could access them by index with code. If that doesn’t help, maybe post your code (through Github Gist), and I’ll take a look.


#9

Hi Louis’
Im sure its something simple that im just not cluing on too.
They are stored as arrays just like in your examples. Im simply calling them one after the other like below:

indexedLayer.drawMonoBitmap(0, 0, ZeroBitmapWidth, ZeroBitmapHeight, 1, ZeroBitmap60);

uint8_t ZeroBitmap60[]=
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xF0, 0x0F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xF0, 0x03, 0xF0, 0xF0, 0x30, 0xF0, 0x30, 0xFC, 0x00, 0xFC, 0x00, 0xF0, 0xC0, 0xF0, 0xC0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0,
};

Any help would be appreciated.
Thanks
Daniel


#10

Hi Daniel,

I think you want an array of arrays, or combine all bitmaps into one big array and use an offset multiplied by the frame number to find the frame you want to display.


#11

Thanks Louis’

I started looking into using one big array when i first started like you suggest but i couldnt work out how to change the below line to allow for the offset.

indexedLayer.drawMonoBitmap(0, 0, ZeroBitmapWidth, ZeroBitmapHeight, 1, ZeroBitmap60);

I’ll look into your array of arrays idea.
Thanks again
Daniel


#12

Taking your earlier example code:

uint8_t ZeroBitmap60[]=
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xF0, 0x0F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xF0, 0x03, 0xF0, 0xF0, 0x30, 0xF0, 0x30, 0xFC, 0x00, 0xFC, 0x00, 0xF0, 0xC0, 0xF0, 0xC0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0,
};

uint8_t ZeroBitmap61[]=
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xF0, 0x0F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xF0, 0x03, 0xF0, 0xF0, 0x30, 0xF0, 0x30, 0xFC, 0x00, 0xFC, 0x00, 0xF0, 0xC0, 0xF0, 0xC0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0,
};

indexedLayer.drawMonoBitmap(0, 0, ZeroBitmapWidth, ZeroBitmapHeight, 1, ZeroBitmap60);
indexedLayer.drawMonoBitmap(0, 0, ZeroBitmapWidth, ZeroBitmapHeight, 1, ZeroBitmap61);

You could put into one big array and use an offset:

uint8_t ZeroBitmapCombined[]=
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xF0, 0x0F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xF0, 0x03, 0xF0, 0xF0, 0x30, 0xF0, 0x30, 0xFC, 0x00, 0xFC, 0x00, 0xF0, 0xC0, 0xF0, 0xC0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0,

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xF0, 0x0F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xF0, 0x03, 0xF0, 0xF0, 0x30, 0xF0, 0x30, 0xFC, 0x00, 0xFC, 0x00, 0xF0, 0xC0, 0xF0, 0xC0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0,
};

indexedLayer.drawMonoBitmap(0, 0, ZeroBitmapWidth, ZeroBitmapHeight, 1, ZeroBitmapCombined + (70 * 0));
indexedLayer.drawMonoBitmap(0, 0, ZeroBitmapWidth, ZeroBitmapHeight, 1, ZeroBitmapCombined + (70 * 1));

#13

Your a legend Louis, i went back and added the offset and all works as planned…

Thanks for the help
Daniel