Add paint brush parameter tests

This commit is contained in:
2026-06-01 08:40:46 +02:00
parent 313a360c01
commit abe578a338
9 changed files with 256 additions and 7 deletions

37
src/paint/brush.h Normal file
View File

@@ -0,0 +1,37 @@
#pragma once
#include "foundation/result.h"
#include <cstdint>
namespace pp::paint {
constexpr float min_brush_size = 0.1F;
constexpr float max_brush_size = 4096.0F;
constexpr float min_brush_spacing = 0.01F;
constexpr float max_brush_spacing = 16.0F;
constexpr float max_brush_angle_degrees = 360.0F;
struct BrushParams {
float size = 32.0F;
float spacing = 0.25F;
float opacity = 1.0F;
float flow = 1.0F;
float angle_degrees = 0.0F;
float size_jitter = 0.0F;
float opacity_jitter = 0.0F;
bool pressure_controls_size = true;
bool pressure_controls_opacity = false;
};
struct BrushStamp {
float size = 0.0F;
float opacity = 0.0F;
float flow = 0.0F;
float angle_degrees = 0.0F;
};
[[nodiscard]] pp::foundation::Status validate_brush_params(const BrushParams& params) noexcept;
[[nodiscard]] BrushStamp evaluate_brush_stamp(const BrushParams& params, float pressure) noexcept;
}