Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
svg_line.hpp
Go to the documentation of this file.
1#pragma once
2
12
14#include <pulp/view/view.hpp>
15
16namespace pulp::view {
17
25class SvgLineWidget : public View {
26public:
27 SvgLineWidget() = default;
28
31 void set_line(float x1, float y1, float x2, float y2);
32
38
40 void set_stroke_width(float w);
41
42 // Accessors used by tests.
43 float x1() const { return x1_; }
44 float y1() const { return y1_; }
45 float x2() const { return x2_; }
46 float y2() const { return y2_; }
47 bool has_stroke() const { return has_stroke_; }
48 canvas::Color stroke_color() const { return stroke_color_; }
49 float stroke_width() const { return stroke_width_; }
50
51 void paint(canvas::Canvas& canvas) override;
52
53private:
54 float x1_ = 0.0f;
55 float y1_ = 0.0f;
56 float x2_ = 0.0f;
57 float y2_ = 0.0f;
58 canvas::Color stroke_color_{0.0f, 0.0f, 0.0f, 1.0f};
59 float stroke_width_ = 1.0f;
60 bool has_stroke_ = true;
61};
62
63} // namespace pulp::view
Definition canvas.hpp:240
void set_stroke_width(float w)
Stroke width in widget-local units. Default 1.
void paint(canvas::Canvas &canvas) override
void set_stroke_color(canvas::Color c)
Solid-stroke paint.
float y2() const
Definition svg_line.hpp:46
void set_line(float x1, float y1, float x2, float y2)
Set the line endpoints.
float x2() const
Definition svg_line.hpp:45
float stroke_width() const
Definition svg_line.hpp:49
canvas::Color stroke_color() const
Definition svg_line.hpp:48
bool has_stroke() const
Definition svg_line.hpp:47
float x1() const
Definition svg_line.hpp:43
float y1() const
Definition svg_line.hpp:44
Definition affine_transform.hpp:24
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
@ c
Definition input_events.hpp:39
@ w
Definition input_events.hpp:41
Definition canvas.hpp:52