That's a little awkward naming IMHO.  How about this trick:

    // somewhere in imagebufalgo.h:
    namespace Composite {
    enum Op { Over, In, Out, ... };
    };

    bool over (ImageBuf &R, const ImageBuf &A, const ImageBuf &B, 
                    Composite::Op = Composite::Over, ROI roi = ROI(), int 
threads=0);

    namespace Blend {
    enum Op { Normal, Multiply, Screen, ... };
    };

    bool blend (ImageBuf &R, const ImageBuf &A, const ImageBuf &B, 
                    Blend::Op = Blend::Normal, ROI roi = ROI(), int threads=0);


Then you just call like this:

    over (R, A, B, Composite::Over);
    blend (R, A, B, Blend::Screen);

Elegant and completely self-explanatory.  

I used the namespaces because I think that pre-C++11, you can't count on the 
enum values being scoped as locally as we'd like.


On Jul 14, 2012, at 7:21 AM, Stefan Stavrev wrote:

> It seems like ImageBufAlgo::over will turn into
> ImageBufAlgo::composite.
> 
> bool over (ImageBuf &R, const ImageBuf &A,
>                   const ImageBuf &B, ROI roi = ROI(),
>                   int threads = 0)
> 
> will become:
> 
> bool composite (ImageBuf &R, const ImageBuf &A,
>                   const ImageBuf &B,
>                   PorterDuff PD = PorterDuff::PD_SRC_OVER,
>                   ROI roi = ROI(), int threads = 0)
> 
> Do you think anything else should be added?
> _______________________________________________
> 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