Browse files

Remove obsolete API.

  • Loading branch information...
1 parent 1135b0b commit f3bd38caa2b114a972dd920ce4a93fe51c835405 @moriyoshi moriyoshi committed May 4, 2012
Showing with 44 additions and 87 deletions.
  1. +0 −2 Makefile
  2. +5 −5 examples/example0.html
  3. +6 −6 examples/example1.html
  4. +0 −16 src/util/Path.js
  5. +0 −24 src/util/Style.js
  6. +0 −4 src/util/util.js
  7. +13 −0 tests/Color.js
  8. +20 −0 tests/Stroke.js
  9. +0 −30 tests/Util_Style.js
View
2 Makefile
@@ -15,8 +15,6 @@ MYSRCS = \
src/conf.js \
src/main.js \
src/util/Matrix.js \
- src/util/Path.js \
- src/util/Style.js \
src/util/util.js \
src/lib/MultipleKeyHash.js \
src/lib/browser.js \
View
10 examples/example0.html
@@ -19,15 +19,15 @@
var p1 = drawable.draw(
new Fashion.Path(
- Fashion.Util.Path.convertPathString('M 0 50 L 0 0 50 0')));
+ new Fashion.PathData('M 0 50 L 0 0 50 0')));
var p2 = drawable.draw(
new Fashion.Path(
- Fashion.Util.Path.convertPathString('M 0 50 L 0 0 50 0')));
+ new Fashion.PathData('M 0 50 L 0 0 50 0')));
var p3 = drawable.draw(
new Fashion.Path(
- Fashion.Util.Path.convertPathString('M 0 50 L 0 0 50 0')));
+ new Fashion.PathData('M 0 50 L 0 0 50 0')));
p2.transform({translate: {x: 50, y: 90}}, {rotate: {angle: -45}});
p3.transform({translate: {x: 50, y: 90}}, {rotate: {angle: -45}}, {translate: {x: 130, y: 160}});
@@ -36,7 +36,7 @@
fill: null,
stroke: {
width: 10,
- color: Fashion.Util.Style.convertColorString('#FF0000FF')
+ color: new Fashion.Color('#FF0000FF')
}
});
@@ -78,7 +78,7 @@
var p = drawable.draw(
new Fashion.Path(
- Fashion.Util.Path.convertPathString(
+ new Fashion.PathData(
'M 0 -10 L 5.88 8.09 -9.51 -3.09 9.51 -3.09 -5.88 8.09 Z')));
p.position({x: Math.random()*1000, y: Math.random()*1000});
p.size({width: Math.random()*300, height: Math.random()*300});
View
12 examples/example1.html
@@ -37,7 +37,7 @@
<div class="stage"></div>
<script type="text/javascript">
var drawable = new Fashion.Drawable(last(document.getElementsByTagName('div')));
- var path = drawable.draw(new Fashion.Path(Fashion.Util.Path.convertPathString("M 32 0 L 51.72 60.54 0 23.03 63 23.03 12.27 60.54 Z")));
+ var path = drawable.draw(new Fashion.Path(new Fashion.PathData("M 32 0 L 51.72 60.54 0 23.03 63 23.03 12.27 60.54 Z")));
path.style({ stroke: null, fill: new Fashion.FloodFill(new Fashion.Color("#fc0")) });
</script>
</td>
@@ -48,7 +48,7 @@
<div class="stage"></div>
<script type="text/javascript">
var drawable = new Fashion.Drawable(last(document.getElementsByTagName('div')));
- var path = drawable.draw(new Fashion.Path(Fashion.Util.Path.convertPathString("M 32 0 L 51.72 60.54 0 23.03 63 23.03 12.27 60.54 Z")));
+ var path = drawable.draw(new Fashion.Path(new Fashion.PathData("M 32 0 L 51.72 60.54 0 23.03 63 23.03 12.27 60.54 Z")));
path.style({ stroke: null, fill: new Fashion.LinearGradientFill([[0, new Fashion.Color("#fc0")], [1, new Fashion.Color("#fff")]], .125) });
</script>
</td>
@@ -59,7 +59,7 @@
<div class="stage"></div>
<script type="text/javascript">
var drawable = new Fashion.Drawable(last(document.getElementsByTagName('div')));
- var path = drawable.draw(new Fashion.Path(Fashion.Util.Path.convertPathString("M 32 0 L 51.72 60.54 0 23.03 63 23.03 12.27 60.54 Z")));
+ var path = drawable.draw(new Fashion.Path(new Fashion.PathData("M 32 0 L 51.72 60.54 0 23.03 63 23.03 12.27 60.54 Z")));
path.style({ stroke: null, fill: new Fashion.RadialGradientFill([[0, new Fashion.Color("#fc0")], [1, new Fashion.Color("#fff")]], { x: "50%", y: "50%" }) });
</script>
</td>
@@ -70,7 +70,7 @@
<div class="stage"></div>
<script type="text/javascript">
var drawable = new Fashion.Drawable(last(document.getElementsByTagName('div')));
- var path = drawable.draw(new Fashion.Path(Fashion.Util.Path.convertPathString("M 32 0 L 51.72 60.54 0 23.03 63 23.03 12.27 60.54 Z")));
+ var path = drawable.draw(new Fashion.Path(new Fashion.PathData("M 32 0 L 51.72 60.54 0 23.03 63 23.03 12.27 60.54 Z")));
path.style({ stroke: null, fill: new Fashion.ImageTileFill(new Fashion.ImageData("pattern.gif")) });
</script>
</td>
@@ -81,7 +81,7 @@
<div class="stage"></div>
<script type="text/javascript">
var drawable = new Fashion.Drawable(last(document.getElementsByTagName('div')));
- var path = drawable.draw(new Fashion.Path(Fashion.Util.Path.convertPathString("M 32 0 L 51.72 60.54 0 23.03 63 23.03 12.27 60.54 Z")));
+ var path = drawable.draw(new Fashion.Path(new Fashion.PathData("M 32 0 L 51.72 60.54 0 23.03 63 23.03 12.27 60.54 Z")));
path.style({ stroke: new Fashion.Stroke(new Fashion.Color("#000"), 1), fill: null });
</script>
</td>
@@ -92,7 +92,7 @@
<div class="stage"></div>
<script type="text/javascript">
var drawable = new Fashion.Drawable(last(document.getElementsByTagName('div')));
- var path = drawable.draw(new Fashion.Path(Fashion.Util.Path.convertPathString("M 32 0 L 51.72 60.54 0 23.03 63 23.03 12.27 60.54 Z")));
+ var path = drawable.draw(new Fashion.Path(new Fashion.PathData("M 32 0 L 51.72 60.54 0 23.03 63 23.03 12.27 60.54 Z")));
path.style({ stroke: new Fashion.Stroke(new Fashion.Color("#000"), 1, [1, 1]), fill: null });
</script>
</td>
View
16 src/util/Path.js
@@ -1,16 +0,0 @@
-var Path = (function() {
-
- var identifierArglen = {
- Z:0, H:1, V:1, M:2, L:2, T:2, R:2, S:4, Q:4, C:6, A:7
- };
-
- var _Path = _class("Util.Path", {
- class_methods: {
- convertPathString: function(points) {
- return new PathData(points);
- }
- }
- });
-
- return _Path;
-})();
View
24 src/util/Style.js
@@ -1,24 +0,0 @@
-var Style = (function() {
-
- var _Style = _class("Util.Style", {
-
- class_methods: {
- convertStyleString: function() {
- },
-
- convertFillString: function() {
- },
-
- convertStrokeString: function(str) {
- return new Stroke(str);
- },
-
- convertColorString: function(str) {
- return new Color(str);
- }
- }
- });
-
- return _Style;
-
-})();
View
4 src/util/util.js
@@ -3,12 +3,8 @@ var Util = (function() {
var Util = {};
include("Matrix.js");
- include("Path.js");
- include("Style.js");
Util.Matrix = Matrix;
- Util.Path = Path;
- Util.Style = Style;
return Util;
View
13 tests/Color.js
@@ -0,0 +1,13 @@
+var Fashion = require('../fashion.js');
+
+exports.Color = {
+ testColor: function(test) {
+ test.expect(5);
+ test.deepEqual(new Fashion.Color("#ccc"), { r: 204, g: 204, b: 204, a: 255 });
+ test.deepEqual(new Fashion.Color("#FFFFFF"), { r: 255, g: 255, b: 255, a: 255 });
+ test.deepEqual(new Fashion.Color("#7F7F7F00"), { r: 127, g: 127, b: 127, a: 0 });
+ test.deepEqual(new Fashion.Color("white"), { r: 255, g: 255, b: 255, a: 255 });
+ test.deepEqual(new Fashion.Color("aqua"), { r: 0, g: 255, b: 255, a: 255 });
+ test.done();
+ }
+};
View
20 tests/Stroke.js
@@ -0,0 +1,20 @@
+var Fashion = require('../fashion.js');
+
+exports.Stroke = {
+ testStroke: function(test) {
+ test.expect(6);
+ test.deepEqual(new Fashion.Stroke("#CCC"),
+ { color: { r: 204, g: 204, b: 204, a: 255 }, width: null, pattern: null });
+ test.deepEqual(new Fashion.Stroke(" #CCC "),
+ { color: { r: 204, g: 204, b: 204, a: 255 }, width: null, pattern: null });
+ test.deepEqual(new Fashion.Stroke(" #CCC 10"),
+ { color: { r: 204, g: 204, b: 204, a: 255 }, width: 10, pattern: null });
+ test.deepEqual(new Fashion.Stroke(" #CCC 10 "),
+ { color: { r: 204, g: 204, b: 204, a: 255 }, width: 10, pattern: null });
+ test.deepEqual(new Fashion.Stroke(" #CCC 10 --__"),
+ { color: { r: 204, g: 204, b: 204, a: 255 }, width: 10, pattern: [ 2, 2 ] });
+ test.deepEqual(new Fashion.Stroke(" #CCC 100 -_--_"),
+ { color: { r: 204, g: 204, b: 204, a: 255 }, width: 100, pattern: [ 1, 1, 2, 1 ] });
+ test.done();
+ }
+};
View
30 tests/Util_Style.js
@@ -1,30 +0,0 @@
-var Fashion = require('../fashion.js');
-
-exports.Util_Style = {
- testConvertStrokeString: function(test) {
- test.expect(6);
- test.deepEqual(Fashion.Util.Style.convertStrokeString("#CCC"),
- { color: { r: 204, g: 204, b: 204, a: 255 }, width: null, pattern: null });
- test.deepEqual(Fashion.Util.Style.convertStrokeString(" #CCC "),
- { color: { r: 204, g: 204, b: 204, a: 255 }, width: null, pattern: null });
- test.deepEqual(Fashion.Util.Style.convertStrokeString(" #CCC 10"),
- { color: { r: 204, g: 204, b: 204, a: 255 }, width: 10, pattern: null });
- test.deepEqual(Fashion.Util.Style.convertStrokeString(" #CCC 10 "),
- { color: { r: 204, g: 204, b: 204, a: 255 }, width: 10, pattern: null });
- test.deepEqual(Fashion.Util.Style.convertStrokeString(" #CCC 10 --__"),
- { color: { r: 204, g: 204, b: 204, a: 255 }, width: 10, pattern: [ 2, 2 ] });
- test.deepEqual(Fashion.Util.Style.convertStrokeString(" #CCC 100 -_--_"),
- { color: { r: 204, g: 204, b: 204, a: 255 }, width: 100, pattern: [ 1, 1, 2, 1 ] });
- test.done();
- },
-
- testConvertColorString: function(test) {
- test.expect(5);
- test.deepEqual(Fashion.Util.Style.convertColorString("#ccc"), { r: 204, g: 204, b: 204, a: 255 });
- test.deepEqual(Fashion.Util.Style.convertColorString("#FFFFFF"), { r: 255, g: 255, b: 255, a: 255 });
- test.deepEqual(Fashion.Util.Style.convertColorString("#7F7F7F00"), { r: 127, g: 127, b: 127, a: 0 });
- test.deepEqual(Fashion.Util.Style.convertColorString("white"), { r: 255, g: 255, b: 255, a: 255 });
- test.deepEqual(Fashion.Util.Style.convertColorString("aqua"), { r: 0, g: 255, b: 255, a: 255 });
- test.done();
- }
-};

0 comments on commit f3bd38c

Please sign in to comment.