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

What is the agg::arrowhead rendering Arrow and using the

2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces what is the agg::arrowhead rendering arrow and the use, the content of the article is carefully selected and edited by the author, with a certain pertinence, the reference significance for you is still relatively great, the following with the author to understand what is the agg::arrowhead rendering arrow and use it.

1 file reference and parameter description

Header file: include/agg_arrowhead.h

Constructor:

Void head (double D1, double d2, double d3, double d4)

Void tail (double D1, double d2, double d3, double d4)

The shape of the arrow is determined by calling the above two functions.

2 Application experience

Agg::vcgen_markers_term: the positioning mark of the end, which saves the coordinates and direction of the end

For example, when calling the agg::conv_stroke declaration, the module parameters provided are too few and are not specified to add a flag for the outline!

Agg::conv_stroke stroke (ps1)

It must be necessary to use the endpoint as a marker for agg::vcgen_markers_term.

Build a flag instance, get both ends of the contour line, and prepare to render

Agg::conv_marker marker (stroke.markers (), ah)

3 example 1) render arrowhead and arrow tail separately

The code is as follows:

Agg::arrowhead ah

Ah.head (0pm 10pm 5pm 5)

Ah.tail (10, 10, 5, 5)

Ras.reset ()

Agg::vcgen_markers_term mt

Mt.add_vertex (200,250, agg::path_cmd_move_to)

Mt.add_vertex (280,250, agg::path_cmd_line_to)

Agg::conv_marker arr (mt, ah)

Ras.add_path (arr)

/ / error situation: ras.add_path (ah), the exact location of the description will not be clear

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

2) render arrowheads with arrowheads

The code is as follows:

Agg::path_storage ps1

Ps1.move_to (200,200)

Ps1.line_to (400,200)

/ / describe the parameters of the arrow in detail, 1. The distance of the arrowhead from the end of the segment

Agg::arrowhead ah

Ah.head (100, 10, 5, 5)

Ah.tail (10, 10, 5, 5)

/ / the template parameters of the flag are given to the segment, and then the endpoint of the segment can be changed through the markers function of stroke

/ / pass agg:: conv_marker,vcgen_markers_term: use the endpoint as the marked point

Agg::conv_stroke stroke (ps1)

/ / use conv_marker to specify ah as the mark of the line segment marker point

Agg::conv_marker marker (stroke.markers (), ah)

Ras.add_path (stroke)

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

/ / marker should be added immediately after that, adding a logo vertex source!

Ras.add_path (marker)

/ / render the lines to the memory image, ready to display

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

After reading the above about what is the agg::arrowhead rendering arrow and use, many readers must have some understanding, if you need to get more industry knowledge and information, you can continue to follow our industry information column.

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