Patch level : 10.0
Files correlati : ba0 Ricompilazione Demo : [ ] Commento : Corretta gestione logo trasparente git-svn-id: svn://10.65.10.50/trunk@16092 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
ab7990b69e
commit
952489c678
@ -304,7 +304,7 @@ bool can_be_transparent(const TImage& i)
|
|||||||
return false;
|
return false;
|
||||||
if (i.get_pixel(0,h) != col)
|
if (i.get_pixel(0,h) != col)
|
||||||
return false;
|
return false;
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
class TCampo_window : public TField_window
|
class TCampo_window : public TField_window
|
||||||
{
|
{
|
||||||
|
TImage _logo;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void update();
|
virtual void update();
|
||||||
virtual void handler(WINDOW win, EVENT* ep);
|
virtual void handler(WINDOW win, EVENT* ep);
|
||||||
@ -26,17 +28,18 @@ void TCampo_window::update()
|
|||||||
RCT rctw; xvt_vobj_get_client_rect(win(), &rctw);
|
RCT rctw; xvt_vobj_get_client_rect(win(), &rctw);
|
||||||
if (rctw.right >= 32)
|
if (rctw.right >= 32)
|
||||||
{
|
{
|
||||||
TImage image("logo.gif");
|
if (_logo.ok())
|
||||||
|
|
||||||
RCT rcti = image.rect();
|
|
||||||
if (rcti.right > rctw.right)
|
|
||||||
{
|
{
|
||||||
const double ratio = double(rctw.right) / double(rcti.right);
|
RCT rcti = _logo.rect();
|
||||||
rcti.right = int(rcti.right * ratio);
|
if (rcti.right > rctw.right)
|
||||||
rcti.bottom = int(rcti.bottom * ratio);
|
{
|
||||||
|
const double ratio = double(rctw.right) / double(rcti.right);
|
||||||
|
rcti.right = int(rcti.right * ratio);
|
||||||
|
rcti.bottom = int(rcti.bottom * ratio);
|
||||||
|
}
|
||||||
|
xvt_rect_offset(&rcti, rctw.right - rcti.right, rctw.bottom - rcti.bottom);
|
||||||
|
_logo.draw(win(), rcti);
|
||||||
}
|
}
|
||||||
xvt_rect_offset(&rcti, rctw.right - rcti.right, rctw.bottom - rcti.bottom);
|
|
||||||
image.draw(win(), rcti);
|
|
||||||
|
|
||||||
PNT pnt = { 0, 0 };
|
PNT pnt = { 0, 0 };
|
||||||
draw_spider(win(), 0x3, pnt);
|
draw_spider(win(), 0x3, pnt);
|
||||||
@ -52,10 +55,13 @@ void TCampo_window::handler(WINDOW win, EVENT* ep)
|
|||||||
|
|
||||||
TCampo_window::TCampo_window(int x, int y, int dx, int dy,
|
TCampo_window::TCampo_window(int x, int y, int dx, int dy,
|
||||||
WINDOW parent, TWindowed_field* owner)
|
WINDOW parent, TWindowed_field* owner)
|
||||||
: TField_window(x, y, dx, dy, parent, owner)
|
: TField_window(x, y, dx, dy, parent, owner), _logo("logo.gif")
|
||||||
{
|
{
|
||||||
set_caption("__CAMPO_MENU__");
|
set_caption("__CAMPO_MENU__");
|
||||||
set_scroll_max(0, 0); // Get rid of that useless scrollbars
|
set_scroll_max(0, 0); // Get rid of that useless scrollbars
|
||||||
|
|
||||||
|
if (_logo.ok() && can_be_transparent(_logo))
|
||||||
|
_logo.convert_transparent_color(NORMAL_BACK_COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
TCampo_window::~TCampo_window()
|
TCampo_window::~TCampo_window()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user