aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/graphics
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-06-08 16:43:16 +0800
committercrupest <crupest@outlook.com>2022-06-08 16:43:16 +0800
commit1e5e914f40503d2a936d1b7db56fcff6d1f8514e (patch)
tree8f3b8adbc5c8e47407d0cb17b10cb2f9624b5418 /include/cru/platform/graphics
parent6795641779916e39e999ea28b51e159a9fade685 (diff)
downloadcru-1e5e914f40503d2a936d1b7db56fcff6d1f8514e.tar.gz
cru-1e5e914f40503d2a936d1b7db56fcff6d1f8514e.tar.bz2
cru-1e5e914f40503d2a936d1b7db56fcff6d1f8514e.zip
...
Diffstat (limited to 'include/cru/platform/graphics')
-rw-r--r--include/cru/platform/graphics/cairo/CairoPainter.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/include/cru/platform/graphics/cairo/CairoPainter.h b/include/cru/platform/graphics/cairo/CairoPainter.h
new file mode 100644
index 00000000..3f6e6e24
--- /dev/null
+++ b/include/cru/platform/graphics/cairo/CairoPainter.h
@@ -0,0 +1,51 @@
+#pragma once
+#include "../Painter.h"
+#include "CairoResource.h"
+
+namespace cru::platform::graphics::cairo {
+class CairoPainter : public CairoResource, public virtual IPainter {
+ public:
+ CairoPainter(CairoGraphicsFactory* factory, cairo_t* cairo,
+ bool auto_release);
+ ~CairoPainter();
+
+ public:
+ Matrix GetTransform() override;
+ void SetTransform(const Matrix& matrix) override;
+
+ void ConcatTransform(const Matrix& matrix) override;
+
+ void Clear(const Color& color) override;
+
+ void DrawLine(const Point& start, const Point& end, IBrush* brush,
+ float width) override;
+ void StrokeRectangle(const Rect& rectangle, IBrush* brush,
+ float width) override;
+ void FillRectangle(const Rect& rectangle, IBrush* brush) override;
+ void StrokeEllipse(const Rect& outline_rect, IBrush* brush,
+ float width) override;
+ void FillEllipse(const Rect& outline_rect, IBrush* brush) override;
+
+ void StrokeGeometry(IGeometry* geometry, IBrush* brush, float width) override;
+ void FillGeometry(IGeometry* geometry, IBrush* brush) override;
+
+ void DrawText(const Point& offset, ITextLayout* text_layout,
+ IBrush* brush) override;
+
+ void DrawImage(const Point& offset, IImage* image) override;
+
+ void PushLayer(const Rect& bounds) override;
+
+ void PopLayer() override;
+
+ void PushState() override;
+
+ void PopState() override;
+
+ void EndDraw() override;
+
+ private:
+ cairo_t* cairo_;
+ bool auto_release_;
+};
+} // namespace cru::platform::graphics::cairo