Add paint brush parameter tests
This commit is contained in:
37
src/paint/brush.h
Normal file
37
src/paint/brush.h
Normal 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;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user