Bodmer / TJpg_Decoder

Jpeg decoder library based on Tiny JPEG Decompressor
Other
227 stars 43 forks source link

Getting the RGB888 value of pixel with JD_FORMAT = 0 #79

Open raulzanardo opened 1 month ago

raulzanardo commented 1 month ago

How do I get the value of each 8 bit color when the library is configured with JD_FORMAT=0?

The function that draws the image, in the mai case called 'tft_outpu' ony has a pointer of 16bits. (int16_t _x, int16_t _y, uint16_t w, uint16_t h, uint16_t *bitmap).

raulzanardo commented 1 month ago

I figure it out:

change JD_FORMAT to 0 in tjpgdcnf.h

in TJpg_Decoder.h change : "typedef bool (SketchCallback)(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t data);" to "typedef bool (SketchCallback)(int16_t x, int16_t y, uint16_t w, uint16_t h, uint8_t data);"

in TJpg_Decoder.cpp, line 155, change: return thisPtr->tft_output(x, y, w, h, (uint16_t)bitmap); to return thisPtr->tft_output(x, y, w, h, (uint8_t)bitmap);

it could be a ifdef for those two parts of the code based on the JD_FORMAT