User Tools

Site Tools


DzLayeredImage

Class that implements multi-layered images.

More...

Inherits :

Methods

Signals

voidlayerListChanged ()
voidsizeChanged ( Size size )

Detailed Description

This class uses explicit sharing to make it very efficient to copy. This does, however, mean that modifying one copy of the image modifies all copies. DzLayeredImage does not currently support detach() or copy() functions for creating unique instances or deep copies.

Methods


void : addLayer( DzImageLayer layer )

Add a layer to the image.

Parameter(s):

  • layer - The layer to add to the image. The image takes ownership of this object and deletes it when it is no longer needed.

Image : getFlattenedImage( Boolean freeMem=false )

Parameter(s):

  • freeMem - If true, any image layers loaded from file will be unloaded immediately after flattening. They will have to be re-loaded again for future flattening operations.

Return Value:

  • An image that is the final result of merging all the visible layers in the image.

DzImageLayer : getLayer( Number which )

Return Value:

  • The layer at index which. This object is owned by the image.

Number : getLayerCount()

Return Value:

  • The number of layers in this image.

Size : getSize()

Return Value:

  • The size of the canvas for this image.

void : insertLayer( DzImageLayer layer, Number idx )

Insert a layer at a specific index.

Parameter(s):

  • layer - The layer to add to the image. The image takes ownership of this object and deletes it when it is no longer needed.
  • idx - The index in the list to insert the layer at.

void : moveLayer( Number from, Number to )

Adjust layer order.

Parameter(s):

  • from - The index of the layer to move.
  • to - The index in the list to move the layer to.

Boolean : removeLayer( DzImageLayer layer )

Remove the specified layer.

Parameter(s):

  • layer - The layer to remove from the image. The layer will be deleted if it is owned by the image.

Return Value:

  • true if the layer was removed from the image, otherwise false.

Boolean : replaceLayer( DzImageLayer oldLayer, DzImageLayer newLayer )

Replace a layer with a new layer.

Parameter(s):

  • oldLayer - A pointer to the layer to remove from the image. The layer will be deleted if it is owned by the image.
  • newLayer - The new layer to add to the image in place of the old layer. The image takes ownership of this object and deletes it when it is no longer used.

Return Value:

  • true if the layer was successfully replaced, otherwise false.

void : setSize( Size size )

Sets the size of the image's canvas.

Parameter(s):

  • size - The new size for the image's canvas.

Boolean : toLayeredTexture( DzLayeredTexture img )

Parameter(s):

  • img - The layered texture to copy/convert the layered image into.

Return Value:

  • true if the image was successfully copied to img, otherwise false.

Signals


void : layerListChanged()

Emits a signal when the list of layers has changed.


void : sizeChanged( Size size )

Signature:“sizeChanged(const QSize&)”

Emits a signal that the size of canvas has changed.

Parameter(s):

  • size - The new size of the canvas.