Node

Search for usage in LXR

#include <Node.h>

Inheritance diagram for Node:

Public Slots

bool addChildNode (Node *child, Node *above)
 
bool alphaLocked () const
 
bool animated () const
 
QString blendingMode () const
 
QRect bounds () const
 
QList< Channel * > channels () const
 
QList< Node * > childNodes () const
 
Nodeclone () const
 
bool collapsed () const
 
QString colorDepth () const
 
int colorLabel () const
 
QString colorModel () const
 
QString colorProfile () const
 
void cropNode (int x, int y, int w, int h)
 
Nodeduplicate ()
 
void enableAnimation () const
 
QList< Node * > findChildNodes (const QString &name=QString(), bool recursive=false, bool partialMatch=false, const QString &type=QString(), int colorLabelIndex=0) const
 
bool hasExtents ()
 
bool hasKeyframeAtTime (int frameNumber)
 
QIcon icon () const
 
int index () const
 
bool inheritAlpha () const
 
bool isPinnedToTimeline () const
 
QString layerStyleToAsl ()
 
bool locked () const
 
NodemergeDown ()
 
void move (int x, int y)
 
QString name () const
 
int opacity () const
 
QString paintAbility ()
 
void paintEllipse (const QRectF &rect, const QString strokeStyle=PaintingResources::defaultStrokeStyle, const QString fillStyle=PaintingResources::defaultFillStyle)
 
void paintLine (const QPointF pointOne, const QPointF pointTwo, double pressureOne=1.0, double pressureTwo=1.0, const QString strokeStyle=PaintingResources::defaultStrokeStyle)
 
void paintPath (const QPainterPath &path, const QString strokeStyle=PaintingResources::defaultStrokeStyle, const QString fillStyle=PaintingResources::defaultFillStyle)
 
void paintPolygon (const QList< QPointF > points, const QString strokeStyle=PaintingResources::defaultStrokeStyle, const QString fillStyle=PaintingResources::defaultFillStyle)
 
void paintRectangle (const QRectF &rect, const QString strokeStyle=PaintingResources::defaultStrokeStyle, const QString fillStyle=PaintingResources::defaultFillStyle)
 
NodeparentNode () const
 
QByteArray pixelData (int x, int y, int w, int h) const
 
QByteArray pixelDataAtTime (int x, int y, int w, int h, int time) const
 
QPoint position () const
 
QByteArray projectionPixelData (int x, int y, int w, int h) const
 
bool remove ()
 
bool removeChildNode (Node *child)
 
void rotateNode (double radians)
 
bool save (const QString &filename, double xRes, double yRes, const InfoObject &exportConfiguration, const QRect &exportRect=QRect())
 
void scaleNode (QPointF origin, int width, int height, QString strategy)
 
void setAlphaLocked (bool value)
 
void setBlendingMode (QString value)
 
void setChildNodes (QList< Node * > nodes)
 
void setCollapsed (bool collapsed)
 
void setColorLabel (int index)
 
bool setColorProfile (const QString &colorProfile)
 
bool setColorSpace (const QString &colorModel, const QString &colorDepth, const QString &colorProfile)
 
void setInheritAlpha (bool value)
 
bool setLayerStyleFromAsl (const QString &asl)
 
void setLocked (bool value)
 
void setName (QString name)
 
void setOpacity (int value)
 
void setPinnedToTimeline (bool pinned) const
 
bool setPixelData (QByteArray value, int x, int y, int w, int h)
 
void setVisible (bool visible)
 
void shearNode (double angleX, double angleY)
 
QImage thumbnail (int w, int h)
 
virtual QString type () const
 
QUuid uniqueId () const
 
bool visible () const
 

Public Member Functions

bool operator!= (const Node &other) const
 
