-
Notifications
You must be signed in to change notification settings - Fork 9
/
MPWDrawingContext.h
141 lines (100 loc) · 4.39 KB
/
MPWDrawingContext.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
//
// MPWDrawingContext.h
// MusselWind
//
// Created by Marcel Weiher on 11/18/10.
// Copyright 2010 Marcel Weiher. All rights reserved.
//
#import "PhoneGeometry.h"
@protocol MPWDrawingContext <NSObject>
@optional
-(instancetype)translate:(float)x :(float)y;
-(instancetype)scale:(float)x :(float)y;
-(instancetype)rotate:(float)degrees;
-(instancetype)gsave;
-(instancetype)grestore;
-(instancetype)setdashpattern:array phase:(float)phase;
-(instancetype)setlinewidth:(float)width;
-(instancetype)setlinecapRound;
-(instancetype)setlinecapSquare;
-(instancetype)setlinecapButt;
-(id)colorRed:(float)r green:(float)g blue:(float)b alpha:(float)alpha;
-(id)colorsRed:r green:g blue:b alpha:alpha;
-(id)colorCyan:(float)c magenta:(float)m yellow:(float)y black:(float)k alpha:(float)alpha;
-(id)colorsCyan:c magenta:m yellow:y black:k alpha:alpha;
-(id)colorGray:(float)gray alpha:(float)alpha;
-(id)colorsGray:gray alpha:alpha;
-(instancetype)setFillColor:(id)aColor;
-(instancetype)setStrokeColor:(id)aColor;
-(instancetype)setFillColorGray:(float)gray alpha:(float)alpha;
-(instancetype)setAlpha:(float)alpha;
-(instancetype)setAntialias:(BOOL)doAntialiasing;
-(instancetype)setShadowOffset:(NSSize)offset blur:(float)blur color:(id)aColor;
-(instancetype)clearShadow;
-(instancetype)concat:(float)m11 :(float)m12 :(float)m21 :(float)m22 :(float)tx :(float)ty;
-(instancetype)concat:someArray;
-(instancetype)setTextMatrix:(float)m11 :(float)m12 :(float)m21 :(float)m22 :(float)tx :(float)ty;
-(instancetype)setTextMatrix:someArray;
-(instancetype)setFontSize:(float)newSize;
-(instancetype)setTextModeFill:(BOOL)fill stroke:(BOOL)stroke clip:(BOOL)clip;
-(instancetype)setCharaterSpacing:(float)newSpacing;
-(id)fontWithName:(NSString*)name size:(float)size;
-(id)paragraphStyle; // experimental
-(instancetype)showTextString:str at:(NSPoint)position;
-(instancetype)showGlyphBuffer:(unsigned short*)glyphs length:(int)len at:(NSPoint)position;
-(instancetype)showGlyphs:glyphArray at:(NSPoint)position;
-(instancetype)drawText:someText inPath:aPath;
-(instancetype)drawLinearGradientFrom:(NSPoint)startPoint to:(NSPoint)endPoint colors:(NSArray*)colors offsets:(NSArray*)offsets;
-(instancetype)drawRadialGradientFrom:(NSPoint)startPoint radius:(float)startRadius to:(NSPoint)endPoint radius:(float)endRadius colors:(NSArray*)colors offsets:(NSArray*)offsets;
-(void)clip;
-(void)fill;
-(void)fill:aPath;
-(void)eofill;
-(void)eofillAndStroke;
-(void)fillAndStroke;
-(void)fillAndStroke:aPath;
-(void)stroke;
-(void)stroke:aPath;
-(void)fillRect:(NSRect)r;
-(void)fillDarken; // not sure this should be here
-(NSRect)cliprect;
-(instancetype)beginPath;
-(instancetype)nsrect:(NSRect)r;
-(instancetype)moveto:(float)x :(float)y;
-(instancetype)lineto:(float)x :(float)y;
-(instancetype)curveto:(float)cp1x :(float)cp1y :(float)cp2x :(float)cp2y :(float)x :(float)y;
-(instancetype)closepath;
-(instancetype)arcWithCenter:(NSPoint)center radius:(float)radius startDegrees:(float)start endDegrees:(float)stop clockwise:(BOOL)clockwise;
-(instancetype)arcFromPoint:(NSPoint)p1 toPoint:(NSPoint)p2 radius:(float)radius;
-(instancetype)ellipseInRect:(NSRect)r;
-(instancetype)drawImage:anImage;
-(instancetype)show:(id)someText; // NS(Attributed)String
-(instancetype)setTextPosition:(NSPoint)p;
-(instancetype)setFont:aFont;
-(NSRect)boundingRectForText:someText inPath:aPath;
-(NSRect)lineRectForText:someText inPath:aPath;
#if NS_BLOCKS_AVAILABLE
typedef void (^DrawingBlock)(id <MPWDrawingContext>);
-withShadowOffset:(NSSize)offset blur:(float)blur color:aColor draw:(DrawingBlock)commands;
-ingsave:(DrawingBlock)drawingCommands;
-(id)drawLater:(DrawingBlock)drawingCommands;
-layerWithSize:(NSSize)size content:(DrawingBlock)drawingCommands;
-laterWithSize:(NSSize)size content:(DrawingBlock)drawingCommands;
-page:(NSDictionary*)parameters content:(DrawingBlock)drawingCommands;
-path:pathCreator;
#endif
-(instancetype)translate:(id)aPoint;
-(instancetype)scale:(id)aPointOrNumber;
-(instancetype)moveto:(id)aPoint;
-(instancetype)lineto:(id)aPoint;
-(instancetype)rect:(id)sizeOrRect;
-(instancetype)rect:(id)sizeOrRect rounded:(id)rounding;
-(instancetype)ellipse:(id)radiusSizeOrRect;
#if !TARGET_OS_IPHONE // hack, don't use
-concatNSAffineTransform:(NSAffineTransform*)transform;
#endif
-(void)flush;
-(void)sync;
-(void)fillBackgroundWithColor:aColor;
@end
typedef id <MPWDrawingContext> Drawable;