mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-08-24 00:19:02 +00:00
SYNC
This commit is contained in:
@@ -36,13 +36,13 @@ Style Style::invert() const {
|
||||
};
|
||||
}
|
||||
|
||||
size_t Painter::draw_char(const Point p, const Style& style, const char c) {
|
||||
int Painter::draw_char(const Point p, const Style& style, const char c) {
|
||||
const auto glyph = style.font.glyph(c);
|
||||
display.draw_glyph(p, glyph, style.foreground, style.background);
|
||||
return glyph.advance().x;
|
||||
}
|
||||
|
||||
size_t Painter::draw_string(Point p, const Style& style, const std::string text) {
|
||||
int Painter::draw_string(Point p, const Style& style, const std::string text) {
|
||||
size_t width = 0;
|
||||
for(const auto c : text) {
|
||||
const auto glyph = style.font.glyph(c);
|
||||
@@ -54,19 +54,19 @@ size_t Painter::draw_string(Point p, const Style& style, const std::string text)
|
||||
return width;
|
||||
}
|
||||
|
||||
void Painter::draw_hline(Point p, size_t width, const Color c) {
|
||||
display.fill_rectangle({ p, { static_cast<Dim>(width), 1 } }, c);
|
||||
void Painter::draw_hline(Point p, int width, const Color c) {
|
||||
display.fill_rectangle({ p, { width, 1 } }, c);
|
||||
}
|
||||
|
||||
void Painter::draw_vline(Point p, size_t height, const Color c) {
|
||||
display.fill_rectangle({ p, { 1, static_cast<Dim>(height) } }, c);
|
||||
void Painter::draw_vline(Point p, int height, const Color c) {
|
||||
display.fill_rectangle({ p, { 1, height } }, c);
|
||||
}
|
||||
|
||||
void Painter::draw_rectangle(const Rect r, const Color c) {
|
||||
draw_hline(r.pos, r.size.w, c);
|
||||
draw_vline({ r.pos.x, static_cast<Coord>(r.pos.y + 1) }, r.size.h - 2, c);
|
||||
draw_vline({ static_cast<Coord>(r.pos.x + r.size.w - 1), static_cast<Coord>(r.pos.y + 1) }, r.size.h - 2, c);
|
||||
draw_hline({ r.pos.x, static_cast<Coord>(r.pos.y + r.size.h - 1) }, r.size.w, c);
|
||||
draw_vline({ r.pos.x, r.pos.y + 1 }, r.size.h - 2, c);
|
||||
draw_vline({ r.pos.x + r.size.w - 1, r.pos.y + 1 }, r.size.h - 2, c);
|
||||
draw_hline({ r.pos.x, r.pos.y + r.size.h - 1 }, r.size.w, c);
|
||||
}
|
||||
|
||||
void Painter::fill_rectangle(const Rect r, const Color c) {
|
||||
|
||||
Reference in New Issue
Block a user