- June 11, 2006 Update and new demo examples.
- New Demo rasterizer_compound.cpp demonstrates a rather advanced
technique of using
the compound rasterizer. The idea is you assign styles to the polygons
(left=style, right=-1) and rasterize this "multi-styled" compound shape
as a whole. If the polygons in the shape overlap, the greater styles have
higher priority. That is, the result is as if greater styles were painted
last, but the geometry is flattened before rendering. It means there are
no pixels will be painted twice. Then the style are associated with colors,
gradients, images, etc. in a special style handler. It simulates
Constructive Solid Geometry so that, you can, for example draw a translucent
fill plus translucent stroke without the overlapped part of the fill being
visible through the stroke.
- Added new file agg_pixfmt_transposer.h. It provides a simple class
template pixfmt_transposer that simply exchanges horizontal and
vertical dimensions. It's mostly used in new blur filters.
- Added new overloaded function
attach() to all pixel level renderers.
it has the following signature:
template<class PixFmt>
bool attach(PixFmt& pixf, int x1, int y1, int x2, int y2);
That is, now you can attach pixfmt_nnnn to some existing
one as a child. It still requires a separate rendering_buffer
object, but will use the shared frame buffer. See example in
Demo blur.cpp.
- Added function
stride() to all pixel level renderers.
- New Demo blur.cpp.
- Added new file agg_blur.h and fast blur functionality.
There two algorithms
are used: Stack Blur by Mario Klingemann and Fast Recursive Gaussian Filter, described
here
and here (PDF). The speed of both methods does not depend on the filter radius.
Mario's method works 3-5 times faster; it doesn't produce exactly Gaussian
response, but pretty fair for most practical purposes. The recursive filter
uses floating point arithmetic and works slower. But it is true Gaussian filter,
with theoretically infinite impulse response. The radius (actually 2*sigma value)
can be fractional and the filter produces quite adequate result.
There are two class templates: stack_blur and recursive_blur. stack_blur
is parametrized by color type and calculator type. The calculator
can be: stack_blur_calc_rgba, stack_blur_calc_rgb, and
stack_blur_calc_gray. They are parametrized by the basic data
type that is typically unsigned for rgba8 and int64u for
rgba16.
recursive_blur is also parametrized by the color type and
calculator type. The calculator can be: recursive_blur_calc_rgba,
recursive_blur_calc_rgb, and recursive_blur_calc_gray. They
are parametrized by float or double . It's better to use
doubles because the algorithm is very sensitive to precision.
Also, there are optimized versions for RGBA32 , RGB24 ,
and GRAY8 formats. They are: stack_blur_rgba32, stack_blur_rgb24,
and stack_blur_gray8 respectively. These functions work only with
8 bits per component colors and with blur radius not exeeded 254.
Many thanks to Mario Klingemann who generously permitted me to
include his algorithm into AGG. |