How to set up a clipping rectangle ?
What is the best way to set up a clipping rectangle with AGG ? I guess
I could specify a subset of the output buffer by tweaking its origin
and its width/height, yet keeping the same byte width, but this won't
clip what gets rasterized.
A bit OT, but a thought occured to me from another renderer. It could
work both by rendering standard bottom-to-top, but also top-to-bottom.
In the latter case, it could skip rasterizing pixels that would fall
underneath already existing pixels. Have you heard of such a technique,
could it be helpful? As an example you could think of a case where you
have say 1000 identical rectangles. Using normal technique you have to
rasterize them all, if you get the logic right for top-to-bottom you
rasterize just once. Ofcourse this assumes the cost of the checks are low.
You can do that, but yes, you will have to worry about
pixel formats. The good news is agg::rendering_buffer
has clip_box() and you can freely use it. But it's a
low-level clipping. It means that clipping is
performed when rendering. The rasterizer doesn't know
anything about the cliping box and it will process
paths anyway even if they are one mile away from the
visible area. The other possibility is
agg::conv_clip<> that clips paths in their vectorial
representation. What method to use (or both) depends
on the task.
この関数は現在存在しません!!
The cost is low for simple primitives like circles,
rectangles, etc. But it can be great for arbitrary
polygons. Still, this technique is widely used and
called "Z-buffer". :-)
Besides, what if the polygon is translucent? :-)
Z-buffer,