Structure Description: ImageChannel#

This is the structure used by the PhotoshopAPI to refer to a single channel. It uses in-memory compression to reduce the memory footprint. For more information on what this is please visit Concept: In Memory Compression

template<typename T>
struct ImageChannel : public BaseImageChannel#

A generic Image Channel that is used by both the PhotoshopFile and LayeredFile, being moved between these two It is entirely valid to have each channel have a different compression method, width and height. We only store the image data in here but do not deal with reading or writing it. Ownership of the image data belongs to this struct

Public Functions

inline ImageChannel(Enum::Compression compression, std::vector<T> imageData, const Enum::ChannelIDInfo channelID, const int32_t width, const int32_t height, const float xcoord, const float ycoord)#

Take a reference to a decompressed image vector stream and set the according member variables.

inline std::vector<T> extractData()#

Extract the data from the image channel and invalidate it (can only be called once). If the image data does not exist yet we simply return an empty vector<T>. If the data was already freed we throw

inline std::vector<T> getData()#

Copy the image data out of the ImageChannel, does not free the data afterwards. Returns an empty vector if the data does not exist yet. If the data was already freed we throw

inline std::vector<std::vector<T>> getRandomChunks(const FileHeader header, uint16_t numChunks) const#

Extract n amount of randomly selected chunks from the ImageChannel super chunk. This does not invalidate any data and is useful to e.g. compress these chunks using photoshops compression methods to estimate the final size on disk

Public Static Attributes

static const uint64_t m_ChunkSize = 1024 * 1024#

The size of each sub-chunk in the super-chunk. For more information about what a chunk and super-chunk is please refer to the c-blosc2 documentation