diff --git a/src/color/Color.js b/src/color/Color.js index ac2ca247..794f4417 100644 --- a/src/color/Color.js +++ b/src/color/Color.js @@ -27,7 +27,7 @@ * var circle = new Path.Circle(new Point(80, 50), 30); * * // Pass a color name to the fillColor property, which is internally - * // converted to an RgbColor. + * // converted to a Color. * circle.fillColor = 'green'; * * @classexample {@paperscript} @@ -38,7 +38,7 @@ * var circle = new Path.Circle(new Point(80, 50), 30); * * // Pass a hex string to the fillColor property, which is internally - * // converted to an RgbColor. + * // converted to a Color. * circle.fillColor = '#ff0000'; */ var Color = this.Color = Base.extend(new function() { @@ -245,8 +245,9 @@ var Color = this.Color = Base.extend(new function() { components = Array.prototype.slice.call(components, 0, length); } else { if (argType === 'object') { - // Loop through all possible types and detect type by - // property names. Then convert to components array + if (arg instanceof Color) + return arg.clone(); + // Determine type from property names type = 'hue' in arg ? 'lightness' in arg ? 'hsl' diff --git a/src/item/HitResult.js b/src/item/HitResult.js index 0d35ccc1..bf4f4e82 100644 --- a/src/item/HitResult.js +++ b/src/item/HitResult.js @@ -73,7 +73,7 @@ var HitResult = this.HitResult = Base.extend(/** @lends HitResult# */{ * * @name HitResult#color * @property - * @type RgbColor + * @type Color */ /** diff --git a/src/item/Item.js b/src/item/Item.js index fe24a9d0..925e4b89 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -1792,7 +1792,7 @@ var Item = this.Item = Base.extend(Callback, { * * @name Item#strokeColor * @property - * @type RgbColor|HsbColor|HslColor|GrayColor + * @type Color * * @example {@paperscript} * // Setting the stroke color of a path: @@ -1941,7 +1941,7 @@ var Item = this.Item = Base.extend(Callback, { * * @name Item#fillColor * @property - * @type RgbColor|HsbColor|HslColor|GrayColor + * @type Color * * @example {@paperscript} * // Setting the fill color of a path to red: diff --git a/src/item/Raster.js b/src/item/Raster.js index 5b22bed0..bfcded61 100644 --- a/src/item/Raster.js +++ b/src/item/Raster.js @@ -358,7 +358,7 @@ var Raster = this.Raster = PlacedItem.extend(/** @lends Raster# */{ * effects. * * @param {Path|Rectangle|Point} object - * @return {RgbColor} the average color contained in the area covered by the + * @return {Color} the average color contained in the area covered by the * specified path, rectangle or point. */ getAverageColor: function(object) { @@ -431,7 +431,7 @@ var Raster = this.Raster = PlacedItem.extend(/** @lends Raster# */{ * @function * @param x the x offset of the pixel in pixel coordinates * @param y the y offset of the pixel in pixel coordinates - * @return {RgbColor} the color of the pixel + * @return {Color} the color of the pixel */ /** * Gets the color of a pixel in the raster. @@ -439,7 +439,7 @@ var Raster = this.Raster = PlacedItem.extend(/** @lends Raster# */{ * @name Raster#getPixel * @function * @param point the offset of the pixel as a point in pixel coordinates - * @return {RgbColor} the color of the pixel + * @return {Color} the color of the pixel */ getPixel: function(point) { point = Point.read(arguments); diff --git a/src/style/PathStyle.js b/src/style/PathStyle.js index bd01e724..bcc162a3 100644 --- a/src/style/PathStyle.js +++ b/src/style/PathStyle.js @@ -73,7 +73,7 @@ var PathStyle = this.PathStyle = Style.extend(/** @lends PathStyle# */{ * * @name PathStyle#strokeColor * @property - * @type RgbColor|HsbColor|HslColor|GrayColor + * @type Color * * @example {@paperscript} * // Setting the stroke color of a path: @@ -216,7 +216,7 @@ var PathStyle = this.PathStyle = Style.extend(/** @lends PathStyle# */{ * * @name PathStyle#fillColor * @property - * @type RgbColor|HsbColor|HslColor|GrayColor + * @type Color * * @example {@paperscript} * // Setting the fill color of a path to red: