Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
svg_rect.hpp
Go to the documentation of this file.
1#pragma once
2
12
14#include <pulp/view/view.hpp>
15
16namespace pulp::view {
17
27class SvgRectWidget : public View {
28public:
29 SvgRectWidget() = default;
30
33 void set_rect(float x, float y, float width, float height);
34
38 void clear_fill();
39
44
46 void set_stroke_width(float w);
47
48 // Accessors used by tests.
49 float rect_x() const { return x_; }
50 float rect_y() const { return y_; }
51 float rect_width() const { return w_; }
52 float rect_height() const { return h_; }
53 bool has_fill() const { return has_fill_; }
54 bool has_stroke() const { return has_stroke_; }
55 canvas::Color fill_color() const { return fill_color_; }
56 canvas::Color stroke_color() const { return stroke_color_; }
57 float stroke_width() const { return stroke_width_; }
58
59 void paint(canvas::Canvas& canvas) override;
60
61private:
62 float x_ = 0.0f;
63 float y_ = 0.0f;
64 float w_ = 0.0f;
65 float h_ = 0.0f;
66 canvas::Color fill_color_{0.0f, 0.0f, 0.0f, 1.0f};
67 canvas::Color stroke_color_{0.0f, 0.0f, 0.0f, 1.0f};
68 float stroke_width_ = 1.0f;
69 bool has_fill_ = true;
70 bool has_stroke_ = false;
71};
72
73} // namespace pulp::view
Definition canvas.hpp:240
float rect_x() const
Definition svg_rect.hpp:49
void set_fill_color(canvas::Color c)
Solid-fill paint.
float stroke_width() const
Definition svg_rect.hpp:57
float rect_width() const
Definition svg_rect.hpp:51
bool has_stroke() const
Definition svg_rect.hpp:54
float rect_y() const
Definition svg_rect.hpp:50
canvas::Color stroke_color() const
Definition svg_rect.hpp:56
float rect_height() const
Definition svg_rect.hpp:52
bool has_fill() const
Definition svg_rect.hpp:53
void set_stroke_width(float w)
Stroke width in widget-local units. Default 1.
void set_rect(float x, float y, float width, float height)
Set the rect geometry.
void set_stroke_color(canvas::Color c)
Solid-stroke paint.
void paint(canvas::Canvas &canvas) override
canvas::Color fill_color() const
Definition svg_rect.hpp:55
Definition affine_transform.hpp:24
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
@ y
Definition input_events.hpp:42
@ c
Definition input_events.hpp:39
@ x
Definition input_events.hpp:41
@ w
Definition input_events.hpp:41
@ height
Definition css_animation.hpp:128
@ width
Definition css_animation.hpp:127
Definition canvas.hpp:52