CaptureMoment 0.1.0
Free and open-source non-destructive photo editor
Loading...
Searching...
No Matches
operation_parameters.h
Go to the documentation of this file.
1
8#pragma once
9
10#include <string>
11#include <cmath>
12#include <algorithm>
13
14namespace CaptureMoment::UI {
15
22 namespace Domain {
23
38 float value {0.0f};
39
43 std::string operation_id;
44
53 bool isActive() const {
54 return std::abs(value) > 0.0001f; // Tolerance for floating-point comparison
55 }
56 };
57
72 float value {0.0f};
73
77 std::string operation_id;
78
87 bool isActive() const {
88 return value > 0.0001f; // Tolerance for positive floating-point comparison
89 }
90 };
91
98 struct AngleParams {
105 float degrees {0.0f};
106
110 std::string operation_id;
111
120 bool isActive() const {
121 return std::abs(degrees) > 0.0001f; // Tolerance for floating-point comparison
122 }
123 };
124
135 int x {0};
139 int y {0};
143 int width {0};
147 int height {0};
151 std::string operation_id;
152
160 bool isActive() const {
161 return width > 0 && height > 0; // A zero-area crop has no effect
162 }
163
170 bool isValid() const {
171 return width >= 0 && height >= 0;
172 }
173 };
174
181 struct IndexParams {
188 int index {0};
192 int min_index {0};
199 int max_index {0}; // Must be set according to context (e.g., number of available profiles - 1)
203 std::string operation_id;
204
214 bool isActive() const {
215 // Assumes index 0 (or minIndex) is "inactive" or "default".
216 // An active state requires a selection beyond the default.
217 return index > min_index && index <= max_index;
218 }
219
225 bool isValid() const {
226 return index >= min_index && index <= max_index;
227 }
228
234 void clampIndex() {
235 index = std::clamp(index, min_index, max_index);
236 }
237 };
238
239 // --- Add more generic parameter structures as needed ---
240 // struct ComplexMaskParams { /* ... */ };
241
242 } // namespace Common
243
244} // namespace CaptureMoment
Parameter structure for operations using an angle value (e.g., Rotation).
std::string operation_id
Optional identifier for the specific operation instance.
bool isActive() const
Checks if the angle parameter indicates an active operation.
float degrees
The angle value in degrees.
Parameter structure for operations based on an index selection (e.g., Color Profile Selection).
void clampIndex()
Clamps the index to the valid range [minIndex, maxIndex].
bool isActive() const
Checks if the index parameter indicates an active operation.
std::string operation_id
Optional identifier for the specific operation instance.
int max_index
The maximum allowed index value.
bool isValid() const
Validates the index value against its bounds.
int min_index
The minimum allowed index value.
Parameter structure for operations using a positive value (e.g., Blur Radius, Sharpen Amount).
std::string operation_id
Optional identifier for the specific operation instance.
bool isActive() const
Checks if the parameter value indicates an active operation.
float value
The positive adjustment value.
Parameter structure for operations defining a rectangular region (e.g., Crop).
int y
Y coordinate of the top-left corner of the rectangle.
std::string operation_id
Optional identifier for the specific operation instance.
bool isValid() const
Validates the rectangle dimensions.
bool isActive() const
Checks if the rectangle parameters indicate an active operation.
int x
X coordinate of the top-left corner of the rectangle.
Parameter structure for operations using a relative adjustment value (e.g., Brightness,...
std::string operation_id
Optional identifier for the specific operation instance.
bool isActive() const
Checks if the parameter value indicates an active operation.
CaptureMoment — footer