Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-09-27 00:33:04


Adam Badura wrote:

>> 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
>
> Yes. This can be hard. But I preffer that then have to write each
> class
> by myself (those would also take time to compile) and to maintaint them by
> myself.

It is not clear that you'll need really many classes. Specifically, do you
know of any use case where you need to manipulate HSV color format
directly? Say, scale an image in that format? I don't, but I'm not graphics
expert.

>
>> - it will be harder to provide image manipulation plugins (as dynamic
>> libraries)
>
> Here I thik I don't understnad what you mean. STL is also templet
> based
> and is widely used...

STL analogy is not right. Say you want to implement "add rain drops to
image" functionality for image editor. That functionality should be in form
of dynamic library. So, you can just write template function. You need to
instantiate it so that the library has certain binary interface. And the
question is whether you better code against the binary interface and don't
bother with templates.

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

Because you seem to associate a color object with each point. For YUV, the
number of points for U and V and smaller than for Y. So, if I have

   color_yuv c = ...;
   c.u();

what happens if the given point of image has no 'u' component?

- Volodya


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