The BitBlt of MFC functions

Source: Internet
Author: User

The BitBlt of MFC functions

//Cgame123view DrawingvoidCgame123view::ondraw (cdc*PDC) {Cgame123doc* PDoc =getdocument ();    Assert_valid (PDOC); if(!PDoc)return; //TODO: Add drawing code here for native dataCRect Rect; GetClientRect (&Rect); //Screen Widthwidth = rect.right-Rect.left; //Screen HeightHeight = rect.bottom-Rect.top;    CDC Dc; if(Dc.createcompatibledc (pDC) = =FALSE) MessageBox (_t ("Can ' t create DC")); //display bitmaps in different locationsDc.selectobject (BACKMAP); //display two bitmaps to make them connectPdc->bitblt (Width- -) /2,0, -, Height, &DC,0, Goup- -, srccopy); PDC->bitblt (Width- -) /2,0, -, Height, &DC,0, Goup, srccopy); //Show BitmapCDC dccompatible; if(dccompatible. CreateCompatibleDC (pDC) = =FALSE) MessageBox (_t ("Can ' t create DC")); Dccompatible.    SelectObject (plane); //The 12th parameter is the position start out (upper left corner), the 34th parameter is the device's height width, and the 67th parameter is a tangentPdc->bitblt (Ten, - $, M_bm.bmwidth, M_bm.bmheight, &dccompatible,0,0, srccopy); PDC->bitblt (Ten, height- -, M_bm.bmwidth, M_bm.bmheight, &dccompatible,0,0, srccopy); PDC->bitblt (Ten, $, M_bm.bmwidth, M_bm.bmheight, &dccompatible,-Ten,0, srccopy); PDC->bitblt (Ten, -, M_bm.bmwidth, M_bm.bmheight, &dccompatible,Ten,0, srccopy); PDC->bitblt (Ten, -, M_bm.bmwidth, M_bm.bmheight, &dccompatible,0,0, srccopy); PDC->bitblt (Ten, -, M_bm.bmwidth, M_bm.bmheight, &dccompatible,0, -Ten, srccopy); PDC->bitblt (Ten, -, M_bm.bmwidth, M_bm.bmheight, &dccompatible,0,Ten, srccopy); PDC->bitblt (Ten, the, M_bm.bmwidth, M_bm.bmheight, &dccompatible,0,0, srccopy); //tangent, negative cut down, height below upperPdc->bitblt ( the,0, M_bm.bmwidth, M_bm.bmheight, &dccompatible,0, -, srccopy); PDC->bitblt ( $,0, M_bm.bmwidth, M_bm.bmheight, &dccompatible,0, - -, srccopy); //tangent, negative cut down, height on top, another full planePdc->bitblt ( $, -, M_bm.bmwidth, M_bm.bmheight, &dccompatible,0, -, srccopy); PDC->bitblt ( $,0, M_bm.bmwidth, M_bm.bmheight, &dccompatible,0, - -, srccopy); CCLIENTDC DC ( This);} There are a number of ways to BitBlt device context drawing. For example, by creating a bit drawing brush, you can use it to fill an area to achieve image rendering. In addition, you can use the CDC class's bitmap function to output a bitmap to the device context. The BitBlt is used to copy bitmaps from the original device to the target device in the following syntax format: Boolbitblt (intXintYintNwidth,intNHEIGHT,CDC*PSRCDC,intXSRC,intysrc,dworddwrop) x: The x-axis coordinate point of the upper-left corner of the target rectangle area. Y: the y-axis coordinate point of the upper-left corner of the target rectangle area. Nwidth: Draws the width of the bitmap in the target device. Nhight: The height of the bitmap is drawn on the target device. PSRCDC: Pointer to the source device context object. XSRC: The origin x-axis coordinate of the source device context from which the function copies the bitmap to the target device. YSRC: The Origin y-coordinate of the source device context from which the function copies the bitmap to the target device. Dwrop: Raster operation code Dwrop has the following options: Blackness use Black to fill the target area Dstinvert target matrix region color inversion mergecopy use and operation to combine the original device rectangular area Color and target device brush mergepaint use or operate the color of the opposite source rectangle area and the color of the destination rectangle to merge notsrccopy copy the inverse of the source device area to the target device notsrcerase use or combination of operations The color of the source device area and the target device area, and then the color of the resulting color patcopy copy the current selected brush from the source device to the target device Patinvert use the XOR operation to combine the colors of the selected brush and target device area of the target device PATP AINT the color Srcand of the currently selected brush and source device area of the target area by or by the combination of colors srccopy the source device and target device area using the                 The source device area to the target device srcerase use the inverse color of the target device area with the operation and the color of the source device area Srcinvert Use the XOR operation to combine the source device area color and the target device area color Srcpaint Use or operation combination source device area color and target device area color whiteness fill the target area with white

http://blog.csdn.net/h1023417614/article/details/43086533

The BitBlt of MFC functions

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.