Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
border_style.hpp
Go to the documentation of this file.
1// CSS border line styles, as painted by View.
2#pragma once
3
4#include <pulp/view/view.hpp>
5
6#include <optional>
7#include <string_view>
8
9namespace pulp::view {
10
14std::optional<View::BorderStyle> border_style_from_css(std::string_view keyword);
15
29
31enum class BorderEdge { top, right, bottom, left };
32
41 float outer = 0.0f;
42 float gap = 0.0f;
43 float inner = 0.0f;
44};
46
49Color border_band_color(View::BorderStyle style, BorderEdge side, bool outer_band, Color side_color,
50 float width);
51
55
58 float tl_x = 0.0f, tl_y = 0.0f;
59 float tr_x = 0.0f, tr_y = 0.0f;
60 float br_x = 0.0f, br_y = 0.0f;
61 float bl_x = 0.0f, bl_y = 0.0f;
62
64 static CornerRadii circular(float tl, float tr, float br, float bl) {
65 return {tl, tl, tr, tr, br, br, bl, bl};
66 }
67};
68
79
83 float width = 0.0f;
84 float height = 0.0f;
85 float top = 0.0f;
86 float right = 0.0f;
87 float bottom = 0.0f;
88 float left = 0.0f;
93 float radius_tl = 0.0f;
94 float radius_tr = 0.0f;
95 float radius_br = 0.0f;
96 float radius_bl = 0.0f;
97};
98
107
108} // namespace pulp::view
Definition canvas.hpp:240
BorderStyle
CSS / RN border-style.
Definition view.hpp:1239
@ outset
Top/left lightened, bottom/right darkened.
Definition view.hpp:1247
Definition affine_transform.hpp:24
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
void paint_banded_border(canvas::Canvas &canvas, const BandedBorder &border)
Paint border.
@ keyword
Language keyword (e.g. if, return, class).
Definition code_editor_tokenizer.hpp:38
BorderShades border_shades(Color side_color)
Color border_band_color(View::BorderStyle style, BorderEdge side, bool outer_band, Color side_color, float width)
The colour style paints the outer or inner band of side in, for a side whose specified colour is side...
BorderEdge
Which edge of the box a border side is on.
Definition border_style.hpp:31
@ bottom
Definition border_style.hpp:31
@ right
Definition border_style.hpp:31
@ left
Definition border_style.hpp:31
@ top
Definition border_style.hpp:31
canvas::Color Color
Definition theme.hpp:12
CornerRadii fit_corner_radii(float width, float height, CornerRadii radii)
radii fitted to a width x height box the way CSS fits border radii (CSS Backgrounds 3,...
BorderBands border_bands(View::BorderStyle style, BorderEdge side, float width)
@ height
Definition css_animation.hpp:128
@ width
Definition css_animation.hpp:127
bool is_banded_border_style(View::BorderStyle style)
Whether style is painted in bands of per-side colour (double and the four 3D styles) rather than as o...
std::optional< View::BorderStyle > border_style_from_css(std::string_view keyword)
The View::BorderStyle a CSS border-style / outline-style keyword names, or nullopt for anything that ...
A banded border in its own border box, origin at the top-left corner.
Definition border_style.hpp:81
float radius_tl
outer corner radii, fitted by fit_corner_radii
Definition border_style.hpp:93
float right
Definition border_style.hpp:86
float radius_bl
Definition border_style.hpp:96
float bottom
Definition border_style.hpp:87
float width
border box
Definition border_style.hpp:83
float height
Definition border_style.hpp:84
float top
side widths, already resolved and clamped
Definition border_style.hpp:85
float left
Definition border_style.hpp:88
Color left_color
Definition border_style.hpp:92
Color right_color
Definition border_style.hpp:90
float radius_br
Definition border_style.hpp:95
View::BorderStyle style
Definition border_style.hpp:82
float radius_tr
Definition border_style.hpp:94
Color top_color
Definition border_style.hpp:89
Color bottom_color
Definition border_style.hpp:91
How a side of width CSS px splits into bands for style: an outer band, a transparent gap,...
Definition border_style.hpp:40
float outer
Definition border_style.hpp:41
float inner
Definition border_style.hpp:43
float gap
Definition border_style.hpp:42
The two shades a 3D border style paints a side colour in, as Chromium resolves them.
Definition border_style.hpp:24
Color dark
Definition border_style.hpp:26
Color light
Definition border_style.hpp:25
A box's corner radii, each corner with a horizontal and a vertical radius.
Definition border_style.hpp:57
float br_y
Definition border_style.hpp:60
float tl_x
Definition border_style.hpp:58
float bl_y
Definition border_style.hpp:61
float bl_x
Definition border_style.hpp:61
float tr_x
Definition border_style.hpp:59
float tl_y
Definition border_style.hpp:58
static CornerRadii circular(float tl, float tr, float br, float bl)
Four circular corners.
Definition border_style.hpp:64
float tr_y
Definition border_style.hpp:59
float br_x
Definition border_style.hpp:60