Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

# gradient_painter.hpp

    00001 // gradient_painter.hpp
    00002
    00003 // Copyright (C) 2004 Steven Weiß (steven11@gmx.de)
    00004 //
    00005 // Permission to copy, use, sell and distribute this software is granted
    00006 // provided this copyright notice appears in all copies.
    00007 // Permission to modify the code and to distribute modified code is granted
    00008 // provided this copyright notice appears in all copies, and a notice
    00009 // that the code was modified is included with the copyright notice.
    00010 //
    00011 // This software is provided "as is" without express or implied warranty,
    00012 // and with no claim as to its suitability for any purpose.
    00013
    00014
    00015 #pragma once
    00016 #include <background_wnd/painter_base.hpp>
    00017
    00018
    00019 namespace win32 { namespace gui {
    00020
    00021 class gradient_painter : public painter_base
    00022 {
    00023 public:
    00024      typedef std::pair<COLORREF, COLORREF> GradientColors;       // first: start color, second: end color
    00025      typedef const GradientColors& param0;
    00026      typedef unsigned param1;
    00027
    00028      // c'tor
    00029      gradient_painter(const GradientColors& colors, unsigned angle = 0);
    00030
    00031      // virtual functions of painter_base
    00032      gradient_painter* clone() const;
    00033      void draw(HDC hDC, int cx, int cy);
    00034      bool is_opaque(int cx, int cy) const;
    00035
    00036      // own functions
    00037      void gradient_colors(const GradientColors& colors);
    00038      GradientColors gradient_colors() const;
    00039      void angle(unsigned angle);
    00040      unsigned angle() const;
    00041      static GradientColors make_gradient_colors(COLORREF crStart, COLORREF crEnd);
    00042
    00043 private:
    00044      void draw_linear(HDC hDC, int cx, int cy, int r1, int g1, int b1, int r2, int g2, int b2);
    00045
    00046      GradientColors  colors_;
    00047      unsigned       angle_;
    00048 };
    00049
    00050 } }  // namespace win32::gui

| by Steven Weiss. You can contact me at steven11@gmx.de.