namespace win32 { namespace gui { class gradient_painter : public painter_base { public: typedef std::pair<COLORREF, COLORREF> GradientColors; // first: start color, second: end color typedef const GradientColors& param0; typedef unsigned param1; // c'tor gradient_painter(const GradientColors& colors, unsigned angle = 0); // virtual functions of painter_base gradient_painter* clone() const; void draw(HDC hDC, int cx, int cy); bool is_opaque(int cx, int cy) const; // own functions void gradient_colors(const GradientColors& colors); GradientColors gradient_colors() const; void angle(unsigned angle); unsigned angle() const; static GradientColors make_gradient_colors(COLORREF crStart, COLORREF crEnd); }; } } // namespace win32::gui
gradient_colors() returns the start- and end-colors of the gradient angle() returns the angle of the gradientunsigned angle = ...;
COLORREF cr_blue = RGB(0, 0, 150);
COLORREF cr_black = RGB(0, 0, 0);
add_painter<gradient_painter> ( gradient_painter::make_gradient_colors(cr_blue, cr_black), angle );
The result is as follows
|
|
|
|
| angle = 0 | angle = 90 | angle = 180 | angle = 270 |
|
by Steven Weiss. You can contact me at steven11@gmx.de. |