core/color_strategy

Patrick Julien freak at codepimps.org
Tue Oct 28 17:50:35 CET 2003


>
> > Yes, it would, for only 8 bit channels, it's only 65000 values, but I'm
> > afraid I don't really understand what you are saying to me here tho.
>
> Well, going by the Gof book, one could imagine that the image data in a
> tile would be stored not as the actual RGB or whatever values, but as
> pointers to KoColor objects; for every possible colour a KoColor, but the
> same KoColor references many times.

No, that was not the intent of this flyweight, here, I would not want to do 
this for speed considerations.  In this case here, flyweight is really for 
the color strategies, not because we have a lot of them but because their 
construction is really going to be expensive.

Look at it, we a TILE_SIZE * 4 X TILE_SIZE * 4 memory buffer that is being 
allocated already, we will have the pre-multiplied alpha which will be at 
least USHRT_MAX colors too.

Also, we want to skip on all those multiplies and divides that we would need 
for rendering otherwise.


More information about the kimageshop mailing list