40 lines
799 B
C++
40 lines
799 B
C++
#pragma once
|
|
|
|
#include "foundation/result.h"
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <span>
|
|
#include <vector>
|
|
|
|
namespace pp::paint {
|
|
|
|
constexpr std::size_t max_stroke_points = 1000000;
|
|
constexpr std::size_t max_stroke_samples = 1000000;
|
|
|
|
struct StrokePoint {
|
|
float x = 0.0F;
|
|
float y = 0.0F;
|
|
float pressure = 1.0F;
|
|
std::uint32_t time_ms = 0;
|
|
};
|
|
|
|
struct StrokeSample {
|
|
float x = 0.0F;
|
|
float y = 0.0F;
|
|
float pressure = 1.0F;
|
|
float distance = 0.0F;
|
|
};
|
|
|
|
struct StrokeSamplingConfig {
|
|
float spacing = 1.0F;
|
|
bool include_endpoint = true;
|
|
std::size_t max_samples = max_stroke_samples;
|
|
};
|
|
|
|
[[nodiscard]] pp::foundation::Result<std::vector<StrokeSample>> sample_stroke(
|
|
std::span<const StrokePoint> points,
|
|
StrokeSamplingConfig config) noexcept;
|
|
|
|
}
|