How to set up a clipping rectangle ?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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,将在后面说明
以上是关于How to set up a clipping rectangle ?的主要内容,如果未能解决你的问题,请参考以下文章
架构How To Use HAProxy to Set Up MySQL Load Balancing
How To Set Up vsftpd on CentOS 6
[译]How-to set up a redundant storage pool with ZFS and Ubuntu
How to set up Tensorflow inception-v3 model on Windows
activate mod_rewrite How To Set Up mod_rewrite for Apache on Ubuntu 14.04
批量下载所有LYNDA课程的方法 (how to download full Lynda.com course in just one set-up)