krita

KisAbstractColorSpace Class Reference

#include <kis_abstract_colorspace.h>

Inheritance diagram for KisAbstractColorSpace:

KisColorSpace KisF16HalfBaseColorSpace KisF32BaseColorSpace KisU16BaseColorSpace KisU8BaseColorSpace List of all members.

Detailed Description

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

Definition at line 43 of file kis_abstract_colorspace.h.


Public Member Functions

 KisAbstractColorSpace (const KisID &id, DWORD cmType, icColorSpaceSignature colorSpaceSignature, KisColorSpaceFactoryRegistry *parent, KisProfile *profile)
void init ()
virtual ~KisAbstractColorSpace ()
virtual bool operator== (const KisAbstractColorSpace &rhs) const
virtual QValueVector< KisChannelInfo * > channels () const =0
virtual Q_UINT32 nChannels () const =0
virtual Q_UINT32 nColorChannels () const =0
virtual Q_UINT32 nSubstanceChannels () const
virtual Q_UINT32 pixelSize () const =0
virtual QString channelValueText (const Q_UINT8 *pixel, Q_UINT32 channelIndex) const =0
virtual QString normalisedChannelValueText (const Q_UINT8 *pixel, Q_UINT32 channelIndex) const =0
virtual Q_UINT8 scaleToU8 (const Q_UINT8 *srcPixel, Q_INT32 channelPos)=0
virtual Q_UINT16 scaleToU16 (const Q_UINT8 *srcPixel, Q_INT32 channelPos)=0
virtual void getSingleChannelPixel (Q_UINT8 *dstPixel, const Q_UINT8 *srcPixel, Q_UINT32 channelIndex)
virtual KisID id () const
void setColorSpaceType (Q_UINT32 type)
Q_UINT32 colorSpaceType ()
virtual icColorSpaceSignature colorSpaceSignature ()
virtual KisCompositeOpList userVisiblecompositeOps () const =0
virtual bool hasHighDynamicRange () const
virtual KisProfilegetProfile ()
virtual void fromQColor (const QColor &c, Q_UINT8 *dst, KisProfile *profile=0)
virtual void fromQColor (const QColor &c, Q_UINT8 opacity, Q_UINT8 *dst, KisProfile *profile=0)
virtual void toQColor (const Q_UINT8 *src, QColor *c, KisProfile *profile=0)
virtual void toQColor (const Q_UINT8 *src, QColor *c, Q_UINT8 *opacity, KisProfile *profile=0)
virtual QImage convertToQImage (const Q_UINT8 *data, Q_INT32 width, Q_INT32 height, KisProfile *dstProfile, Q_INT32 renderingIntent=INTENT_PERCEPTUAL, float exposure=0.0f)
virtual bool convertPixelsTo (const Q_UINT8 *src, Q_UINT8 *dst, KisColorSpace *dstColorSpace, Q_UINT32 numPixels, Q_INT32 renderingIntent=INTENT_PERCEPTUAL)
virtual KisColorAdjustmentcreateBrightnessContrastAdjustment (Q_UINT16 *transferValues)
virtual KisColorAdjustmentcreateDesaturateAdjustment ()
virtual KisColorAdjustmentcreatePerChannelAdjustment (Q_UINT16 **transferValues)
virtual void applyAdjustment (const Q_UINT8 *src, Q_UINT8 *dst, KisColorAdjustment *, Q_INT32 nPixels)
virtual void invertColor (Q_UINT8 *src, Q_INT32 nPixels)
virtual Q_UINT8 difference (const Q_UINT8 *src1, const Q_UINT8 *src2)
virtual void mixColors (const Q_UINT8 **colors, const Q_UINT8 *weights, Q_UINT32 nColors, Q_UINT8 *dst) const
virtual void convolveColors (Q_UINT8 **colors, Q_INT32 *kernelValues, KisChannelInfo::enumChannelFlags channelFlags, Q_UINT8 *dst, Q_INT32 factor, Q_INT32 offset, Q_INT32 nPixels) const
virtual void darken (const Q_UINT8 *src, Q_UINT8 *dst, Q_INT32 shade, bool compensate, double compensation, Q_INT32 nPixels) const
virtual Q_UINT8 intensity8 (const Q_UINT8 *src) const
virtual KisID mathToolboxID () const
virtual void bitBlt (Q_UINT8 *dst, Q_INT32 dststride, KisColorSpace *srcSpace, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *srcAlphaMask, Q_INT32 maskRowStride, Q_UINT8 opacity, Q_INT32 rows, Q_INT32 cols, const KisCompositeOp &op)

