Structure Description: LinkedLayerData#
-
template<typename T>
struct LinkedLayerData# Public Types
-
using storage_type = std::unordered_map<Enum::ChannelIDInfo, std::unique_ptr<channel_wrapper>, Enum::ChannelIDInfoHasher>#
Alias for our storage data type.
Public Functions
-
LinkedLayerData() = default#
initialize a linked layer from a filepath, parsing the file
-
inline const std::span<const uint8_t> raw_data() const#
Get a view over the raw file data associated with this linked layer.
-
inline const storage_type &image_data() const#
Get a const view over the image data.
-
inline data_type get_image_data(size_t width, size_t height, Render::Interpolation interpolation = Render::Interpolation::bicubic)#
Return the image data held by this struct as a rescaled version of itself
This interpolates the data to the given
widthandheightwhere those do not necessarily need to match the aspect ratio of the original image (but will be stretched if they do not match). We provide several interpolation methods but not all that photoshop recognizes.- Parameters:
width – The horizontal resolution to resample to
height – The vertical resolution to resample to
interpolation – The interpolation algorithm to use. This may be
nearest_neighbour,bilinearorbicubic(default). Each of these has their advantages and disadvantages.nearest_neighbourfor example is the fastest but will create blocky results whilebicubicwill create the best result but may be slowest.
- Returns:
The resampled image data
-
inline std::array<size_t, 2> size() const noexcept#
Get the width and height of the image data stored on the linked layer.
-
inline size_t width() const noexcept#
Return the width of the image data held by this struct.
-
inline size_t height() const noexcept#
Return the height of the image data held by this struct.
-
inline std::filesystem::path path() const noexcept#
Get the full path to the file stored on the LinkedLayerData.
-
inline std::string hash() const noexcept#
Get the hash associated with the LinkedLayerData.
-
inline std::string filename() const noexcept#
Get the filename associated with the LinkedLayerData.
-
inline LinkedLayerType type() const noexcept#
Get the type of linkage this file has, whether that may be data (on the file itself) or external.
-
inline void type(LinkedLayerType type_) noexcept#
Set the type of linkage this file has, whether that may be data (on the file itself) or external.
As we only apply this on write this can be changed as many times as wanted.
-
inline LinkedLayerItem::Data to_photoshop(bool dealloc_raw_data, std::filesystem::path file_path)#
Generate LinkedLayer::Data from the data, this is for internal API usage.
- Parameters:
dealloc_raw_data – Whether to move m_RawData into the new struct. Effectively invalidates this struct
file_path – The path to the psd file being written. This is required for externally linked files to properly compute the relative path.
-
using storage_type = std::unordered_map<Enum::ChannelIDInfo, std::unique_ptr<channel_wrapper>, Enum::ChannelIDInfoHasher>#