CaptureMoment 0.1.0
Free and open-source non-destructive photo editor
Loading...
Searching...
No Matches
photo_engine.h
Go to the documentation of this file.
1
17#pragma once
18
22#include "common/image_region.h"
25
26#include <memory>
27#include <string_view>
28#include <vector>
29#include <expected>
30#include <future>
31
32namespace CaptureMoment::Core {
33
34namespace Engine {
35
45{
46private:
47 std::unique_ptr<Managers::StateImageManager> m_state_manager;
48
49public:
56
71 [[nodiscard]] std::expected<void, ErrorHandling::CoreError> loadImage(std::string_view path);
72
82 [[nodiscard]] std::expected<void, ErrorHandling::CoreError> commitWorkingImageToSource();
83
90 void resetWorkingImage();
91
97 [[nodiscard]] Common::ImageDim width() const noexcept;
98
104 [[nodiscard]] Common::ImageDim height() const noexcept;
105
111 [[nodiscard]] Common::ImageChan channels() const noexcept;
112
127 [[nodiscard]] std::future<bool> applyOperations(std::vector<Operations::OperationDescriptor>&& ops);
128
140 [[nodiscard]] std::expected<std::unique_ptr<Common::ImageRegion>, ErrorHandling::CoreError> getWorkingImageAsRegion() const;
141
142
143 /*
144 * @brief Gets a downsampled version of the working image for display purposes.
145 *
146 * This method performs an internal downsampling of the working image to create
147 * a lower-resolution version suitable for real-time display. The dimensions of
148 * the downsampled image are determined based on the current viewport size and
149 * the original source image dimensions.
150 *
151 * This is intended for use by the DisplayManager to efficiently render a preview
152 * without needing to process the full-resolution image on every update.
153 */
154 [[nodiscard]] std::expected<std::unique_ptr<Common::ImageRegion>, ErrorHandling::CoreError>
156};
157
158} // namespace Engine
159
160} // namespace CaptureMoment::Core
Core engine orchestrating image loading and cumulative operation management.
Common::ImageDim width() const noexcept
Gets the width of the loaded image.
std::expected< void, ErrorHandling::CoreError > loadImage(std::string_view path)
Loads an image file and initializes the processing pipeline.
Common::ImageDim height() const noexcept
Gets the height of the loaded image.
void resetWorkingImage()
Resets the working image to the original state.
Common::ImageChan channels() const noexcept
Gets the number of color channels.
std::expected< std::unique_ptr< Common::ImageRegion >, ErrorHandling::CoreError > getDownsampledDisplayImage(Common::ImageDim width, Common::ImageDim height)
std::expected< void, ErrorHandling::CoreError > commitWorkingImageToSource()
Commits the processed working image back to the source manager.
std::expected< std::unique_ptr< Common::ImageRegion >, ErrorHandling::CoreError > getWorkingImageAsRegion() const
Gets the working image as a CPU-based copy.
PhotoEngine()
Constructs a PhotoEngine instance.
std::future< bool > applyOperations(std::vector< Operations::OperationDescriptor > &&ops)
Applies a cumulative list of operations.
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::uint8_t ImageChan
Type for channel count.
Definition image_types.h:26
std::size_t ImageDim
Type for image dimensions (width, height).
Definition image_types.h:20
CoreError
Enumeration of all error codes for CaptureMoment Core.
Definition core_error.h:36
Manages the lifecycle of a single IWorkingImage instance.
Descriptor of an operation with its parameters and unique identifier.
Image source management class using OpenImageIO (OIIO).
Declaration of StateImageManager class.
CaptureMoment — footer