|
Boost Users : |
Subject: Re: [Boost-users] [GIL] How can I copy a subimage_view to a view?
From: blp330 (blp330_at_[hidden])
Date: 2009-04-26 13:42:17
Hi,
Thanks for your reply,
I initialize view member using io extension to read image file.
I try to create a local rgb8_image_t in crop method because I have another
method fill.
It look like this:
Image& Image::Fill(int x1, int y1, int x2, int y2,
int r, int g, int b)
{
boost::gil::rgb8_pixel_t pixel(r, g, b);
boost::gil::fill_pixels(
boost::gil::subimage_view(view, x1, y1, x2 - x1, y2 - y1), pixel);
return *this;
}
But when I do this:
Image a("a.png");
Image b;
a.crop(100, 100, 50, 50, b);
a.fill(100, 100, 50, 50, 0xff, 0xff, 0xff);
I found that b will be also filled with white color.
So, I try to "copy" all pixels from a to b.
copy_pixels requires two view with the same dimension, but I can't change
dimension of a view directly,
that is why I create a local rgb8_image_t to do that.
Now, I clarify my requirement. I need to do this:
Image a("a.png");
Image b;
a.crop(100, 100, 50, 50, b);
a.fill(100, 100, 50, 50, 0xff, 0xff, 0xff);
a and b are now with independent view. a.fill should not affect b.
How can I do that?
Thank you!
-- View this message in context: http://www.nabble.com/-GIL--How-can-I-copy-a-subimage_view-to-a-view--tp23234549p23244565.html Sent from the Boost - Users mailing list archive at Nabble.com.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net