2022-03-09 03:46:27 +02:00
|
|
|
#pragma once
|
|
|
|
|
2022-03-09 20:02:18 +02:00
|
|
|
#include "Box.hpp"
|
2022-03-18 02:49:16 +02:00
|
|
|
#include "Point.hpp"
|
|
|
|
#include "src/RGB.hpp"
|
2022-03-09 03:46:27 +02:00
|
|
|
#include <cairomm/cairomm.h>
|
2022-03-18 02:49:16 +02:00
|
|
|
#include <pango/pangocairo.h>
|
2022-03-09 03:46:27 +02:00
|
|
|
|
2022-03-08 02:25:22 +02:00
|
|
|
namespace Raven {
|
|
|
|
|
2022-03-18 02:49:16 +02:00
|
|
|
enum class PaintTextAlign {
|
|
|
|
Center = 0,
|
|
|
|
Left
|
|
|
|
};
|
|
|
|
|
2022-03-08 02:25:22 +02:00
|
|
|
class Painter {
|
2022-03-09 03:46:27 +02:00
|
|
|
private:
|
|
|
|
Cairo::RefPtr<Cairo::Context> m_cairo;
|
2022-03-18 02:49:16 +02:00
|
|
|
PangoFontDescription *m_pango_font_description;
|
2022-03-09 03:46:27 +02:00
|
|
|
public:
|
|
|
|
Painter() {}
|
2022-03-08 02:25:22 +02:00
|
|
|
|
2022-03-09 03:46:27 +02:00
|
|
|
Cairo::RefPtr<Cairo::Context> get_cairo() { return m_cairo; }
|
|
|
|
void set_cairo(Cairo::RefPtr<Cairo::Context> cairo) { m_cairo = cairo; }
|
2022-03-09 20:02:18 +02:00
|
|
|
|
2022-03-18 02:49:16 +02:00
|
|
|
void set_pango_font_description(PangoFontDescription *pango_font_description) { m_pango_font_description = pango_font_description; }
|
|
|
|
PangoFontDescription *get_pango_font_description() { return m_pango_font_description; }
|
|
|
|
|
2022-03-09 20:02:18 +02:00
|
|
|
void rounded_rectangle(Box &geometry, double border_radius);
|
2022-03-18 02:49:16 +02:00
|
|
|
bool text(Point &where, std::string &text);
|
|
|
|
bool text(Box &geometry, std::string &text, PaintTextAlign align);
|
|
|
|
|
|
|
|
void source_rgb(RGB &source_rgb);
|
|
|
|
void fill();
|
2022-03-08 02:25:22 +02:00
|
|
|
};
|
|
|
|
|
2022-03-09 03:46:27 +02:00
|
|
|
}
|