4 // Created by Chad Weider on 12/3/05.
5 // Copyright (c) 2006 Cotingent.
6 // Some rights reserved: <http://creativecommons.org/licenses/by/2.5/>
10 #import <Cocoa/Cocoa.h>
12 typedef struct _CTGradientElement
14 float red
, green
, blue
, alpha
;
17 struct _CTGradientElement
*nextElement
;
20 typedef enum _CTBlendingMode
23 CTChromaticBlendingMode
,
24 CTInverseChromaticBlendingMode
25 } CTGradientBlendingMode
;
28 @interface CTGradient
: NSObject
<NSCopying
, NSCoding
>
30 CTGradientElement
* elementList
;
31 CTGradientBlendingMode blendingMode
;
33 CGFunctionRef gradientFunction
;
36 + (id
)gradientWithBeginningColor
:(NSColor
*)begin endingColor
:(NSColor
*)end
;
38 + (id
)aquaSelectedGradient
;
39 + (id
)aquaNormalGradient
;
40 + (id
)aquaPressedGradient
;
42 + (id
)unifiedSelectedGradient
;
43 + (id
)unifiedNormalGradient
;
44 + (id
)unifiedPressedGradient
;
45 + (id
)unifiedDarkGradient
;
47 + (id
)sourceListSelectedGradient
;
48 + (id
)sourceListUnselectedGradient
;
50 - (CTGradient
*)gradientWithAlphaComponent
:(float)alpha
;
52 - (CTGradient
*)addColorStop
:(NSColor
*)color atPosition
:(float)position
; //positions given relative to [0,1]
53 - (CTGradient
*)removeColorStopAtIndex
:(unsigned)index
;
54 - (CTGradient
*)removeColorStopAtPosition
:(float)position
;
56 - (CTGradientBlendingMode
)blendingMode
;
57 - (NSColor
*)colorStopAtIndex
:(unsigned)index
;
58 - (NSColor
*)colorAtPosition
:(float)position
;
61 - (void)drawSwatchInRect
:(NSRect
)rect
;
62 - (void)fillRect
:(NSRect
)rect angle
:(float)angle
; //fills rect with axial gradient
64 - (void)radialFillRect
:(NSRect
)rect
; //fills rect with radial gradient
65 // gradient from center outwards