Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-09-26 05:38:30


Adam Badura wrote:

> I use tamplates to allow user to have on class (class name to be
> honest,
> because templates de facto create many classes) with fixed interface to
> manipulate on color data (for example color_rgb, color_cmyk, color_yuv)
> with abilyty to have many underlying representations.
> You could than wrtie simple function:
>
> template<typename color> vertex<color> get_middle(vertex<color> p1,
> vertex<color> p2) {
> vertex<color> result;
> result.color.red((p1.red()+p2.red())/2);
> result.color.red((p1.green()+p2.green())/2);
> result.color.red((p1.blue()+p2.blue())/2);
> result.point = (p1.point+p2.point)/2;
> return result;
> }

I get suspicious about the idea of using templated functions to work on
image data, because
- you can get slow compile times for non-trivial
- it will be harder to provide image manipulation plugins (as dynamic
libraries)

It was already noted that YUV typically has different sizes for components,
so it is not exactly usable with the above function.

In fact, I think your proposal lacks concrete goals and real-world examples.
Are you trying to get somethink like QColor
(http://doc.trolltech.com/4.0/qcolor.html) with BSL license? Or color
library that can handle any color model on earth?

If the latter, how about taking look at existing open-source drawing
applications written in C++

1. Inkscape (http://inkscape.org) (Vector drawing tool)
2. Krita (http://www.koffice.org/krita/) (Pixel drawining tool)

The latter is especially interesting because it supports CMYK, and 16-bit
color depth.

Maybe, you can study their code and describe how your library can benefit
those projects? And then contact them to find their opinion? Or ask them
what they'd like to have?

>> I think you're assuming that when I said "polymorphism", I meant
>> "inheritance and virtual functions", but "polymorphism" just means

[ snip 300 lines of quoted messages ]

- Volodya


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