|
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.
|
#include <graphics.hpp>
Static Public Member Functions | |
| template<FramebufferLike FB> | |
| static auto | draw_line (FB &fb, Point start, Point end, LineStyle style, Color color, Orientation orientation) -> void |
| Draw a line on the framebuffer. | |
| template<FramebufferLike FB> | |
| static auto | draw_rectangle (FB &fb, Point top_left, Point bottom_right, LineStyle style, Color color, DrawFill fill, Orientation orientation) -> void |
| Draw a rectangle on the framebuffer. | |
| template<FramebufferLike FB> | |
| static auto | draw_circle (FB &fb, Point center, std::size_t radius, LineStyle style, Color color, DrawFill fill, Orientation orientation) -> void |
| Draw a circle on the framebuffer. | |
| template<FramebufferLike FB> | |
| static auto | draw_text (FB &fb, Point pos, std::string_view text, const Font &font, Color foreground, Color background, Orientation orientation) -> void |
| Draw text string on the framebuffer. | |
| template<FramebufferLike FB> | |
| static auto | draw_bitmap (FB &fb, Point pos, std::span< const std::uint8_t > data, std::size_t w, std::size_t h, std::size_t target_w, std::size_t target_h, Orientation orientation) -> void |
| Draw a bitmap on the framebuffer. | |
|
static |
Draw a bitmap on the framebuffer.
| FB | FramebufferLike type |
| fb | Target framebuffer |
| pos | Top-left position |
| data | Raw bitmap data |
| w | Source width |
| h | Source height |
| target_w | Target width (scaling) |
| target_h | Target height (scaling) |
| orientation | Coordinate orientation |

|
static |
Draw a circle on the framebuffer.
Midpoint circle algorithm (Bresenham's circle).
| FB | FramebufferLike type |
| fb | Target framebuffer |
| center | Center point |
| radius | Radius in pixels |
| style | Border style |
| color | Circle color |
| fill | Fill mode |
| orientation | Coordinate orientation |
Efficient integer-only circle drawing using 8-way symmetry. Calculates one octant and mirrors to draw all 8 octants simultaneously.
Algorithm Properties:
Octant Symmetry: Computing (x, y) for one octant gives 8 points: (±x, ±y) and (±y, ±x)
Fill Implementation: For filled circles, draws horizontal scan lines between symmetric points in each octant, creating solid interior.
Reference: Derived from Bresenham's line algorithm, adapted for circles.

|
static |
Draw a line on the framebuffer.
Bresenham's line algorithm implementation.
| FB | FramebufferLike type |
| fb | Target framebuffer |
| start | Start point |
| end | End point |
| style | Line style (Solid, Dotted, etc.) |
| color | Line color |
| orientation | Coordinate orientation |
Classic integer-only line drawing algorithm. Efficiently determines which pixels to illuminate on a raster display to approximate a straight line between two points.
Algorithm Properties:
Dotted Line Support:
Reference: Bresenham, J. E. (1965). "Algorithm for computer control of a digital plotter". IBM Systems Journal. 4 (1): 25–30.

|
static |
Draw a rectangle on the framebuffer.
Rectangle drawing via edge decomposition.
| FB | FramebufferLike type |
| fb | Target framebuffer |
| top_left | Top-left corner |
| bottom_right | Bottom-right corner |
| style | Border style |
| color | Rectangle color |
| fill | Fill mode |
| orientation | Coordinate orientation |
Draws rectangle as 4 separate lines (top, right, bottom, left edges). For filled rectangles, draws horizontal scan lines between left and right edges.
Algorithm:
Optimization Note: For filled rectangles, could use faster set_pixel loops instead of draw_line, but current approach reuses line drawing logic for consistency.

|
static |
Draw text string on the framebuffer.
| FB | FramebufferLike type |
| fb | Target framebuffer |
| pos | Top-left position of text |
| text | Text content |
| font | Font to use |
| foreground | Text color |
| background | Background color (Color::None for transparent) |
| orientation | Coordinate orientation |
