- // gradient fill from colour 1 to colour 2 with top to bottom
-
- if(rect.height < 1 || rect.width < 1)
- return;
-
- dc.SetPen(*wxTRANSPARENT_PEN);
-
-
- // calculate gradient coefficients
- wxColour col2 = _style.GetSecondColour(),
- col1 = _style.GetFirstColour();
-
- double rstep = double((col2.Red() - col1.Red())) / double(rect.height), rf = 0,
- gstep = double((col2.Green() - col1.Green())) / double(rect.height), gf = 0,
- bstep = double((col2.Blue() - col1.Blue())) / double(rect.height), bf = 0;
-
- wxColour currCol;
- for(int y = rect.y; y < rect.y + rect.height; y++)
- {
- currCol.Set(col1.Red() + rf, col1.Green() + gf, col1.Blue() + bf);
- dc.SetBrush( wxBrush( currCol, wxSOLID ) );
- dc.DrawRectangle( rect.x, rect.y + (y - rect.y), rect.width, rect.height );
- //currCol.Set(currCol.Red() + rstep, currCol.Green() + gstep, currCol.Blue() + bstep);
- rf += rstep; gf += gstep; bf += bstep;
- }
+ // gradient fill from colour 1 to colour 2 with top to bottom
+
+ if(rect.height < 1 || rect.width < 1)
+ return;
+
+ int size = rect.height;
+
+ dc.SetPen(*wxTRANSPARENT_PEN);
+
+
+ // calculate gradient coefficients
+ wxColour col2 = m_captionStyle.GetSecondColour(),
+ col1 = m_captionStyle.GetFirstColour();
+
+ double rstep = double((col2.Red() - col1.Red())) / double(size), rf = 0,
+ gstep = double((col2.Green() - col1.Green())) / double(size), gf = 0,
+ bstep = double((col2.Blue() - col1.Blue())) / double(size), bf = 0;
+
+ wxColour currCol;
+ for(int y = rect.y; y < rect.y + size; y++)
+ {
+ currCol.Set(
+ (unsigned char)(col1.Red() + rf),
+ (unsigned char)(col1.Green() + gf),
+ (unsigned char)(col1.Blue() + bf)
+ );
+ dc.SetBrush( wxBrush( currCol, wxSOLID ) );
+ dc.DrawRectangle( rect.x, rect.y + (y - rect.y), rect.width, size );
+ //currCol.Set(currCol.Red() + rstep, currCol.Green() + gstep, currCol.Blue() + bstep);
+ rf += rstep; gf += gstep; bf += bstep;
+ }