In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
AGG provides a lot of additional interfaces for SVG calls, so many beginners like me need to learn SVG first, and then understand the meaning of the interface before they can really grasp the meaning of the interface, such as miter_join.
1 knowledge reserve
Literally, it is the rule of filling, isn't it the filling of graphics? There are no rules. There is no problem with a single shape, what if the area between the two rings is filled with color when rendering the ring? At this point, you need to specify a rule, a filling rule.
AGG provides two algorithms to determine whether the point is in the filled area, and if the point is in the filled area, then populate the point. For a simple path without crossover, it is very easy to judge. However, for a complex path, such as self-intersection or one path wrapping another subpath, the interior is not so easy to understand.
Nonzero
It literally means "non-zero". According to this rule, it is necessary to judge whether a point is in the graph, make a ray in any direction from that point, and then detect the intersection of the ray and the path of the graph. Counting starts at 0, and the path through the ray from left to right increases by 1, and from right to left through the ray minus 1. After the counting result is obtained, if the result is 0, the point is considered to be outside the graph, otherwise it is considered to be internal.
Evenodd
It literally means "parity". According to this rule, to determine whether a point is in the graph, make a ray in any direction from that point, and then detect the number of intersecting points between the ray and the path of the graph. If the result is odd, the point is considered to be internal, and if it is even, the point is considered to be external.
Extracted from: http://blog.csdn.net/cuixiping/article/details/7848369
2 simple example code
Void TestRasFillRule ()
{
Agg::rendering_buffer & rbuf = rbuf_window ()
Agg::pixfmt_bgr24 pixf (rbuf)
Typedef agg::renderer_base renderer_base_type
Renderer_base_type renb (pixf)
Typedef agg::renderer_scanline_bin_solidrenderder_scanline_type
Renderder_scanline_type rensl (renb)
Agg::rasterizer_scanline_aa ras
Agg::scanline_p8 sl
Ras.reset ()
Renb.clear (agg::rgba8 (255255255))
Rensl.color (agg::rgba8 (255j0pl 0))
/ / agg::filling_rule_e rule = agg::fill_non_zero
Agg::filling_rule_e rule = agg::fill_even_odd
Ras.filling_rule (rule)
Ras.move_to_d (100100)
Ras.line_to_d (200100)
Ras.line_to_d (200400)
Ras.line_to_d (100400)
Ras.close_polygon ()
Ras.move_to_d (150250)
Ras.line_to_d (180250)
Ras.line_to_d (180350)
Ras.line_to_d (150350)
Ras.close_polygon ()
Agg::render_scanlines (ras, sl, rensl)
Return
}
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.