Added 8bit PNG font loader
This commit is contained in:
@@ -1436,3 +1436,15 @@ BitmapBuffer * BitmapBuffer::convert_stb_bitmap(uint8_t * img, int w, int h, int
|
|||||||
|
|
||||||
return bmp;
|
return bmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t * BitmapBuffer::loadFont(const uint8_t * lbm, int len, int& w, int& h)
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
unsigned char * font = stbi_load_from_memory(lbm, len, &w, &h, &n, 1);
|
||||||
|
if (!font) {
|
||||||
|
TRACE("load_stb_buffer(%p,%d) failed: %s", font, len, stbi_failure_reason());
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return font;
|
||||||
|
}
|
||||||
|
|||||||
@@ -299,6 +299,8 @@ class BitmapBuffer: public BitmapBufferBase<pixel_t>
|
|||||||
static BitmapBuffer * loadMaskOnBackground(const char * filename, LcdFlags foreground, LcdFlags background);
|
static BitmapBuffer * loadMaskOnBackground(const char * filename, LcdFlags foreground, LcdFlags background);
|
||||||
static BitmapBuffer * load8bitMaskOnBackground(const uint8_t * lbm, LcdFlags foreground, LcdFlags background);
|
static BitmapBuffer * load8bitMaskOnBackground(const uint8_t * lbm, LcdFlags foreground, LcdFlags background);
|
||||||
|
|
||||||
|
static uint8_t * loadFont(const uint8_t * lbm, int len, int& w, int& h);
|
||||||
|
|
||||||
void drawMask(coord_t x, coord_t y, const BitmapBuffer * mask, LcdFlags flags, coord_t offsetX = 0, coord_t width = 0);
|
void drawMask(coord_t x, coord_t y, const BitmapBuffer * mask, LcdFlags flags, coord_t offsetX = 0, coord_t width = 0);
|
||||||
|
|
||||||
void drawMask(coord_t x, coord_t y, const BitmapBuffer * mask, const BitmapBuffer * srcBitmap, coord_t offsetX = 0, coord_t offsetY = 0, coord_t width = 0, coord_t height = 0);
|
void drawMask(coord_t x, coord_t y, const BitmapBuffer * mask, const BitmapBuffer * srcBitmap, coord_t offsetX = 0, coord_t offsetY = 0, coord_t width = 0, coord_t height = 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user