libepaper 2.0.0
A C++23 library for controlling Waveshare e-paper displays on Raspberry Pi, featuring transparent sleep/wake management and a fluent builder API.
Loading...
Searching...
No Matches
commands.hpp
Go to the documentation of this file.
1#pragma once
2
57#include "epaper/core/types.hpp"
59#include <cstdint>
60#include <string>
61#include <string_view>
62
63namespace epaper {
64
90
101 LineStyle s = LineStyle::Solid) noexcept
102 : from(from_pt), to(to_pt), color(c), width(w), style(s) {}
103};
104
149
176 std::size_t radius;
180
190 constexpr CircleCommand(Point ctr, std::size_t r, Color c = Color::Black, DotPixel w = DotPixel::Pixel1x1,
191 DrawFill f = DrawFill::Empty) noexcept
192 : center(ctr), radius(r), color(c), border_width(w), fill(f) {}
193};
194
233
240enum class TextContent {
241 String,
242 Number,
243 Decimal
244};
245
283 std::string text;
284 const Font *font;
288 std::int32_t number;
289 double decimal;
290 std::uint8_t decimal_places;
291
301 TextCommand(Point pos, std::string_view txt, const Font *f, Color fg = Color::Black, Color bg = Color::White) noexcept
303 decimal(0.0), decimal_places(0) {}
304
314 TextCommand(Point pos, std::int32_t num, const Font *f, Color fg = Color::Black, Color bg = Color::White) noexcept
316 decimal(0.0), decimal_places(0) {}
317
328 TextCommand(Point pos, double dec, std::uint8_t places, const Font *f, Color fg = Color::Black,
329 Color bg = Color::White) noexcept
331 decimal(dec), decimal_places(places) {}
332};
333
334} // namespace epaper
Definition font.hpp:142
Bitmap font rendering for e-paper displays.
Definition color.hpp:5
DrawFill
Definition types.hpp:151
@ Empty
Draw outline only (border with no fill)
TextContent
Content type for text rendering.
Definition commands.hpp:240
@ String
Direct string content (text field used as-is)
@ Decimal
Decimal number (decimal field formatted with decimal_places precision)
@ Number
Integer number (number field converted to text via sprintf)
DotPixel
Definition types.hpp:92
@ Pixel1x1
Single pixel (finest resolution)
Color
Definition types.hpp:32
@ White
White (or lightest gray in grayscale modes)
@ Black
Black (or darkest gray in grayscale modes)
LineStyle
Definition types.hpp:120
@ Solid
Continuous solid line.
Command for drawing a circle.
Definition commands.hpp:174
constexpr CircleCommand(Point ctr, std::size_t r, Color c=Color::Black, DotPixel w=DotPixel::Pixel1x1, DrawFill f=DrawFill::Empty) noexcept
Construct a circle command with specified parameters.
Definition commands.hpp:190
Color color
Circle color.
Definition commands.hpp:177
DotPixel border_width
Border width.
Definition commands.hpp:178
DrawFill fill
Fill mode (empty/full)
Definition commands.hpp:179
std::size_t radius
Circle radius in pixels.
Definition commands.hpp:176
Point center
Center point.
Definition commands.hpp:175
Command for drawing a line between two points.
Definition commands.hpp:84
Point from
Starting point.
Definition commands.hpp:85
DotPixel width
Line width.
Definition commands.hpp:88
LineStyle style
Line style (solid/dotted)
Definition commands.hpp:89
Point to
Ending point.
Definition commands.hpp:86
Color color
Line color.
Definition commands.hpp:87
constexpr LineCommand(Point from_pt, Point to_pt, Color c=Color::Black, DotPixel w=DotPixel::Pixel1x1, LineStyle s=LineStyle::Solid) noexcept
Construct a line command with specified parameters.
Definition commands.hpp:100
Command for drawing a point (pixel or multi-pixel dot).
Definition commands.hpp:218
Color color
Point color.
Definition commands.hpp:220
Point position
Point position.
Definition commands.hpp:219
constexpr PointCommand(Point pos, Color c=Color::Black, DotPixel s=DotPixel::Pixel1x1) noexcept
Construct a point command with specified parameters.
Definition commands.hpp:230
DotPixel pixel_size
Point size.
Definition commands.hpp:221
Definition geometry.hpp:37
Command for drawing a rectangle.
Definition commands.hpp:129
DrawFill fill
Fill mode (empty/full)
Definition commands.hpp:134
Color color
Rectangle color.
Definition commands.hpp:132
Point top_left
Top-left corner.
Definition commands.hpp:130
Point bottom_right
Bottom-right corner.
Definition commands.hpp:131
DotPixel border_width
Border width.
Definition commands.hpp:133
constexpr RectangleCommand(Point tl, Point br, Color c=Color::Black, DotPixel w=DotPixel::Pixel1x1, DrawFill f=DrawFill::Empty) noexcept
Construct a rectangle command with specified parameters.
Definition commands.hpp:145
Command for drawing text.
Definition commands.hpp:281
TextCommand(Point pos, std::string_view txt, const Font *f, Color fg=Color::Black, Color bg=Color::White) noexcept
Construct a text command with string content.
Definition commands.hpp:301
Color background
Background color.
Definition commands.hpp:286
TextContent content_type
Content type for internal use.
Definition commands.hpp:287
const Font * font
Font to use.
Definition commands.hpp:284
double decimal
Decimal value (for Decimal type)
Definition commands.hpp:289
std::int32_t number
Number value (for Number type)
Definition commands.hpp:288
Point position
Text position.
Definition commands.hpp:282
Color foreground
Foreground (text) color.
Definition commands.hpp:285
TextCommand(Point pos, double dec, std::uint8_t places, const Font *f, Color fg=Color::Black, Color bg=Color::White) noexcept
Construct a text command with decimal content.
Definition commands.hpp:328
std::string text
Text content (or converted number)
Definition commands.hpp:283
std::uint8_t decimal_places
Decimal places (for Decimal type)
Definition commands.hpp:290
TextCommand(Point pos, std::int32_t num, const Font *f, Color fg=Color::Black, Color bg=Color::White) noexcept
Construct a text command with number content.
Definition commands.hpp:314