Auto_detect_orientation Effect of Agg::conv_contour function

Source: Internet
Author: User

as the name says: auto-detect direction, what direction, many people may not understand, through AGG e-Mail learned several things: the extension contour is related to the direction in which the drawing is drawn ( that is, the move_to,line_to, the clockwise, or counterclockwise) of the shape. As in the next two examples, one is to draw the rectangle clockwise, one to draw the rectangle counterclockwise, and then to expand the contour line.

Example1Counter-clockwise

AGG::p ath_storage PS;

Ps.move_to (395.5,200.5);

Ps.line_to (295.5,200.5);

Ps.line_to (295.5,210.5);

Ps.line_to (395.5,210.5);

Ps.close_polygon ();

Agg::conv_contour<agg::p ath_storage> Contour (PS);

Contour.auto_detect_orientation (TRUE);

Contour.width (M_slider1.value ());// Gets the value of the slider bar

Agg::conv_stroke<agg::conv_contour<agg::p ath_storage> >stroke (contour);

Ras.add_path (stroke);

Example2Clockwise

AGG::p ath_storage PS;

Ps.move_to (395.5,200.5);

Ps.line_to (395.5,210.5);

Ps.line_to (295.5,210.5);

Ps.line_to (295.5,200.5);

Agg::conv_contour<agg::p Ath_storage>contour (PS);

Contour.width (M_slider1.value ());

Agg::conv_stroke<agg::conv_contour<agg::p ath_storage>> Stroke (contour);

Ras.add_path (stroke);

Result Analysis: The second example smoothly expands or shrinks the expansion line, but the first example is just the opposite, and the difference between the two examples is that the direction of the drawing is different. So in order to solve this problem, we introduced the contour.auto_detect_orientation function.

The above function of the first example is stripped of the annotation, and the contour line can be scaled according to normal logic.


Auto_detect_orientation Effect of Agg::conv_contour function

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.