WinCE use of bitmaps

Source: Internet
Author: User

Basic steps for manipulating bitmaps:

* Create a bitmap handle

* Loading Bitmap objects

* Create a memory Device description object, select the bitmap into the memory device description object

* Graphic drawing using the drawing function

* Delete Bitmap handle

Create a bitmap handle and load the bitmap object:

* Bitmap Handle

Hbitmap hbmp

*bool LoadBitmap (

HInstance Hlnstance,

LPCTSTR lpbitmapname);

* There are two types of bitmap resources:

System built-in resources

Application Bitmap Resources

Hbitmap CreateBitmap (

int nwidth,//refers to the width of the mapping

int nheight,//refers to the height of the location map

UINT Cplanes,//number of color bits used by the device, 1 in CE environment

UINT cbitsperal,//Specifies the number of bits used per pixel, typically 2 of the n-th square

CONST VOID *lpbits)//Pointer to color data array

Examples include:

hbmp = Creatbitmap (20,5,1,4,bits);

Hbitmap Shloaddlbitmap (LPCTSTR szfilename);

Display steps for bitmaps:

* Create a memory device environment

* Select the bitmap handle into the device memory environment

* Call the transfer function to display the bitmap on the device

Memory Device Environment:

* The role of the memory device environment:

To improve access speed and match the settings of the bitmap with the settings of the device environment, Windows CE first loads the bitmap into the memory device environment and then assigns the value from memory to the device environment.

*HDC CreateCompatibleDC (hdc hdc);

* Bitmap Selection Device object using: SelectObject () function

Functions for transmitting data blocks:

BOOL BitBlt (

HDC hdcdest,//handle to target device environment

int Nxdest,int nydest,//logical coordinates of the upper-left corner of the target rectangle area

int Nwidth,int nheight,//width and height of the target rectangle area

HDC hdcsrc,//handle to the source drawing environment

int Nxsrc,int NYSRC,//logical coordinates of the upper-left corner of the source drawing

DWORD dwrop); Set raster operation code for execution

*srccopy Copy the source bitmap to the target bitmap

BOOL Stretchbit (

HDC Hdcdest,

int Nxorigindest,int Nyorigindest,

int Nwidthdest,int Nheightdest,

HDC hDCSrc,

int Nxoriginsrc,int NYORIGINSRC,

int Nwidthsrc,int NHEIGHTSRC,

UINT crtransparent);

WinCE use of bitmaps

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.