forked from flit/MidiKeys
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CTGradient.h
54 lines (39 loc) · 1.4 KB
/
CTGradient.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//
// CTGradient.h
//
// Created by Chad Weider on 12/3/05.
// Copyright (c) 2005 Cotingent.
// Some rights reserved: <http://creativecommons.org/licenses/by/2.5/>
//
#import <Cocoa/Cocoa.h>
typedef struct _CTGradientElement
{
float red, green, blue, alpha;
float position;
struct _CTGradientElement *nextElement;
} CTGradientElement;
@interface CTGradient : NSObject <NSCopying, NSCoding>
{
CTGradientElement* elementList;
CGFunctionRef gradientFunction;
}
+ (id)gradientWithBeginningColor:(NSColor *)begin endingColor:(NSColor *)end;
+ (id)aquaSelectedGradient;
+ (id)aquaNormalGradient;
+ (id)aquaPressedGradient;
+ (id)unifiedSelectedGradient;
+ (id)unifiedNormalGradient;
+ (id)unifiedPressedGradient;
+ (id)unifiedDarkGradient;
- (CTGradient *)gradientWithAlphaComponent:(float)alpha;
- (CTGradient *)addColorStop:(NSColor *)color atPosition:(float)position; //positions given relative to [0,1]
- (CTGradient *)removeColorStopAtIndex:(unsigned)index;
- (CTGradient *)removeColorStopAtPosition:(float)position;
- (NSColor *)colorStopAtIndex:(unsigned)index;
- (NSColor *)colorAtPosition:(float)position;
- (void)drawSwatchInRect:(NSRect)rect;
- (void)fillRect:(NSRect)rect angle:(float)angle; //fills rect with axial gradient
// angle in degrees
- (void)radialFillRect:(NSRect)rect; //fills rect with radial gradient
// gradient from center outwards
@end