It may be handy to encapsulate the channel logic in a public function that 
looks like:

    bool ImageBufAlgo::compatible_channels (const ImageBuf &A, const ImageBuf 
&B,
                                            bool allow_differing_alpha = false);

I have a feeling that a whole lot more of the functions you will implement will 
need a similar comparison, so there's no point repeating the logic.


On Jun 12, 2012, at 12:09 PM, Larry Gritz wrote:

> 
> On Jun 12, 2012, at 11:54 AM, Stefan Stavrev wrote:
> 
>> 1. "If you have an ImageBuf::Iterator<BUFTYPE,float>, then *iterator will 
>> always be float that you can just use."
>> 
>> Will it always be in range 0-1?
> 
> No.  It will be the float conversion of whatever the input is.  Certainly for 
> half or float image files, it could be anything.  (For anybody doing 
> compositing, half is increasingly the usual case.)
> 
> 
>> 2. Since m_spec_valid and m_pixels_valid are protected I need to add a 
>> method in imagebuf.h.
>> 
>> bool uninitialized () const { return ! m_spec_valid && ! m_pixels_valid; }
>> 
>> Is "initialized" negation of "uninitialized"? In this case initialized would 
>> mean:
>> 
>> m_spec_valid || m_pixels_valid
> 
> Let's do it as "initialized" and then you can ask for "if (! 
> ib.initialized())".  I think that's more clear.  Or you could do both, I 
> don't mind.
> 
> 
>> 
>> 3. "A channel with a labeled alpha channel should be assumed to be correct, 
>> use it (any number of non-alpha channels are ok, as long as they match 
>> between the two input images)."
>> 
>> Hmm, ok I think I got it this time. So we handle the case of alpha channel 
>> not specified, only for the two cases where number of channels is 3 or 4? In 
>> other words, for number of channels 1,2,5,... fail if alpha channel is not 
>> specified for both images? Don't assume any channel is alpha, don't assume 
>> alpha is 1 everywhere.
> 
> I think that is right.
> 
> If there are 6 channels and none are alpha, it's anybody's guess whether 
> alpha might be channel #3 (as if it were RGBA??), or if it's the last channel 
> (XYZPQA), or if none are alpha.  Just give up in that case.
> 
> But if it's 3 or 4 channels and unlabeled, it will almost always be RGB/RGBA.
> 
> --
> Larry Gritz
> [email protected]
> 
> 
> _______________________________________________
> Oiio-dev mailing list
> [email protected]
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

--
Larry Gritz
[email protected]


_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to