Selection

Search for usage in LXR

#include <Selection.h>

Inheritance diagram for Selection:

Public Slots

void add (Selection *selection)
 
void border (int xRadius, int yRadius)
 
void clear ()
 
void contract (int value)
 
void copy (Node *node)
 
void cut (Node *node)
 
void dilate ()
 
Selectionduplicate () const
 
void erode ()
 
void feather (int radius)
 
void grow (int xradius, int yradius)
 
int height () const
 
void intersect (Selection *selection)
 
void invert ()
 
void move (int x, int y)
 
void paste (Node *destination, int x, int y)
 
QByteArray pixelData (int x, int y, int w, int h) const
 
void replace (Selection *selection)
 
void resize (int w, int h)
 
void select (int x, int y, int w, int h, int value)
 
void selectAll (Node *node, int value)
 
void setPixelData (QByteArray value, int x, int y, int w, int h)
 
void shrink (int xRadius, int yRadius, bool edgeLock)
 
void smooth ()
 
void subtract (Selection *selection)
 
void symmetricdifference (Selection *selection)
 
int width () const
 
int x () const
 
int y () const
 

Public Member Functions

 Selection (KisSelectionSP selection, QObject *parent=0)
 
 Selection (QObject *parent=0)
 
bool operator!= (const Selection &other) const
 
bool operator== (const Selection &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
 

Additional Inherited Members

- Public Types inherited from QObject
typedef  QObjectList
 
- Properties inherited from QObject
 objectName
 
- 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)
 
- 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

Selection represents a selection on Krita.

A selection is not necessarily associated with a particular Node or Image.

from krita import *
d = Application.activeDocument()
n = d.activeNode()
r = n.bounds()
s = Selection()
s.select(r.width() / 3, r.height() / 3, r.width() / 3, r.height() / 3, 255)
s.cut(n)

Definition at line 30 of file Selection.h.

Constructor & Destructor Documentation

◆ Selection() [1/2]

Selection::Selection ( KisSelectionSP selection,
QObject * parent = 0 )

For internal use only.

Definition at line 26 of file Selection.cpp.

◆ Selection() [2/2]

Selection::Selection ( QObject * parent = 0)
explicit

Create a new, empty selection object.

Definition at line 34 of file Selection.cpp.

◆ ~Selection()

Selection::~Selection ( )
override

Definition at line 41 of file Selection.cpp.

Member Function Documentation

◆ add

void Selection::add ( Selection * selection)
slot

Add the given selection's selected pixels to the current selection.

Definition at line 273 of file Selection.cpp.

◆ border

void Selection::border ( int xRadius,
int yRadius )
slot

Border the selection with the given radius.

Definition at line 199 of file Selection.cpp.

◆ clear

void Selection::clear ( )
slot

Make the selection entirely unselected.

Definition at line 101 of file Selection.cpp.

◆ contract

void Selection::contract ( int value)
slot

Make the selection's width and height smaller by the given value.

This will not move the selection's top-left position.

Definition at line 107 of file Selection.cpp.

◆ copy

void Selection::copy ( Node * node)
slot

copy copies the area defined by the selection from the node to the clipboard.

Parameters
nodethe node from where the pixels will be copied.

Definition at line 113 of file Selection.cpp.

◆ cut

void Selection::cut ( Node * node)
slot

cut erases the area defined by the selection from the node and puts a copy on the clipboard.

Parameters
nodethe node from which the selection will be cut.

Definition at line 154 of file Selection.cpp.

◆ dilate

void Selection::dilate ( )
slot

Dilate the selection with a radius of 1 pixel.

Definition at line 191 of file Selection.cpp.

◆ duplicate

Selection * Selection::duplicate ( ) const
slot
Returns
a duplicate of the selection

Definition at line 56 of file Selection.cpp.

◆ erode

void Selection::erode ( )
slot

Erode the selection with a radius of 1 pixel.

Definition at line 183 of file Selection.cpp.

◆ feather

void Selection::feather ( int radius)
slot

Feather the selection with the given radius.

Definition at line 207 of file Selection.cpp.

◆ grow

void Selection::grow ( int xradius,
int yradius )
slot

Grow the selection with the given radius.

Definition at line 215 of file Selection.cpp.

◆ height

int Selection::height ( ) const
slot
Returns
the height of the selection

Definition at line 68 of file Selection.cpp.

◆ intersect

void Selection::intersect ( Selection * selection)
slot

Intersect the given selection with this selection.

Definition at line 285 of file Selection.cpp.

◆ invert

void Selection::invert ( )
slot

Invert the selection.

Definition at line 241 of file Selection.cpp.

◆ move

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

Move the selection's top-left corner to the given coordinates.

Definition at line 94 of file Selection.cpp.

◆ operator!=()

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

Definition at line 51 of file Selection.cpp.

◆ operator==()

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

Definition at line 46 of file Selection.cpp.

◆ paste

void Selection::paste ( Node * destination,
int x,
int y )
slot

paste pastes the content of the clipboard to the given node, limited by the area of the current selection.

Parameters
destinationthe node where the pixels will be written
xthe x position at which the clip will be written
ythe y position at which the clip will be written

Definition at line 166 of file Selection.cpp.

◆ pixelData

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

pixelData reads the given rectangle from the Selection's mask and returns it as a byte array.

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

The byte array will contain one byte for every pixel, representing the selectedness. 0 is totally unselected, 255 is fully selected.

You can read outside the Selection's boundaries; those pixels will be unselected.

The byte array is a copy of the original selection data.

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 298 of file Selection.cpp.

◆ replace

void Selection::replace ( Selection * selection)
slot

Replace the current selection's selection with the one of the given selection.

Definition at line 267 of file Selection.cpp.

◆ resize

void Selection::resize ( int w,
int h )
slot

Resize the selection to the given width and height.

The top-left position will not be moved.

Definition at line 249 of file Selection.cpp.

◆ select

void Selection::select ( int x,
int y,
int w,
int h,
int value )
slot

Select the given area.

The value can be between 0 and 255; 0 is totally unselected, 255 is totally selected.

Definition at line 255 of file Selection.cpp.

◆ selectAll

void Selection::selectAll ( Node * node,
int value )
slot

Select all pixels in the given node.

The value can be between 0 and 255; 0 is totally unselected, 255 is totally selected.

Definition at line 261 of file Selection.cpp.

◆ setPixelData

void Selection::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 Selection.

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 (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

Definition at line 310 of file Selection.cpp.

◆ shrink

void Selection::shrink ( int xRadius,
int yRadius,
bool edgeLock )
slot

Shrink the selection with the given radius.

Definition at line 224 of file Selection.cpp.

◆ smooth

void Selection::smooth ( )
slot

Smooth the selection.

Definition at line 232 of file Selection.cpp.

◆ subtract

void Selection::subtract ( Selection * selection)
slot

Subtract the given selection's selected pixels from the current selection.

Definition at line 279 of file Selection.cpp.

◆ symmetricdifference

void Selection::symmetricdifference ( Selection * selection)
slot

Intersect with the inverse of the given selection with this selection.

Definition at line 291 of file Selection.cpp.

◆ width

int Selection::width ( ) const
slot
Returns
the width of the selection

Definition at line 62 of file Selection.cpp.

◆ x

int Selection::x ( ) const
slot
Returns
the left-hand position of the selection.

Definition at line 74 of file Selection.cpp.

◆ y

int Selection::y ( ) const
slot
Returns
the top position of the selection.

Definition at line 84 of file Selection.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 Fri Nov 22 2024 12:06:52 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.