Boost logo

Boost Users :

Subject: Re: [Boost-users] [gil] Using gil::color_converted_view with gil::for_each_pixel
From: Christian Henning (chhenning_at_[hidden])
Date: 2010-12-05 13:03:13


Hi Chris

On Sun, Dec 5, 2010 at 8:20 AM, Chris Yuen <kizzx2+boost_at_[hidden]> wrote:
> Hello Christian,
>
> Thanks for your guidance! I took a look at semantic_at_c() and get_color()
> and they seem to do the trick!
>
> Here's a couple of more questions. I've posted a compiling, annotated code
> at
>
> http://boost.codepad.org/Fy2vP73l

Your code doesn't work since you overriding the first channel which is
alpha when using argb. You should use get_color().

>
> Below is the more elaborate description of my questions which can be found
> in the code:
>
> 1. Can I specify which channel to get in nth_channel_view()? For example, if
> I want to set the red channel to 255 for all the pixels, I would do
> gil::fil_pixels(gil::nth_channel_view(view, 0), 255). However, that only
> works if our view is rgb8 or bgr8, not argb8. Is there a way I can say
> something like gil::fill_pixels(gil::nth_channel_view(view,
> gil::find_channel_for_view(view, gil::red_t())), 255) ???

nth_channel_view does exactly what you ask for. Namely overriding the
first channel.

I don't think there is a channel_view where you can define the color
type instead of a channel number. I think that could be quite useful.
For now I would just stick with get_color() and a functor which does
what you're trying to do.

>
> 2. This compiles
>
> gil::gil_function_requires<gil::ImageViewConcept<int> >();

What do you mean? This shouldn't compile?

>
> P.S. I am definitely interested in reviewing the extension! Apparently I'm a
> begginer in GIL. How would you like me to review and where should I write
> to?

Everyone can participate. Here is the announcement and a guide on what to do.

http://mateusz.loskot.net/2010/11/30/formal-review-of-io-and-toolbox-extensions-to-boost-gil-starts-tomorrow/

Regards,
Christian


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