From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-10-12 17:51:36


Lubomir Bourdev wrote:

> 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);

Hi Lubomir, sorry for asking this in the wrong thread, but: is it possible
to write fill_pixels so that it produces the equivalent of three memset
calls in the planar case, one per channel?