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
Classes | Namespaces
styles.hpp File Reference

Reusable style specifications for drawing commands. More...

#include "epaper/core/types.hpp"
#include "epaper/graphics/font.hpp"
Include dependency graph for styles.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  epaper::LineStyleSpec
 
struct  epaper::ShapeStyleSpec
 
struct  epaper::TextStyleSpec
 

Namespaces

namespace  epaper
 

Detailed Description

Reusable style specifications for drawing commands.

Provides style bundle structs that encapsulate related visual properties. Styles can be defined once and applied to multiple commands via with_style() for consistent visual appearance.

Design Pattern:

Style Bundle Pattern
├─ Encapsulation: Group related visual properties (color, width, fill)
├─ Reusability: Define once, apply to many commands
├─ Consistency: Ensure related elements share visual style
└─ Maintainability: Change style in one place, affects all uses

Benefits:

Usage Patterns:

// Define reusable styles
constexpr LineStyleSpec grid_lines{Color::Gray1, DotPixel::Pixel1x1, LineStyle::Dotted};
constexpr ShapeStyleSpec highlight{Color::Red, DotPixel::Pixel2x2, DrawFill::Empty};
constexpr TextStyleSpec header{&font20, Color::Black, Color::White};
// Apply to multiple commands
display.draw(display.line().from({0,0}).to({100,0}).with_style(grid_lines).build());
display.draw(display.line().from({0,10}).to({100,10}).with_style(grid_lines).build());
display.draw(display.rectangle().at({10,10}).size({80,60}).with_style(highlight).build());
display.draw(display.text("Title").at({10,10}).with_style(header).build());

Style Composition:

See also
builders.hpp, LineBuilder::with_style(), RectangleBuilder::with_style()