Route stroke panel view through app core
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace pp::app {
|
||||
|
||||
@@ -175,6 +177,41 @@ struct BrushStrokeControlPlan {
|
||||
bool notifies_stroke_change = false;
|
||||
};
|
||||
|
||||
struct BrushStrokeFloatValue {
|
||||
BrushStrokeFloatSetting setting = BrushStrokeFloatSetting::tip_size;
|
||||
float value = 0.0F;
|
||||
};
|
||||
|
||||
struct BrushStrokeBoolValue {
|
||||
BrushStrokeBoolSetting setting = BrushStrokeBoolSetting::tip_angle_init;
|
||||
bool value = false;
|
||||
};
|
||||
|
||||
struct BrushStrokeBlendValue {
|
||||
BrushStrokeBlendSetting setting = BrushStrokeBlendSetting::tip;
|
||||
int blend_mode = 0;
|
||||
};
|
||||
|
||||
struct BrushStrokePanelInput {
|
||||
std::vector<BrushStrokeFloatValue> float_values;
|
||||
std::vector<BrushStrokeBoolValue> bool_values;
|
||||
std::vector<BrushStrokeBlendValue> blend_values;
|
||||
std::string tip_thumbnail_path;
|
||||
std::string dual_thumbnail_path;
|
||||
std::string pattern_thumbnail_path;
|
||||
};
|
||||
|
||||
struct BrushStrokePanelView {
|
||||
std::vector<BrushStrokeFloatValue> float_values;
|
||||
std::vector<BrushStrokeBoolValue> bool_values;
|
||||
std::vector<BrushStrokeBlendValue> blend_values;
|
||||
std::string tip_thumbnail_path;
|
||||
std::string dual_thumbnail_path;
|
||||
std::string pattern_thumbnail_path;
|
||||
bool updates_preview = true;
|
||||
bool updates_thumbnails = true;
|
||||
};
|
||||
|
||||
class BrushUiServices {
|
||||
public:
|
||||
virtual ~BrushUiServices() = default;
|
||||
@@ -278,6 +315,33 @@ public:
|
||||
return pp::foundation::Status::success();
|
||||
}
|
||||
|
||||
[[nodiscard]] inline pp::foundation::Result<BrushStrokePanelView> plan_brush_stroke_panel_view(
|
||||
BrushStrokePanelInput input)
|
||||
{
|
||||
for (const auto& value : input.float_values) {
|
||||
const auto status = validate_brush_stroke_float(value.value);
|
||||
if (!status.ok()) {
|
||||
return pp::foundation::Result<BrushStrokePanelView>::failure(status);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& value : input.blend_values) {
|
||||
const auto status = validate_brush_stroke_blend_mode(value.blend_mode);
|
||||
if (!status.ok()) {
|
||||
return pp::foundation::Result<BrushStrokePanelView>::failure(status);
|
||||
}
|
||||
}
|
||||
|
||||
BrushStrokePanelView view;
|
||||
view.float_values = std::move(input.float_values);
|
||||
view.bool_values = std::move(input.bool_values);
|
||||
view.blend_values = std::move(input.blend_values);
|
||||
view.tip_thumbnail_path = std::move(input.tip_thumbnail_path);
|
||||
view.dual_thumbnail_path = std::move(input.dual_thumbnail_path);
|
||||
view.pattern_thumbnail_path = std::move(input.pattern_thumbnail_path);
|
||||
return pp::foundation::Result<BrushStrokePanelView>::success(std::move(view));
|
||||
}
|
||||
|
||||
[[nodiscard]] inline pp::foundation::Result<BrushUiPlan> plan_brush_ui_color(
|
||||
float r,
|
||||
float g,
|
||||
|
||||
Reference in New Issue
Block a user