Krita Source Code Documentation
Loading...
Searching...
No Matches
KoFallBackColorTransformation Class Reference

#include <KoFallBackColorTransformation.h>

+ Inheritance diagram for KoFallBackColorTransformation:

Public Member Functions

 KoFallBackColorTransformation (const KoColorSpace *_cs, const KoColorSpace *_fallBackCS, KoColorTransformation *_transfo)
 
 KoFallBackColorTransformation (KoColorConversionTransformation *_csToFallBack, KoColorConversionTransformation *_fallBackToCs, KoColorTransformation *_transfo)
 
int parameterId (const QString &name) const override
 
QList< QString > parameters () const override
 
void setParameter (int id, const QVariant &parameter) override
 
void transform (const quint8 *src, quint8 *dst, qint32 nPixels) const override
 
 ~KoFallBackColorTransformation () override
 
- Public Member Functions inherited from Private
 Private (KisCanvas2 *c)
 
- Public Member Functions inherited from KoColorTransformation
virtual bool isValid () const
 
void setParameters (const QHash< QString, QVariant > &parameters)
 
virtual ~KoColorTransformation ()
 

Public Attributes

quint8 * buff
 
qint32 buffSize
 
KoColorTransformationcolorTransformation
 
const KoColorConversionTransformationcsToFallBack
 
KoCachedColorConversionTransformationcsToFallBackCache
 
const KoColorSpacefallBackColorSpace
 
const KoColorConversionTransformationfallBackToCs
 
KoCachedColorConversionTransformationfallBackToCsCache
 
- Public Attributes inherited from Private
KisCanvas2canvas
 
int displayedFrame
 
int intendedFrame
 

Private Attributes

Private *const d
 

Detailed Description

Use this color transformation to encapsulate another KoColorTransformation and perform a color conversion before and after using that KoColorTransformation.

Definition at line 17 of file KoFallBackColorTransformation.cpp.

Constructor & Destructor Documentation

◆ KoFallBackColorTransformation() [1/2]

KoFallBackColorTransformation::KoFallBackColorTransformation ( const KoColorSpace * _cs,
const KoColorSpace * _fallBackCS,
KoColorTransformation * _transfo )

Create a fall back color transformation using the given two color spaces. This constructor will initialize his own color conversion objects.

The created object takes owner ship of the transformation and will take charge of deleting it.

Parameters
cscolor space of the source and destination pixels
fallBackCScolor space use natively by the color transformation
transfothe color transformation (working in the fallback color space)

Definition at line 28 of file KoFallBackColorTransformation.cpp.

28 : d(new Private)
29{
30 d->fallBackColorSpace = _fallBackCS;
32 d->csToFallBack = d->csToFallBackCache->transformation();
34 d->fallBackToCs = d->fallBackToCsCache->transformation();
35 d->colorTransformation = _transfo;
36 d->buff = 0;
37 d->buffSize = 0;
38}
static KoColorSpaceRegistry * instance()

References d, KoColorSpaceRegistry::instance(), KoColorConversionTransformation::internalConversionFlags(), and KoColorConversionTransformation::internalRenderingIntent().

◆ KoFallBackColorTransformation() [2/2]

KoFallBackColorTransformation::KoFallBackColorTransformation ( KoColorConversionTransformation * _csToFallBack,
KoColorConversionTransformation * _fallBackToCs,
KoColorTransformation * _transfo )

Creates a fall back color transformation using the two transformations given as parameters. The created object take ownership of the conversion and the color transformations and will be in charge of deleting them.

Parameters
csToFallBacktransformation from the color space to the fallback
fallBackToCstransformation from the fallback to the color space
transfothe color transformation (working in the fallback color space)

Definition at line 40 of file KoFallBackColorTransformation.cpp.

40 : d(new Private)
41{
42 Q_ASSERT(*_csToFallBack->srcColorSpace() == *_fallBackToCs->dstColorSpace());
43 Q_ASSERT(*_fallBackToCs->srcColorSpace() == *_csToFallBack->dstColorSpace());
44 d->fallBackColorSpace = _fallBackToCs->srcColorSpace();
45 d->csToFallBack = _csToFallBack;
46 d->fallBackToCs = _fallBackToCs;
47 d->csToFallBackCache = 0;
48 d->fallBackToCsCache = 0;
49 d->colorTransformation = _transfo;
50 d->buff = 0;
51 d->buffSize = 0;
52}

