srctree

Robin Linden parent da492d7e dc4f2f16
gfx: Remove Painter API

We were going to put shared high-level logic here, but haven't ended upneeding it yet.

inlinesplit
gfx/BUILD added: 2, removed: 45, total 0
@@ -9,7 +9,6 @@ cc_library(
"color.h",
"font.h",
"icanvas.h",
"painter.h",
],
copts = HASTUR_COPTS,
visibility = ["//visibility:public"],
 
ev/null added: 2, removed: 45, total 0
@@ -1,42 +0,0 @@
// SPDX-FileCopyrightText: 2022 Mikael Larsson <c.mikael.larsson@gmail.com>
// SPDX-FileCopyrightText: 2022-2023 Robin Lindén <dev@robinlinden.eu>
//
// SPDX-License-Identifier: BSD-2-Clause
 
#ifndef GFX_PAINTER_H_
#define GFX_PAINTER_H_
 
#include "gfx/icanvas.h"
 
namespace gfx {
 
class Painter {
public:
explicit Painter(ICanvas &canvas) : canvas_{canvas} {}
 
void fill_rect(geom::Rect const &rect, Color color) { canvas_.fill_rect(rect, color); }
 
void draw_rect(geom::Rect const &rect, Color const &color, Borders const &borders, Corners const &corners) {
canvas_.draw_rect(rect, color, borders, corners);
}
 
void draw_text(geom::Position p,
std::string_view text,
std::span<Font const> font_options,
FontSize size,
FontStyle style,
Color color) {
canvas_.draw_text(p, text, font_options, size, style, color);
}
 
void draw_text(geom::Position p, std::string_view text, Font font, FontSize size, FontStyle style, Color color) {
canvas_.draw_text(p, text, font, size, style, color);
}
 
private:
ICanvas &canvas_;
};
 
} // namespace gfx
 
#endif