Patch level : 4.0

Files correlati     : xvaga.dll
Ricompilazione Demo : [ ]
Commento            :
Implementato gradiente dei poveri anche per wxWidgets 2.6.3


git-svn-id: svn://10.65.10.50/trunk@14933 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2007-02-19 15:59:02 +00:00
parent 9a4c28e1cd
commit 4828c63331

View File

@ -2348,13 +2348,25 @@ void xvt_dwin_draw_gradient_linear(WINDOW win, const RCT* r, COLOR col1, COLOR c
#if wxCHECK_VERSION(2,8,0) #if wxCHECK_VERSION(2,8,0)
dc.GradientFillLinear(rect, color1, color2, dir); dc.GradientFillLinear(rect, color1, color2, dir);
#else #else
wxBrush brush(color1); // Gradiente dei poveri
dc.SetBrush(brush); const bool bVert = dir == wxUP || dir == wxDOWN;
dc.SetPen(*wxTRANSPARENT_PEN); if (dir == wxUP || dir == wxLEFT) // Scambia colori se necessario
dc.DrawRectangle(rect); { const wxColour tmp = color1; color1 = color2; color2 = tmp; }
const int n = (bVert ? rect.GetHeight() : rect.GetWidth());
for (int i = 0; i < n; i++)
{
const int r = (color2.Red() * i + color1.Red() *(n-i)) / n;
const int g = (color2.Green()* i + color1.Green()*(n-i)) / n;
const int b = (color2.Blue() * i + color1.Blue() *(n-i)) / n;
wxPen pen(wxColour(r, g, b));
dc.SetPen(pen);
if (bVert)
dc.DrawLine(rect.x, rect.y+i, rect.GetRight(), rect.y+i);
else
dc.DrawLine(rect.x+i, rect.y, rect.x+i, rect.GetBottom());
}
#endif #endif
} }
} }