EN
RU
Portals
0.7.0 · dev
0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Toggle main menu visibility
Loading...
Searching...
No Matches
canvas.hpp
1
// Copyright (c) 2026 ttldtor.
2
// SPDX-License-Identifier: BSL-1.0
3
#pragma once
4
#include <portals/widget_types.hpp>
5
6
namespace
portals
{
12
class
Canvas
{
13
public
:
20
Canvas
(
PaintContext
&context,
CellRect
clip,
const
GraphemeText
*brush =
nullptr
) noexcept;
26
std::expected<
void
,
TreeError
>
point
(
CellPoint
position,
CellStyle
style = {});
34
std::expected<void, TreeError>
line
(
CellPoint
first,
CellPoint
last,
CellStyle
style = {});
35
36
private
:
37
PaintContext
&context_;
38
CellRect
clip_;
39
const
GraphemeText
*brush_;
40
};
41
}
// namespace portals
portals::Canvas::Canvas
Canvas(PaintContext &context, CellRect clip, const GraphemeText *brush=nullptr) noexcept
Borrow a sink and optional one-cell glyph for this frame.
portals::Canvas::point
std::expected< void, TreeError > point(CellPoint position, CellStyle style={})
Draw a cell if it is inside the clip.
portals::Canvas::line
std::expected< void, TreeError > line(CellPoint first, CellPoint last, CellStyle style={})
Rasterize an inclusive DDA line, rounding ties away from zero, then clip. Only the clip's dominant-ax...
portals::CellRect
An owning, invariant-preserving half-open cell rectangle.
Definition
geometry.hpp:81
portals::GraphemeText
Owning validated UTF-8 and immutable extended grapheme measurements.
Definition
text.hpp:145
portals::PaintContext
Borrowed synchronous command sink supplied by the frame owner. submit must consume commands immediate...
Definition
widget_types.hpp:66
portals
Public Portals API.
Definition
action.hpp:8
portals::TreeError
TreeError
Checked tree failures; rejected operations never start the requested callback.
Definition
widget_types.hpp:26
portals::CellPoint
An owning value in terminal columns/rows, x right and y down.
Definition
geometry.hpp:24
portals::CellStyle
Small owning paint value, independent of themes and text metrics.
Definition
cell_buffer.hpp:35
include
portals
canvas.hpp