Index: sky/engine/core/painting/Offset.dart |
diff --git a/sky/engine/core/painting/Offset.dart b/sky/engine/core/painting/Offset.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..161bd754c5ca2637d09219f4bb6eea5fb4ab1cf9 |
--- /dev/null |
+++ b/sky/engine/core/painting/Offset.dart |
@@ -0,0 +1,29 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+part of dart.sky; |
+ |
+/// Holds a 2D floating-point offset. |
+/// Think of this as a vector from an unspecified point |
+class Offset extends OffsetBase { |
+ const Offset(dx, dy) : super(dx, dy); |
+ Offset.copy(Offset source) : super(source.dx, source.dy); |
+ |
+ double get dx => _dx; |
+ double get dy => _dy; |
+ |
+ static const Offset zero = const Offset(0.0, 0.0); |
+ static const Offset infinite = const Offset(double.INFINITY, double.INFINITY); |
+ |
+ Offset scale(double scaleX, double scaleY) => new Offset(dx * scaleX, dy * scaleY); |
+ |
+ Offset operator -() => new Offset(-dx, -dy); |
+ Offset operator -(Offset other) => new Offset(dx - other.dx, dy - other.dy); |
+ Offset operator +(Offset other) => new Offset(dx + other.dx, dy + other.dy); |
+ |
+ // does the equivalent of "return new Point(0,0) + this" |
abarth-chromium
2015/06/26 22:04:42
s/new Point(0,0)/Point.origin/
|
+ Point toPoint() => new Point(this.dx, this.dy); |
+ |
+ String toString() => "Offset($dx, $dy)"; |
+} |