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

void read(File &document, const FileHeader &header, ProgressCallback &callback, 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, ProgressCallback &callback, 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.

inline std::vector<std::shared_ptr<TaggedBlock>> get_base_tagged_blocks() const#

Retrieve all the base tagged blocks from the additional layer information, excluding any blocks that are explicitly overridden to decode them. This is useful e.g. for roundtripping tagged blocks.

inline void initialize(size_t offset, size_t size) noexcept#

Initialize the file section with a size and offset. If re-initialization is needed this function may be called again

template<typename T = size_t>
inline T size() const#

Get the size of the FileSection as the given integral type checking internally if this access would overflow the template argument T. This function is primarily intended for structures such as a PascalString which may only be a max of uint8_t in size.

inline void size(size_t size) noexcept#

Set the size of the file section.

inline void addSize(size_t increment)#

Add to the size of the FileSection.

Public Members

TaggedBlockStorage m_TaggedBlocks#

Our storage container for a vector of tagged blocks.