CaptureMoment 0.1.0
Free and open-source non-destructive photo editor
Loading...
Searching...
No Matches
i_source_manager.h
Go to the documentation of this file.
1
17#pragma once
18
19#include "common/image_region.h"
22
23#include <string>
24#include <string_view>
25#include <memory>
26#include <optional>
27#include <expected>
28
29namespace CaptureMoment::Core {
30
31namespace Managers {
32
41public:
42 virtual ~ISourceManager() = default;
43
56 [[nodiscard]] virtual std::expected<void, ErrorHandling::CoreError> loadFile(std::string_view path) = 0;
57
61 virtual void unload() = 0;
62
67 [[nodiscard]] virtual bool isLoaded() const = 0;
68
74 [[nodiscard]] virtual std::string getImageSourcePath() const = 0;
75
80 [[nodiscard]] virtual Common::ImageDim width() const noexcept = 0;
81
86 [[nodiscard]] virtual Common::ImageDim height() const noexcept = 0;
87
92 [[nodiscard]] virtual Common::ImageChan channels() const noexcept = 0;
93
108 [[nodiscard]] virtual std::expected<std::unique_ptr<Common::ImageRegion>, ErrorHandling::CoreError> getTile(
109 Common::ImageDim x, Common::ImageDim y, Common::ImageDim width, Common::ImageDim height
110 ) = 0;
111
122 [[nodiscard]] virtual std::expected<void, ErrorHandling::CoreError> setTile(const Common::ImageRegion& tile) = 0;
123
129 [[nodiscard]] virtual std::optional<std::string> getMetadata(std::string_view key) const = 0;
130};
131
132} // namespace Managers
133
134} // namespace CaptureMoment::Core
Abstract interface for managing image sources.
virtual Common::ImageDim height() const noexcept=0
Retrieves the height (in pixels) of the source image.
virtual std::string getImageSourcePath() const =0
Gets the path of the image source.
virtual std::expected< void, ErrorHandling::CoreError > loadFile(std::string_view path)=0
Loads an image file from the specified path.
virtual Common::ImageChan channels() const noexcept=0
Gets the number of channels of the internal buffer.
virtual std::expected< void, ErrorHandling::CoreError > setTile(const Common::ImageRegion &tile)=0
Writes pixel data from a tile back into the image buffer.
virtual std::optional< std::string > getMetadata(std::string_view key) const =0
Retrieves a specific metadata field from the source image.
virtual bool isLoaded() const =0
Checks if an image is currently loaded.
virtual std::expected< std::unique_ptr< Common::ImageRegion >, ErrorHandling::CoreError > getTile(Common::ImageDim x, Common::ImageDim y, Common::ImageDim width, Common::ImageDim height)=0
Extracts a rectangular region (tile) of pixels from the image.
virtual Common::ImageDim width() const noexcept=0
Retrieves the width (in pixels) of the source image.
virtual void unload()=0
Unloads the currently loaded image and frees resources.
Central error handling system for CaptureMoment Core library.
Defines the ImageRegion structure for representing pixel buffers in the CaptureMoment Core library.
Common type definitions for all image types in CaptureMoment.
std::size_t ImageDim
Type for image dimensions (width, height).
Definition image_types.h:20
Manages the lifecycle of a single IWorkingImage instance.
Contains the error handling infrastructure for the Core library.
CaptureMoment — footer