mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-31 01:11:12 +02:00
CComponentsPicture: Add parameter 'transparent'...
...to set the transparency of pictures - Set default transparency for CComponentsChannelLogo to CFrameBuffer::TM_BLACK (Transparency when black content -> 'pseudo' transparency) - Set default transparency for CComponentsPicture to CFrameBuffer::TM_NONE (No 'pseudo' transparency)
This commit is contained in:
@@ -45,25 +45,25 @@ CComponentsPicture::CComponentsPicture( const int &x_pos, const int &y_pos, cons
|
|||||||
const std::string& image_path,
|
const std::string& image_path,
|
||||||
CComponentsForm *parent,
|
CComponentsForm *parent,
|
||||||
bool has_shadow,
|
bool has_shadow,
|
||||||
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow)
|
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow, int transparent)
|
||||||
{
|
{
|
||||||
init(x_pos, y_pos, w, h, image_path, parent, has_shadow, color_frame, color_background, color_shadow);
|
init(x_pos, y_pos, w, h, image_path, parent, has_shadow, color_frame, color_background, color_shadow, transparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
CComponentsPicture::CComponentsPicture( const int &x_pos, const int &y_pos,
|
CComponentsPicture::CComponentsPicture( const int &x_pos, const int &y_pos,
|
||||||
const std::string& image_name,
|
const std::string& image_name,
|
||||||
CComponentsForm *parent,
|
CComponentsForm *parent,
|
||||||
bool has_shadow,
|
bool has_shadow,
|
||||||
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow)
|
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow, int transparent)
|
||||||
{
|
{
|
||||||
init(x_pos, y_pos, 0, 0, image_name, parent, has_shadow, color_frame, color_background, color_shadow);
|
init(x_pos, y_pos, 0, 0, image_name, parent, has_shadow, color_frame, color_background, color_shadow, transparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w, const int &h,
|
void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w, const int &h,
|
||||||
const string& image_name,
|
const string& image_name,
|
||||||
CComponentsForm *parent,
|
CComponentsForm *parent,
|
||||||
bool has_shadow,
|
bool has_shadow,
|
||||||
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow)
|
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow, int transparent)
|
||||||
{
|
{
|
||||||
//CComponents, CComponentsItem
|
//CComponents, CComponentsItem
|
||||||
cc_item_type = CC_ITEMTYPE_PICTURE;
|
cc_item_type = CC_ITEMTYPE_PICTURE;
|
||||||
@@ -86,6 +86,8 @@ void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w,
|
|||||||
is_image_painted= false;
|
is_image_painted= false;
|
||||||
do_paint = true;
|
do_paint = true;
|
||||||
|
|
||||||
|
image_transparent = transparent;
|
||||||
|
|
||||||
g_PicViewer->getSupportedImageFormats(v_ext);
|
g_PicViewer->getSupportedImageFormats(v_ext);
|
||||||
v_ext.resize(unique(v_ext.begin(), v_ext.end()) - v_ext.begin());
|
v_ext.resize(unique(v_ext.begin(), v_ext.end()) - v_ext.begin());
|
||||||
initCCItem();
|
initCCItem();
|
||||||
@@ -181,10 +183,12 @@ void CComponentsPicture::paintPicture()
|
|||||||
|
|
||||||
dprintf(DEBUG_INFO, "[CComponentsPicture] %s: paint image file: pic_name=%s\n", __func__, pic_name.c_str());
|
dprintf(DEBUG_INFO, "[CComponentsPicture] %s: paint image file: pic_name=%s\n", __func__, pic_name.c_str());
|
||||||
if (cc_allow_paint){
|
if (cc_allow_paint){
|
||||||
|
frameBuffer->SetTransparent(image_transparent);
|
||||||
if (!is_icon)
|
if (!is_icon)
|
||||||
is_image_painted = g_PicViewer->DisplayImage(pic_name, x_pic, y_pic, width, height);
|
is_image_painted = g_PicViewer->DisplayImage(pic_name, x_pic, y_pic, width, height);
|
||||||
else
|
else
|
||||||
is_image_painted = frameBuffer->paintIcon(pic_name, x_pic, y_pic, height, 1, do_paint, paint_bg, col_body);
|
is_image_painted = frameBuffer->paintIcon(pic_name, x_pic, y_pic, height, 1, do_paint, paint_bg, col_body);
|
||||||
|
frameBuffer->SetTransparentDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,10 +210,10 @@ CComponentsChannelLogo::CComponentsChannelLogo( const int &x_pos, const int &y_p
|
|||||||
const uint64_t& channelId,
|
const uint64_t& channelId,
|
||||||
CComponentsForm *parent,
|
CComponentsForm *parent,
|
||||||
bool has_shadow,
|
bool has_shadow,
|
||||||
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow)
|
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow, int transparent)
|
||||||
:CComponentsPicture(x_pos, y_pos, w, h,
|
:CComponentsPicture(x_pos, y_pos, w, h,
|
||||||
"", parent, has_shadow,
|
"", parent, has_shadow,
|
||||||
color_frame, color_background, color_shadow)
|
color_frame, color_background, color_shadow, transparent)
|
||||||
{
|
{
|
||||||
setChannel(channelId, channelName);
|
setChannel(channelId, channelName);
|
||||||
alt_pic_name = "";
|
alt_pic_name = "";
|
||||||
@@ -220,10 +224,10 @@ CComponentsChannelLogo::CComponentsChannelLogo( const int &x_pos, const int &y_p
|
|||||||
const uint64_t& channelId,
|
const uint64_t& channelId,
|
||||||
CComponentsForm *parent,
|
CComponentsForm *parent,
|
||||||
bool has_shadow,
|
bool has_shadow,
|
||||||
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow)
|
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow, int transparent)
|
||||||
:CComponentsPicture(x_pos, y_pos, 0, 0,
|
:CComponentsPicture(x_pos, y_pos, 0, 0,
|
||||||
"", parent, has_shadow,
|
"", parent, has_shadow,
|
||||||
color_frame, color_background, color_shadow)
|
color_frame, color_background, color_shadow, transparent)
|
||||||
{
|
{
|
||||||
setChannel(channelId, channelName);
|
setChannel(channelId, channelName);
|
||||||
alt_pic_name = "";
|
alt_pic_name = "";
|
||||||
|
@@ -56,13 +56,17 @@ class CComponentsPicture : public CComponentsItem
|
|||||||
///sets that image may be painted, default = false
|
///sets that image may be painted, default = false
|
||||||
bool do_paint;
|
bool do_paint;
|
||||||
|
|
||||||
|
///set the transparency of pictures (default = CFrameBuffer::TM_NONE)
|
||||||
|
int image_transparent;
|
||||||
|
|
||||||
void init( const int &x_pos, const int &y_pos, const int &w, const int &h,
|
void init( const int &x_pos, const int &y_pos, const int &w, const int &h,
|
||||||
const std::string& image_name,
|
const std::string& image_name,
|
||||||
CComponentsForm *parent,
|
CComponentsForm *parent,
|
||||||
bool has_shadow,
|
bool has_shadow,
|
||||||
fb_pixel_t color_frame,
|
fb_pixel_t color_frame,
|
||||||
fb_pixel_t color_background,
|
fb_pixel_t color_background,
|
||||||
fb_pixel_t color_shadow);
|
fb_pixel_t color_shadow,
|
||||||
|
int transparent);
|
||||||
|
|
||||||
///initialize all required attributes
|
///initialize all required attributes
|
||||||
void initCCItem();
|
void initCCItem();
|
||||||
@@ -71,6 +75,10 @@ class CComponentsPicture : public CComponentsItem
|
|||||||
///paint image
|
///paint image
|
||||||
void paintPicture();
|
void paintPicture();
|
||||||
|
|
||||||
|
// t = CFrameBuffer::TM_BLACK : Transparency when black content ('pseudo' transparency)
|
||||||
|
// t = CFrameBuffer::TM_NONE : No 'pseudo' transparency
|
||||||
|
void SetTransparent(int t){ image_transparent = t; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CComponentsPicture( const int &x_pos, const int &y_pos, const int &w, const int &h,
|
CComponentsPicture( const int &x_pos, const int &y_pos, const int &w, const int &h,
|
||||||
const std::string& image_name,
|
const std::string& image_name,
|
||||||
@@ -78,7 +86,8 @@ class CComponentsPicture : public CComponentsItem
|
|||||||
bool has_shadow = CC_SHADOW_OFF,
|
bool has_shadow = CC_SHADOW_OFF,
|
||||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||||
fb_pixel_t color_background = 0,
|
fb_pixel_t color_background = 0,
|
||||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0,
|
||||||
|
int transparent = CFrameBuffer::TM_NONE);
|
||||||
|
|
||||||
CComponentsPicture( const int &x_pos, const int &y_pos,
|
CComponentsPicture( const int &x_pos, const int &y_pos,
|
||||||
const std::string& image_name,
|
const std::string& image_name,
|
||||||
@@ -86,7 +95,8 @@ class CComponentsPicture : public CComponentsItem
|
|||||||
bool has_shadow = CC_SHADOW_OFF,
|
bool has_shadow = CC_SHADOW_OFF,
|
||||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||||
fb_pixel_t color_background = 0,
|
fb_pixel_t color_background = 0,
|
||||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0,
|
||||||
|
int transparent = CFrameBuffer::TM_NONE);
|
||||||
|
|
||||||
///sets an image name (unscaled icons only), full image path or url to an iamge file (scalable)
|
///sets an image name (unscaled icons only), full image path or url to an iamge file (scalable)
|
||||||
virtual void setPicture(const std::string& picture_name);
|
virtual void setPicture(const std::string& picture_name);
|
||||||
@@ -127,7 +137,8 @@ class CComponentsChannelLogo : public CComponentsPicture
|
|||||||
bool has_shadow = CC_SHADOW_OFF,
|
bool has_shadow = CC_SHADOW_OFF,
|
||||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||||
fb_pixel_t color_background = 0,
|
fb_pixel_t color_background = 0,
|
||||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0,
|
||||||
|
int transparent = CFrameBuffer::TM_BLACK);
|
||||||
|
|
||||||
CComponentsChannelLogo( const int &x_pos, const int &y_pos,
|
CComponentsChannelLogo( const int &x_pos, const int &y_pos,
|
||||||
const std::string& channelName = "",
|
const std::string& channelName = "",
|
||||||
@@ -136,7 +147,8 @@ class CComponentsChannelLogo : public CComponentsPicture
|
|||||||
bool has_shadow = CC_SHADOW_OFF,
|
bool has_shadow = CC_SHADOW_OFF,
|
||||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||||
fb_pixel_t color_background = 0,
|
fb_pixel_t color_background = 0,
|
||||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0,
|
||||||
|
int transparent = CFrameBuffer::TM_BLACK);
|
||||||
|
|
||||||
///set channel id and/or channel name, NOTE: channel name is prefered
|
///set channel id and/or channel name, NOTE: channel name is prefered
|
||||||
void setChannel(const uint64_t& channelId, const std::string& channelName);
|
void setChannel(const uint64_t& channelId, const std::string& channelName);
|
||||||
|
Reference in New Issue
Block a user