Differences between transparentblt, stretchblt, and bitblt Functions

Source: Internet
Author: User

Bool stretchblt (
Int X, // specifies the X coordinate in the upper-left corner of the destination rectangle.
Int y, // specifies the Y coordinate in the upper-left corner of the target rectangle.
Int nwidth, // specify the width of the area of the target rectangle
Int nheight, // specify the height of the destination rectangle
CDC * psrcdc,
Int xsrc, // specify the X coordinate in the upper left corner of the source rectangle area
Int ysrc, // specifies the Y coordinate in the upper left corner of the source rectangle area.
Int nscwidth, // specify the width of the source rectangle area
Int nscheight, // specify the height of the source rectangular area
DWORD dwdrop // For details about this parameter, refer to msdn. The srccopy type is direct copy.
); // This function copies a bitmap resource from one rectangle area to another, that is, the scaled bitmap.

 

Bool transparentblt (
Int xdest,
Int ydest,
Int ndestwidth,
Int ndestheight,
CDC * psrcdc,
Int xsrc,
Int ysrc,
Int nscwidth,
Int nscheight,
Uint clrtransparent
); // This function also has the zoom function, but the last parameter of this function is used to specify the RGB color as the transparent color;
 
Bool bitblt (
Int X,
Int y,
Int nwidth,
Int nheight,
CDC * psrcdc,
Int xsrc,
Int ysrc,
DWORD dwrop
); // This function is also used to copy bitmap resources, but does not support scaling.
 
Example:
Cpaintdc DC (this); cbitmap backbmp; backbmp. loadbitmapw (idb_bitmap1); bitmap bm; backbmp. getbitmap (& BM );
CDC imagedc; imagedc. createcompatibledc (& DC); cbitmap * poldimagebmp = imagedc. selectObject (& backbmp); DC. stretchblt (0, 0, BM. bmwidth + 15, BM. bmheight + 15, & imagedc, 0, 0, BM. bmwidth, BM. bmheight, srccopy); imagedc. selectObject (poldimagebmp );
Cbitmap forebmp; forebmp. loadbitmapw (idb_bitmap2); forebmp. getbitmap (& BM );
Poldimagebmp = imagedc. selectObject (& forebmp); DC. transparentblt (0, 0, BM. bmwidth + 15, BM. bmheight + 15, & imagedc, 0, 0, BM. bmwidth, BM. bmheight, RGB (255,255,255); imagedc. selectObject (poldimagebmp );

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.