API  0.9.6
 All Classes Files Functions Variables Macros Modules Pages
CPColor Class Reference

#import <CPColor.h>

+ Inheritance diagram for CPColor:

Instance Methods

(float) - alphaComponent
 
(float) - blueComponent
 
(CPColor- colorUsingColorSpaceName:
 
(CPColor- colorWithAlphaComponent:
 
(CPArray- components
 
(CPString- cssString
 
(CPString- description
 
(void) - encodeWithCoder:
 
(float) - greenComponent
 
(CPString- hexString
 
(CPArray- hsbComponents
 
(id) - initWithCoder:
 
(BOOL) - isEqual:
 
(CPImage- patternImage
 
(float) - redComponent
 
(void) - set
 
(void) - setFill
 
(void) - setStroke
 
- Instance Methods inherited from CPObject
(void) - addObserver:forKeyPath:options:context:
 
(void) - applyChange:toKeyPath:
 
(id) - autorelease
 
(id) - awakeAfterUsingCoder:
 
(void) - awakeFromCib
 
(void) - bind:toObject:withKeyPath:options:
 
(Class) - classForCoder
 
(Class) - classForKeyedArchiver
 
(CPString- className
 
(id) - copy
 
(void) - dealloc
 
(CPDictionary- dictionaryWithValuesForKeys:
 
(void) - didChange:valuesAtIndexes:forKey:
 
(void) - didChangeValueForKey:
 
(void) - didChangeValueForKey:withSetMutation:usingObjects:
 
(void) - doesNotRecognizeSelector:
 
(CPArray- exposedBindings
 
(id) - forwardingTargetForSelector:
 
(void) - forwardInvocation:
 
(unsigned) - hash
 
(BOOL) - implementsSelector:
 
(CPDictionary- infoForBinding:
 
(id) - init
 
(BOOL) - isEqual:
 
(BOOL) - isKindOfClass:
 
(BOOL) - isMemberOfClass:
 
(BOOL) - isProxy
 
(IMP) - methodForSelector:
 
(CPMethodSignature) - methodSignatureForSelector:
 
(id) - mutableArrayValueForKey:
 
(id) - mutableArrayValueForKeyPath:
 
(id) - mutableCopy
 
(id) - mutableSetValueForKey:
 
(id) - mutableSetValueForKeyPath:
 
(id) - performSelector:
 
(id) - performSelector:withObject:
 
(id) - performSelector:withObject:withObject:
 
(id) - performSelector:withObjects:
 
(void) - release
 
(void) - removeObserver:forKeyPath:
 
(id) - replacementObjectForArchiver:
 
(id) - replacementObjectForCoder:
 
(id) - replacementObjectForKeyedArchiver:
 
(BOOL) - respondsToSelector:
 
(id) - retain
 
(id) - self
 
(void) - setValue:forKey:
 
(void) - setValue:forKeyPath:
 
(void) - setValue:forUndefinedKey:
 
(void) - setValuesForKeysWithDictionary:
 
(CPString- UID
 
(void) - unbind:
 
(Class) - valueClassForBinding:
 
(id) - valueForKey:
 
(id) - valueForKeyPath:
 
(id) - valueForUndefinedKey:
 
(void) - willChange:valuesAtIndexes:forKey:
 
(void) - willChangeValueForKey:
 
(void) - willChangeValueForKey:withSetMutation:usingObjects:
 

Class Methods

(CPColor+ alternateSelectedControlColor
 
(CPColor+ blackColor
 
(CPColor+ blueColor
 
(CPColor+ brownColor
 
(CPColor+ clearColor
 
(CPColor+ colorWithCalibratedRed:green:blue:alpha:
 
(CPColor+ colorWithCalibratedWhite:alpha:
 
(CPColor+ colorWithCSSString:
 
(CPColor+ colorWithHexString:
 
(CPColor+ colorWithHue:saturation:brightness:
 
(CPColor+ colorWithHue:saturation:brightness:alpha:
 
(CPColor+ colorWithPatternImage:
 
(CPColor+ colorWithRed:green:blue:alpha:
 
(CPColor+ colorWithSRGBRed:green:blue:alpha:
 
(CPColor+ colorWithWhite:alpha:
 
(CPColor+ cyanColor
 
(CPColor+ darkGrayColor
 
(CPColor+ grayColor
 
(CPColor+ greenColor
 
(CPColor+ lightGrayColor
 
(CPColor+ magentaColor
 
(CPColor+ orangeColor
 
(CPColor+ purpleColor
 
(CPColor+ randomColor
 
(CPColor+ redColor
 
(CPColor+ secondarySelectedControlColor
 
(CPColor+ shadowColor
 
(CPColor+ whiteColor
 
(CPColor+ yellowColor
 
- Class Methods inherited from CPObject
(BOOL) + accessInstanceVariablesDirectly
 
(id) + alloc
 
(id) + allocWithCoder:
 
(BOOL) + automaticallyNotifiesObserversForKey:
 
(Class) + class
 
(void) + exposeBinding:
 
(void) + initialize
 
(IMP) + instanceMethodForSelector:
 
(BOOL) + instancesRespondToSelector:
 
(BOOL) + isSubclassOfClass:
 
(CPSet+ keyPathsForValuesAffectingValueForKey:
 
(void) + load
 
(id) + new
 
(void) + setVersion:
 
(Class) + superclass
 
(int) + version
 

Additional Inherited Members

- Instance Variables inherited from CPObject
Class isa
 

Detailed Description

CPColor can be used to represent color in an RGB or HSB model with an optional transparency value.

It also provides some class helper methods that returns instances of commonly used colors.

Definition at line 2 of file CPColor.h.

Method Documentation

- (float) alphaComponent
implementation

Returns the alpha component of this color.

Definition at line 549 of file CPColor.j.

+ (CPColor) alternateSelectedControlColor
implementation

Definition at line 441 of file CPColor.j.

+ (CPColor) blackColor
implementation

Returns a black color object. (RGBA=[0.0, 0.0, 0.0, 1.0])

Definition at line 266 of file CPColor.j.

+ (CPColor) blueColor
implementation

Returns a blue color object. (RGBA=[0.0, 0.0, 1.0, 1.0])

Definition at line 277 of file CPColor.j.

- (float) blueComponent
implementation

Returns the blue component of this color.

Definition at line 557 of file CPColor.j.

+ (CPColor) brownColor
implementation

Returns a brown color object (RGBA=[0.6, 0.4, 0.2, 1.0])

Definition at line 365 of file CPColor.j.

+ (CPColor) clearColor
implementation

Returns a clear color (RGBA=[0.0, 0.0, 0.0, 0.0])

Definition at line 433 of file CPColor.j.

- (CPColor) colorUsingColorSpaceName: (id)  aColorSpaceName
implementation

Returns the receiver. This method is a placeholder that does nothing but may be implemented in the future.

Definition at line 613 of file CPColor.j.

- (CPColor) colorWithAlphaComponent: (float)  anAlphaComponent
implementation

Returns a new color with the same RGB as the receiver but a new alpha component.

Parameters
anAlphaComponentthe alpha component for the new color
Returns
a new color object

Definition at line 601 of file CPColor.j.

+ (CPColor) colorWithCalibratedRed: (float)  red
green: (float)  green
blue: (float)  blue
alpha: (float)  alpha 
implementation
Deprecated:
in favor of colorWithRed:green:blue:alpha:

Creates a color in the RGB colorspace, with an alpha value. Each component should be between the range of 0.0 to 1.0. For the alpha component, a value of 1.0 is opaque, and 0.0 means completely transparent.

Parameters
redthe red component of the color
greenthe green component of the color
bluethe blue component of the color
alphathe alpha component
Returns
a color initialized to the values specified

Definition at line 164 of file CPColor.j.

+ (CPColor) colorWithCalibratedWhite: (float)  white
alpha: (float)  alpha 
implementation
Deprecated:
in favor of colorWithWhite:alpha:

Creates a new color object with white for the RGB components. For the alpha component, a value of 1.0 is opaque, and 0.0 means completely transparent.

Parameters
whitea float between 0.0 and 1.0
alphathe alpha component between 0.0 and 1.0
Returns
a color initialized to the values specified

Definition at line 195 of file CPColor.j.

+ (CPColor) colorWithCSSString: (CPString aString
implementation

Creates a CPColor from a valid CSS RGB string. Example, "rgb(32,64,129)".

Parameters
aStringa CSS color string
Returns
a color initialized to the value in the css string

Definition at line 467 of file CPColor.j.

+ (CPColor) colorWithHexString: (string)  hex
implementation

Creates an RGB color from a hexadecimal string. For example, the a string of "FFFFFF" would return a white CPColor. "FF0000" would return a pure red, "00FF00" would return a pure blue, and "0000FF" would return a pure green.

Parameters
hexa 6 character long string of hex
Returns
an initialized RGB color

Definition at line 246 of file CPColor.j.

+ (CPColor) colorWithHue: (float)  hue
saturation: (float)  saturation
brightness: (float)  brightness 
implementation

Creates a new color in HSB space.

Parameters
huethe hue value
saturationthe saturation value
brightnessthe brightness value
Returns
the initialized color

Definition at line 209 of file CPColor.j.

+ (CPColor) colorWithHue: (float)  hue
saturation: (float)  saturation
brightness: (float)  brightness
alpha: (float)  alpha 
implementation

Definition at line 214 of file CPColor.j.

+ (CPColor) colorWithPatternImage: (CPImage anImage
implementation

Creates a color using a tile pattern with anImage

Parameters
theimage to tile
Returns
a tiled image color object

Definition at line 456 of file CPColor.j.

+ (CPColor) colorWithRed: (float)  red
green: (float)  green
blue: (float)  blue
alpha: (float)  alpha 
implementation

Creates a color in the RGB colorspace, with an alpha value. Each component should be between the range of 0.0 to 1.0. For the alpha component, a value of 1.0 is opaque, and 0.0 means completely transparent.

Parameters
redthe red component of the color
greenthe green component of the color
bluethe blue component of the color
alphathe alpha component
Returns
a color initialized to the values specified

Definition at line 144 of file CPColor.j.

+ (CPColor) colorWithSRGBRed: (float)  red
green: (float)  green
blue: (float)  blue
alpha: (float)  alpha 
implementation

Creates a color in the sRGB colorspace with the given components and alpha values. Values below 0.0 are treated as 0.0 and values above 1.0 are treated as 1.0.

Definition at line 256 of file CPColor.j.

+ (CPColor) colorWithWhite: (float)  white
alpha: (float)  alpha 
implementation

Creates a new color object with white for the RGB components. For the alpha component, a value of 1.0 is opaque, and 0.0 means completely transparent.

Parameters
whitea float between 0.0 and 1.0
alphathe alpha component between 0.0 and 1.0
Returns
a color initialized to the values specified

Definition at line 179 of file CPColor.j.

- (CPArray) components
implementation

Returns the RGBA components of this color in an array. The index values are ordered as:

Index   Component
0       Red
1       Green
2       Blue
3       Alpha

Definition at line 589 of file CPColor.j.

- (CPString) cssString
implementation

Returns the CSS representation of this color. The color will be in one of the following forms:

rgb(22,44,88)
rgba(22,44,88,0.5)  // if there is an alpha
url("data:image/png;base64,BASE64ENCODEDDATA")  // if there is a pattern image

Definition at line 681 of file CPColor.j.

+ (CPColor) cyanColor
implementation

Returns a cyan color object (RGBA=[0.0, 1.0, 1.0, 1.0])

Definition at line 376 of file CPColor.j.

+ (CPColor) darkGrayColor
implementation

Returns a dark gray color object. (RGBA=[0.33 ,0.33, 0.33, 1.0])

Definition at line 288 of file CPColor.j.

- (CPString) description
implementation

Returns a human readable string describing the receiver

Reimplemented from CPObject.

Definition at line 717 of file CPColor.j.

- (void) encodeWithCoder: (CPCoder aCoder
implementation

Archives this color into a coder.

Parameters
aCoderthe coder into which the color will be archived.

Provided by category CPColor(CPCoding).

Definition at line 816 of file CPColor.j.

+ (CPColor) grayColor
implementation

Returns a gray color object. (RGBA=[0.5, 0.5, 0.5, 1.0])

Definition at line 299 of file CPColor.j.

+ (CPColor) greenColor
implementation

Returns a green color object. (RGBA=[0.0, 1.0, 0.0, 1.0])

Definition at line 310 of file CPColor.j.

- (float) greenComponent
implementation

Returns the green component of this color.

Definition at line 565 of file CPColor.j.

- (CPString) hexString
implementation

Returns a 6 character long hex string of this color.

Definition at line 689 of file CPColor.j.

- (CPArray) hsbComponents
implementation

Returns an array with the HSB values for this color. The index values are ordered as:

Index   Component
0       Hue
1       Saturation
2       Brightness

Definition at line 628 of file CPColor.j.

- (id) initWithCoder: (CPCoder aCoder
implementation

Initializes this color from the data archived in a coder.

Parameters
aCoderthe coder from which the color will be loaded

Provided by category CPColor(CPCoding).

Definition at line 804 of file CPColor.j.

- (BOOL) isEqual: (CPColor aColor
implementation

Definition at line 694 of file CPColor.j.

+ (CPColor) lightGrayColor
implementation

Returns a light gray color object (RGBA=[0.66, 0.66, 0.66, 1.0])

Definition at line 321 of file CPColor.j.

+ (CPColor) magentaColor
implementation

Returns a magenta color object (RGBA=[1.0, 0.0, 1.0, 1.0])

Definition at line 387 of file CPColor.j.

+ (CPColor) orangeColor
implementation

Returns a orange color object (RGBA=[1.0, 0.5, 0.0, 1.0])

Definition at line 398 of file CPColor.j.

- (CPImage) patternImage
implementation

Returns the image being used as the pattern for the tile in this color.

Definition at line 541 of file CPColor.j.

+ (CPColor) purpleColor
implementation

Returns a purple color object (RGBA=[0.5, 0.0, 0.5, 1.0])

Definition at line 409 of file CPColor.j.

+ (CPColor) randomColor
implementation

Provided by category CPColor(Debugging).

Definition at line 786 of file CPColor.j.

+ (CPColor) redColor
implementation

Returns a red color object (RGBA=[1.0, 0.0, 0.0, 1.0])

Definition at line 332 of file CPColor.j.

- (float) redComponent
implementation

Return the red component of this color.

Definition at line 573 of file CPColor.j.

+ (CPColor) secondarySelectedControlColor
implementation

Definition at line 446 of file CPColor.j.

- (void) set
implementation

Set's the receiver to be the fill and stroke color in the current graphics context

Provided by category CPColor(CoreGraphicsExtensions).

Definition at line 758 of file CPColor.j.

- (void) setFill
implementation

Set's the receiver to be the fill color in the current graphics context

Provided by category CPColor(CoreGraphicsExtensions).

Definition at line 767 of file CPColor.j.

- (void) setStroke
implementation

Set's the receiver to be the stroke color in the current graphics context

Provided by category CPColor(CoreGraphicsExtensions).

Definition at line 776 of file CPColor.j.

+ (CPColor) shadowColor
implementation

Returns a shadow looking color (RGBA=[0.0, 0.0, 0.0, 0.33])

Definition at line 421 of file CPColor.j.

+ (CPColor) whiteColor
implementation

Returns a white color object (RGBA=[1.0, 1.0, 1.0, 1.0])

Definition at line 343 of file CPColor.j.

+ (CPColor) yellowColor
implementation

Returns a yellow color object (RGBA=[1.0, 1.0, 0.0, 1.0])

Definition at line 354 of file CPColor.j.


The documentation for this class was generated from the following files: