Additional Layer Info Structure#

struct AdditionalLayerInfo : public FileSection#

The AdditionalLayerInfo section exists in two different parts of the Photoshop File Format, once at the end of the LayerAndMaskInformation section as well as at the end of each LayerRecord instance. These sections may be empty

Public Functions

virtual uint64_t calculateSize(std::shared_ptr<FileHeader> header = nullptr) const override#

Each FileSection must implement a way to calculate its own section size in bytes based on the data it holds. This is important for writing to disk as we sometimes hold a section size marker. The size must include this marker (if applicable) and when writing the marker we subtract the size of it.

Note

Any sections that include image data (LayerAndMaskInformation and ImageData) will not be able to calculate the section size due to offloading the compression to the write step. For these sections the size calculation gets done on write.

Parameters:

header – An optional ptr to the document FileHeader, only some functions require this to be present

void read(File &document, const FileHeader &header, const uint64_t offset, const uint64_t maxLength, const uint16_t padding = 1u)#

Read and Initialize this section. Unlike many other sections we do not usually know the exact size but only a max size. Therefore we continuously read and verify that we can read another TaggedBlock with the right signature

void write(File &document, const FileHeader &header, const uint16_t padding = 1u) const#

Write all the stored TaggedBlocks to disk.

template<typename T> inline requires std::is_base_of_v< TaggedBlock, T > std::optional< std::shared_ptr< T > > getTaggedBlock (const Enum::TaggedBlockKey key) const

Get a tagged block from the key and try to cast it to T. If the key cannot be found return nullptr.

Public Members

TaggedBlockStorage m_TaggedBlocks#

Our storage container for a vector of tagged blocks.