GroupLayer Structure#

Equivalent of Photoshops Group Layer

template<typename T>
struct GroupLayer : public Layer<T>#

Represents a group of layers that may contain nested child layers.

Template Parameters:

T – The data type for pixel values in layers (e.g., uint8_t, uint16_t, float32_t).

Public Functions

void addLayer(const LayeredFile<T> &layeredFile, std::shared_ptr<Layer<T>> layer)#

Adds a layer to the group, checking for duplicates in the process.

Parameters:
  • layeredFile – The layered file containing the group.

  • layer – The layer to be added.

void removeLayer(const int index)#

Removes a layer at the given index from the group.

Parameters:

index – The index of the layer to be removed.

void removeLayer(std::shared_ptr<Layer<T>> &layer)#

Removes the specified layer from the group.

Parameters:

layer – The layer to be removed.

void removeLayer(const std::string layerName)#

Removes the specified layer from the group.

Parameters:

layerName – The name of the layer to be removed

virtual std::tuple<LayerRecord, ChannelImageData> toPhotoshop(const Enum::ColorMode colorMode, const bool doCopy, const FileHeader &header) override#

Converts the group layer to Photoshop layerRecords and imageData.

Parameters:
  • colorMode – The color mode for the conversion.

  • doCopy – Set to true to safely keep using the current GroupLayer instance. Advised to keep true unless parsing the whole LayeredFile

  • header – The file header for the conversion.

Returns:

A tuple containing layerRecords and imageData.

GroupLayer(const LayerRecord &layerRecord, ChannelImageData &channelImageData, const FileHeader &header)#

Constructs a GroupLayer using layerRecord, channelImageData, and file header.

Parameters:
  • layerRecord – The layer record for the group layer.

  • channelImageData – The channel image data for the group layer.

  • header – The file header for the group layer.

GroupLayer(const Layer<T>::Params &layerParameters, bool isCollapsed = false)#

Constructs a GroupLayer with the given layer parameters and collapse state.

Parameters:
  • layerParameters – The parameters for the group layer.

  • isCollapsed – Specifies whether the group layer is initially collapsed.

Public Members

std::vector<std::shared_ptr<Layer<T>>> m_Layers#

Child layers contained within the group. Note that Layer<T> is polymorphic.

bool m_isCollapsed = false#

Specifies whether or not the layer is collapsed or open.