Image Data Structure#

struct ImageData : public FileSection#

This section is for interoperability with different software such as lightroom and holds a composite of all the layers.

When writing out data we fill it with empty pixels using Rle compression, this is due to Photoshop unfortunately requiring it to be present. Due to this compression step we can usually save lots of data over what Photoshop writes out

Public Functions

inline void write(File &document, const FileHeader &header)#

Write out an empty image data section from the number of channels. This section is unfortunately required.

ImageData() = default#
inline ImageData(uint16_t numChannels)#

Initialize the ImageData with a given number of channels to write out. We do this rather than deducting from the header as the header counts alpha channels while this does not!

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.

inline size_t offset() const noexcept#