idfxx 1.0.0
Modern C++23 components for ESP-IDF
Loading...
Searching...
No Matches
gfx.hpp File Reference

Drawing primitives for pixel surfaces. More...

#include <idfxx/error.hpp>
#include <idfxx/font.hpp>
#include <algorithm>
#include <concepts>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <string_view>
#include <utility>

Go to the source code of this file.

Classes

class  idfxx::gfx::canvas< Surface >
 A drawing view bundling a pixel surface with the drawing primitives. More...
 

Namespaces

namespace  idfxx
 
namespace  idfxx::gfx
 Drawing primitives and the pixel surface concept.
 

Concepts

concept  idfxx::gfx::pixel_surface
 A drawable two-dimensional pixel surface.
 

Functions

template<pixel_surface Surface>
void idfxx::gfx::fill_rect (Surface &surface, size_t x, size_t y, size_t width, size_t height, typename Surface::pixel_type ink) noexcept
 Fills a rectangle with the given ink.
 
template<pixel_surface Surface>
void idfxx::gfx::draw_hline (Surface &surface, size_t x, size_t y, size_t length, typename Surface::pixel_type ink) noexcept
 Draws a horizontal line with the given ink.
 
template<pixel_surface Surface>
void idfxx::gfx::draw_vline (Surface &surface, size_t x, size_t y, size_t length, typename Surface::pixel_type ink) noexcept
 Draws a vertical line with the given ink.
 
template<pixel_surface Surface>
void idfxx::gfx::draw_rect (Surface &surface, size_t x, size_t y, size_t width, size_t height, typename Surface::pixel_type ink) noexcept
 Outlines a rectangle with the given ink.
 
template<pixel_surface Surface>
void idfxx::gfx::draw_line (Surface &surface, size_t x0, size_t y0, size_t x1, size_t y1, typename Surface::pixel_type ink) noexcept
 Draws a straight line between two points with the given ink.
 
template<pixel_surface Surface>
void idfxx::gfx::draw_text (Surface &surface, const font::mono_font &font, size_t x, size_t y, std::string_view text, typename Surface::pixel_type ink, unsigned scale=1) noexcept
 Draws text with the given ink.
 
template<pixel_surface Surface>
requires std::same_as<typename Surface::pixel_type, bool>
void idfxx::gfx::draw_text (Surface &surface, const font::mono_font &font, size_t x, size_t y, std::string_view text) noexcept
 Draws text on a monochrome surface, setting glyph ink pixels.
 
template<pixel_surface Surface, typename Dest , typename DrawFn >
requires banded_renderable<Surface, Dest, DrawFn>
void idfxx::gfx::render_banded (Surface &band, Dest &dest, size_t frame_height, DrawFn &&draw)
 Renders a frame taller than its framebuffer, band by band.
 
template<pixel_surface Surface, typename Dest , typename DrawFn >
requires banded_renderable<Surface, Dest, DrawFn>
result< void > idfxx::gfx::try_render_banded (Surface &band, Dest &dest, size_t frame_height, DrawFn &&draw)
 Renders a frame taller than its framebuffer, band by band.
 

Detailed Description

Drawing primitives for pixel surfaces.

Definition in file gfx.hpp.