1 // TortoiseSVN - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2003-2007 - TortoiseSVN
\r
5 // This program is free software; you can redistribute it and/or
\r
6 // modify it under the terms of the GNU General Public License
\r
7 // as published by the Free Software Foundation; either version 2
\r
8 // of the License, or (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, write to the Free Software Foundation,
\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
24 * Class for drawing gradients.
\r
25 * There are two methods for each gradient. One using standard API function and the other using GDI.
\r
26 * Since not all systems (e.g. WinCE and the like) don't have GDI you must define USE_GDI_GRADIENT to
\r
36 * Fills a rectangle with a two color gradient.
\r
37 * \param pDC the device context to draw on
\r
38 * \param rect the rectangle to fill
\r
39 * \param colorStart the starting color. This is either the color used on the left (if bHorz == TRUE) or top
\r
40 * \param colorEnd the ending color. This is either the color used on the right (if bHorz == TRUE) or bottom
\r
41 * \param bHorz if TRUE then the gradient is drawn from left to right, otherwise from top to bottom
\r
42 * \param nSteps the steps the gradient shall have. The more the smoother the gradient will be but also slower.
\r
44 static void Draw(CDC * pDC, CRect rect, COLORREF colorStart, COLORREF colorEnd, BOOL bHorz = TRUE, UINT nSteps = 64);
\r
46 * Fills a rectangle with a three color gradient.
\r
47 * \param pDC the device context to draw on
\r
48 * \param rect the rectangle to fill
\r
49 * \param colorStart the starting color. This is either the color used on the left (if bHorz == TRUE) or top
\r
50 * \param colorMid the middle color.
\r
51 * \param colorEnd the ending color. This is either the color used on the right (if bHorz == TRUE) or bottom
\r
52 * \param bHorz if TRUE then the gradient is drawn from left to right, otherwise from top to bottom
\r
53 * \param nSteps the steps the gradient shall have. The more the smoother the gradient will be but also slower.
\r
55 static void Draw(CDC * pDC, CRect rect, COLORREF colorStart, COLORREF colorMid, COLORREF colorFinish, BOOL bHorz = TRUE, UINT nSteps = 64);
\r
56 #ifdef USE_GDI_GRADIENT
\r
58 * Fills a rectangle with a two color gradient.
\r
59 * \param pDC the device context to draw on
\r
60 * \param rect the rectangle to fill
\r
61 * \param colorStart the starting color. This is either the color used on the left (if bHorz == TRUE) or top
\r
62 * \param colorEnd the ending color. This is either the color used on the right (if bHorz == TRUE) or bottom
\r
63 * \param bHorz if TRUE then the gradient is drawn from left to right, otherwise from top to bottom
\r
65 static void DrawGDI(CDC * pDC, CRect rect, COLORREF colorStart, COLORREF colorEnd, BOOL bHorz = TRUE);
\r
67 * Fills a rectangle with a three color gradient.
\r
68 * \param pDC the device context to draw on
\r
69 * \param rect the rectangle to fill
\r
70 * \param colorStart the starting color. This is either the color used on the left (if bHorz == TRUE) or top
\r
71 * \param colorMid the middle color.
\r
72 * \param colorEnd the ending color. This is either the color used on the right (if bHorz == TRUE) or bottom
\r
73 * \param bHorz if TRUE then the gradient is drawn from left to right, otherwise from top to bottom
\r
75 static void DrawGDI(CDC * pDC, CRect rect, COLORREF colorStart, COLORREF colorMid, COLORREF colorEnd, BOOL bHorz = TRUE);
\r
78 static void SplitRect(const CRect& rSource, CRect& rHalf1, CRect& rHalf2, BOOL bHorz);
\r