1 | //␊ |
2 | // CTGradient.h␊ |
3 | //␊ |
4 | // Created by Chad Weider on 2/14/07.␊ |
5 | // Copyright (c) 2007 Chad Weider.␊ |
6 | // Some rights reserved: <http://creativecommons.org/licenses/by/2.5/>␊ |
7 | //␊ |
8 | // Version: 1.6␊ |
9 | ␊ |
10 | #import <Cocoa/Cocoa.h>␊ |
11 | ␊ |
12 | typedef struct _CTGradientElement ␊ |
13 | {␊ |
14 | ␉float red, green, blue, alpha;␊ |
15 | ␉float position;␊ |
16 | ␉␊ |
17 | ␉struct _CTGradientElement *nextElement;␊ |
18 | } CTGradientElement;␊ |
19 | ␊ |
20 | typedef enum _CTBlendingMode␊ |
21 | {␊ |
22 | ␉CTLinearBlendingMode,␊ |
23 | ␉CTChromaticBlendingMode,␊ |
24 | ␉CTInverseChromaticBlendingMode␊ |
25 | } CTGradientBlendingMode;␊ |
26 | ␊ |
27 | ␊ |
28 | @interface CTGradient : NSObject <NSCopying, NSCoding>␊ |
29 | {␊ |
30 | ␉CTGradientElement* elementList;␊ |
31 | ␉CTGradientBlendingMode blendingMode;␊ |
32 | ␉␊ |
33 | ␉CGFunctionRef gradientFunction;␊ |
34 | }␊ |
35 | ␊ |
36 | + (id)gradientWithBeginningColor:(NSColor *)begin endingColor:(NSColor *)end;␊ |
37 | ␊ |
38 | + (id)aquaSelectedGradient;␊ |
39 | + (id)aquaNormalGradient;␊ |
40 | + (id)aquaPressedGradient;␊ |
41 | ␊ |
42 | + (id)unifiedSelectedGradient;␊ |
43 | + (id)unifiedNormalGradient;␊ |
44 | + (id)unifiedPressedGradient;␊ |
45 | + (id)unifiedDarkGradient;␊ |
46 | ␊ |
47 | + (id)sourceListSelectedGradient;␊ |
48 | + (id)sourceListUnselectedGradient;␊ |
49 | ␊ |
50 | + (id)rainbowGradient;␊ |
51 | + (id)hydrogenSpectrumGradient;␊ |
52 | ␊ |
53 | - (CTGradient *)gradientWithAlphaComponent:(float)alpha;␊ |
54 | ␊ |
55 | - (CTGradient *)addColorStop:(NSColor *)color atPosition:(float)position;␉//positions given relative to [0,1]␊ |
56 | - (CTGradient *)removeColorStopAtIndex:(unsigned)index;␊ |
57 | - (CTGradient *)removeColorStopAtPosition:(float)position;␊ |
58 | ␊ |
59 | - (CTGradientBlendingMode)blendingMode;␊ |
60 | - (NSColor *)colorStopAtIndex:(unsigned)index;␊ |
61 | - (NSColor *)colorAtPosition:(float)position;␊ |
62 | ␊ |
63 | ␊ |
64 | - (void)drawSwatchInRect:(NSRect)rect;␊ |
65 | - (void)fillRect:(NSRect)rect angle:(float)angle;␉␉␉␉␉//fills rect with axial gradient␊ |
66 | //␉angle in degrees␊ |
67 | - (void)radialFillRect:(NSRect)rect;␉␉␉␉␉␉␉␉//fills rect with radial gradient␊ |
68 | // gradient from center outwards␊ |
69 | - (void)fillBezierPath:(NSBezierPath *)path angle:(float)angle;␊ |
70 | - (void)radialFillBezierPath:(NSBezierPath *)path;␊ |
71 | ␊ |
72 | @end |