raven/src/Painter.hpp
2022-03-29 09:27:59 +03:00

41 lines
1.1 KiB
C++

#pragma once
#include "Box.hpp"
#include "Point.hpp"
#include "RGB.hpp"
#include "cairomm/xlib_surface.h"
#include <cairomm/cairomm.h>
#include <pango/pangocairo.h>
namespace Raven {
enum class PaintTextAlign {
Center = 0,
Left
};
class Painter {
private:
Cairo::RefPtr<Cairo::Context> m_cairo { nullptr };
PangoFontDescription *m_pango_font_description { nullptr };
public:
Painter() {}
Cairo::RefPtr<Cairo::Context> get_cairo() { return m_cairo; }
void set_cairo(Cairo::RefPtr<Cairo::Context> cairo) { m_cairo = cairo; }
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; }
void rounded_rectangle(Box &geometry, double border_radius);
bool text(Point &where, std::string &text);
bool text(Box &geometry, std::string &text, PaintTextAlign align, PangoEllipsizeMode ellipsize);
void source_rgb(RGB &source_rgb);
void fill();
void begin_paint_group();
void end_paint_group();
};
}