Image Resources Structure#
-
struct ImageResources : public FileSection#
The ImageResources section holds a list of ResourceBlocks giving additional information over the state of the document such as DPI or Color Space. It additionally also always holds a rather large XML metadata block which we ignore. For a full list of what is and isnt in the ImageResources section please refer to the Photoshop File Format reference
Public Functions
-
inline ImageResources()#
-
ImageResources(std::vector<std::unique_ptr<ResourceBlock>> &&resourceBlocks)#
-
ImageResources(const ImageResources&) = delete#
-
ImageResources(ImageResources&&) = default#
-
ImageResources &operator=(const ImageResources&) = delete#
-
ImageResources &operator=(ImageResources&&) = default#
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 uint64_t offset)#
Read the ImageResources from disk, any ImageResources without an implementation are not parsed and skipped
-
void write(File &document)#
Write the ImageResources to disk using the given document.
- template<typename T> inline requires std::is_base_of_v< ResourceBlock, T > const T * getResourceBlockView (const Enum::ImageResource key) const
Retrieve a resource block view as the given template argument using a key as index to the block
- Returns:
a non owning ptr to the block or nullptr if the resource block is not found
Public Members
-
std::vector<std::unique_ptr<ResourceBlock>> m_ResourceBlocks#
We store our ResourceBlocks here, most of them we do not parse as they hold irrelevant information to keep memory usage low
-
inline ImageResources()#