API problems with krita

Schleimer, Ben bensch128 at yahoo.com
Thu Feb 1 19:54:09 CET 2007


Hey Cyrille,

> > Um, I like it. Maybe have the ChannelIterator have
> > toUInt8, toUInt16, and toFloat accessors.
> 
> That's a bad idea if you want bit depth
> independence, unless we only provides 
> the toFunctions and not the fromFunctions, and that
> the value returned by the 
> toFunctions is never ever copied to the paint device

What does bit depth have to do with it? Because each
iterator is associated with one PaintDevice and each
PaintDevice is associated with a ColorSpace, the
iterator should be able to provide toXXX and fromXXX
functions if the ColorSpace provides them. (Which it
should i think) If you're using rawData(), you might
as well abstract it a little bit so the user doesn't
have to do the pointer arithmatic himself. It'll
reduce errors in the long run.

> Little reminder: most of the gimp filter only works
> on RGBA 8bit images. In 
> krita, you can never assumes that the paintdevice is
> RGBA 8bit !

Thats why having toXXX/fromXXX methods in the
ColorSpace interface is so important. The plugin
writer doesn't have to worry about whether the image's
bitdepth is 8, 16, or float! He can just grab the type
he needs and not worry about checking src+dst
colorspace's type. :)

The current method (as far as I can see) of only
providing toQColor/fromQColor sucks because it
prevents higher bitdepths from being exploited
properly.

> And I also don't really see the advantage of
> iterating only on a channel 
> instead of iterating on the pixel of the image and
> only consider the channels 
> you are interested in ?

There's the advantage of abstraction. Currently, in
order to use a strategy (smooth vs. non-smooth) for
the poisson plugin, I need to specify both the
iterator and the channel in the interface. Ideally,
the interface should only know about the iterator.

> (Note, that iterating on one channel is easily
> doable with a "fake" 
> colorspace, that would advertise only one channel,
> and a pixelsize of the 
> real size of the pixel)

Whats a "fake" colorspace? Does it inherit from
KisColorSpace? Can you give a code example?

Cheers
Ben



More information about the kimageshop mailing list