14.Windows Drawing

Source: Internet
Author: User

1. Drawing-related

Drawing device DC (device context), drawing context/Drawing Description table

HDC-DC handle, representing the drawing device

Gdi-windows Graphics Device Interface,win32 provides a drawing API

2. Color

(1) The expression of color

Computer use red, green, blue: R-0 ~ 255

G-0 ~ 255

B-0 ~ 255

Each color dot is 3 bytes 24 bits, save 0-2^24-1

16-bit: 5, 5, 6-red, green, blue

32-bit: 8, 8, 8, 8-red, green, blue, transparency

(2) Use of color

COLORREF-Actual DWORD, for example: colorref ncolor = 0;

Assign values using RGB macros, for example: Ncolor = RGB (0, 0, 255);

Gets the RGB value, Getrvalue/getgvalue/getbvalue, for example: BYTE nred = Getrvalue (Ncolor);

3. Use of points

(1) GetPixel gets the color of the specified point

COLORREF GetPixel (HDC hdc,//

int Nxpos,//

int nypos); //

(2) SetPixel set the specified color

COLORREF SetPixel (HDC hdc,//

int X,//

int Y,//

COLORREF crcolor); //

Returns the original color of the point

4. Use of lines (lines, arcs)

Moves the current point to the specified point: BOOL movetoex (HDC hdc,

int X,

int Y,

Lppoint lppoint);

Draws a line from the current point to the specified point: BOOL LineTo (HDC hdc,

int Nxend,

int nyend);

14.Windows Drawing

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.