diff --git a/xvaga/xvaga.cpp b/xvaga/xvaga.cpp index adde39e28..f0b121486 100755 --- a/xvaga/xvaga.cpp +++ b/xvaga/xvaga.cpp @@ -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) dc.GradientFillLinear(rect, color1, color2, dir); #else - wxBrush brush(color1); - dc.SetBrush(brush); - dc.SetPen(*wxTRANSPARENT_PEN); - dc.DrawRectangle(rect); + // Gradiente dei poveri + const bool bVert = dir == wxUP || dir == wxDOWN; + if (dir == wxUP || dir == wxLEFT) // Scambia colori se necessario + { 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 } - }