Krita Source Code Documentation
Loading...
Searching...
No Matches
KoShapeUnclipCommand::Private Class Reference

Public Member Functions

void createClipPathShapes ()
 
 Private (KoShapeControllerBase *c)
 
 ~Private ()
 

Public Attributes

QList< KoShapeContainer * > clipPathParents
 
QList< KoPathShape * > clipPathShapes
 
KoShapeControllerBasecontroller
 
bool executed
 
QList< KoClipPath * > oldClipPaths
 
QList< KoShape * > shapesToUnclip
 

Detailed Description

Definition at line 17 of file KoShapeUnclipCommand.cpp.

Constructor & Destructor Documentation

◆ Private()

KoShapeUnclipCommand::Private::Private ( KoShapeControllerBase * c)
inline

Definition at line 20 of file KoShapeUnclipCommand.cpp.

◆ ~Private()

KoShapeUnclipCommand::Private::~Private ( )
inline

Definition at line 24 of file KoShapeUnclipCommand.cpp.

24 {
25 if (executed) {
26 qDeleteAll(oldClipPaths);
27 } else {
28 qDeleteAll(clipPathShapes);
29 }
30 }
QList< KoPathShape * > clipPathShapes

References clipPathShapes, executed, and oldClipPaths.

Member Function Documentation

◆ createClipPathShapes()

void KoShapeUnclipCommand::Private::createClipPathShapes ( )
inline

Definition at line 32 of file KoShapeUnclipCommand.cpp.

32 {
33 // check if we have already created the clip path shapes
34 if (!clipPathShapes.isEmpty())
35 return;
36
37 Q_FOREACH (KoShape *shape, shapesToUnclip) {
38 KoClipPath *clipPath = shape->clipPath();
39 if (!clipPath)
40 continue;
41
42 Q_FOREACH (KoShape *clipShape, clipPath->clipPathShapes()) {
43 KoShape *clone = clipShape->cloneShape();
44
45 KoPathShape *pathShape = dynamic_cast<KoPathShape*>(clone);
46 KIS_SAFE_ASSERT_RECOVER(pathShape) {
47 delete clone;
48 continue;
49 }
50
51 clipPathShapes.append(pathShape);
52 }
53
54 // apply transformations
55 Q_FOREACH (KoPathShape *pathShape, clipPathShapes) {
56 // apply transformation so that it matches the current clipped shapes clip path
57 pathShape->applyAbsoluteTransformation(clipPath->clipDataTransformation(shape));
58 pathShape->setZIndex(shape->zIndex() + 1);
59 clipPathParents.append(shape->parent());
60 }
61 }
62 }
Clip path used to clip shapes.
QList< KoPathShape * > clipPathShapes() const
Returns the clip path shapes.
QTransform clipDataTransformation(KoShape *clippedShape) const
The position of a path point within a path shape.
Definition KoPathShape.h:63
QList< KoShapeContainer * > clipPathParents
void setZIndex(qint16 zIndex)
Definition KoShape.cpp:954
void applyAbsoluteTransformation(const QTransform &matrix)
Definition KoShape.cpp:400
KoClipPath * clipPath() const
Returns the currently set clip path or 0 if there is no clip path set.
Definition KoShape.cpp:1128
KoShapeContainer * parent() const
Definition KoShape.cpp:1039
virtual KoShape * cloneShape() const
creates a deep copy of the shape or shape's subtree
Definition KoShape.cpp:200
qint16 zIndex() const
Definition KoShape.cpp:600
#define KIS_SAFE_ASSERT_RECOVER(cond)
Definition kis_assert.h:126

References KoShape::applyAbsoluteTransformation(), KoClipPath::clipDataTransformation(), KoShape::clipPath(), clipPathParents, clipPathShapes, KoClipPath::clipPathShapes(), KoShape::cloneShape(), KIS_SAFE_ASSERT_RECOVER, KoShape::parent(), KoShape::setZIndex(), shapesToUnclip, and KoShape::zIndex().

Member Data Documentation

◆ clipPathParents

QList<KoShapeContainer*> KoShapeUnclipCommand::Private::clipPathParents

Definition at line 67 of file KoShapeUnclipCommand.cpp.

◆ clipPathShapes

QList<KoPathShape*> KoShapeUnclipCommand::Private::clipPathShapes

Definition at line 66 of file KoShapeUnclipCommand.cpp.

◆ controller

KoShapeControllerBase* KoShapeUnclipCommand::Private::controller

Definition at line 70 of file KoShapeUnclipCommand.cpp.

◆ executed

bool KoShapeUnclipCommand::Private::executed

Definition at line 72 of file KoShapeUnclipCommand.cpp.

◆ oldClipPaths

QList<KoClipPath*> KoShapeUnclipCommand::Private::oldClipPaths

Definition at line 65 of file KoShapeUnclipCommand.cpp.

◆ shapesToUnclip

QList<KoShape*> KoShapeUnclipCommand::Private::shapesToUnclip

Definition at line 64 of file KoShapeUnclipCommand.cpp.


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