bool operator== (const Node &other) const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
QBindable< QStringbindableObjectName ()
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo () const const
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isQuickItemType () const const
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_GADGET_EXPORT (EXPORT_MACRO)
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setObjectName (QAnyStringView name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool setProperty (const char *name, QVariant &&value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType)
 
QThreadthread () const const
 

Static Public Member Functions

static NodecreateNode (KisImageSP image, KisNodeSP node, QObject *parent=0)
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 

Additional Inherited Members

- Public Types inherited from QObject
typedef  QObjectList
 
- Properties inherited from QObject
 objectName
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

Node represents a layer or mask in a Krita image's Node hierarchy.

Group layers can contain other layers and masks; layers can contain masks.

Definition at line 23 of file Node.h.

Constructor & Destructor Documentation

◆ ~Node()

Node::~Node ( )
override

Definition at line 133 of file Node.cpp.

Member Function Documentation

◆ addChildNode

bool Node::addChildNode ( Node * child,
Node * above )
slot

addChildNode adds the given node in the list of children.

Parameters
childthe node to be added
abovethe node above which this node will be placed
Returns
false if adding the node failed

Definition at line 264 of file Node.cpp.

◆ alphaLocked

bool Node::alphaLocked ( ) const
slot

alphaLocked checks whether the node is a paint layer and returns whether it is alpha locked

Returns
whether the paint layer is alpha locked, or false if the node is not a paint layer

Definition at line 157 of file Node.cpp.

◆ animated

bool Node::animated ( ) const
slot

Krita layers can be animated, i.e., have frames.

Returns
return true if the layer has frames. Currently, the scripting framework does not give access to the animation features.

Definition at line 360 of file Node.cpp.

◆ blendingMode

QString Node::blendingMode ( ) const
slot
Returns
the blending mode of the layer. The values of the blending modes are defined in
See also
KoCompositeOpRegistry.h

Definition at line 177 of file Node.cpp.

◆ bounds

QRect Node::bounds ( ) const
slot

bounds return the exact bounds of the node's paint device

Returns
the bounds, or an empty QRect if the node has no paint device or is empty.

Definition at line 614 of file Node.cpp.

◆ channels

QList< Channel * > Node::channels ( ) const
slot

channels creates a list of Channel objects that can be used individually to show or hide certain channels, and to retrieve the contents of each channel in a node separately.

Only layers have channels, masks do not, and calling channels on a Node that is a mask will return an empty list.

Returns
the list of channels ordered in by position of the channels in pixel position

Definition at line 196 of file Node.cpp.

◆ childNodes

QList< Node * > Node::childNodes ( ) const
slot

childNodes

Returns
returns a list of child nodes of the current node. The nodes are ordered from the bottommost up. The function is not recursive.

Definition at line 211 of file Node.cpp.

◆ clone

Node * Node::clone ( ) const
slot

clone clone the current node.

The node is not associated with any image.

Definition at line 149 of file Node.cpp.

◆ collapsed

bool Node::collapsed ( ) const
slot

returns the collapsed state of this node

Definition at line 384 of file Node.cpp.

◆ colorDepth

QString Node::colorDepth ( ) const
slot

colorDepth A string describing the color depth of the image:

  • U8: unsigned 8 bits integer, the most common type
  • U16: unsigned 16 bits integer
  • F16: half, 16 bits floating point. Only available if Krita was built with OpenEXR
  • F32: 32 bits floating point
Returns
the color depth.

Definition at line 313 of file Node.cpp.

◆ colorLabel

int Node::colorLabel ( ) const
slot

Sets a color label index associated to the layer.

The actual color of the label and the number of available colors is defined by Krita GUI configuration.

Definition at line 301 of file Node.cpp.

◆ colorModel

QString Node::colorModel ( ) const
slot

colorModel retrieve the current color model of this document:

  • A: Alpha mask
  • RGBA: RGB with alpha channel (The actual order of channels is most often BGR!)
  • XYZA: XYZ with alpha channel
  • LABA: LAB with alpha channel
  • CMYKA: CMYK with alpha channel
  • GRAYA: Gray with alpha channel
  • YCbCrA: YCbCr with alpha channel
Returns
the internal color model string.

Definition at line 320 of file Node.cpp.

◆ colorProfile

QString Node::colorProfile ( ) const
slot
Returns
the name of the current color profile

Definition at line 328 of file Node.cpp.

◆ createNode()

Node * Node::createNode ( KisImageSP image,
KisNodeSP node,
QObject * parent = 0 )
static

Definition at line 90 of file Node.cpp.

◆ cropNode

void Node::cropNode ( int x,
int y,
int w,
int h )
slot

cropNode crop this layer.

Parameters
xthe left edge of the cropping rectangle.
ythe top edge of the cropping rectangle
wthe right edge of the cropping rectangle
hthe bottom edge of the cropping rectangle

Definition at line 725 of file Node.cpp.

◆ duplicate

Node * Node::duplicate ( )
slot

duplicate returns a full copy of the current node.

The node is not inserted in the graphic

Returns
a valid Node object or 0 if the node couldn't be duplicated.

Definition at line 646 of file Node.cpp.

◆ enableAnimation

void Node::enableAnimation ( ) const
slot

enableAnimation make the current layer animated, so it can have frames.

Definition at line 366 of file Node.cpp.

◆ findChildNodes

QList< Node * > Node::findChildNodes ( const QString & name = QString(),
bool recursive = false,
bool partialMatch = false,
const QString & type = QString(),
int colorLabelIndex = 0 ) const
slot

findChildNodes

Parameters
namename of the child node to search for. Leaving this blank will return all nodes.
recursivewhether or not to search recursively. Defaults to false.
partialMatchreturn if the name partially contains the string (case insensitive). Defaults to false.
typefilter returned nodes based on type
colorLabelIndexfilter returned nodes based on color label index
Returns
returns a list of child nodes and grand child nodes of the current node that match the search criteria.

Definition at line 225 of file Node.cpp.

◆ hasExtents

bool Node::hasExtents ( )
slot

does the node have any content in it?

Returns
if node has any content in it

Definition at line 422 of file Node.cpp.

◆ hasKeyframeAtTime

bool Node::hasKeyframeAtTime ( int frameNumber)
slot

Check to see if frame number on layer is a keyframe.

Definition at line 522 of file Node.cpp.

◆ icon

QIcon Node::icon ( ) const
slot

icon

Returns
the icon associated with the layer.

Definition at line 507 of file Node.cpp.

◆ index

int Node::index ( ) const
slot

index the index of the node inside the parent

Returns
an integer representing the node's index inside the parent

Definition at line 802 of file Node.cpp.

◆ inheritAlpha

bool Node::inheritAlpha ( ) const
slot

inheritAlpha checks whether this node has the inherits alpha flag set

Returns
true if the Inherit Alpha is set

Definition at line 396 of file Node.cpp.

◆ isPinnedToTimeline

bool Node::isPinnedToTimeline ( ) const
slot
Returns
Returns true if node is pinned to the Timeline Docker or false if it is not.

Definition at line 378 of file Node.cpp.

◆ layerStyleToAsl

QString Node::layerStyleToAsl ( )
slot

layerStyleToAsl retrieve the current layer's style in ASL format.

Returns
a QString in ASL format representing the layer style.

Definition at line 752 of file Node.cpp.

◆ locked

bool Node::locked ( ) const
slot

locked checks whether the Node is locked.

A locked node cannot be changed.

Returns
true if the Node is locked, false if it hasn't been locked.

Definition at line 410 of file Node.cpp.

◆ mergeDown

Node * Node::mergeDown ( )
slot

mergeDown merges the given node with the first visible node underneath this node in the layerstack.

This will drop all per-layer metadata.

Definition at line 684 of file Node.cpp.

◆ move

void Node::move ( int x,
int y )
slot

move the pixels to the given x, y location in the image coordinate space.

Definition at line 620 of file Node.cpp.

◆ name

QString Node::name ( ) const
slot
Returns
the user-visible name of this node.

Definition at line 427 of file Node.cpp.

◆ opacity

int Node::opacity ( ) const
slot

return the opacity of the Node.

The opacity is a value between 0 and 255.

Definition at line 440 of file Node.cpp.

◆ operator!=()

bool Node::operator!= ( const Node & other) const

Definition at line 144 of file Node.cpp.

◆ operator==()

bool Node::operator== ( const Node & other) const

Definition at line 138 of file Node.cpp.

◆ paintAbility

QString Node::paintAbility ( )
slot

paintAbility can be used to determine whether this node can be painted on with the current brush preset.

Returns
QString, one of the following:
  • VECTOR - This node is vector-based.
  • CLONE - This node is a Clone Layer.
  • PAINT - This node is paintable by the current brush preset.
  • UNPAINTABLE - This node is not paintable, or a null preset is somehow selected./li>
  • MYPAINTBRUSH_UNPAINTABLE - This node's non-RGBA colorspace cannot be painted on by the currently selected MyPaint brush.

Definition at line 831 of file Node.cpp.

◆ paintEllipse

void Node::paintEllipse ( const QRectF & rect,
const QString strokeStyle = PaintingResources::defaultStrokeStyle,
const QString fillStyle = PaintingResources::defaultFillStyle )
slot

paint an ellipse on the canvas.

Uses current brush preset

Parameters
rectQRect with x, y, width, and height
  • None
  • ForegroundColor
  • BackgroundColor
Default is ForegroundColor.
fillStyleappearance of the fill, one of:
  • None
  • ForegroundColor
  • BackgroundColor
  • Pattern
Default is None.

Definition at line 915 of file Node.cpp.

◆ paintLine

void Node::paintLine ( const QPointF pointOne,
const QPointF pointTwo,
double pressureOne = 1.0,
double pressureTwo = 1.0,
const QString strokeStyle = PaintingResources::defaultStrokeStyle )
slot

paint a line on the canvas.

Uses current brush preset

Parameters
pointOnestarting point
pointTwoend point
pressureOnestarting pressure
pressureTwoend pressure
strokeStyleappearance of the outline, one of:
  • None - will use Foreground Color, since line would be invisible otherwise
  • ForegroundColor
  • BackgroundColor

Definition at line 866 of file Node.cpp.

◆ paintPath

void Node::paintPath ( const QPainterPath & path,
const QString strokeStyle = PaintingResources::defaultStrokeStyle,
const QString fillStyle = PaintingResources::defaultFillStyle )
slot

paint a custom path on the canvas.

Uses current brush preset

Parameters
pathQPainterPath to determine path
  • None
  • ForegroundColor
  • BackgroundColor
Default is ForegroundColor.
fillStyleappearance of the fill, one of:
  • None
  • ForegroundColor
  • BackgroundColor
  • Pattern
Default is None.

Definition at line 927 of file Node.cpp.

◆ paintPolygon

void Node::paintPolygon ( const QList< QPointF > points,
const QString strokeStyle = PaintingResources::defaultStrokeStyle,
const QString fillStyle = PaintingResources::defaultFillStyle )
slot

paint a polygon on the canvas.

Uses current brush preset

Parameters
listof Qpoints
  • None
  • ForegroundColor
  • BackgroundColor
Default is ForegroundColor.
fillStyleappearance of the fill, one of:
  • None
  • ForegroundColor
  • BackgroundColor
  • Pattern
Default is None.

Definition at line 901 of file Node.cpp.

◆ paintRectangle

void Node::paintRectangle ( const QRectF & rect,
const QString strokeStyle = PaintingResources::defaultStrokeStyle,
const QString fillStyle = PaintingResources::defaultFillStyle )
slot

paint a rectangle on the canvas.

Uses current brush preset

Parameters
rectQRect with x, y, width, and height
strokeStyleappearance of the outline, one of:
  • None
  • ForegroundColor
  • BackgroundColor
Default is ForegroundColor.
fillStyleappearance of the fill, one of:
  • None
  • ForegroundColor
  • BackgroundColor
  • Pattern
Default is None.

Definition at line 886 of file Node.cpp.

◆ parentNode

Node * Node::parentNode ( ) const
slot

return the Node that is the parent of the current Node, or 0 if this is the root Node.

Definition at line 455 of file Node.cpp.

◆ pixelData

QByteArray Node::pixelData ( int x,
int y,
int w,
int h ) const
slot

pixelData reads the given rectangle from the Node's paintable pixels, if those exist, and returns it as a byte array.

The pixel data starts top-left, and is ordered row-first.

The byte array can be interpreted as follows: 8 bits images have one byte per channel, and as many bytes as there are channels. 16 bits integer images have two bytes per channel, representing an unsigned short. 16 bits float images have two bytes per channel, representing a half, or 16 bits float. 32 bits float images have four bytes per channel, representing a float.

You can read outside the node boundaries; those pixels will be transparent black.

The order of channels is:

  • Integer RGBA: Blue, Green, Red, Alpha
  • Float RGBA: Red, Green, Blue, Alpha
  • GrayA: Gray, Alpha
  • Selection: selectedness
  • LabA: L, a, b, Alpha
  • CMYKA: Cyan, Magenta, Yellow, Key, Alpha
  • XYZA: X, Y, Z, A
  • YCbCrA: Y, Cb, Cr, Alpha

The byte array is a copy of the original node data. In Python, you can use bytes, bytearray and the struct module to interpret the data and construct, for instance, a Pillow Image object.

If you read the pixeldata of a mask, a filter or generator layer, you get the selection bytes, which is one channel with values in the range from 0..255.

If you want to change the pixels of a node you can write the pixels back after manipulation with setPixelData(). This will only succeed on nodes with writable pixel data, e.g not on groups or file layers.

Parameters
xx position from where to start reading
yy position from where to start reading
wrow length to read
hnumber of rows to read
Returns
a QByteArray with the pixel data. The byte array may be empty.

Definition at line 545 of file Node.cpp.

◆ pixelDataAtTime

QByteArray Node::pixelDataAtTime ( int x,
int y,
int w,
int h,
int time ) const
slot

pixelDataAtTime a basic function to get pixeldata from an animated node at a given time.

Parameters
xthe position from the left to start reading.
ythe position from the top to start reader
wthe row length to read
hthe number of rows to read
timethe frame number
Returns
a QByteArray with the pixel data. The byte array may be empty.

Definition at line 559 of file Node.cpp.

◆ position

QPoint Node::position ( ) const
slot

position returns the position of the paint device of this node.

The position is always 0,0 unless the layer has been moved. If you want to know the topleft position of the rectangle around the actual non-transparent pixels in the node, use bounds().

Returns
the top-left position of the node

Definition at line 627 of file Node.cpp.

◆ projectionPixelData

QByteArray Node::projectionPixelData ( int x,
int y,
int w,
int h ) const
slot

projectionPixelData reads the given rectangle from the Node's projection (that is, what the node looks like after all sub-Nodes (like layers in a group or masks on a layer) have been applied, and returns it as a byte array.

The pixel data starts top-left, and is ordered row-first.

The byte array can be interpreted as follows: 8 bits images have one byte per channel, and as many bytes as there are channels. 16 bits integer images have two bytes per channel, representing an unsigned short. 16 bits float images have two bytes per channel, representing a half, or 16 bits float. 32 bits float images have four bytes per channel, representing a float.

You can read outside the node boundaries; those pixels will be transparent black.

The order of channels is:

  • Integer RGBA: Blue, Green, Red, Alpha
  • Float RGBA: Red, Green, Blue, Alpha
  • GrayA: Gray, Alpha
  • Selection: selectedness
  • LabA: L, a, b, Alpha
  • CMYKA: Cyan, Magenta, Yellow, Key, Alpha
  • XYZA: X, Y, Z, A
  • YCbCrA: Y, Cb, Cr, Alpha

The byte array is a copy of the original node data. In Python, you can use bytes, bytearray and the struct module to interpret the data and construct, for instance, a Pillow Image object.

If you read the projection of a mask, you get the selection bytes, which is one channel with values in the range from 0..255.

If you want to change the pixels of a node you can write the pixels back after manipulation with setPixelData(). This will only succeed on nodes with writable pixel data, e.g not on groups or file layers.

Parameters
xx position from where to start reading
yy position from where to start reading
wrow length to read
hnumber of rows to read
Returns
a QByteArray with the pixel data. The byte array may be empty.

Definition at line 581 of file Node.cpp.

◆ remove

bool Node::remove ( )
slot

remove removes this node from its parent image.

Definition at line 633 of file Node.cpp.

◆ removeChildNode

bool Node::removeChildNode ( Node * child)
slot

removeChildNode removes the given node from the list of children.

Parameters
childthe node to be removed

Definition at line 282 of file Node.cpp.

◆ rotateNode

void Node::rotateNode ( double radians)
slot

rotateNode rotate this layer by the given radians.

Parameters
radiansamount the layer should be rotated in, in radians.

Definition at line 715 of file Node.cpp.

◆ save

bool Node::save ( const QString & filename,
double xRes,
double yRes,
const InfoObject & exportConfiguration,
const QRect & exportRect = QRect() )
slot

save exports the given node with this filename.

The extension of the filename determines the filetype.

Parameters
filenamethe filename including extension
xResthe horizontal resolution in pixels per pt (there are 72 pts in an inch)
yResthe horizontal resolution in pixels per pt (there are 72 pts in an inch)
exportConfigurationa configuration object appropriate to the file format.
exportRectthe export bounds for saving a node as a QRect If exportRect is empty, then save exactBounds() of the node. If you'd like to save the image- aligned area of the node, just pass image->bounds() there. See Document->exportImage for InfoObject details.
Returns
true if saving succeeded, false if it failed.

Definition at line 652 of file Node.cpp.

◆ scaleNode

void Node::scaleNode ( QPointF origin,
int width,
int height,
QString strategy )
slot

scaleNode

Parameters
originthe origin point
widththe width
heightthe height
strategythe scaling strategy. There's several ones amongst these that aren't available in the regular UI.
  • Hermite
  • Bicubic - Adds pixels using the color of surrounding pixels. Produces smoother tonal gradations than Bilinear.
  • Box - Replicate pixels in the image. Preserves all the original detail, but can produce jagged effects.
  • Bilinear - Adds pixels averaging the color values of surrounding pixels. Produces medium quality results when the image is scaled from half to two times the original size.
  • Bell
  • BSpline
  • Lanczos3 - Offers similar results than Bicubic, but maybe a little bit sharper. Can produce light and dark halos along strong edges.
  • Mitchell

Definition at line 696 of file Node.cpp.

◆ setAlphaLocked

void Node::setAlphaLocked ( bool value)
slot

setAlphaLocked set the layer to value if the node is paint layer.

Definition at line 167 of file Node.cpp.

◆ setBlendingMode

void Node::setBlendingMode ( QString value)
slot

setBlendingMode set the blending mode of the node to the given value

Parameters
valueone of the string values from
See also
KoCompositeOpRegistry.h

Definition at line 184 of file Node.cpp.

◆ setChildNodes

void Node::setChildNodes ( QList< Node * > nodes)
slot

setChildNodes this replaces the existing set of child nodes with the new set.

Parameters
nodesThe list of nodes that will become children, bottom-up – the first node, is the bottom-most node in the stack.

Definition at line 288 of file Node.cpp.

◆ setCollapsed

void Node::setCollapsed ( bool collapsed)
slot

Sets the state of the node to the value of.

Parameters
collapsed

Definition at line 390 of file Node.cpp.

◆ setColorLabel

void Node::setColorLabel ( int index)
slot

setColorLabel sets a color label index associated to the layer.

The actual color of the label and the number of available colors is defined by Krita GUI configuration.

Parameters
indexan integer corresponding to the set of available color labels.

Definition at line 307 of file Node.cpp.

◆ setColorProfile

bool Node::setColorProfile ( const QString & colorProfile)
slot

setColorProfile set the color profile of the image to the given profile.

The profile has to be registered with krita and be compatible with the current color model and depth; the image data is not converted.

Parameters
colorProfile
Returns
if assigning the color profile worked

Definition at line 335 of file Node.cpp.

◆ setColorSpace

bool Node::setColorSpace ( const QString & colorModel,
const QString & colorDepth,
const QString & colorProfile )
slot

setColorSpace convert the node to the given colorspace

Parameters
colorModelA string describing the color model of the node:
  • A: Alpha mask
  • RGBA: RGB with alpha channel (The actual order of channels is most often BGR!)
  • XYZA: XYZ with alpha channel
  • LABA: LAB with alpha channel
  • CMYKA: CMYK with alpha channel
  • GRAYA: Gray with alpha channel
  • YCbCrA: YCbCr with alpha channel
colorDepthA string describing the color depth of the image:
  • U8: unsigned 8 bits integer, the most common type
  • U16: unsigned 16 bits integer
  • F16: half, 16 bits floating point. Only available if Krita was built with OpenEXR
  • F32: 32 bits floating point
colorProfilea valid color profile for this color model and color depth combination.

Definition at line 346 of file Node.cpp.

◆ setInheritAlpha

void Node::setInheritAlpha ( bool value)
slot

set the Inherit Alpha flag to the given value

Definition at line 403 of file Node.cpp.

◆ setLayerStyleFromAsl

bool Node::setLayerStyleFromAsl ( const QString & asl)
slot

setLayerStyleFromAsl set a new layer style for this node.

Parameters
aslContenta string formatted in ASL format containing the layer style
Returns
true if layer style was set, false if failed.

Definition at line 771 of file Node.cpp.

◆ setLocked

void Node::setLocked ( bool value)
slot

set the Locked flag to the give value

Definition at line 416 of file Node.cpp.

◆ setName

void Node::setName ( QString name)
slot

rename the Node to the given name

Definition at line 433 of file Node.cpp.

◆ setOpacity

void Node::setOpacity ( int value)
slot

set the opacity of the Node to the given value.

The opacity is a value between 0 and 255.

Definition at line 446 of file Node.cpp.

◆ setPinnedToTimeline

void Node::setPinnedToTimeline ( bool pinned) const
slot

Sets whether or not node should be pinned to the Timeline Docker, regardless of selection activity.

Definition at line 372 of file Node.cpp.

◆ setPixelData

bool Node::setPixelData ( QByteArray value,
int x,
int y,
int w,
int h )
slot

setPixelData writes the given bytes, of which there must be enough, into the Node, if the Node has writable pixel data:

  • paint layer: the layer's original pixels are overwritten
  • filter layer, generator layer, any mask: the embedded selection's pixels are overwritten. Note: for these

File layers, Group layers, Clone layers cannot be written to. Calling setPixelData on those layer types will silently do nothing.

Parameters
valuethe byte array representing the pixels. There must be enough bytes available. Krita will take the raw pointer from the QByteArray and start reading, not stopping before (number of channels * size of channel * w * h) bytes are read.
xthe x position to start writing from
ythe y position to start writing from
wthe width of each row
hthe number of rows to write
Returns
true if writing the pixeldata worked

Definition at line 601 of file Node.cpp.

◆ setVisible

void Node::setVisible ( bool visible)
slot

Set the visibility of the current node to.

Parameters
visible

Definition at line 538 of file Node.cpp.

◆ shearNode

void Node::shearNode ( double angleX,
double angleY )
slot

shearNode perform a shear operation on this node.

Parameters
angleXthe X-angle in degrees to shear by
angleYthe Y-angle in degrees to shear by

Definition at line 736 of file Node.cpp.

◆ thumbnail

QImage Node::thumbnail ( int w,
int h )
slot

thumbnail create a thumbnail of the given dimensions.

The thumbnail is sized according to the layer dimensions, not the image dimensions. If the requested size is too big a null QImage is created. If the current node cannot generate a thumbnail, a transparent QImage of the requested size is generated.

Returns
a QImage representing the layer contents.

Definition at line 746 of file Node.cpp.

◆ type

QString Node::type ( ) const
virtualslot

type Krita has several types of nodes, split in layers and masks.

Group layers can contain other layers, any layer can contain masks.

Returns
The type of the node. Valid types are:
  • paintlayer
  • grouplayer
  • filelayer
  • filterlayer
  • filllayer
  • clonelayer
  • vectorlayer
  • transparencymask
  • filtermask
  • transformmask
  • selectionmask
  • colorizemask

If the Node object isn't wrapping a valid Krita layer or mask object, and empty string is returned.

Definition at line 462 of file Node.cpp.

◆ uniqueId

QUuid Node::uniqueId ( ) const
slot

uniqueId uniqueId of the node

Returns
a QUuid representing a unique id to identify the node

Definition at line 810 of file Node.cpp.

◆ visible

bool Node::visible ( ) const
slot

Check whether the current Node is visible in the layer stack.

Definition at line 516 of file Node.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:35:00 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.