tiny-skia-cpp
A C++20 2D rendering library (port of tiny-skia)
Loading...
Searching...
No Matches
SweepGradient.h
Go to the documentation of this file.
1#pragma once
2
5
6#include <optional>
7#include <variant>
8#include <vector>
9
11
12namespace tiny_skia {
13
18 public:
19 explicit SweepGradient(Gradient base) : base_(std::move(base)) {}
20
23 static std::optional<std::variant<Color, SweepGradient>> create(Point center, float startAngle,
24 float endAngle,
25 std::vector<GradientStop> stops,
26 SpreadMode mode,
27 Transform transform);
28
30 [[nodiscard]] bool isOpaque() const { return base_.colorsAreOpaque(); }
31
33 [[nodiscard]] bool pushStages(ColorSpace cs, pipeline::RasterPipelineBuilder& p) const;
34
36 Gradient base_;
37
38 private:
39 float t0_ = 0.0f;
40 float t1_ = 1.0f;
41};
42
43} // namespace tiny_skia
ColorSpace
Colorspace for gamma-correct blending.
Definition Color.h:167
Base gradient data and gradient stop type.
Angular sweep gradient shader.
Definition SweepGradient.h:17
static std::optional< std::variant< Color, SweepGradient > > create(Point center, float startAngle, float endAngle, std::vector< GradientStop > stops, SpreadMode mode, Transform transform)
Creates a sweep gradient between startAngle and endAngle (degrees). Returns a Color if the gradient d...
2D affine transformation: [sx kx tx; ky sy ty; 0 0 1].
Definition Transform.h:17
2D point / vector with float components.
Definition Point.h:14