Bodmer / TFT_eFEX

A support library for TFT_eSPI that adds commonly used extra functions
Other
83 stars 27 forks source link

DrawBmp supports only files and not Arrays (DrawJpg supports both) #15

Closed alijani1 closed 4 years ago

alijani1 commented 4 years ago

please add ability to drawbmp from an array (16 bit 565) or (8bit). you support Drawjpg from array but for small sprites, jpgs are too large. would be very useful for high speed small sprites drawing.

Bodmer commented 4 years ago

There is an example here that draw 16 bit raw bitmap image files. Os this waht you are asking for?

alijani1 commented 4 years ago

there is an interface to DrawJPG from array or a file, but the implementation of DrawBmp is only for file and none from array. So developers whom have BMP arrays have to create their own implementation using DrawPixel one at a time. Since your DrawJPG supports both files and arrays, in the same if you can implement DrawBmp to also support array, it would make it more complete and eliminate developers from creating their own draw from array functions.

Bodmer commented 4 years ago

I missed the link. Here. See comments in sketch on how to create the bitmap. If you mean store a windows format bitmap then this would need a method to copy the BMP file into an array to be identified. Note that the BMP format would be very wasteful of memory due to the header size and 3 bytes per pixel and would probably be of interest to very few users.

alijani1 commented 4 years ago

What I meant was ability to send 565 or 332 image data stored in array to sprite or screen. I did not realize you had implemented PushImage when I posted this so I guess its similar except PushImage does not support 8 bit images (i think). I guess no action needed and we can close out. Thanks for your replies. Love the library.

Bodmer commented 4 years ago

There is a pushImage for 8 bit colours and 1 bit. If the image pointer is 16 bit, this uses the 16 bit colour pushImage, if the pointer is 8 bit then 8bit colours are assumed.

8 bit pointers are also used for 1 bit colour images, so the last parameter selects 1 bit colours if the last parameter is set false, the default is true if the last parameter is missing.

Colour format for 8 bits is 332 - RGB, so blue is only 2 bits, red and green 3 bits.