32 diag_ = diag_ == TL_BR ? TR_BL : TL_BR;
36 diag_ = diag_ == TL_BR ? TR_BL : TL_BR;
43 enum Diagonal { TL_BR = 0, TR_BL = 1 };
45 void drawTo(
const Surface &s)
const override;
47 bool steep()
const {
return y1_ - y0_ > x1_ - x0_; }
61 if (x1 < x0) std::swap(
x0_,
x1_);
62 if (y1 < y0) std::swap(
y0_,
y1_);
84 void drawTo(
const Surface &
s)
const override;
92 :
Border(x0, y0, x1, y1, border, border, border, border,
color) {}
108 left_(left < 0 ? 0 : left),
109 top_(top < 0 ? 0 : top),
110 right_(right < 0 ? 0 : right),
111 bottom_(bottom < 0 ? 0 : bottom) {
112 if ((
x0_ + left_ + 1 >=
x1_ - right_) ||
113 (
y0_ + top_ + 1 >=
y1_ - bottom_)) {
127 void drawTo(
const Surface &
s)
const override;
146 std::unique_ptr<PixelStream>
createStream()
const override;
147 std::unique_ptr<PixelStream>
createStream(
const Box &bounds)
const override;
155 void drawTo(
const Surface &
s)
const override;
164 if (x1 < x0) std::swap(
x0_,
x1_);
165 if (y1 < y0) std::swap(
y0_,
y1_);
190 void drawInteriorTo(
const Surface &
s)
const override;
201 void drawTo(
const Surface &
s)
const override;
268 void drawInteriorTo(
const Surface &s)
const override;
319 void drawTo(
const Surface &s)
const override;
372 void drawInteriorTo(
const Surface &
s)
const override;
385 void drawInteriorTo(
const Surface &
s)
const override;
Base class for simple colored shapes.
Color color() const
Return the shape color.
Rectangle border with configurable thickness on each side.
Border(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t border, Color color)
Border(const roo_display::Box &outer, const roo_display::Box &inner, Color color)
Border(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t left, int16_t top, int16_t right, int16_t bottom, Color color)
Border(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t hborder, int16_t vborder, Color color)
Axis-aligned integer rectangle.
Box extents() const override
Return the bounding box encompassing all pixels that need to be drawn.
CircleBase(int16_t x0, int16_t y0, int16_t diameter, Color color)
static Circle ByRadius(int16_t x_center, int16_t y_center, int16_t radius, Color color)
Create an outline circle by center coordinates and radius.
static Circle ByExtents(int16_t x0, int16_t y0, int16_t diameter, Color color)
Create an outline circle by top-left coordinates and diameter.
static Circle ByExtents(Point top_left, int16_t diameter, Color color)
Create an outline circle by top-left and diameter.
static Circle ByRadius(Point center, int16_t radius, Color color)
Create an outline circle by center point and radius.
ARGB8888 color stored as a 32-bit unsigned integer.
constexpr bool isOpaque() const
Return true if the color is fully opaque (alpha = 255).
Interface for objects that can be drawn to an output device.
static FilledCircle ByExtents(int16_t x0, int16_t y0, int16_t diameter, Color color)
Create a filled circle by top-left coordinates and diameter.
static FilledCircle ByRadius(int16_t x_center, int16_t y_center, int16_t radius, Color color)
Create a filled circle by center coordinates and radius.
static FilledCircle ByExtents(Point top_left, int16_t diameter, Color color)
Create a filled circle by top-left and diameter.
static FilledCircle ByRadius(Point center, int16_t radius, Color color)
Create a filled circle by center point and radius.
Filled rectangle (rasterizable).
Box extents() const override
Return the bounding box encompassing all pixels that need to be drawn.
FilledRect(int16_t x0, int16_t y0, int16_t x1, int16_t y1, Color color)
std::unique_ptr< PixelStream > createStream() const override
Create a stream covering the full extents().
FilledRect(const Box &box, Color color)
void readColors(const int16_t *x, const int16_t *y, uint32_t count, Color *result) const override
Read colors for the given points.
TransparencyMode getTransparencyMode() const override
Return the transparency mode for pixels in this stream.
Filled rounded rectangle.
FilledRoundRect(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t radius, Color color)
FilledTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, Color color)
FilledTriangle(Point a, Point b, Point c, Color color)
A straight line segment between two points.
Line(Point a, Point b, Color color)
Box extents() const override
Return the bounding box encompassing all pixels that need to be drawn.
Line(int16_t x0, int16_t y0, int16_t x1, int16_t y1, Color color)
Drawable that can provide a color for any point within its extents.
Base class for axis-aligned rectangle shapes.
Box extents() const override
Return the bounding box encompassing all pixels that need to be drawn.
RectBase(int16_t x0, int16_t y0, int16_t x1, int16_t y1, Color color)
Rect(int16_t x0, int16_t y0, int16_t x1, int16_t y1, Color color)
Rect(const Box &box, Color color)
Base class for rounded rectangles.
RoundRectBase(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t radius, Color color)
Box extents() const override
Return the bounding box encompassing all pixels that need to be drawn.
Outline rounded rectangle.
RoundRect(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t radius, Color color)
Low-level handle used to draw to an underlying device.
TriangleBase(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, Color color)
Box extents() const override
Return the bounding box encompassing all pixels that need to be drawn.
Triangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, Color color)
Triangle(Point a, Point b, Point c, Color color)
Defines 140 opaque HTML named colors.
TransparencyMode
Transparency information for a stream or color mode.
@ kNone
All colors are fully opaque.
@ kFull
Colors may include partial transparency (alpha channel).
void FillColor(Color *buf, uint32_t count, Color color)
Fill an array with a single color.
Public API surface for roo_display display, touch, and drawing utilities.