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

# transparent_painter.hpp

    00001 // transparent_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_holder.hpp>
    00017
    00018
    00019 namespace win32 { namespace gui {
    00020
    00021 class transparent_painter : public painter_base, public painter_holder
    00022 {
    00023 public:
    00024      typedef COLORREF param0;
    00025
    00026      // c'tor
    00027      transparent_painter(COLORREF crTransparent);
    00028
    00029      // virtual functions of painter_base
    00030      transparent_painter* clone() const;
    00031      void draw(HDC hDC, int cx, int cy);
    00032
    00033      // own functions
    00034      void transparent_color(COLORREF crTransparent);
    00035      COLORREF transparent_color() const;
    00036
    00037 private:
    00038 // only use our implementation on Win98 or below (TransparentBlt() has a resource leak on those OSes)
    00039 #if (!defined WINVER || WINVER < 0x0500)
    00040      HBITMAP prepare_mask(HBITMAP hSourceBmp, int cx, int cy);
    00041      void draw_transparent_bitmap(HDC hDC, HDC hSourceDC, HBITMAP hMaskBmp, int cx, int cy);
    00042 #endif    // #ifndef WINVER || WINVER < 0x0500
    00043
    00044      COLORREF crTransparent_;
    00045 };
    00046
    00047 } }  // namespace win32::gui

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