krita
KisLayer Class Reference
#include <kis_layer.h>
Inheritance diagram for KisLayer:

Detailed Description
Abstract class that represents the concept of a Layer in Krita.This is not related to the paint devices: this is merely an abstraction of how layers can be stacked and rendered differently. Regarding the previous-, first-, next- and lastChild() calls, first means that it the layer is at the top of the group in the layerlist, using next will iterate to the bottom to last, whereas previous will go up to first again.
Definition at line 41 of file kis_layer.h.
Public Types | |
enum | { Visible = 1, Hidden = 2, Locked = 4, Unlocked = 8 } |
Public Member Functions | |
KisLayer (KisImage *img, const QString &name, Q_UINT8 opacity) | |
KisLayer (const KisLayer &rhs) | |
virtual | ~KisLayer () |
virtual void | setClean (const QRect &rect) |
virtual bool | dirty () |
virtual bool | dirty (const QRect &rc) |
virtual QRect | dirtyRect () const |
virtual void | setDirty (bool propagate=true) |
virtual void | setDirty (const QRect &rect, bool propagate=true) |
virtual KisLayerSP | clone () const=0 |
int | id () const |
virtual int | index () const |
virtual void | setIndex (int index) |
virtual KisGroupLayerSP | parent () const |
virtual KisLayerSP | prevSibling () const |
virtual KisLayerSP | nextSibling () const |
KisLayerSP | siblingAbove () const |
KisLayerSP | siblingBelow () const |
virtual uint | childCount () const |
virtual KisLayerSP | firstChild () const |
virtual KisLayerSP | lastChild () const |
virtual KisLayerSP | findLayer (const QString &name) const |
virtual KisLayerSP | findLayer (int id) const |
virtual int | numLayers (int type=0) const |
virtual void | activate () |
virtual void | deactivate () |
virtual Q_INT32 | x () const=0 |
virtual void | setX (Q_INT32)=0 |
virtual Q_INT32 | y () const=0 |
virtual void | setY (Q_INT32)=0 |
virtual KNamedCommand * | moveCommand (QPoint oldPosition, QPoint newPosition) |
virtual QRect | extent () const=0 |
virtual QRect | exactBounds () const=0 |
virtual const bool | visible () const |
virtual void | setVisible (bool v) |
KNamedCommand * | setVisibleCommand (bool visiblel) |
Q_UINT8 | opacity () const |
void | setOpacity (Q_UINT8 val) |
KNamedCommand * | setOpacityCommand (Q_UINT8 val) |
KNamedCommand * | setOpacityCommand (Q_UINT8 prevOpacity, Q_UINT8 newOpacity) |
bool | locked () const |
void | setLocked (bool l) |
KNamedCommand * | setLockedCommand (bool locked) |
void | notifyPropertyChanged () |
bool | temporary () const |
void | setTemporary (bool t) |
virtual QString | name () const |
virtual void | setName (const QString &name) |
KisCompositeOp | compositeOp () |
void | setCompositeOp (const KisCompositeOp &compositeOp) |
KNamedCommand * | setCompositeOpCommand (const KisCompositeOp &compositeOp) |
KisImage * | image () const |
virtual void | setImage (KisImage *image) |
KisUndoAdapter * | undoAdapter () const |
virtual void | paintSelection (QImage &img, Q_INT32 x, Q_INT32 y, Q_INT32 w, Q_INT32 h) |
virtual void | paintSelection (QImage &img, const QRect &scaledImageRect, const QSize &scaledImageSize, const QSize &imageSize) |
virtual void | paintMaskInactiveLayers (QImage &img, Q_INT32 x, Q_INT32 y, Q_INT32 w, Q_INT32 h) |
virtual QImage | createThumbnail (Q_INT32 w, Q_INT32 h) |
virtual bool | accept (KisLayerVisitor &)=0 |
Friends | |
class | KisGroupLayer |
Member Function Documentation
void KisLayer::setClean | ( | const QRect & | rect | ) | [virtual] |
bool KisLayer::dirty | ( | ) | [virtual] |
If the layer has been changed and not been composited yet, this returns true.
Definition at line 320 of file kis_layer.cc.
bool KisLayer::dirty | ( | const QRect & | rc | ) | [virtual] |
Return true if the given rect intersects the dirty rect(s) of this layer.
Definition at line 326 of file kis_layer.cc.
void KisLayer::setDirty | ( | bool | propagate = true |
) | [virtual] |
Set the entire layer extent dirty; this percolates up to parent layers all the way to the root layer.
Reimplemented in KisGroupLayer, and KisPaintLayer.
Definition at line 338 of file kis_layer.cc.
void KisLayer::setDirty | ( | const QRect & | rect, | |
bool | propagate = true | |||
) | [virtual] |
Add the given rect to the set of dirty rects for this layer; this percolates up to parent layers all the way to the root layer.
Reimplemented in KisGroupLayer, and KisPaintLayer.
Definition at line 352 of file kis_layer.cc.
virtual KisLayerSP KisLayer::clone | ( | ) | const [pure virtual] |
Return a copy of this layer.
Implemented in KisAdjustmentLayer, KisGroupLayer, KisPaintLayer, and KisPartLayerImpl.
int KisLayer::id | ( | ) | const [inline] |
Returns the ID of the layer, which is guaranteed to be unique among all KisLayers.
Definition at line 87 of file kis_layer.h.
void KisLayer::setIndex | ( | int | index | ) | [virtual] |
Moves this layer to the specified index within its parent's list of child layers.
Definition at line 391 of file kis_layer.cc.
KisGroupLayerSP KisLayer::parent | ( | ) | const [virtual] |
Returns the parent layer of a layer.
This is 0 only for a root layer; otherwise this will be an actual GroupLayer
Definition at line 367 of file kis_layer.cc.
KisLayerSP KisLayer::prevSibling | ( | ) | const [virtual] |
Returns the previous sibling of this layer in the parent's list.
This is the layer *above* this layer. 0 is returned if there is no parent, or if this child has no more previous siblings (== firstChild())
Definition at line 372 of file kis_layer.cc.
KisLayerSP KisLayer::nextSibling | ( | ) | const [virtual] |
Returns the next sibling of this layer in the parent's list.
This is the layer *below* this layer. 0 is returned if there is no parent, or if this child has no more next siblings (== lastChild())
Definition at line 379 of file kis_layer.cc.
KisLayerSP KisLayer::siblingAbove | ( | ) | const [inline] |
Returns the sibling above this layer in its parent's list.
0 is returned if there is no parent, or if this layer is the topmost layer in its group. This is the same as calling prevSibling().
Definition at line 120 of file kis_layer.h.
KisLayerSP KisLayer::siblingBelow | ( | ) | const [inline] |
Returns the sibling below this layer in its parent's list.
0 is returned if there is no parent, or if this layer is the bottommost layer in its group. This is the same as calling nextSibling().
Definition at line 126 of file kis_layer.h.
virtual uint KisLayer::childCount | ( | ) | const [inline, virtual] |
Returns how many direct child layers this layer has (not recursive).
Reimplemented in KisGroupLayer.
Definition at line 129 of file kis_layer.h.
virtual KisLayerSP KisLayer::firstChild | ( | ) | const [inline, virtual] |
Returns the first child layer of this layer (if it supports that).
Reimplemented in KisGroupLayer.
Definition at line 132 of file kis_layer.h.
virtual KisLayerSP KisLayer::lastChild | ( | ) | const [inline, virtual] |
Returns the last child layer of this layer (if it supports that).
Reimplemented in KisGroupLayer.
Definition at line 135 of file kis_layer.h.
KisLayerSP KisLayer::findLayer | ( | const QString & | name | ) | const [virtual] |
Recursively searches this layer and any child layers for a layer with the specified name.
Definition at line 398 of file kis_layer.cc.
KisLayerSP KisLayer::findLayer | ( | int | id | ) | const [virtual] |
Recursively searches this layer and any child layers for a layer with the specified ID.
Definition at line 408 of file kis_layer.cc.
int KisLayer::numLayers | ( | int | type = 0 |
) | const [virtual] |
Returns the total number of layers in this layer, its child layers, and their child layers recursively, optionally ones with the specified properties Visible or Locked, which you can OR together.
Definition at line 418 of file kis_layer.cc.
virtual void KisLayer::activate | ( | ) | [inline, virtual] |
Called when the layer is made active.
Reimplemented in KisGroupLayer, KisPaintLayer, and KisPartLayerImpl.
Definition at line 150 of file kis_layer.h.
virtual void KisLayer::deactivate | ( | ) | [inline, virtual] |
Called when another layer is made active.
Reimplemented in KisGroupLayer, KisPaintLayer, and KisPartLayerImpl.
Definition at line 153 of file kis_layer.h.
virtual QRect KisLayer::extent | ( | ) | const [pure virtual] |
Returns an approximation of where the bounds on actual data are in this layer.
Implemented in KisAdjustmentLayer, KisGroupLayer, KisPaintLayer, and KisPartLayerImpl.
virtual QRect KisLayer::exactBounds | ( | ) | const [pure virtual] |
Returns the exact bounds of where the actual data resides in this layer.
Implemented in KisAdjustmentLayer, KisGroupLayer, KisPaintLayer, and KisPartLayerImpl.
void KisLayer::paintSelection | ( | QImage & | img, | |
Q_INT32 | x, | |||
Q_INT32 | y, | |||
Q_INT32 | w, | |||
Q_INT32 | h | |||
) | [virtual] |
paints a mask where the selection on this layer resides
Reimplemented in KisAdjustmentLayer, KisPaintLayer, and KisPartLayerImpl.
Definition at line 568 of file kis_layer.cc.
void KisLayer::paintMaskInactiveLayers | ( | QImage & | img, | |
Q_INT32 | x, | |||
Q_INT32 | y, | |||
Q_INT32 | w, | |||
Q_INT32 | h | |||
) | [virtual] |
paints where no data is on this layer. Useful when it is a transparent layer stacked on top of another one
Reimplemented in KisPaintLayer.
Definition at line 564 of file kis_layer.cc.
QImage KisLayer::createThumbnail | ( | Q_INT32 | w, | |
Q_INT32 | h | |||
) | [virtual] |
Returns a thumbnail in requested size.
The QImage may have transparent parts. May also return 0
Reimplemented in KisAdjustmentLayer, KisGroupLayer, KisPaintLayer, and KisPartLayerImpl.
Definition at line 576 of file kis_layer.cc.
virtual bool KisLayer::accept | ( | KisLayerVisitor & | ) | [pure virtual] |
Accept the KisLayerVisitor (for the Visitor design pattern), should call the correct function on the KisLayerVisitor for this layer type.
Implemented in KisAdjustmentLayer, KisGroupLayer, KisPaintLayer, and KisPartLayerImpl.
The documentation for this class was generated from the following files: