Windows program design Reading Notes-GDI track/font outline

Source: Internet
Author: User

1. Track generation:
Beginpath (HDC); // start trajectory

Textout (...);
Movetoex (HDC, 40, 25, null );
Lineto (HDC, 50, 75 );
Lineto (HDC, 60, 25 );
Closefigure (); // use a straight line to close the trajectory
Endpath (HDC); // end trajectory
Strokepath (HDC); // draw the trajectory

 

Ii. Track handling:

Strokepath // draw the trajectory

Fillpath // fill

Strokeandfillpath // draw and fill

Pathtoregion // convert to Region

Selectclippath // select the cut area
For fields with fill or area, it must be automatically closed in a straight line.

3. Extended paint brush

Logbrush Lb;
LB. lbstyle = bs_solid;
LB. lbcolor = RGB (128,128,128 );
LB. lbhatch = 0;
SelectObject (HDC,
Extcreatepen (ps_solid | ps_geometric | ps_endcap_round | ps_join_round, & Lb, 0, null ));

Iv. CDC: selectclippath

Bool selectclippath (INT nmode );

Return Value: if the operation is successful, a non-zero value is returned. Otherwise, the return value is 0.

Parameters:

Nmode Specify the path to use. The following values are allowed:

· Rgn_and The new cut area, including the current cut area and the current path.
· Rgn_copy The new cut area is the current path.
· Rgn_diff The new cut area is the current path, but does not include the current path.
· Rgn_or The new cut area, including the combined area and current path of the current cut area.
· Rgn_xor The new cut area includes the combined area and current path of the current cut area, but does not include the overwrite part.

Note:
Select the current path as the cut area for the device context, and use the specified mode to combine the new area with the existing cut area. The device context must contain a closed path.

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.