Protected Member Functions

virtual void bitBlt (Q_UINT8 *dst, Q_INT32 dstRowSize, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *srcAlphaMask, Q_INT32 maskRowStride, Q_UINT8 opacity, Q_INT32 rows, Q_INT32 cols, const KisCompositeOp &op)=0
virtual cmsHTRANSFORM createTransform (KisColorSpace *dstColorSpace, KisProfile *srcProfile, KisProfile *dstProfile, Q_INT32 renderingIntent)
virtual void compositeCopy (Q_UINT8 *dstRowStart, Q_INT32 dstRowStride, const Q_UINT8 *srcRowStart, Q_INT32 srcRowStride, const Q_UINT8 *maskRowStart, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 numColumns, Q_UINT8 opacity)

Protected Attributes

QStringList m_profileFilenames
Q_UINT8 * m_qcolordata
Q_INT32 m_alphaPos
Q_INT32 m_alphaSize
QValueVector< KisChannelInfo * > m_channels
KisColorSpaceFactoryRegistrym_parent

Constructor & Destructor Documentation

KisAbstractColorSpace::KisAbstractColorSpace const KisID id,
DWORD  cmType,
icColorSpaceSignature  colorSpaceSignature,
KisColorSpaceFactoryRegistry parent,
KisProfile profile
 

Parameters:
id The unique human and machine readable identifiation of this colorspace
cmType the lcms type indentification for this colorspace, may be 0
colorSpaceSignature the icc identification for this colorspace, may be 0
parent the registry that owns this instance
profile the profile this colorspace uses for transforms

Definition at line 63 of file kis_abstract_colorspace.cc.


Member Function Documentation

void KisAbstractColorSpace::applyAdjustment const Q_UINT8 *  src,
Q_UINT8 *  dst,
KisColorAdjustment ,
Q_INT32  nPixels
[virtual]
 

Apply the adjustment created with onr of the other functions.

Implements KisColorSpace.

Definition at line 407 of file kis_abstract_colorspace.cc.

virtual void KisAbstractColorSpace::bitBlt Q_UINT8 *  dst,
Q_INT32  dstRowSize,
const Q_UINT8 *  src,
Q_INT32  srcRowStride,
const Q_UINT8 *  srcAlphaMask,
Q_INT32  maskRowStride,
Q_UINT8  opacity,
Q_INT32  rows,
Q_INT32  cols,
const KisCompositeOp op
[protected, pure virtual]
 

Compose two byte arrays containing pixels in the same color model together.

void KisAbstractColorSpace::bitBlt Q_UINT8 *  dst,
Q_INT32  dststride,
KisColorSpace srcSpace,
const Q_UINT8 *  src,
Q_INT32  srcRowStride,
const Q_UINT8 *  srcAlphaMask,
Q_INT32  maskRowStride,
Q_UINT8  opacity,
Q_INT32  rows,
Q_INT32  cols,
const KisCompositeOp op
[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.

Implements KisColorSpace.

Definition at line 620 of file kis_abstract_colorspace.cc.

virtual QValueVector<KisChannelInfo *> KisAbstractColorSpace::channels  )  const [pure virtual]
 

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

Implements KisColorSpace.

virtual QString KisAbstractColorSpace::channelValueText const Q_UINT8 *  pixel,
Q_UINT32  channelIndex
const [pure virtual]
 

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

Implements KisColorSpace.

Implemented in KisF16HalfBaseColorSpace, KisF32BaseColorSpace, KisU16BaseColorSpace, and KisU8BaseColorSpace.

Q_UINT32 KisAbstractColorSpace::colorSpaceType  )  [inline, virtual]
 

lcms colorspace type definition.

Implements KisColorSpace.

Definition at line 103 of file kis_abstract_colorspace.h.

