aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/platform/graphics')
-rw-r--r--include/cru/platform/graphics/NullPainter.hpp53
-rw-r--r--include/cru/platform/graphics/TextLayout.hpp4
2 files changed, 57 insertions, 0 deletions
diff --git a/include/cru/platform/graphics/NullPainter.hpp b/include/cru/platform/graphics/NullPainter.hpp
new file mode 100644
index 00000000..cf790ccf
--- /dev/null
+++ b/include/cru/platform/graphics/NullPainter.hpp
@@ -0,0 +1,53 @@
+#pragma once
+#include "Painter.hpp"
+
+namespace cru::platform::graphics {
+class NullPainter : public Object, public virtual IPainter {
+ public:
+ NullPainter() = default;
+
+ CRU_DELETE_COPY(NullPainter)
+ CRU_DELETE_MOVE(NullPainter)
+
+ ~NullPainter() override = default;
+
+ public:
+ String GetPlatformId() const override { return u"NULL"; }
+
+ String GetDebugString() override { return u"NullPainter"; }
+
+ Matrix GetTransform() override { return Matrix(); }
+ 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,
+ float width) 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 PushLayer(const Rect& bounds) override{};
+
+ void PopLayer() override {}
+
+ void PushState() override {}
+
+ void PopState() override {}
+
+ void EndDraw() override {}
+};
+} // namespace cru::platform::graphics
diff --git a/include/cru/platform/graphics/TextLayout.hpp b/include/cru/platform/graphics/TextLayout.hpp
index d10c9f22..a040ec3b 100644
--- a/include/cru/platform/graphics/TextLayout.hpp
+++ b/include/cru/platform/graphics/TextLayout.hpp
@@ -20,6 +20,10 @@ struct ITextLayout : virtual IGraphicsResource {
virtual bool IsEditMode() = 0;
virtual void SetEditMode(bool enable) = 0;
+ virtual Index GetLineIndexFromCharIndex(Index char_index) = 0;
+ virtual Index GetLineCount() = 0;
+ virtual float GetLineHeight(Index line_index) = 0;
+
virtual Rect GetTextBounds(bool includingTrailingSpace = false) = 0;
virtual std::vector<Rect> TextRangeRect(const TextRange& text_range) = 0;
// Width is always 0, height is line height.