agg::conv_transform调用时机

> I corrected my program as follows:
>         
>        .....
>         agg::path_storage path;
>         /* how it was
>         agg::conv_transform<agg::path_storage> trans(path, mtx);
> 
>         agg::conv_curve<agg::conv_transform<agg::path_storage> > 
> fill(trans);
>        
> agg::conv_stroke<agg::conv_curve<agg::conv_transform<agg::path_storage> > >
> stroke(fill);
>         */
>         // next three lines are new
>           agg::conv_curve<agg::path_storage> fill(path);
>         agg::conv_stroke<agg::conv_curve<agg::path_storage> > stroke(fill);
>        
> agg::conv_transform<agg::conv_stroke<agg::conv_curve<agg::path_storage> > >
> trans(stroke, mtx);
> 
> but the transform does not work at all now.
> 
> Hope it's a minor glitch.
I suspect that you declare conv_transform, but don't actually use it. You need
to pull vertices from "trans".
Typically it's as follows:
Fill:
path_storage->conv_transform->conv_curve.
Note that here we can afford the transformations *before* flattenning curves.
It will process fewer number of points. And conv_curve works in *screen*
coordinates.

Stroke:
path_storage->conv_curve->conv_stroke->conv_transform.
Here we apply transformations *after* curve and stroke. It guarantees correct
result even if you have anisotropic scaling:http://antigrain.com/tips/line_alignment/conv_order.gifBut in this case the curve and stroke converters work in the *world*
coordinates, so, the curves may look inaccurate with huge zoom. To adjust the
approximation accuracy call:
conv_curve.approximation_scale(mtx.scale());
conv_stroke.approximation_scale(mtx.scale());

Note that for the fill pipeline you don't need to adjust it because the curve
converter already works with *screen* coordinates. But if you change the order,
(path_storage->conv_curve->conv_transform) you will need to do so.


你可能感兴趣的:(agg,调用时机)