Class Channel
Build from Channel.h
Krita 4.0.0

A Channel represents a single channel in a Node. Krita does not use channels to store local selections: these are strictly the color and alpha channels.

Methods

bounds()QRect channelSize()int name()str pixelData(rect: QRect)QByteArray position()int setPixelData(value: QByteArray, rect: QRect) setVisible(value: bool) visible()bool

Member documentation

bounds()QRect
Krita 4.0.0

Return

the exact bounds of the channel. This can be smaller than the bounds of the Node this channel is part of.

channelSize()int
Krita 4.0.0

Return

the number of bytes this channel takes

name()str
Krita 4.0.0

Return

the name of the channel

pixelData(rect: QRect)QByteArray
Krita 4.0.0

Read the values of the channel into the a byte array for each pixel in the rect from the Node this channel is part of, and returns it.

Note that if Krita is built with OpenEXR and the Node has the 16 bits floating point channel depth type, Krita returns 32 bits float for every channel; the libkis scripting API does not support half.

Parameters

rect(no description provided)

Return

(no description provided)

position()int
Krita 4.0.0

Return

the position of the first byte of the channel in the pixel

setPixelData(value: QByteArray, rect: QRect)
Krita 4.0.0

writes the given data to the relevant channel in the Node. This is only possible for Nodes that have a paintDevice, so nothing will happen when trying to write to e.g. a group layer.

Note that if Krita is built with OpenEXR and the Node has the 16 bits floating point channel depth type, Krita expects to be given a 4 byte, 32 bits float for every channel; the libkis scripting API does not support half.

Parameters

value

a byte array with exactly enough bytes.

rect

the rectangle to write the bytes into

setVisible(value: bool)
Krita 4.0.0

setvisible set the visibility of the channel to the given value.

Parameters

value(no description provided)
visible()bool
Krita 4.0.0

checks whether this channel is visible in the node

Return

the status of this channel