CaptureMoment 0.1.0
Free and open-source non-destructive photo editor
Loading...
Searching...
No Matches
working_image_context.h
Go to the documentation of this file.
1#pragma once
17#include "common/image_region.h"
20
21#include <memory>
22
31namespace CaptureMoment::Core {
32
33namespace ImageProcessing {
34
43{
44public:
51
58
59 // Non-copyable, movable
64
74 [[nodiscard]] bool prepare(std::unique_ptr<Common::ImageRegion> original_tile);
75
82 void resetToOriginal();
83
89 [[nodiscard]] bool isReady() const noexcept;
90
100 [[nodiscard]] std::expected<std::unique_ptr<Common::ImageRegion>, ErrorHandling::CoreError>
102
107 [[nodiscard]] std::shared_ptr<IWorkingImageHardware>
108 getWorkingImage() noexcept;
109
120 [[nodiscard]] std::expected<std::unique_ptr<Common::ImageRegion>, ErrorHandling::CoreError>
121 getDownsampled(Common::ImageDim target_width, Common::ImageDim target_height);
122
129 void release() noexcept;
130
131private:
132
134 std::unique_ptr<WorkingImageData> m_image_data;
135
139 std::shared_ptr<IWorkingImageHardware> m_working_image;
140};
141
142} // namespace ImageProcessing
143} // namespace CaptureMoment::Core
Abstract interface representing an image used as a working buffer.
Manages the lifecycle of a single IWorkingImage instance and its data.
WorkingImageContext(const WorkingImageContext &)=delete
std::expected< std::unique_ptr< Common::ImageRegion >, ErrorHandling::CoreError > getWorkingImageAsRegion() const
Exports the WorkingImage data to CPU.
std::expected< std::unique_ptr< Common::ImageRegion >, ErrorHandling::CoreError > getDownsampled(Common::ImageDim target_width, Common::ImageDim target_height)
Downsamples the WorkingImage to the specified dimensions.
std::shared_ptr< IWorkingImageHardware > getWorkingImage() noexcept
Gets the WorkingImage for processing.
void release() noexcept
Releases the managed WorkingImage.
bool prepare(std::unique_ptr< Common::ImageRegion > original_tile)
Prepares the context with a new source image.
bool isReady() const noexcept
Checks if a WorkingImage is ready for use.
void resetToOriginal()
Restores the internal working buffer to the original source data.
WorkingImageContext & operator=(WorkingImageContext &&)=default
WorkingImageContext & operator=(const WorkingImageContext &)=delete
Base class providing raw buffer storage and metadata for working images.
Abstract interface representing an image used as a working buffer, abstracting hardware location.
Defines the ImageRegion structure for representing pixel buffers in the CaptureMoment Core library.
Common type definitions for all image types in CaptureMoment.
@ ImageProcessing
Errors related to Image Processing, GPU, or Memory.
Manages the lifecycle of a single IWorkingImage instance.
Contains the error handling infrastructure for the Core library.
Base class providing raw buffer storage and metadata for all working image implementations.
CaptureMoment — footer