Scene:
1. Zoom the picture, needless to say, is the need for thumbnails and painting on the interface of this kind.
2. Cut, needless to say, is to cut a portion of the picture used to draw the control background.
3. The wximage of Wxwidget is a direct method of bringing these functions.
gdiplus::bitmap* cutimage (gdiplus::image* source,int x,int y,int width,int height) { Gdiplus::rect zoomrect (0, 0, width,height); gdiplus::bitmap* Pimagescale_ = new Gdiplus::bitmap (zoomrect.width, zoomrect.height); GDIPLUS::RECTF RF (x,y,width,height); Gdiplus::texturebrush Brush (SOURCE,RF); Gdiplus::graphics Graphicsscale (Pimagescale_); Graphicsscale.fillrectangle (&brush, zoomRect); return Pimagescale_;} gdiplus::image* scaleimage (gdiplus::image* source,int width,int height) {gdiplus::rect zoomrect (0, 0, width,height); gdiplus::bitmap* Pimagescale = new Gdiplus::bitmap (zoomrect.width, zoomrect.height); Gdiplus::graphics Graphicsscale (Pimagescale); Gdiplus::texturebrush Brush (source); Graphicsscale.scaletransform ((Gdiplus::real) ((gdiplus::real) ZoomRect.Width/ (gdiplus::real) Source->getwidth ()), (Gdiplus::real) ((gdiplus::real) zoomrect.height/(Gdiplus::real) source- >getheight ())); Graphicsscale.fillrectangle (&brush, zoomrect); return pimagescale;}
[atl/wtl]_[Intermediate]_[use Gdiplus to cut and zoom pictures]