agg::rasterizer_scanline_aa<...>::hit_test(int x, int y)

问题:尝试判断当前鼠标是否点击在固定的区域,重新渲染某一部分。

given a set of points and commands (i.e. moveto, lineto, etc) is it 
possible to create a path and then determine if a point is:
1)  within the path's area (taking into account whatever winding rules 
are in use)
2)  intersects the path
Can this be calculated without rendering the path to a render buffer, or 
do I have to render the points first? I'd rather not have to do this as 
this could get a bit expensive.


回答:

bool agg::rasterizer_scanline_aa<...>::hit_test(int x,
int y)

You need to rasterize the paths (add_path) and then
call hit_test(). After testing you can render the
rasterized path if you wish. As well as you can
hit_test() after rendering.

BTW, what do you mean "point intersects the path"? :-)
I suspect it means "a point is inside the polygon that
determines the path stroke", right? If so, just
rasterize the stroke and invoke the very same
hit_test().


你可能感兴趣的:(test,agg,hit)