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

This class provides a loading context for filter effects. More...

#include <KoFilterEffectLoadingContext.h>

+ Inheritance diagram for KoFilterEffectLoadingContext:

Public Member Functions

QPointF convertFilterPrimitiveUnits (const QPointF &value) const
 
qreal convertFilterPrimitiveUnitsX (qreal value) const
 Converts an x value from user space to bounding box coordinates.
 
qreal convertFilterPrimitiveUnitsY (qreal value) const
 Converts an y value from user space to bounding box coordinates.
 
QPointF convertFilterUnits (const QPointF &value) const
 Converts a point value from user space to bounding box coordinates.
 
qreal convertFilterUnitsX (qreal value) const
 Converts an x value from user space to bounding box coordinates.
 
qreal convertFilterUnitsY (qreal value) const
 Converts an y value from user space to bounding box coordinates.
 
void enableFilterPrimitiveUnitsConversion (bool enable)
 Enables conversion of filter primitive units.
 
void enableFilterUnitsConversion (bool enable)
 Enables conversion of filter units.
 
 KoFilterEffectLoadingContext (const QString &basePath=QString())
 
QString pathFromHref (const QString &href) const
 Converts a href to an absolute path name.
 
 Private ()
 
void setShapeBoundingBox (const QRectF &shapeBound)
 
virtual ~KoFilterEffectLoadingContext ()
 Destructor.
 

Public Attributes

QString basePath
 
bool convertFilterPrimitiveUnits
 
bool convertFilterUnits
 
QRectF shapeBound
 

Private Attributes

Private *const d
 
- Private Attributes inherited from Private
KisCanvas2canvas
 
int displayedFrame
 
int intendedFrame
 

Additional Inherited Members

- Private Member Functions inherited from Private
 Private (KisCanvas2 *c)
 

Detailed Description

This class provides a loading context for filter effects.

Definition at line 14 of file KoFilterEffectLoadingContext.cpp.

Constructor & Destructor Documentation

◆ KoFilterEffectLoadingContext()

KoFilterEffectLoadingContext::KoFilterEffectLoadingContext ( const QString & basePath = QString())
explicit

Constructs a new filter effect loading context

Parameters
basePaththe xml document base path

Definition at line 26 of file KoFilterEffectLoadingContext.cpp.

References basePath, and d.

◆ ~KoFilterEffectLoadingContext()

KoFilterEffectLoadingContext::~KoFilterEffectLoadingContext ( )
virtual

Destructor.

Definition at line 32 of file KoFilterEffectLoadingContext.cpp.

33{
34 delete d;
35}

References d.

Member Function Documentation

◆ convertFilterPrimitiveUnits()

QPointF KoFilterEffectLoadingContext::convertFilterPrimitiveUnits ( const QPointF & value) const

◆ convertFilterPrimitiveUnitsX()

qreal KoFilterEffectLoadingContext::convertFilterPrimitiveUnitsX ( qreal value) const

Converts an x value from user space to bounding box coordinates.

Definition at line 84 of file KoFilterEffectLoadingContext.cpp.

85{
86 if (!d->convertFilterPrimitiveUnits)
87 return value;
88
89 return value / d->shapeBound.width();
90}
float value(const T *src, size_t ch)

References d, and value().

◆ convertFilterPrimitiveUnitsY()

qreal KoFilterEffectLoadingContext::convertFilterPrimitiveUnitsY ( qreal value) const

Converts an y value from user space to bounding box coordinates.

Definition at line 92 of file KoFilterEffectLoadingContext.cpp.

93{
94 if (!d->convertFilterPrimitiveUnits)
95 return value;
96
97 return value / d->shapeBound.height();
98}

References d, and value().

◆ convertFilterUnits()

QPointF KoFilterEffectLoadingContext::convertFilterUnits ( const QPointF & value) const

Converts a point value from user space to bounding box coordinates.

◆ convertFilterUnitsX()

qreal KoFilterEffectLoadingContext::convertFilterUnitsX ( qreal value) const

Converts an x value from user space to bounding box coordinates.

Definition at line 60 of file KoFilterEffectLoadingContext.cpp.

61{
62 if (!d->convertFilterUnits)
63 return value;
64
65 return value / d->shapeBound.width();
66}

References d, and value().

◆ convertFilterUnitsY()

qreal KoFilterEffectLoadingContext::convertFilterUnitsY ( qreal value) const

Converts an y value from user space to bounding box coordinates.

Definition at line 68 of file KoFilterEffectLoadingContext.cpp.

69{
70 if (!d->convertFilterUnits)
71 return value;
72
73 return value / d->shapeBound.height();
74}

References d, and value().

◆ enableFilterPrimitiveUnitsConversion()

void KoFilterEffectLoadingContext::enableFilterPrimitiveUnitsConversion ( bool enable)

Enables conversion of filter primitive units.

Definition at line 47 of file KoFilterEffectLoadingContext.cpp.

48{
49 d->convertFilterPrimitiveUnits = enable;
50}

References d.

◆ enableFilterUnitsConversion()

void KoFilterEffectLoadingContext::enableFilterUnitsConversion ( bool enable)

Enables conversion of filter units.

Definition at line 42 of file KoFilterEffectLoadingContext.cpp.

43{
44 d->convertFilterUnits = enable;
45}

References d.

◆ pathFromHref()

QString KoFilterEffectLoadingContext::pathFromHref ( const QString & href) const

Converts a href to an absolute path name.

Definition at line 100 of file KoFilterEffectLoadingContext.cpp.

101{
102 QFileInfo info(href);
103 if (! info.isRelative())
104 return href;
105
106 QFileInfo pathInfo(QFileInfo(d->basePath).filePath());
107
108 QString relFile = href;
109 while (relFile.startsWith(QLatin1String("../"))) {
110 relFile.remove(0, 3);
111 pathInfo.setFile(pathInfo.dir(), QString());
112 }
113
114 QString absFile = pathInfo.absolutePath() + '/' + relFile;
115
116 return absFile;
117}

References d.

◆ Private()

KoFilterEffectLoadingContext::Private ( )
inline

◆ setShapeBoundingBox()

void KoFilterEffectLoadingContext::setShapeBoundingBox ( const QRectF & shapeBound)

Sets the bounding box of the shape a filter is loaded for. The shapes bounding box is used to convert from user space coordinates to bounding box coordinates for filter attributes.

Parameters
shapeBoundthe shapes bounding box

Definition at line 37 of file KoFilterEffectLoadingContext.cpp.

38{
39 d->shapeBound = shapeBound;
40}

References d, and shapeBound.

Member Data Documentation

◆ basePath

QString KoFilterEffectLoadingContext::basePath

Definition at line 20 of file KoFilterEffectLoadingContext.cpp.

◆ convertFilterPrimitiveUnits

QPointF KoFilterEffectLoadingContext::convertFilterPrimitiveUnits

Definition at line 23 of file KoFilterEffectLoadingContext.cpp.

◆ convertFilterUnits

QPointF KoFilterEffectLoadingContext::convertFilterUnits

Definition at line 22 of file KoFilterEffectLoadingContext.cpp.

◆ d

Private* const KoFilterEffectLoadingContext::d
private

Definition at line 67 of file KoFilterEffectLoadingContext.h.

◆ shapeBound

QRectF KoFilterEffectLoadingContext::shapeBound

Definition at line 21 of file KoFilterEffectLoadingContext.cpp.


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