aboutsummaryrefslogtreecommitdiff
path: root/src/osx/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'src/osx/graphics')
-rw-r--r--src/osx/graphics/quartz/Geometry.cpp27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/osx/graphics/quartz/Geometry.cpp b/src/osx/graphics/quartz/Geometry.cpp
index 284f5c4d..37e4645b 100644
--- a/src/osx/graphics/quartz/Geometry.cpp
+++ b/src/osx/graphics/quartz/Geometry.cpp
@@ -1,4 +1,5 @@
#include "cru/osx/graphics/quartz/Geometry.h"
+#include "cru/osx/graphics/quartz/Convert.h"
#include <memory>
@@ -23,24 +24,42 @@ QuartzGeometryBuilder::~QuartzGeometryBuilder() {
CGPathRelease(cg_mutable_path_);
}
-void QuartzGeometryBuilder::BeginFigure(const Point &point) {
- CGPathMoveToPoint(cg_mutable_path_, nullptr, point.x, point.y);
+Point QuartzGeometryBuilder::GetCurrentPosition() {
+ return Convert(CGPathGetCurrentPoint(cg_mutable_path_));
}
-void QuartzGeometryBuilder::CloseFigure(bool close) {
- if (close) CGPathCloseSubpath(cg_mutable_path_);
+void QuartzGeometryBuilder::MoveTo(const Point &point) {
+ CGPathMoveToPoint(cg_mutable_path_, nullptr, point.x, point.y);
}
void QuartzGeometryBuilder::LineTo(const Point &point) {
CGPathAddLineToPoint(cg_mutable_path_, nullptr, point.x, point.y);
}
+void QuartzGeometryBuilder::CubicBezierTo(const Point &start_control_point,
+ const Point &end_control_point,
+ const Point &end_point) {
+ CGPathAddCurveToPoint(cg_mutable_path_, nullptr, start_control_point.x,
+ start_control_point.y, end_control_point.x,
+ end_control_point.y, end_point.x, end_point.y);
+}
+
void QuartzGeometryBuilder::QuadraticBezierTo(const Point &control_point,
const Point &end_point) {
CGPathAddQuadCurveToPoint(cg_mutable_path_, nullptr, control_point.x,
control_point.y, end_point.x, end_point.y);
}
+void QuartzGeometryBuilder::ArcTo(const Point &radius, float angle,
+ bool is_large_arc, bool is_clockwise,
+ const Point &end_point) {
+ // TODO: Implement this!
+}
+
+void QuartzGeometryBuilder::CloseFigure(bool close) {
+ if (close) CGPathCloseSubpath(cg_mutable_path_);
+}
+
std::unique_ptr<IGeometry> QuartzGeometryBuilder::Build() {
return std::make_unique<QuartzGeometry>(GetGraphicsFactory(),
CGPathCreateCopy(cg_mutable_path_));