References d, KoColorConversionTransformation::dstColorSpace, and KoColorConversionTransformation::srcColorSpace.

◆ ~KoFallBackColorTransformation()

KoFallBackColorTransformation::~KoFallBackColorTransformation ( )
override

Definition at line 54 of file KoFallBackColorTransformation.cpp.

55{
56 if (d->csToFallBackCache) {
57 delete d->csToFallBackCache;
58 } else {
59 delete d->csToFallBack;
60 }
61 if (d->csToFallBackCache) {
62 delete d->fallBackToCsCache;
63 } else {
64 delete d->fallBackToCs;
65 }
66 delete d->colorTransformation;
67 delete[] d->buff;
68 delete d;
69}

References d.

Member Function Documentation

◆ parameterId()

int KoFallBackColorTransformation::parameterId ( const QString & name) const
overridevirtual

Get the parameter id for a parameter name

Reimplemented from KoColorTransformation.

Definition at line 88 of file KoFallBackColorTransformation.cpp.

89{
90 return d->colorTransformation->parameterId(name);
91}

References d.

◆ parameters()

QList< QString > KoFallBackColorTransformation::parameters ( ) const
overridevirtual
Returns
the list of parameters

Reimplemented from KoColorTransformation.

Definition at line 83 of file KoFallBackColorTransformation.cpp.

84{
85 return d->colorTransformation->parameters();
86}

References d.

◆ setParameter()

void KoFallBackColorTransformation::setParameter ( int id,
const QVariant & parameter )
overridevirtual

Update one parameter of a cached transformation object.

Reimplemented from KoColorTransformation.

Definition at line 93 of file KoFallBackColorTransformation.cpp.

94{
95 d->colorTransformation->setParameter(id, parameter);
96}

References d.

◆ transform()

void KoFallBackColorTransformation::transform ( const quint8 * src,
quint8 * dst,
qint32 nPixels ) const
overridevirtual

This function apply the transformation on a given number of pixels.

Parameters
srca pointer to the source pixels
dsta pointer to the destination pixels
nPixelsthe number of pixels

This function may or may not be thread safe. You need to create one KoColorTransformation per thread.

Implements KoColorTransformation.

Definition at line 71 of file KoFallBackColorTransformation.cpp.

72{
73 if (d->buffSize < nPixels) { // Expand the buffer if needed
74 d->buffSize = nPixels;
75 delete[] d->buff;
76 d->buff = new quint8[ d->buffSize * d->fallBackColorSpace->pixelSize()];
77 }
78 d->csToFallBack->transform(src, d->buff, nPixels);
79 d->colorTransformation->transform(d->buff, d->buff, nPixels);
80 d->fallBackToCs->transform(d->buff, dst, nPixels);
81}

References d.

Member Data Documentation

◆ buff

quint8* KoFallBackColorTransformation::buff
mutable

Definition at line 24 of file KoFallBackColorTransformation.cpp.

◆ buffSize

qint32 KoFallBackColorTransformation::buffSize
mutable

Definition at line 25 of file KoFallBackColorTransformation.cpp.

◆ colorTransformation

KoColorTransformation* KoFallBackColorTransformation::colorTransformation

Definition at line 23 of file KoFallBackColorTransformation.cpp.

◆ csToFallBack

const KoColorConversionTransformation* KoFallBackColorTransformation::csToFallBack

Definition at line 21 of file KoFallBackColorTransformation.cpp.

◆ csToFallBackCache

KoCachedColorConversionTransformation* KoFallBackColorTransformation::csToFallBackCache

Definition at line 19 of file KoFallBackColorTransformation.cpp.

◆ d

Private* const KoFallBackColorTransformation::d
private

Definition at line 55 of file KoFallBackColorTransformation.h.

◆ fallBackColorSpace

const KoColorSpace* KoFallBackColorTransformation::fallBackColorSpace

Definition at line 18 of file KoFallBackColorTransformation.cpp.

◆ fallBackToCs

const KoColorConversionTransformation* KoFallBackColorTransformation::fallBackToCs

Definition at line 22 of file KoFallBackColorTransformation.cpp.

◆ fallBackToCsCache

KoCachedColorConversionTransformation* KoFallBackColorTransformation::fallBackToCsCache

Definition at line 20 of file KoFallBackColorTransformation.cpp.


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