Color Mode Data Structure#

struct ColorModeData : public FileSection#

The ColorModeData section holds information for e.g. how the image is tonemapped in 32-bit mode as well as mapping of indexed and duotone colours.

Public Functions

inline ColorModeData()#
inline ColorModeData(std::vector<uint8_t> &data)#
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)#

Read the ColorModeData section as is without interpreting anything.

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

Write the ColorModeData section, note that the m_Data field does not contain the length marker and we write it explicitly.

Public Members

std::vector<uint8_t> m_Data#

The raw bytes held by this section excluding the section marker. This should only hold data for 32-bit files and Duotone/Indexed color mode. For the time being we do not interpret this data in any way and defaults are written automatically