22#include <OpenImageIO/imagebuf.h>
23#include <OpenImageIO/imagecache.h>
49 [[nodiscard]] std::expected<void, ErrorHandling::CoreError>
loadFile(std::string_view path)
override;
51 [[nodiscard]]
bool isLoaded()
const override;
62 [[nodiscard]] std::optional<std::string>
getMetadata(std::string_view key)
const override;
71 std::unique_ptr<OIIO::ImageBuf> m_image_buf;
77 mutable std::mutex m_mutex;
83 OIIO::ImageCache* m_cache;
88 std::string m_current_path;
93 static OIIO::ImageCache* getGlobalCache();
99 void unloadInternal();
105 [[nodiscard]]
bool isLoaded_unsafe()
const;
114 [[nodiscard]] std::expected<OIIO::ImageBuf, ErrorHandling::CoreError>
115 loadImageBuffer(std::string_view path,
const OIIO::ImageSpec* config =
nullptr);
131 [[nodiscard]]
bool isRawFile(std::string_view path)
const;
143 [[nodiscard]]
bool isHeicFile(std::string_view path)
const;
159 [[nodiscard]] std::expected<void, ErrorHandling::CoreError> loadRawFile(std::string_view path);
172 [[nodiscard]] std::expected<void, ErrorHandling::CoreError> loadHeicFile(std::string_view path);
183 [[nodiscard]] std::expected<void, ErrorHandling::CoreError> loadStandardFile(std::string_view path);
191 [[nodiscard]] std::expected<void, ErrorHandling::CoreError> convertToRgbaInternal(OIIO::ImageBuf&& src_buf);
Abstract interface for managing image sources.
Concrete implementation of ISourceManager using OIIO.
~SourceManager() override
std::expected< std::unique_ptr< Common::ImageRegion >, ErrorHandling::CoreError > getTile(Common::ImageDim x, Common::ImageDim y, Common::ImageDim width, Common::ImageDim height) override
Extracts a rectangular region (tile) of pixels from the image.
Common::ImageDim width() const noexcept override
Retrieves the width (in pixels) of the source image.
bool isLoaded() const override
Checks if an image is currently loaded.
Common::ImageDim height() const noexcept override
Retrieves the height (in pixels) of the source image.
std::expected< void, ErrorHandling::CoreError > setTile(const Common::ImageRegion &tile) override
Writes pixel data from a tile back into the image buffer.
void unload() override
Unloads the currently loaded image and frees resources.
std::string getImageSourcePath() const override
Gets the path of the image source.
std::expected< void, ErrorHandling::CoreError > loadFile(std::string_view path) override
Loads an image file from the specified path.
Common::ImageChan channels() const noexcept override
Gets the number of channels of the internal buffer.
std::optional< std::string > getMetadata(std::string_view key) const override
Retrieves a specific metadata field from the source image.
Abstract interface for managing image sources.
std::uint8_t ImageChan
Type for channel count.
std::size_t ImageDim
Type for image dimensions (width, height).
CoreError
Enumeration of all error codes for CaptureMoment Core.
Manages the lifecycle of a single IWorkingImage instance.
Represents a rectangular region of an image and its pixel data.