diff --git a/src/color/GradientColor.js b/src/color/GradientColor.js index 279fc105..08dcba90 100644 --- a/src/color/GradientColor.js +++ b/src/color/GradientColor.js @@ -54,7 +54,7 @@ var GradientColor = Color.extend({ } for (var i = 0, l = this.gradient.stops.length; i < l; i++) { var stop = this.gradient.stops[i]; - gradient.addColorStop(stop.rampPoint, stop.color.getCssString()); + gradient.addColorStop(stop.rampPoint, stop.color.toCssString()); } return gradient; } diff --git a/src/color/GrayColor.js b/src/color/GrayColor.js index 51f5114e..e8aa289e 100644 --- a/src/color/GrayColor.js +++ b/src/color/GrayColor.js @@ -55,7 +55,7 @@ var GrayColor = Color.extend({ + ' }'; }, - getCssString: function() { + toCssString: function() { if (!this._cssString) { var component = Math.round((1 - this.gray) * 255) + ','; this._cssString = 'rgba(' diff --git a/src/color/RGBColor.js b/src/color/RGBColor.js index 92966dcc..6eab5869 100644 --- a/src/color/RGBColor.js +++ b/src/color/RGBColor.js @@ -187,7 +187,7 @@ var RGBColor = Color.extend(new function() { + ' }'; }, - getCssString: function() { + toCssString: function() { if (!this._cssString) { this._cssString = 'rgba(' + (Math.round(this.red * 255)) + ', ' diff --git a/src/path/CompoundPath.js b/src/path/CompoundPath.js index 16edde23..91dc231f 100644 --- a/src/path/CompoundPath.js +++ b/src/path/CompoundPath.js @@ -67,11 +67,11 @@ var CompoundPath = PathItem.extend({ } firstChild.setCtxStyles(ctx); if (firstChild.fillColor) { - ctx.fillStyle = firstChild.fillColor.getCssString(); + ctx.fillStyle = firstChild.fillColor.toCssString(); ctx.fill(); } if (firstChild.strokeColor) { - ctx.strokeStyle = firstChild.strokeColor.getCssString(); + ctx.strokeStyle = firstChild.strokeColor.toCssString(); ctx.stroke(); } } diff --git a/test/tests/Color.js b/test/tests/Color.js index 57767e3c..aecf073c 100644 --- a/test/tests/Color.js +++ b/test/tests/Color.js @@ -5,7 +5,7 @@ test('Set named color', function() { var path = new Path(); path.fillColor = 'red'; compareRGBColors(path.fillColor, new RGBColor(1, 0, 0)); - equals(path.fillColor.getCssString(), 'rgba(255, 0, 0, 1)'); + equals(path.fillColor.toCssString(), 'rgba(255, 0, 0, 1)'); }); test('Set color to hex', function() { @@ -13,12 +13,12 @@ test('Set color to hex', function() { var path = new Path(); path.fillColor = '#ff0000'; compareRGBColors(path.fillColor, new RGBColor(1, 0, 0)); - equals(path.fillColor.getCssString(), 'rgba(255, 0, 0, 1)'); + equals(path.fillColor.toCssString(), 'rgba(255, 0, 0, 1)'); var path = new Path(); path.fillColor = '#f00'; compareRGBColors(path.fillColor, new RGBColor(1, 0, 0)); - equals(path.fillColor.getCssString(), 'rgba(255, 0, 0, 1)'); + equals(path.fillColor.toCssString(), 'rgba(255, 0, 0, 1)'); }); test('Set color to object', function() { @@ -26,12 +26,12 @@ test('Set color to object', function() { var path = new Path(); path.fillColor = { red: 1, green: 0, blue: 1}; compareRGBColors(path.fillColor, new RGBColor(1, 0, 1)); - equals(path.fillColor.getCssString(), 'rgba(255, 0, 255, 1)'); + equals(path.fillColor.toCssString(), 'rgba(255, 0, 255, 1)'); var path = new Path(); path.fillColor = { gray: 0.2 }; compareRGBColors(path.fillColor, new RGBColor(0.8, 0.8, 0.8)); - equals(path.fillColor.getCssString(), 'rgba(204, 204, 204, 1)'); + equals(path.fillColor.toCssString(), 'rgba(204, 204, 204, 1)'); }); test('Set color to array', function() { @@ -39,7 +39,7 @@ test('Set color to array', function() { var path = new Path(); path.fillColor = [1, 0, 0]; compareRGBColors(path.fillColor, new RGBColor(1, 0, 0)); - equals(path.fillColor.getCssString(), 'rgba(255, 0, 0, 1)'); + equals(path.fillColor.toCssString(), 'rgba(255, 0, 0, 1)'); }); test('Get gray from RGBColor', function() {