4 // Created by Chad Weider on 2/14/07.
5 // Writtin by Chad Weider.
7 // Released into public domain on 4/10/08.
11 #import <Cocoa/Cocoa.h>
13 typedef struct _CTGradientElement
15 float red
, green
, blue
, alpha
;
18 struct _CTGradientElement
*nextElement
;
21 typedef enum _CTBlendingMode
24 CTChromaticBlendingMode
,
25 CTInverseChromaticBlendingMode
26 } CTGradientBlendingMode
;
29 @interface CTGradient
: NSObject
<NSCopying
, NSCoding
>
31 CTGradientElement
* elementList
;
32 CTGradientBlendingMode blendingMode
;
34 CGFunctionRef gradientFunction
;
37 + (id
)gradientWithBeginningColor
:(NSColor
*)begin endingColor
:(NSColor
*)end
;
39 + (id
)aquaSelectedGradient
;
40 + (id
)aquaNormalGradient
;
41 + (id
)aquaPressedGradient
;
43 + (id
)unifiedSelectedGradient
;
44 + (id
)unifiedNormalGradient
;
45 + (id
)unifiedPressedGradient
;
46 + (id
)unifiedDarkGradient
;
48 + (id
)sourceListSelectedGradient
;
49 + (id
)sourceListUnselectedGradient
;
51 + (id
)rainbowGradient
;
52 + (id
)hydrogenSpectrumGradient
;
54 - (CTGradient
*)gradientWithAlphaComponent
:(float)alpha
;
56 - (CTGradient
*)addColorStop
:(NSColor
*)color atPosition
:(float)position
; //positions given relative to [0,1]
57 - (CTGradient
*)removeColorStopAtIndex
:(unsigned)index
;
58 - (CTGradient
*)removeColorStopAtPosition
:(float)position
;
60 - (CTGradientBlendingMode
)blendingMode
;
61 - (NSColor
*)colorStopAtIndex
:(unsigned)index
;
62 - (NSColor
*)colorAtPosition
:(float)position
;
65 - (void)drawSwatchInRect
:(NSRect
)rect
;
66 - (void)fillRect
:(NSRect
)rect angle
:(float)angle
; //fills rect with axial gradient
68 - (void)radialFillRect
:(NSRect
)rect
; //fills rect with radial gradient
69 // gradient from center outwards
70 - (void)fillBezierPath
:(NSBezierPath
*)path angle
:(float)angle
;
71 - (void)radialFillBezierPath
:(NSBezierPath
*)path
;