cc_extra: add short methode to paintIcon with optional text content

This commit is contained in:
2021-01-06 10:17:18 +01:00
parent 6953daf121
commit 072995afcb
3 changed files with 120 additions and 3 deletions

View File

@@ -122,3 +122,51 @@ bool paintImage( const std::string& Image,
return box.isPicPainted();
}
bool paintIcon ( const std::string& filename,
const int& x,
const int& y,
const int& dx,
const int& dy,
const std::string& text,
const int& font_style,
const fb_pixel_t& color_body,
const fb_pixel_t& color_text)
{
int h = 0;
int w = 0;
CFrameBuffer::getInstance()->getIconSize(filename.c_str(), &w, &h);
CComponentsText box( x,
y,
dx < 1 ? w : dx,
dy < 1 ? h : dy,
text,
CTextBox::CENTER,
*CNeutrinoFonts::getInstance()->getDynFont(w, h, text),
font_style,
NULL,
CC_SHADOW_OFF,
color_text,
COL_FRAME_PLUS_0,
color_body);
box.setBodyBGImageName(filename);
box.doPaintBg(true);
box.enableTboxSaveScreen(false);
box.setCorner(0, 0);
box.paint(CC_SAVE_SCREEN_NO);
return box.isPainted();
}
bool paintIcon ( const std::string& filename,
const int& x,
const int& y,
const std::string& text,
const int& font_style,
const fb_pixel_t& color_body,
const fb_pixel_t& color_text)
{
return paintIcon (filename, x, y, 0, 0, text, font_style, color_body, color_text);
}