bool KisAbstractColorSpace::convertPixelsTo const Q_UINT8 *  src,
Q_UINT8 *  dst,
KisColorSpace dstColorSpace,
Q_UINT32  numPixels,
Q_INT32  renderingIntent = INTENT_PERCEPTUAL
[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

Implements KisColorSpace.

Definition at line 191 of file kis_abstract_colorspace.cc.

QImage KisAbstractColorSpace::convertToQImage const Q_UINT8 *  data,
Q_INT32  width,
Q_INT32  height,
KisProfile dstProfile,
Q_INT32  renderingIntent = INTENT_PERCEPTUAL,
float  exposure = 0.0f
[virtual]
 

Convert the pixels in data to (8-bit BGRA) QImage 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:
data A pointer to a contiguous memory region containing width * height pixels
width in pixels
height in pixels
dstProfile destination profile
renderingIntent the rendering intent
exposure The exposure setting for rendering a preview of a high dynamic range image.

Implements KisColorSpace.

Definition at line 680 of file kis_abstract_colorspace.cc.

void KisAbstractColorSpace::convolveColors Q_UINT8 **  colors,
Q_INT32 *  kernelValues,
KisChannelInfo::enumChannelFlags  channelFlags,
Q_UINT8 *  dst,
Q_INT32  factor,
Q_INT32  offset,
Q_INT32  nPixels
const [virtual]
 

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

The kernel values are clamped between -128 and 128

Implements KisColorSpace.

Definition at line 515 of file kis_abstract_colorspace.cc.

KisColorAdjustment * KisAbstractColorSpace::createBrightnessContrastAdjustment Q_UINT16 *  transferValues  )  [virtual]
 

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

Implements KisColorSpace.

Definition at line 274 of file kis_abstract_colorspace.cc.

KisColorAdjustment * KisAbstractColorSpace::createDesaturateAdjustment  )  [virtual]
 

Create an adjustment object for desaturating.

Implements KisColorSpace.

Definition at line 326 of file kis_abstract_colorspace.cc.

KisColorAdjustment * KisAbstractColorSpace::createPerChannelAdjustment Q_UINT16 **  transferValues  )  [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.

Implements KisColorSpace.

Definition at line 381 of file kis_abstract_colorspace.cc.

void KisAbstractColorSpace::darken const Q_UINT8 *  src,
Q_UINT8 *  dst,
Q_INT32  shade,
bool  compensate,
double  compensation,
Q_INT32  nPixels
const [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)

Implements KisColorSpace.

Definition at line 556 of file kis_abstract_colorspace.cc.

Q_UINT8 KisAbstractColorSpace::difference const Q_UINT8 *  src1,
const Q_UINT8 *  src2
[virtual]
 

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

Implements KisColorSpace.

Definition at line 431 of file kis_abstract_colorspace.cc.

void KisAbstractColorSpace::fromQColor const QColor &  c,
Q_UINT8  opacity,
Q_UINT8 *  dst,
KisProfile profile = 0
[virtual]
 

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

Parameters:
c the QColor that will be used to fill dst
opacity the opacity of the color
dst a pointer to a pixel
profile the optional profile that describes the color values of QColor

Implements KisColorSpace.

Definition at line 149 of file kis_abstract_colorspace.cc.

void KisAbstractColorSpace::fromQColor const QColor &  c,
Q_UINT8 *  dst,
KisProfile profile = 0
[virtual]
 

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

Parameters:
c the QColor that will be used to fill dst
dst a pointer to a pixel
profile the optional profile that describes the color values of QColor

Implements KisColorSpace.

Definition at line 122 of file kis_abstract_colorspace.cc.

virtual KisProfile* KisAbstractColorSpace::getProfile  )  [inline, virtual]
 

Return the profile of this color space.

This may be 0

Implements KisColorSpace.

Definition at line 119 of file kis_abstract_colorspace.h.

void KisAbstractColorSpace::getSingleChannelPixel Q_UINT8 *  dstPixel,
const Q_UINT8 *  srcPixel,
Q_UINT32  channelIndex
[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.

Implements KisColorSpace.

Definition at line 180 of file kis_abstract_colorspace.cc.

virtual bool KisAbstractColorSpace::hasHighDynamicRange  )  const [inline, virtual]
 

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

