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