The difference between the three functions of TransparentBlt, StretchBlt and BitBlt

Source: Internet
Author: User
Tags transparent color

Ackyhwei posted in 2011-10-13 10:55 click:1080 times From: Blog.csdn.net/weiqubo
BOOL StretchBlt (int x,//The x-coordinate of the upper-left corner of the specified destination rectangle, int y,//The y-coordinate of the upper-left corner of the specified destination rectangle, int nwidth,//width int nheight for the specified destination rectangle area,//height CD for the specified destination rectangle area c* PSRCDC, int xsrc,//Specify the x-coordinate of the upper-left corner of the source rectangle, int ysrc,//Specify the source rectangle area TAG:GDI Blt

BOOL StretchBlt (
int x,//The x-coordinate of the upper-left corner of the specified destination rectangle area
int y,//y-coordinate of the upper-left corner of the specified destination rectangle area
int nwidth,//width of the specified destination rectangle area
int nheight,//height of the specified destination rectangle area
cdc* PSRCDC,
int XSRC,//Specifies the x-coordinate of the upper-left corner of the source rectangular area
int YSRC,//Specifies the y-coordinate of the upper-left corner of the source rectangular area
int Nsrcwidth,//Specifies the width of the source rectangle area
int Nsrcheight,//Specifies the height of the source rectangle area
DWORD Dwrop//This parameter reference msdn,srccopy type is direct copy
); This function copies a bitmap resource from one rectangular region to another, that is, a scaled bitmap

BOOL TransparentBlt (
int Xdest,
int Ydest,
int Ndestwidth,
int Ndestheight,
cdc* PSRCDC,
int XSRC,
int YSRC,
int Nsrcwidth,
int Nsrcheight,
UINT clrtransparent
); This function also has a zoom function, but the last parameter of this function is used to specify RGB as a 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 have the zoom function.

Examples of usage:
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);

(Weiqubo)
This site in addition to the article reproduced, are the original or compile the site to welcome any form of reprint, but please be sure to indicate the source, respect for the work of others, with the study of growth. Reprint Please specify: article reproduced from: Russell Labs[http://www.rosoo.net/a/201110/15131.html]http://www.cnblogs.com/lidabo/p/3702026.html

The difference between the three functions of TransparentBlt, StretchBlt and BitBlt

Related Article

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.