mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Merge pull request #2146 from abarth/path_functions
Add a bunch of missing Path functions
This commit is contained in:
commit
398ec7f81e
@ -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 addOval(Rect oval);
|
||||
void close();
|
||||
|
||||
void addRect(Rect rect);
|
||||
void addOval(Rect oval);
|
||||
void addArc(Rect oval, float startAngle, float sweepAngle); // angles in radians
|
||||
void addRRect(RRect rrect);
|
||||
|
||||
void close();
|
||||
void reset();
|
||||
|
||||
Path shift(Offset offset);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user