Implements KisColorSpace.

Reimplemented in KisF16HalfBaseColorSpace, and KisF32BaseColorSpace.

Definition at line 115 of file kis_abstract_colorspace.h.

virtual KisID KisAbstractColorSpace::id  )  const [inline, virtual]
 

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

Implements KisColorSpace.

Definition at line 100 of file kis_abstract_colorspace.h.

Q_UINT8 KisAbstractColorSpace::intensity8 const Q_UINT8 *  src  )  const [virtual]
 

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

XXX: Maybe this should be more flexible

Implements KisColorSpace.

Definition at line 605 of file kis_abstract_colorspace.cc.

void KisAbstractColorSpace::invertColor Q_UINT8 *  src,
Q_INT32  nPixels
[virtual]
 

Invert color channels of the given pixels.

Implements KisColorSpace.

Definition at line 415 of file kis_abstract_colorspace.cc.

KisID KisAbstractColorSpace::mathToolboxID  )  const [virtual]
 

Create a mathematical toolbox compatible with this colorspace.

Implements KisColorSpace.

Definition at line 615 of file kis_abstract_colorspace.cc.

void KisAbstractColorSpace::mixColors const Q_UINT8 **  colors,
const Q_UINT8 *  weights,
Q_UINT32  nColors,
Q_UINT8 *  dst
const [virtual]
 

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

Implements KisColorSpace.

Definition at line 467 of file kis_abstract_colorspace.cc.

virtual Q_UINT32 KisAbstractColorSpace::nChannels  )  const [pure virtual]
 

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

Implements KisColorSpace.

virtual Q_UINT32 KisAbstractColorSpace::nColorChannels  )  const [pure virtual]
 

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

Implements KisColorSpace.

virtual QString KisAbstractColorSpace::normalisedChannelValueText const Q_UINT8 *  pixel,
Q_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.

Implements KisColorSpace.

Implemented in KisF16HalfBaseColorSpace, KisF32BaseColorSpace, KisU16BaseColorSpace, and KisU8BaseColorSpace.

virtual Q_UINT32 KisAbstractColorSpace::nSubstanceChannels  )  const [inline, virtual]
 

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

Reimplemented from KisColorSpace.

Definition at line 84 of file kis_abstract_colorspace.h.

virtual Q_UINT32 KisAbstractColorSpace::pixelSize  )  const [pure virtual]
 

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

Implements KisColorSpace.

virtual Q_UINT16 KisAbstractColorSpace::scaleToU16 const Q_UINT8 *  srcPixel,
Q_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

Implements KisColorSpace.

Implemented in KisF16HalfBaseColorSpace, KisF32BaseColorSpace, KisU16BaseColorSpace, and KisU8BaseColorSpace.

virtual Q_UINT8 KisAbstractColorSpace::scaleToU8 const Q_UINT8 *  srcPixel,
Q_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.

Implements KisColorSpace.

Implemented in KisF16HalfBaseColorSpace, KisF32BaseColorSpace, KisU16BaseColorSpace, and KisU8BaseColorSpace.

void KisAbstractColorSpace::toQColor const Q_UINT8 *  src,
QColor *  c,
Q_UINT8 *  opacity,
KisProfile profile = 0
[virtual]
 

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

Parameters:
src a pointer to the source pixel
c the QColor that will be filled with the color at src
opacity a pointer to a byte that will be filled with the opacity a src
profile the optional profile that describes the color in c, for instance the monitor profile

Implements KisColorSpace.

Definition at line 174 of file kis_abstract_colorspace.cc.

void KisAbstractColorSpace::toQColor const Q_UINT8 *  src,
QColor *  c,
KisProfile profile = 0
[virtual]
 

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

Parameters:
src a pointer to the source pixel
c the QColor that will be filled with the color at src
profile the optional profile that describes the color in c, for instance the monitor profile

Implements KisColorSpace.

Definition at line 155 of file kis_abstract_colorspace.cc.

virtual KisCompositeOpList KisAbstractColorSpace::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.

Implements KisColorSpace.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys