|
Boost : |
From: Lubomir Bourdev (lbourdev_at_[hidden])
Date: 2006-10-12 17:29:06
> Is there a comparison with Anti-Grain? IIRC it also was
representation
> independent.
>
> Bruno
>
Question for Bruno (or anyone familiar with Anti-Grain):
1. How does Anti-Grain deal with planar images?
Let's take the simplest possible example: Fill an image with the color
red.
Here is a possible code in GIL to do that:
template <typename View, typename Pixel>
void fill_pixels(const View& view, const Pixel& color) {
typename View::pixel_t value;
color_convert(color, value);
for (typename View::iterator it=view.begin(); it!=view.end(); ++it)
*it = value;
};
Here is how to call it:
rgb8_pixel_t red(255,0,0);
// Channel ordering: RGBRGBRGBRGB...
rgb8_image_t interleaved_image(100,100);
fill_pixels(view(interleaved_image), red);
// Channel ordering: RRR... GGG... BBB...
rgb8_planar_image_t planar_image(100,100);
fill_pixels(view(planar_image), red);
How would this example look with Anti-Grain?
__________________
Second question, how does AGG deal with images whose type is
instantiated at run-time? (For example, suppose you read the image from
a file and want to keep it in native form). Here is the extra GIL code
to do this:
template <typename Pixel>
struct fill_pixels_op {
typedef void result_type;
Pixel _color;
fill_pixels_op(const Pixel& color) : _color(color) {}
template <typename View>
void operator()(const View& view) const { fill_pixels(view, _color);
}
};
template <typename ViewTypes, typename Pixel>
void fill_pixels(const any_image_view<ViewTypes>& view, const Pixel&
color) {
apply_operation(view, fill_pixels_op<Pixel>(color));
}
Here is how to call it:
typedef mpl::vector<rgb8_view_t, rgb8_planar_view_t> my_views_t;
any_image_view<my_views_t> runtime_view;
runtime_view = view(interleaved_image);
fill_pixels(runtime_view, red);
runtime_view = view(planar_image);
fill_pixels(runtime_view, red);
Again, my question is, how would this look in Anti-Grain?
For the Vigra fans out there... How would the above two examples look in
Vigra?
For the Cairo fans... same question.
Thanks,
Lubomir
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk