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)


Origin commit data
------------------
Branch: ni/coolstream
Commit: a182fca81f
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2014-07-10 (Thu, 10 Jul 2014)

Origin message was:
------------------
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 was generated by Migit
This commit is contained in:
Michael Liebmann
2014-07-10 15:59:20 +02:00
parent aaa305dd57
commit 2795f29339
2 changed files with 30 additions and 14 deletions

View File

@@ -45,25 +45,25 @@ CComponentsPicture::CComponentsPicture( const int &x_pos, const int &y_pos, cons
const std::string& image_path,
CComponentsForm *parent,
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,
const std::string& image_name,
CComponentsForm *parent,
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,
const string& image_name,
CComponentsForm *parent,
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
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;
do_paint = true;
image_transparent = transparent;
g_PicViewer->getSupportedImageFormats(v_ext);
v_ext.resize(unique(v_ext.begin(), v_ext.end()) - v_ext.begin());
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());
if (cc_allow_paint){
frameBuffer->SetTransparent(image_transparent);
if (!is_icon)
is_image_painted = g_PicViewer->DisplayImage(pic_name, x_pic, y_pic, width, height);
else
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,
CComponentsForm *parent,
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,
"", parent, has_shadow,
color_frame, color_background, color_shadow)
color_frame, color_background, color_shadow, transparent)
{
setChannel(channelId, channelName);
alt_pic_name = "";
@@ -220,10 +224,10 @@ CComponentsChannelLogo::CComponentsChannelLogo( const int &x_pos, const int &y_p
const uint64_t& channelId,
CComponentsForm *parent,
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,
"", parent, has_shadow,
color_frame, color_background, color_shadow)
color_frame, color_background, color_shadow, transparent)
{
setChannel(channelId, channelName);
alt_pic_name = "";

View File

@@ -56,13 +56,17 @@ class CComponentsPicture : public CComponentsItem
///sets that image may be painted, default = false
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,
const std::string& image_name,
CComponentsForm *parent,
bool has_shadow,
fb_pixel_t color_frame,
fb_pixel_t color_background,
fb_pixel_t color_shadow);
fb_pixel_t color_shadow,
int transparent);
///initialize all required attributes
void initCCItem();
@@ -71,6 +75,10 @@ class CComponentsPicture : public CComponentsItem
///paint image
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:
CComponentsPicture( const int &x_pos, const int &y_pos, const int &w, const int &h,
const std::string& image_name,
@@ -78,7 +86,8 @@ class CComponentsPicture : public CComponentsItem
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
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,
const std::string& image_name,
@@ -86,7 +95,8 @@ class CComponentsPicture : public CComponentsItem
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
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)
virtual void setPicture(const std::string& picture_name);
@@ -127,7 +137,8 @@ class CComponentsChannelLogo : public CComponentsPicture
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
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,
const std::string& channelName = "",
@@ -136,7 +147,8 @@ class CComponentsChannelLogo : public CComponentsPicture
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
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
void setChannel(const uint64_t& channelId, const std::string& channelName);