Class Index | File Index

Classes


Class fabric.Color

Color
Defined in: color.class.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
fabric.Color(color)
The purpose of fabric.Color is to abstract and encapsulate common color operations; fabric.Color is a constructor and creates instances of fabric.Color objects.
Field Summary
Field Attributes Field Name and Description
<static>  
fabric.Color.reHex
Regex matching color in HEX format (ex: #FF5555, 010155, aff)
<static>  
fabric.Color.reRGBa
Regex matching color in RGB or RGBA formats (ex: rgb(0, 0, 0), rgb(255, 100, 10, 0.5), rgb(1,1,1))
Method Summary
Method Attributes Method Name and Description
<static>  
fabric.Color.fromHex(color)
Returns new color object, when given a color in HEX format
<static>  
fabric.Color.fromRgb(color)
Returns new color object, when given a color in RGB format
<static>  
fabric.Color.fromRgba(color)
Returns new color object, when given a color in RGBA format
<static>  
fabric.Color.fromSource(source)
Returns new color object, when given color in array representation (ex: [200, 100, 100, 0.5])
 
Gets value of alpha channel for this color
 
Returns source of this color (where source is an array representation; ex: [200, 200, 100, 1])
 
overlayWith(otherColor)
Overlays color with another color
 
setAlpha(0-1)
Sets value of alpha channel for this color
 
setSource(source)
Sets source of this color (where source is an array representation; ex: [200, 200, 100, 1])
<static>  
fabric.Color.sourceFromHex(color)
Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HEX format
<static>  
fabric.Color.sourceFromRgb(color)
Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in RGB or RGBA format
 
toBlackWhite(threshold)
Transforms color to its black and white representation
 
Transforms color to its grayscale representation
 
Returns color represenation in HEX format
 
Returns color represenation in RGB format
 
Returns color represenation in RGBA format
Class Detail
fabric.Color(color)
The purpose of fabric.Color is to abstract and encapsulate common color operations; fabric.Color is a constructor and creates instances of fabric.Color objects.
Parameters:
{String} color
(optional) in hex or rgb(a) format
Field Detail
<static> fabric.Color.reHex
Regex matching color in HEX format (ex: #FF5555, 010155, aff)

<static> fabric.Color.reRGBa
Regex matching color in RGB or RGBA formats (ex: rgb(0, 0, 0), rgb(255, 100, 10, 0.5), rgb(1,1,1))
Method Detail
<static> {fabric.Color} fabric.Color.fromHex(color)
Returns new color object, when given a color in HEX format
Parameters:
color
Returns:
{fabric.Color}

<static> {fabric.Color} fabric.Color.fromRgb(color)
Returns new color object, when given a color in RGB format
Parameters:
{String} color
ex: rgb(0-255,0-255,0-255)
Returns:
{fabric.Color}

<static> {fabric.Color} fabric.Color.fromRgba(color)
Returns new color object, when given a color in RGBA format
Parameters:
{String} color
Returns:
{fabric.Color}

<static> {fabric.Color} fabric.Color.fromSource(source)
Returns new color object, when given color in array representation (ex: [200, 100, 100, 0.5])
Parameters:
source
Returns:
{fabric.Color}

{Number} getAlpha()
Gets value of alpha channel for this color
Returns:
{Number} 0-1

{Array} getSource()
Returns source of this color (where source is an array representation; ex: [200, 200, 100, 1])
Returns:
{Array}

{fabric.Color} overlayWith(otherColor)
Overlays color with another color
Parameters:
{String|fabric.Color} otherColor
Returns:
{fabric.Color} thisArg

{fabric.Color} setAlpha(0-1)
Sets value of alpha channel for this color
Parameters:
{Number} 0-1
Returns:
{fabric.Color} thisArg

setSource(source)
Sets source of this color (where source is an array representation; ex: [200, 200, 100, 1])
Parameters:
{Array} source

<static> {Array} fabric.Color.sourceFromHex(color)
Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HEX format
Parameters:
{String} color
ex: FF5555
Returns:
{Array} source

<static> {Array} fabric.Color.sourceFromRgb(color)
Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in RGB or RGBA format
Parameters:
{String} color
ex: rgb(0-255,0-255,0-255)
Returns:
{Array} source

{fabric.Color} toBlackWhite(threshold)
Transforms color to its black and white representation
Parameters:
threshold
Returns:
{fabric.Color} thisArg

{fabric.Color} toGrayscale()
Transforms color to its grayscale representation
Returns:
{fabric.Color} thisArg

{String} toHex()
Returns color represenation in HEX format
Returns:
{String} ex: FF5555

{String} toRgb()
Returns color represenation in RGB format
Returns:
{String} ex: rgb(0-255,0-255,0-255)

{String} toRgba()
Returns color represenation in RGBA format
Returns:
{String} ex: rgba(0-255,0-255,0-255,0-1)

Documentation generated by JsDoc Toolkit 2.4.0 on Thu Oct 14 2010 21:41:42 GMT-0400 (EDT)