Class Resource
Build from Resource.h
Krita 4.0.0Krita 5.0.0

A Resource represents a gradient, pattern, brush tip, brush preset, palette or

workspace definition.

allPresets = Application.resources("preset")for preset in allPresets: print(preset.name())

Resources are identified by their type, name and filename. If you want to change the contents of a resource, you should read its data using data(), parse it and write the changed contents back.

Methods

Resource(rhs: Resource) data()QByteArray filename()str image()QImage name()str setData(data: QByteArray)bool setImage(image: QImage) setName(value: str) type()str

Member documentation

Krita 5.0.0Krita master

Parameters

rhs(no description provided)

Return

(no description provided)

data()QByteArray
Krita 4.0.0

Return the resource as a byte array.

Return

(no description provided)

filename()str
Krita 4.0.0

The filename of the resource, if present. Not all resources are loaded from files.

Return

(no description provided)

image()QImage
Krita 4.0.0

An image that can be used to represent the resource in the user interface. For some resources, like patterns, the

image is identical to the resource, for others it's a mere icon.

Return

(no description provided)

name()str
Krita 4.0.0

The user-visible name of the resource.

Return

(no description provided)

setData(data: QByteArray)bool
Krita 4.0.0Krita 4.3.0

Change the internal data of the resource to the given byte

array. If the byte array is not valid, setData returns false, otherwise true.

Parameters

data(no description provided)

Return

(no description provided)

setImage(image: QImage)
Krita 4.0.0

Change the image for this resource.

Parameters

image(no description provided)
setName(value: str)
Krita 4.0.0

setName changes the user-visible name of the current resource.

Parameters

value(no description provided)
type()str
Krita 4.0.0

Return the type of this resource. Valid types are:

  • pattern: a raster image representing a pattern
  • gradient: a gradient
  • brush: a brush tip
  • preset: a brush preset
  • palette: a color set
  • workspace: a workspace definition.

Return

(no description provided)