Patch level : 760

Files correlati     : ba0.exe
Ricompilazione Demo : [ ]
Commento            :
Migliorata gestione sfondi


git-svn-id: svn://10.65.10.50/trunk@20562 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2010-06-09 15:07:12 +00:00
parent cbe140da9e
commit 4238f31e6e
4 changed files with 39 additions and 15 deletions

View File

@ -350,7 +350,7 @@ public:
TMenulist_images() : TCache(17), _win(NULL_WIN), _max_side(0) { }
};
inline int fast_hypot(int x, int y)
int fast_hypot(int x, int y)
{
// loop unrolled
#define TEST(s, h, i) { const int k = h+i; if (k*k <= s) h = k; }

View File

@ -127,5 +127,6 @@ bool can_be_transparent(const TImage& i);
void draw_spider(WINDOW win, int mode, const PNT& mouse);
void enable_options_menu(bool on);
const TString& get_logo();
int fast_hypot(int x, int y);
#endif

View File

@ -345,9 +345,28 @@ void TBook_window::set_logo(const char* logo)
const short h = _logo.height();
const short h2 = h/4;
XVT_IMAGE big = xvt_image_create(XVT_IMAGE_RGB, w, h+h2, NORMAL_BACK_COLOR);
XVT_IMAGE big = xvt_image_create(XVT_IMAGE_RGB, w, h+h2, MASK_BACK_COLOR);
RCT rct; xvt_rect_set(&rct, 0, 0, w, h);
xvt_image_transfer(big, _logo.xvt_image(), &rct, &rct);
XVT_IMAGE tile = get_background_texture();
if (tile != NULL)
{
short tw, th; xvt_image_get_dimensions(tile, &tw, &th);
if (tw > 0 && th > 0)
{
RCT src; xvt_rect_set(&src, 0, 0, tw, th);
for (short y = 0; y < h2; y += th)
{
for (short x = 0; x < w; x += tw)
{
RCT dst; xvt_rect_set(&dst, x, y+h, x+tw, y+th+h);
xvt_image_transfer(big, tile, &dst, &src);
}
}
}
}
for (short y = 0; y < h2; y++)
{
const double weight = 0.5+double(y)/double(2*h2);
@ -355,19 +374,22 @@ void TBook_window::set_logo(const char* logo)
for (short x = 0; x < w; x++)
{
const short sx = x-2*y;
COLOR col = MASK_DARK_COLOR;
if (sx >= 0)
{
const COLOR rgb = xvt_image_get_pixel(big, sx, sy);
const unsigned char r = XVT_COLOR_GET_RED(rgb);
const unsigned char g = XVT_COLOR_GET_GREEN(rgb);
const unsigned char b = XVT_COLOR_GET_BLUE(rgb);
if (r != g || g != b)
col = blend_colors(col, rgb, weight);
}
xvt_image_set_pixel(big, x, y+h, col);
const COLOR src = xvt_image_get_pixel(big, sx, sy);
const unsigned char r = XVT_COLOR_GET_RED(src);
const unsigned char g = XVT_COLOR_GET_GREEN(src);
const unsigned char b = XVT_COLOR_GET_BLUE(src);
if (abs(r-g)>8 || abs(g-b)>8) // Non e' grigio, cioe' !(r==g && g==b)
{
const COLOR dst = xvt_image_get_pixel(big, x, y+h);
COLOR col = blend_colors(dst, src, weight);
xvt_image_set_pixel(big, x, y+h, col);
}
}
}
}
_logo.set(big);
}
else
@ -415,7 +437,8 @@ void TBook_window::set_back(const TString& back)
}
}
}
force_update();
if (pages() == 0)
force_update();
}
}
}

View File

@ -1951,7 +1951,7 @@ void TEditMask_sheet::update()const
RCT rg={r.top,r.left,r.bottom,r.right};
RCT rn={r.top+ROWY,r.left+3*CHARX,r.top+ROWY+3*CHARY,r.right-10};
padre().set_brush(TOOL_BACK_COLOR);
padre().set_brush(MASK_DARK_COLOR);
xvt_dwin_draw_rect(maschera(),&rg);
padre().set_brush(NORMAL_BACK_COLOR);
@ -2920,9 +2920,9 @@ void TEditMask_window::update()
set_brush(MASK_BACK_COLOR);
_rt=::resize_rect(0,_y_tool,0,0,W_DOC,win());
line(0,_rt.top,_rt.right,_rt.top);
set_pen(TOOL_BACK_COLOR);
set_pen(MASK_DARK_COLOR);
line(0,_rt.top-2,_rt.right-2,_rt.top-2);
set_pen(COLOR_BLACK);
set_pen(PROMPT_COLOR);
line(0,_rt.top-1,_rt.right-1,_rt.top-1);
hide_brush();
}