Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

AGG lesson 21 agg::conv_contour extended Contour

2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1 preface

The outline is the boundary of the graph, and any closed vertex source that skips the agg::conv_stroke phase will depict a solid figure with the same color and boundary as the fill. If you don't close the vertex source, once you skip agg::conv_stroke, you don't draw anything. Agg::conv_stroke is used to depict the boundaries of graphics.

Compared with agg::trans_affine, agg::conv_contour is the outline of the extended graphics, and the popular point is to expand the boundaries of the graphics and scale the boundaries of the graphics (but unlike the agg::trans_affine affine transformation, this is a zoom with the same central position).

2 official examples

Execute the examples/conv_stroke routine, providing the following control:

1) switching of segment endpoints

2) the connection mode between line segments

3) Segment width

3 code analysis

Header file: # include "agg/include/agg_conv_stroke.h"

1) shape of the end of the segment

Enum line_cap_e

{

The shape of butt_cap,// button is no different from that of square.

After square_cap,// is set, the length is longer than butt_cap.

Round_cap// semicircle shape

}

Setting function: voidline_cap (line_cap_e lc)

2) the width of the segment

Setting function: voidwidth (double w)

3) introduce the default parameters of stroke

Of course, we can not call line_cap or width, because stroke has a default constructor, and the default parameters are specified as follows:

M_width (0.5)

M_width_abs (0.5)

M_width_eps (0.5Accord 1024.0)

M_width_sign (1)

M_miter_limit (4.0)

M_inner_miter_limit (1.01)

M_approx_scale (1.0)

M_line_cap (butt_cap)

M_line_join (miter_join)

M_inner_join (inner_miter)

4) Line segment style of agg::conv_stroke

The rendering mode of solid line is adopted. Can we describe the dashed line by replacing her: agg::conv_dash

It turns out that nothing has been rendered! Agg::conv_dash will describe it separately!

3 exampl

Ras.reset ()

Agg::path_storage ps1

Ps1.move_to (200200)

Ps1.line_to (300300)

Agg::line_cap_e cap = agg::round_cap;// sets the shape of the end of the segment

Agg::conv_stroke stroke (ps1); / / the style of the segment

Stroke.line_cap (cap)

Stroke.width (50); / / sets the width of the segment

Ras.add_path (stroke)

Agg::render_scanlines_aa_solid (ras,sl,renb,agg::rgba8 (255j0pl 0))

2 agg::conv_contour Contour Transformation 1 Analysis

The contour line is the outline boundary of the graph. When the center position of the graph is unchanged, the boundary is scaled and scaled, which is different from the affine scaling of affine. The center position of the latter is also offset. It is very easy to understand the circle. You can try to treat a circle with agg::conv_contour and agg::trans_affine respectively, and you can see obvious results:

Agg::conv_contour expansion in situ

Agg::trans_affine center offset and zoom

3.3 example playback

/ / Vertex Source

Agg::ellipse ell (100, 100, 50, 50, 50)

/ / Coordinate conversion pipeline

Typedef agg::conv_contour ell_cc_type

Ell_cc_type ccell (ell)

Typedef agg::conv_stroke ell_cc_cs_type

Ell_cc_cs_type csccell (ccell)

/ / Draw

Renb.clear (agg::rgba8 (255255255))

For (int item0; I

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report