roo_display
API Documentation for roo_display
Loading...
Searching...
No Matches
shadow.h
Go to the documentation of this file.
1#pragma once
2
4
5namespace roo_display {
6
7/// Rasterizable drop shadow for rounded rectangles.
9 public:
10 /// Shadow specification parameters.
11 struct Spec {
12 // Extents of the shadow.
14
15 // External radius of the shadow at full extents.
17
18 // 'Internal' shadow radius, within which the shadow is not diffused.
19 // Generally the same as the corner radius of the widget casting the shadow.
21
22 // The alpha at a point where the shadow is not diffuset.
24
25 // 256 * how much the alpha decreases per each pixel of distance.
27 };
28
29 /// Construct a rounded-rect shadow.
30 ///
31 /// `extents` refer to the original object area. `blur_radius` approximates
32 /// elevation (shadow growth). `corner_radius` indicates rounded corners of
33 /// the casting object.
36
37 Box extents() const override { return shadow_extents_; }
38
39 void readColors(const int16_t* x, const int16_t* y, uint32_t count,
40 Color* result) const override;
41
42 bool readColorRect(int16_t xMin, int16_t yMin, int16_t xMax, int16_t yMax,
43 roo_display::Color* result) const override;
44
45 private:
46 Spec spec_;
47 Box object_extents_;
48 Box shadow_extents_;
49 uint8_t corner_radius_;
50 Color color_;
51};
52
53} // namespace roo_display
Axis-aligned integer rectangle.
Definition box.h:12
ARGB8888 color stored as a 32-bit unsigned integer.
Definition color.h:16
Drawable that can provide a color for any point within its extents.
Rasterizable drop shadow for rounded rectangles.
Definition shadow.h:8
void readColors(const int16_t *x, const int16_t *y, uint32_t count, Color *result) const override
Read colors for the given points.
Definition shadow.cpp:92
Box extents() const override
Return the bounding box encompassing all pixels that need to be drawn.
Definition shadow.h:37
bool readColorRect(int16_t xMin, int16_t yMin, int16_t xMax, int16_t yMax, roo_display::Color *result) const override
Read colors for a rectangle.
Definition shadow.cpp:99
Defines 140 opaque HTML named colors.
Shadow specification parameters.
Definition shadow.h:11