Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2005-09-15 10:19:37


Fabio Fracassi wrote:
>Adam Badura wrote:
>
> > Upsss...
> > I pressed "send" to fast... :)
> >
> > I am gathering materials and working on a library (originaly I
>wanted
> > one class, but it seems now that it wont be that easy) dealing with
> > colors, their representation (like ranges 0.0-1.0 and 0-255), models
>(like
> > RGB, YUV, HSV and others). Any sugestions or needs?
> >
> > Adam Badura

>I would be interested in such a library. One of the prime requirements I
>have on a color class is that the storage format fits commonly used ones
>like RGBA 8:8:8:8 or YUV 4:2:2, etc...
>This makes it possible to interact with legacy libs (X, OpenGL, OpenCV,
>imagemagic, ...), which often use raw image buffers, efficiently.
>
>I would also like to see easy conversions between the types (YUV a =
>color_cast<YUV>(RGB(0x411468)); or something simmilar)
>I don't know exactly how Ranges fit in.

Windows stores RGB(A) values in a DWORD with values in the range 0..255.
However, Mac (and presumably others) uses a data structure equivalent to
float[4]. I think this is what is meant by Ranges. It should be possible to
cast
to the native type:

   namespace c = boost::color;
   dc.Plot( 10, 10, color_cast< c::native_color >( c::rgba( 128, 128, 128
)));

Don't forget that RGB is a define on Windows!

- Reece


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk