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 39 doubts about the function of rasterizer_scanline_aa drawing lines

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Header file

# include

Types

Template

Class rasterizer_scanline_aa

Member function

Void add_path (VertexSource&vs,unsigned path_id=0) join vertex source

Void reset () clears the last rendering cache data, which needs to be performed before each call to the add_path function

It also provides a simple line drawing function, but it doesn't actually work, so you need to know how the whole operation flow is executed!

Void move_to (int x, int y)

Void line_to (int x, int y)

The following is a simple example of using rasterizer_scanline_aa without any effect

It is impossible to draw lines with rasterizer_scanline_aa, but through the cooperation of move_to_d and line_to_d

Use, build a closed polygon, and render a filled polygon

The code is as follows:

Ras.reset ()

/ *

Agg::path_storage ps1

Ps1.move_to (200200)

Ps1.line_to (400200)

Agg::line_cap_e cap = agg::square_cap

Agg::conv_stroke stroke (ps1)

Stroke.line_cap (cap)

Stroke.width (50)

Ras.add_path (stroke)

, /

/ / the following code is mainly used to test how rasterizer_scanline_aa draws lines, which cannot be implemented for the time being.

Ras.move_to (400400)

Ras.line_to (500500)

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

Ras.reset ()

This example is tested on the basis of the existing, but one thing is certain, after the connection function of ras, it does not specify the style of rendered line segments, who knows whether to use dashed lines or solid lines.

Extracted from: http://www.360doc.com/content/11/1015/09/992979_156311972.shtml

Header file

# include

Mainly record two methods of drawing lines

Void move_to (int x, int y) simple line drawing function, in 1/poly_subpixel_scale

Void line_to (int x, int y) (poly_subpixel_scale is generally 256)

Void move_to_d (double x, double y) simple line drawing function in pixels

Void line_to_d (double x, double y)

Now there is a question: you can use the following _ d version to draw lines, but how should the above two versions be combined, especially how to view such thin segments!

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