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

stretch_painter

stretch_painter is derived from painter_holder and therefore has the ability to hold another painter. The purpose of this class is to draw another painter but somehow stretched. You specify the position, width and height of the stretched rectangle.

namespace win32 { namespace gui {

     class stretch_painter : public painter_base, public painter_holder
     {    
     public:
          typedef const rectangle& param0;
          typedef COLORREF param1;

          // c'tor
          stretch_painter(const rectangle& rc_stretch, COLORREF cr_not_used = RGB(255, 0, 255));
          
          // virtual functions of painter_base
          stretch_painter* clone() const;
          void draw(HDC hDC, int cx, int cy);
               
          // own functions
          void stretched_rect(const rectangle& rc_stretch);
          rectangle stretched_rect() const;
     };

} }  // namespace win32::gui

Note:


Example:
// image in full client size
ipicture_painter pic_beavis("c:\\img1.jpg");
add_painter(pic_beavis);

// image stretched
rectangle rc_stretch(0, 0, 200, 100);
stretch_painter stretcher(rc_stretch);
stretcher.set_painter(pic_beavis);
add_painter(stretcher);

The result is as follows

stretch_painter.jpg
Here you can see that the stretch_painter resizes the whole drawing-rect to 200 x 100


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