CaptureMoment 0.1.0
Free and open-source non-destructive photo editor
Loading...
Searching...
No Matches
working_image_cpu_default.cpp
Go to the documentation of this file.
1
9#include <spdlog/spdlog.h>
10
12
13std::expected<std::unique_ptr<Common::ImageRegion>, ErrorHandling::CoreError>
15{
16 if (!isValid()) {
17 spdlog::warn("[WorkingImageCPU_Default::getFullResImage]: Image view is invalid.");
19 }
20
21 try {
22 auto cpu_image_copy { std::make_unique<Common::ImageRegion>(
24 static_cast<int>(m_view_data_image.width),
25 static_cast<int>(m_view_data_image.height),
26 static_cast<int>(m_view_data_image.channels)
27 ) };
28
29 if (!cpu_image_copy->isValid()) {
31 }
32
33 spdlog::debug("[WorkingImageCPU_Default::getFullResImage]: Exported {}x{}.",
35
36 return cpu_image_copy;
37
38 } catch (const std::bad_alloc& e) {
39 spdlog::critical("[WorkingImageCPU_Default::getFullResImage]: Allocation failed: {}", e.what());
40 return std::unexpected(ErrorHandling::CoreError::AllocationFailed);
41 }
42}
43
44} // namespace CaptureMoment::Core::ImageProcessing
ImageView m_view_data_image
The image view bound to this hardware worker.
std::expected< std::unique_ptr< Common::ImageRegion >, ErrorHandling::CoreError > getFullResImage() override
Exports current working data to a new CPU-based ImageRegion.
bool isValid() const override
Checks if the image data is valid.
CoreError
Enumeration of all error codes for CaptureMoment Core.
Definition core_error.h:36
@ InvalidImageRegion
The provided ImageRegion dimensions or data are invalid.
@ InvalidWorkingImage
The working image state is invalid or corrupted.
@ AllocationFailed
Memory allocation failed.
std::span< float > working_data
Mutable span for processing.
Definition image_view.h:27
Default concrete implementation of IWorkingImageCPU using standard CPU memory.
CaptureMoment — footer