mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
More work on Color refactoring.
This commit is contained in:
parent
09824e6b91
commit
a48e6e5bf9
5 changed files with 13 additions and 12 deletions
|
@ -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'
|
||||
|
|
|
@ -73,7 +73,7 @@ var HitResult = this.HitResult = Base.extend(/** @lends HitResult# */{
|
|||
*
|
||||
* @name HitResult#color
|
||||
* @property
|
||||
* @type RgbColor
|
||||
* @type Color
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue