raven/src/Painter.hpp
hippoz 1aec5d3e44
☢️☢️☢️☢️☢️☢️
2022-04-30 09:40:09 +03:00

43 lines
1.2 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> 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 *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);
bool can_paint() { if (m_cairo) return true; else return false; }
void source_rgb(RGB &source_rgb);
void fill();
void begin_paint_group();
void end_paint_group();
};
}