提交 19f6331a 编写于 作者: A Adam Barth

Add a bunch of missing Path functions

Part of #252
上级 3df1de91
......@@ -9,6 +9,7 @@
#include "sky/engine/core/painting/Offset.h"
#include "sky/engine/core/painting/Rect.h"
#include "sky/engine/core/painting/RRect.h"
#include "sky/engine/tonic/dart_wrappable.h"
#include "sky/engine/wtf/PassRefPtr.h"
#include "sky/engine/wtf/RefCounted.h"
......@@ -29,25 +30,25 @@ public:
return adoptRef(new CanvasPath);
}
void moveTo(float x, float y)
{
m_path.moveTo(x, y);
}
void lineTo(float x, float y)
{
m_path.lineTo(x, y);
}
void arcTo(const Rect& rect, float startAngle, float sweepAngle, bool forceMoveTo)
{
void moveTo(float x, float y) { m_path.moveTo(x, y); }
void relativeMoveTo(float x, float y) { m_path.rMoveTo(x, y); }
void lineTo(float x, float y) { m_path.lineTo(x, y); }
void relativeLineTo(float x, float y) { m_path.rLineTo(x, y); }
void quadraticBezierTo(float x1, float y1, float x2, float y2) { m_path.quadTo(x1, y1, x2, y2); }
void relativeQuadraticBezierTo(float x1, float y1, float x2, float y2) { m_path.rQuadTo(x1, y1, x2, y2); }
void cubicTo(float x1, float y1, float x2, float y2, float x3, float y3) { m_path.cubicTo(x1, y1, x2, y2, x3, y3); }
void relativeCubicTo(float x1, float y1, float x2, float y2, float x3, float y3) { m_path.rCubicTo(x1, y1, x2, y2, x3, y3); }
void conicTo(float x1, float y1, float x2, float y2, float w) { m_path.conicTo(x1, y1, x2, y2, w); }
void relativeConicTo(float x1, float y1, float x2, float y2, float w) { m_path.rConicTo(x1, y1, x2, y2, w); }
void arcTo(const Rect& rect, float startAngle, float sweepAngle, bool forceMoveTo) {
m_path.arcTo(rect.sk_rect, startAngle*180.0/M_PI, sweepAngle*180.0/M_PI, forceMoveTo);
}
void addOval(const Rect& oval)
{
m_path.addOval(oval.sk_rect);
void addRect(const Rect& rect) { m_path.addRect(rect.sk_rect); }
void addOval(const Rect& oval) { m_path.addOval(oval.sk_rect); }
void addArc(const Rect& rect, float startAngle, float sweepAngle) {
m_path.addArc(rect.sk_rect, startAngle*180.0/M_PI, sweepAngle*180.0/M_PI);
}
void addRRect(const RRect& rrect) { m_path.addRRect(rrect.sk_rrect); }
void close()
{
......
......@@ -7,11 +7,23 @@
ImplementedAs=CanvasPath,
] interface Path {
void moveTo(float x, float y);
void relativeMoveTo(float dx, float dy);
void lineTo(float x, float y);
void relativeLineTo(float dx, float dy);
void quadraticBezierTo(float x1, float y1, float x2, float y2);
void relativeQuadraticBezierTo(float x1, float y1, float x2, float y2);
void cubicTo(float x1, float y1, float x2, float y2, float x3, float y3);
void relativeCubicTo(float x1, float y1, float x2, float y2, float x3, float y3);
void conicTo(float x1, float y1, float x2, float y2, float w);
void relativeConicTo(float x1, float y1, float x2, float y2, float w);
void arcTo(Rect rect, float startAngle, float sweepAngle, boolean forceMoveTo); // angles in radians
void addRect(Rect rect);
void addOval(Rect oval);
void close();
void addArc(Rect oval, float startAngle, float sweepAngle); // angles in radians
void addRRect(RRect rrect);
void close();
void reset();
Path shift(Offset offset);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册