chalk

KisColorSpace Class Referenceabstract

#include <kis_colorspace.h>

Inheritance diagram for KisColorSpace:
KisAbstractColorSpace KisU16BaseColorSpace KisU8BaseColorSpace

Public Member Functions

virtual DCOPObject * dcopObject ()
 
virtual bool operator== (const KisColorSpace &rhs) const
 
virtual TQValueVector< KisChannelInfo * > channels () const =0
 
virtual TQ_UINT32 nChannels () const =0
 
virtual TQ_UINT32 nColorChannels () const =0
 
virtual TQ_UINT32 nSubstanceChannels () const
 
virtual TQ_UINT32 pixelSize () const =0
 
virtual TQString channelValueText (const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const =0
 
virtual TQString normalisedChannelValueText (const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const =0
 
virtual TQ_UINT8 scaleToU8 (const TQ_UINT8 *srcPixel, TQ_INT32 channelPos)=0
 
virtual TQ_UINT16 scaleToU16 (const TQ_UINT8 *srcPixel, TQ_INT32 channelPos)=0
 
virtual void getSingleChannelPixel (TQ_UINT8 *dstPixel, const TQ_UINT8 *srcPixel, TQ_UINT32 channelIndex)=0
 
virtual KisID id () const =0
 
virtual TQ_UINT32 colorSpaceType ()=0
 
virtual icColorSpaceSignature colorSpaceSignature ()=0
 
virtual bool willDegrade (ColorSpaceIndependence independence)=0
 
virtual KisCompositeOpList userVisiblecompositeOps () const =0
 
virtual bool hasHighDynamicRange () const =0
 
virtual KisProfile * getProfile () const =0
 
virtual void fromTQColor (const TQColor &c, TQ_UINT8 *dst, KisProfile *profile=0)=0
 
virtual void fromTQColor (const TQColor &c, TQ_UINT8 opacity, TQ_UINT8 *dst, KisProfile *profile=0)=0
 
virtual void toTQColor (const TQ_UINT8 *src, TQColor *c, KisProfile *profile=0)=0
 
virtual void toTQColor (const TQ_UINT8 *src, TQColor *c, TQ_UINT8 *opacity, KisProfile *profile=0)=0
 
virtual TQImage convertToTQImage (const TQ_UINT8 *data, TQ_INT32 width, TQ_INT32 height, KisProfile *dstProfile, TQ_INT32 renderingIntent=INTENT_PERCEPTUAL, float exposure=0.0f)=0
 
virtual void toLabA16 (const TQ_UINT8 *src, TQ_UINT8 *dst, const TQ_UINT32 nPixels) const =0
 
virtual void fromLabA16 (const TQ_UINT8 *src, TQ_UINT8 *dst, const TQ_UINT32 nPixels) const =0
 
virtual bool convertPixelsTo (const TQ_UINT8 *src, TQ_UINT8 *dst, KisColorSpace *dstColorSpace, TQ_UINT32 numPixels, TQ_INT32 renderingIntent=INTENT_PERCEPTUAL)=0
 
virtual TQ_UINT8 getAlpha (const TQ_UINT8 *pixel) const =0
 
virtual void setAlpha (TQ_UINT8 *pixels, TQ_UINT8 alpha, TQ_INT32 nPixels) const =0
 
virtual void multiplyAlpha (TQ_UINT8 *pixels, TQ_UINT8 alpha, TQ_INT32 nPixels)=0
 
virtual void applyAlphaU8Mask (TQ_UINT8 *pixels, TQ_UINT8 *alpha, TQ_INT32 nPixels)=0
 
virtual void applyInverseAlphaU8Mask (TQ_UINT8 *pixels, TQ_UINT8 *alpha, TQ_INT32 nPixels)=0
 
virtual KisColorAdjustment * createBrightnessContrastAdjustment (TQ_UINT16 *transferValues)=0
 
virtual KisColorAdjustment * createDesaturateAdjustment ()=0
 
virtual KisColorAdjustment * createPerChannelAdjustment (TQ_UINT16 **transferValues)=0
 
virtual void applyAdjustment (const TQ_UINT8 *src, TQ_UINT8 *dst, KisColorAdjustment *, TQ_INT32 nPixels)=0
 
virtual void invertColor (TQ_UINT8 *src, TQ_INT32 nPixels)=0
 
virtual TQ_UINT8 difference (const TQ_UINT8 *src1, const TQ_UINT8 *src2)=0
 
virtual void mixColors (const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const =0
 
virtual void convolveColors (TQ_UINT8 **colors, TQ_INT32 *kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nPixels) const =0
 
virtual void darken (const TQ_UINT8 *src, TQ_UINT8 *dst, TQ_INT32 shade, bool compensate, double compensation, TQ_INT32 nPixels) const =0
 
virtual TQ_UINT8 intensity8 (const TQ_UINT8 *src) const =0
 
virtual KisID mathToolboxID () const =0
 
virtual void bitBlt (TQ_UINT8 *dst, TQ_INT32 dststride, KisColorSpace *srcSpace, const TQ_UINT8 *src, TQ_INT32 srcRowStride, const TQ_UINT8 *srcAlphaMask, TQ_INT32 maskRowStride, TQ_UINT8 opacity, TQ_INT32 rows, TQ_INT32 cols, const KisCompositeOp &op)=0
 
virtual TQValueList< KisFilter * > createBackgroundFilters ()
 

Detailed Description

A colorspace is the definition of a certain color model in Chalk.

This is the definition of the public API for colormodels.

Definition at line 58 of file kis_colorspace.h.

Constructor & Destructor Documentation

◆ KisColorSpace()

KisColorSpace::KisColorSpace ( )

Definition at line 22 of file kis_colorspace.cpp.

◆ ~KisColorSpace()

KisColorSpace::~KisColorSpace ( )
virtual

Definition at line 27 of file kis_colorspace.cpp.

Member Function Documentation

◆ applyAdjustment()

virtual void KisColorSpace::applyAdjustment ( const TQ_UINT8 *  src,
TQ_UINT8 *  dst,
KisColorAdjustment *  ,
TQ_INT32  nPixels 
)
pure virtual

Apply the adjustment created with onr of the other functions.

Implemented in KisAbstractColorSpace.

◆ applyAlphaU8Mask()

virtual void KisColorSpace::applyAlphaU8Mask ( TQ_UINT8 *  pixels,
TQ_UINT8 *  alpha,
TQ_INT32  nPixels 
)
pure virtual

Applies the specified 8-bit alpha mask to the pixels.

We assume that there are just as many alpha values as pixels but we do not check this; the alpha values are assumed to be 8-bits.

Implemented in KisU16BaseColorSpace, and KisU8BaseColorSpace.

◆ applyInverseAlphaU8Mask()

virtual void KisColorSpace::applyInverseAlphaU8Mask ( TQ_UINT8 *  pixels,
TQ_UINT8 *  alpha,
TQ_INT32  nPixels 
)
pure virtual

Applies the inverted 8-bit alpha mask to the pixels.

We assume that there are just as many alpha values as pixels but we do not check this; the alpha values are assumed to be 8-bits.

Implemented in KisU16BaseColorSpace, and KisU8BaseColorSpace.

◆ bitBlt()

virtual void KisColorSpace::bitBlt ( TQ_UINT8 *  dst,
TQ_INT32  dststride,
KisColorSpace *  srcSpace,
const TQ_UINT8 *  src,
TQ_INT32  srcRowStride,
const TQ_UINT8 *  srcAlphaMask,
TQ_INT32  maskRowStride,
TQ_UINT8  opacity,
TQ_INT32  rows,
TQ_INT32  cols,
const KisCompositeOp &  op 
)
pure virtual

Compose two arrays of pixels together.

If source and target are not the same colour model, the source pixels will be converted to the target model.

Implemented in KisAbstractColorSpace.

◆ channels()

virtual TQValueVector< KisChannelInfo * > KisColorSpace::channels ( ) const
pure virtual

Return a vector describing all the channels this color model has.

Implemented in KisAbstractColorSpace.

◆ channelValueText()

virtual TQString KisColorSpace::channelValueText ( const TQ_UINT8 *  pixel,
TQ_UINT32  channelIndex 
) const
pure virtual

Return a string with the channel's value suitable for display in the gui.

Implemented in KisU16BaseColorSpace, KisU8BaseColorSpace, and KisAbstractColorSpace.

◆ colorSpaceType()

virtual TQ_UINT32 KisColorSpace::colorSpaceType ( )
pure virtual

lcms colorspace type definition.

Implemented in KisAbstractColorSpace.

◆ convertPixelsTo()

virtual bool KisColorSpace::convertPixelsTo ( const TQ_UINT8 *  src,
TQ_UINT8 *  dst,
KisColorSpace *  dstColorSpace,
TQ_UINT32  numPixels,
TQ_INT32  renderingIntent = INTENT_PERCEPTUAL 
)
pure virtual

Convert a byte array of srcLen pixels *src to the specified color space and put the converted bytes into the prepared byte array *dst.

Returns false if the conversion failed, true if it succeeded

Implemented in KisAbstractColorSpace.

◆ convertToTQImage()

virtual TQImage KisColorSpace::convertToTQImage ( const TQ_UINT8 *  data,
TQ_INT32  width,
TQ_INT32  height,
KisProfile *  dstProfile,
TQ_INT32  renderingIntent = INTENT_PERCEPTUAL,
float  exposure = 0.0f 
)
pure virtual

Convert the pixels in data to (8-bit BGRA) TQImage using the specified profiles.

The pixels are supposed to be encoded in this color model. The default implementation will convert the pixels using either the profiles or the default profiles for the current colorstrategy and the RGBA colorstrategy. If that is not what you want, or if you think you can do better than lcms, reimplement this methods.

Parameters
dataA pointer to a contiguous memory region containing width * height pixels
widthin pixels
heightin pixels
dstProfiledestination profile
renderingIntentthe rendering intent
exposureThe exposure setting for rendering a preview of a high dynamic range image.

Implemented in KisAbstractColorSpace.

◆ convolveColors()

virtual void KisColorSpace::convolveColors ( TQ_UINT8 **  colors,
TQ_INT32 *  kernelValues,
KisChannelInfo::enumChannelFlags  channelFlags,
TQ_UINT8 *  dst,
TQ_INT32  factor,
TQ_INT32  offset,
TQ_INT32  nPixels 
) const
pure virtual

Convolve the given array of pointers to pixels and return the result in dst.

The kernel values are clamped between -128 and 128

Implemented in KisAbstractColorSpace.

◆ createBackgroundFilters()

virtual TQValueList< KisFilter * > KisColorSpace::createBackgroundFilters ( )
inlinevirtual

The backgroundfilters will be run periodically on the newly created paint device.

XXX: Currently this uses times and not threads.

Definition at line 415 of file kis_colorspace.h.

◆ createBrightnessContrastAdjustment()

virtual KisColorAdjustment * KisColorSpace::createBrightnessContrastAdjustment ( TQ_UINT16 *  transferValues)
pure virtual

Create an adjustment object for adjusting the brightness and contrast transferValues is a 256 bins array with values from 0 to 0xFFFF.

Implemented in KisAbstractColorSpace.

◆ createDesaturateAdjustment()

virtual KisColorAdjustment * KisColorSpace::createDesaturateAdjustment ( )
pure virtual

Create an adjustment object for desaturating.

Implemented in KisAbstractColorSpace.

◆ createPerChannelAdjustment()

virtual KisColorAdjustment * KisColorSpace::createPerChannelAdjustment ( TQ_UINT16 **  transferValues)
pure virtual

Create an adjustment object for adjusting individual channels transferValues is an array of nColorChannels number of 256 bins array with values from 0 to 0xFFFF.

Implemented in KisAbstractColorSpace.

◆ darken()

virtual void KisColorSpace::darken ( const TQ_UINT8 *  src,
TQ_UINT8 *  dst,
TQ_INT32  shade,
bool  compensate,
double  compensation,
TQ_INT32  nPixels 
) const
pure virtual

Darken all color channels with the given amount.

If compensate is true, the compensation factor will be used to limit the darkening.

(See the bumpmap filter)

Implemented in KisAbstractColorSpace.

◆ dcopObject()

DCOPObject * KisColorSpace::dcopObject ( )
virtual

Definition at line 32 of file kis_colorspace.cpp.

◆ difference()

virtual TQ_UINT8 KisColorSpace::difference ( const TQ_UINT8 *  src1,
const TQ_UINT8 *  src2 
)
pure virtual

Get the difference between 2 colors, normalized in the range (0,255)

Implemented in KisAbstractColorSpace.

◆ fromLabA16()

virtual void KisColorSpace::fromLabA16 ( const TQ_UINT8 *  src,
TQ_UINT8 *  dst,
const TQ_UINT32  nPixels 
) const
pure virtual

Convert the specified data from Lab.

to this colorspace. All colorspaces are guaranteed to support this.

Parameters
srcthe pixels in 16 bit lab format
dstthe destination data
nPixelsthe number of pixels in the array

Implemented in KisAbstractColorSpace.

◆ fromTQColor() [1/2]

virtual void KisColorSpace::fromTQColor ( const TQColor &  c,
TQ_UINT8 *  dst,
KisProfile *  profile = 0 
)
pure virtual

The fromTQColor methods take a given color defined as an RGB TQColor and fills a byte array with the corresponding color in the the colorspace managed by this strategy.

Parameters
cthe TQColor that will be used to fill dst
dsta pointer to a pixel
profilethe optional profile that describes the color values of TQColor

Implemented in KisAbstractColorSpace.

◆ fromTQColor() [2/2]

virtual void KisColorSpace::fromTQColor ( const TQColor &  c,
TQ_UINT8  opacity,
TQ_UINT8 *  dst,
KisProfile *  profile = 0 
)
pure virtual

The fromTQColor methods take a given color defined as an RGB TQColor and fills a byte array with the corresponding color in the the colorspace managed by this strategy.

Parameters
cthe TQColor that will be used to fill dst
opacitythe opacity of the color
dsta pointer to a pixel
profilethe optional profile that describes the color values of TQColor

Implemented in KisAbstractColorSpace.

◆ getAlpha()

virtual TQ_UINT8 KisColorSpace::getAlpha ( const TQ_UINT8 *  pixel) const
pure virtual

Get the alpha value of the given pixel, downscaled to an 8-bit value.

Implemented in KisU16BaseColorSpace, and KisU8BaseColorSpace.

◆ getProfile()

virtual KisProfile * KisColorSpace::getProfile ( ) const
pure virtual

Return the profile of this color space.

This may be 0

Implemented in KisAbstractColorSpace.

◆ getSingleChannelPixel()

virtual void KisColorSpace::getSingleChannelPixel ( TQ_UINT8 *  dstPixel,
const TQ_UINT8 *  srcPixel,
TQ_UINT32  channelIndex 
)
pure virtual

Set dstPixel to the pixel containing only the given channel of srcPixel.

The remaining channels should be set to whatever makes sense for 'empty' channels of this colour space, with the intent being that the pixel should look like it only has the given channel.

Implemented in KisAbstractColorSpace.

◆ hasHighDynamicRange()

virtual bool KisColorSpace::hasHighDynamicRange ( ) const
pure virtual

Returns true if the colorspace supports channel values outside the (normalised) range 0 to 1.

Implemented in KisAbstractColorSpace.

◆ id()

virtual KisID KisColorSpace::id ( ) const
pure virtual

Chalk definition for use in .kra files and internally: unchanging name + i18n'able description.

Implemented in KisAbstractColorSpace.

◆ intensity8()

virtual TQ_UINT8 KisColorSpace::intensity8 ( const TQ_UINT8 *  src) const
pure virtual

Calculate the intensity of the given pixel, scaled down to the range 0-255.

XXX: Maybe this should be more flexible

Implemented in KisAbstractColorSpace.

◆ invertColor()

virtual void KisColorSpace::invertColor ( TQ_UINT8 *  src,
TQ_INT32  nPixels 
)
pure virtual

Invert color channels of the given pixels.

Implemented in KisAbstractColorSpace.

◆ mathToolboxID()

virtual KisID KisColorSpace::mathToolboxID ( ) const
pure virtual

Create a mathematical toolbox compatible with this colorspace.

Implemented in KisAbstractColorSpace.

◆ mixColors()

virtual void KisColorSpace::mixColors ( const TQ_UINT8 **  colors,
const TQ_UINT8 *  weights,
TQ_UINT32  nColors,
TQ_UINT8 *  dst 
) const
pure virtual

Mix the colors given their weights and return in dst The sum of weights is assumed 255.

Implemented in KisAbstractColorSpace.

◆ multiplyAlpha()

virtual void KisColorSpace::multiplyAlpha ( TQ_UINT8 *  pixels,
TQ_UINT8  alpha,
TQ_INT32  nPixels 
)
pure virtual

Multiply the alpha channel of the given run of pixels by the given value.

pixels – a pointer to the pixels that will have their alpha set to this value alpha – a downscaled 8-bit value for opacity nPixels – the number of pixels

Implemented in KisU16BaseColorSpace, and KisU8BaseColorSpace.

◆ nChannels()

virtual TQ_UINT32 KisColorSpace::nChannels ( ) const
pure virtual

The total number of channels for a single pixel in this color model.

Implemented in KisAbstractColorSpace.

◆ nColorChannels()

virtual TQ_UINT32 KisColorSpace::nColorChannels ( ) const
pure virtual

The total number of color channels (excludes alpha and substance) for a single pixel in this color model.

Implemented in KisAbstractColorSpace.

◆ normalisedChannelValueText()

virtual TQString KisColorSpace::normalisedChannelValueText ( const TQ_UINT8 *  pixel,
TQ_UINT32  channelIndex 
) const
pure virtual

Return a string with the channel's value with integer channels normalised to the floating point range 0 to 1, if appropriate.

Implemented in KisU16BaseColorSpace, KisU8BaseColorSpace, and KisAbstractColorSpace.

◆ nSubstanceChannels()

virtual TQ_UINT32 KisColorSpace::nSubstanceChannels ( ) const
inlinevirtual

The total number of substance channels for a single pixel in this color model.

Reimplemented in KisAbstractColorSpace.

Definition at line 95 of file kis_colorspace.h.

◆ operator==()

virtual bool KisColorSpace::operator== ( const KisColorSpace &  rhs) const
inlinevirtual

Definition at line 68 of file kis_colorspace.h.

◆ pixelSize()

virtual TQ_UINT32 KisColorSpace::pixelSize ( ) const
pure virtual

The size in bytes of a single pixel in this color model.

Implemented in KisAbstractColorSpace.

◆ scaleToU16()

virtual TQ_UINT16 KisColorSpace::scaleToU16 ( const TQ_UINT8 *  srcPixel,
TQ_INT32  channelPos 
)
pure virtual

Convert the value of the channel at the specified position into a 16-bit value.

This may be upscaling or downscaling, depending on the defined value of the channel

Implemented in KisU16BaseColorSpace, KisU8BaseColorSpace, and KisAbstractColorSpace.

◆ scaleToU8()

virtual TQ_UINT8 KisColorSpace::scaleToU8 ( const TQ_UINT8 *  srcPixel,
TQ_INT32  channelPos 
)
pure virtual

Convert the value of the channel at the specified position into an 8-bit value.

The position is not the number of bytes, but the position of the channel as defined in the channel info list.

Implemented in KisU16BaseColorSpace, KisU8BaseColorSpace, and KisAbstractColorSpace.

◆ setAlpha()

virtual void KisColorSpace::setAlpha ( TQ_UINT8 *  pixels,
TQ_UINT8  alpha,
TQ_INT32  nPixels 
) const
pure virtual

Set the alpha channel of the given run of pixels to the given value.

pixels – a pointer to the pixels that will have their alpha set to this value alpha – a downscaled 8-bit value for opacity nPixels – the number of pixels

Implemented in KisU16BaseColorSpace, and KisU8BaseColorSpace.

◆ toLabA16()

virtual void KisColorSpace::toLabA16 ( const TQ_UINT8 *  src,
TQ_UINT8 *  dst,
const TQ_UINT32  nPixels 
) const
pure virtual

Convert the specified data to Lab.

All colorspaces are guaranteed to support this

Parameters
srcthe source data
dstthe destination data
nPixelsthe number of source pixels

Implemented in KisAbstractColorSpace.

◆ toTQColor() [1/2]

virtual void KisColorSpace::toTQColor ( const TQ_UINT8 *  src,
TQColor *  c,
KisProfile *  profile = 0 
)
pure virtual

The toTQColor methods take a byte array that is at least pixelSize() long and converts the contents to a TQColor, using the given profile as a source profile and the optional profile as a destination profile.

Parameters
srca pointer to the source pixel
cthe TQColor that will be filled with the color at src
profilethe optional profile that describes the color in c, for instance the monitor profile

Implemented in KisAbstractColorSpace.

◆ toTQColor() [2/2]

virtual void KisColorSpace::toTQColor ( const TQ_UINT8 *  src,
TQColor *  c,
TQ_UINT8 *  opacity,
KisProfile *  profile = 0 
)
pure virtual

The toTQColor methods take a byte array that is at least pixelSize() long and converts the contents to a TQColor, using the given profile as a source profile and the option profile as a destination profile.

Parameters
srca pointer to the source pixel
cthe TQColor that will be filled with the color at src
opacitya pointer to a byte that will be filled with the opacity a src
profilethe optional profile that describes the color in c, for instance the monitor profile

Implemented in KisAbstractColorSpace.

◆ userVisiblecompositeOps()

virtual KisCompositeOpList KisColorSpace::userVisiblecompositeOps ( ) const
pure virtual

Returns the list of user-visible composite ops supported by this colourspace.

Internal ops such as COPY, CLEAR, and ERASE, are not included as these make no sense for layers in the full image model.

Implemented in KisAbstractColorSpace.

◆ willDegrade()

virtual bool KisColorSpace::willDegrade ( ColorSpaceIndependence  independence)
pure virtual

If false, images in this colorspace will degrade considerably by functions, tools and filters that have the given measure of colorspace independence.

Parameters
independencethe measure to which this colorspace will suffer from the manipulations of the tool or filter asking
Returns
false if no degradation will take place, true if degradation will take place

The documentation for this class was generated from the following files: