Pigment and colorspaces

Cyrille Berger cberger at cberger.net
Wed Feb 7 16:07:51 CET 2007


On Wednesday 07 February 2007, Leonardo Giordani wrote:
> Hi, after a long pause due to medical problems I'm about to begin again my
> work on colorspace. I'm sorry that my development goes slowly.
>
> Some questions for you, gurus of Krita:
>
> 1) I am confused by the pigment and colorspaces stuff. What goes exactly in
> pigment and what in colorspaces?
pigment defines the interface (KoColorSpace), a few common class (ie 
KoLcmsColorSpace and soon more composite op once they are "generic"), and 
goes in the colorspaces plugin what is specific to a given colorspace.

> Furthermore, there is a "colorspaces" 
> folder in koffice/libs/pigment/ too: what is this compared with
> koffice/krita/colorspaces?

in koffice/libs/pigment/colorspace : there are three anavoidable colorspaces : 
pure alpha, LAB16 and RGB16.
in koffice/plugins/colorspaces : there are the colorspaces which can be 
usefull to more applications than krita (GRAY8/16, RGB8 and CMYK8/16)
in koffice/krita/colorspaces : the other colorspaces which are specific to 
krita

> 2) KoAlphaColorSpace implements many methods such as fromQColor(),
> toQColor(), channelValueText(), etc... (KoAlphaColorSpace.cpp?rev=625077),
> but both KoLabColorSpace and KoRgbU16ColorSpace (in pigment/colorspaces
> too) do not implement them? Why?
because they inherits them from KoLcmsColorSpace which implement nearly all 
functions needed by lcms supported colorspaces. And there is 
KoIncompleteColorSpace 
(http://koffice.org/developer/apidocs/libs-pigment/classKoIncompleteColorSpace.html) 
which is usefull for colorspace which are not supported by lcms and for which 
converting to/from either rgb or lab isn't a problem (see 
koffice/krita/colorspaces/rgb_float_hdr for an example)

> 3) What is the "d-pointerification" I can see more or less everywhere in
> SVN?
I suggest reading this:
http://developer.kde.org/documentation/other/binarycompatibility.html 
(especially the "Using a d-Pointer" section)

> 4) I remember that I experienced difficulties managing the canvas, i.e.
> the "quint8 *dst" you can find in setPixel() methods, for example in
> kis_lms_f32_colorspace.cc, but in general I didn't understand when and what
> methods are called... For example convertToQImage(). No one of you can
> write something detailed about what is expected from a colorspace and how
> it works? Or perhaps I'm losing myself in a simple thing?
I think you are confusing multiple thing :/ Anyway don't look at colorspaces 
that are not build, as they are outdated. 
And a colorspace is expected to implement every single functions of 
KoColorSpace. But there is three subclass of KoColorSpace which allready 
implement quiet a few functions if your colorspace follow some rules:

KoAbstractColorSpace<T> if all the channels of your colorspace are of the same 
type
KoLcmsColorSpace if all the channels of your colorspace are of the same type 
and is supported by LCMS
KoLcmsColorSpace if all the channels of your colorspace are of the same type 
and it is not a problem to convert to/from RGB or to/from LAB for some 
operations (not that the to/from LAB fallback is yet to be implemented)

And welcome back !
-- 
Cyrille Berger


More information about the kimageshop mailing list