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#
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

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#

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