1 /* GSMethodTable.h - Definitions of PostScript methods for NSGraphicsContext
2 
3    Copyright (C) 1998 Free Software Foundation, Inc.
4    Written by:  Adam Fedor <fedor@gnu.org>
5    Date: Nov 1998
6    Updated by:  Richard Frith-Macdonald <richard@brainstorm.co.uk>
7 
8    This library is free software; you can redistribute it and/or
9    modify it under the terms of the GNU Lesser General Public
10    License as published by the Free Software Foundation; either
11    version 2 of the License, or (at your option) any later version.
12 
13    This library is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
16    Lesser General Public License for more details.
17 
18    You should have received a copy of the GNU Lesser General Public
19    License along with this library; see the file COPYING.LIB.
20    If not, see <http://www.gnu.org/licenses/> or write to the
21    Free Software Foundation, 51 Franklin Street, Fifth Floor,
22    Boston, MA 02110-1301, USA.
23 */
24 
25 #ifndef _GSMethodTable_h_INCLUDE
26 #define _GSMethodTable_h_INCLUDE
27 
28 #import <Foundation/NSObject.h>
29 #import <Foundation/NSGeometry.h>
30 #import <AppKit/NSFont.h>
31 
32 @class NSAffineTransform;
33 @class NSDate;
34 @class NSString;
35 @class NSBezierPath;
36 @class NSColor;
37 @class NSEvent;
38 @class NSGraphicsContext;
39 
40 typedef struct {
41 
42 /* ----------------------------------------------------------------------- */
43 /* Color operations */
44 /* ----------------------------------------------------------------------- */
45   void (*DPScurrentalpha_)
46         (NSGraphicsContext*, SEL, CGFloat*);
47   void (*DPScurrentcmykcolor____)
48         (NSGraphicsContext*, SEL, CGFloat*, CGFloat*, CGFloat*, CGFloat*);
49   void (*DPScurrentgray_)
50         (NSGraphicsContext*, SEL, CGFloat*);
51   void (*DPScurrenthsbcolor___)
52         (NSGraphicsContext*, SEL, CGFloat*, CGFloat*, CGFloat*);
53   void (*DPScurrentrgbcolor___)
54         (NSGraphicsContext*, SEL, CGFloat*, CGFloat*, CGFloat*);
55   void (*DPSsetalpha_)
56         (NSGraphicsContext*, SEL, CGFloat);
57   void (*DPSsetcmykcolor____)
58         (NSGraphicsContext*, SEL, CGFloat, CGFloat, CGFloat, CGFloat);
59   void (*DPSsetgray_)
60         (NSGraphicsContext*, SEL, CGFloat);
61   void (*DPSsethsbcolor___)
62         (NSGraphicsContext*, SEL, CGFloat, CGFloat, CGFloat);
63   void (*DPSsetrgbcolor___)
64         (NSGraphicsContext*, SEL, CGFloat, CGFloat, CGFloat);
65 
66   void (*GSSetFillColorspace_)
67         (NSGraphicsContext*, SEL, NSDictionary *);
68   void (*GSSetStrokeColorspace_)
69         (NSGraphicsContext*, SEL, NSDictionary *);
70   void (*GSSetFillColor_)
71         (NSGraphicsContext*, SEL, CGFloat *);
72   void (*GSSetStrokeColor_)
73         (NSGraphicsContext*, SEL, CGFloat *);
74 
75 /* ----------------------------------------------------------------------- */
76 /* Text operations */
77 /* ----------------------------------------------------------------------- */
78   void (*DPSashow___)
79         (NSGraphicsContext*, SEL, CGFloat, CGFloat, const char*);
80   void (*DPSawidthshow______)
81         (NSGraphicsContext*, SEL, CGFloat, CGFloat, int, CGFloat, CGFloat, const char*);
82   void (*DPScharpath__)
83         (NSGraphicsContext*, SEL, const char*, int);
84   void (*DPSshow_)
85         (NSGraphicsContext*, SEL, const char*);
86   void (*DPSwidthshow____)
87         (NSGraphicsContext*, SEL, CGFloat, CGFloat, int, const char*);
88   void (*DPSxshow___)
89         (NSGraphicsContext*, SEL, const char*, const CGFloat*, int);
90   void (*DPSxyshow___)
91         (NSGraphicsContext*, SEL, const char*, const CGFloat*, int);
92   void (*DPSyshow___)
93         (NSGraphicsContext*, SEL, const char*, const CGFloat*, int);
94 
95   void (*GSSetCharacterSpacing_)
96         (NSGraphicsContext*, SEL, CGFloat);
97   void (*GSSetFont_)
98         (NSGraphicsContext*, SEL, NSFont*);
99   void (*GSSetFontSize_)
100         (NSGraphicsContext*, SEL, CGFloat);
101   NSAffineTransform * (*GSGetTextCTM)
102         (NSGraphicsContext*, SEL);
103   NSPoint (*GSGetTextPosition)
104         (NSGraphicsContext*, SEL);
105   void (*GSSetTextCTM_)
106         (NSGraphicsContext*, SEL, NSAffineTransform *);
107   void (*GSSetTextDrawingMode_)
108         (NSGraphicsContext*, SEL, GSTextDrawingMode);
109   void (*GSSetTextPosition_)
110         (NSGraphicsContext*, SEL, NSPoint);
111   void (*GSShowText__)
112         (NSGraphicsContext*, SEL, const char *, size_t);
113   void (*GSShowGlyphs__)
114         (NSGraphicsContext*, SEL, const NSGlyph *, size_t);
115   void (*GSShowGlyphsWithAdvances__)
116         (NSGraphicsContext*, SEL, const NSGlyph *, const NSSize *, size_t);
117 
118 /* ----------------------------------------------------------------------- */
119 /* Gstate Handling */
120 /* ----------------------------------------------------------------------- */
121   void (*DPSgrestore)
122         (NSGraphicsContext*, SEL);
123   void (*DPSgsave)
124         (NSGraphicsContext*, SEL);
125   void (*DPSinitgraphics)
126         (NSGraphicsContext*, SEL);
127   void (*DPSsetgstate_)
128         (NSGraphicsContext*, SEL, NSInteger);
129 
130   NSInteger (*GSDefineGState)
131         (NSGraphicsContext*, SEL);
132   void (*GSUndefineGState_)
133         (NSGraphicsContext*, SEL, NSInteger);
134   void (*GSReplaceGState_)
135         (NSGraphicsContext*, SEL, NSInteger);
136 
137 /* ----------------------------------------------------------------------- */
138 /* Gstate operations */
139 /* ----------------------------------------------------------------------- */
140   void (*DPScurrentflat_)
141         (NSGraphicsContext*, SEL, CGFloat*);
142   void (*DPScurrentlinecap_)
143         (NSGraphicsContext*, SEL, int*);
144   void (*DPScurrentlinejoin_)
145         (NSGraphicsContext*, SEL, int*);
146   void (*DPScurrentlinewidth_)
147         (NSGraphicsContext*, SEL, CGFloat*);
148   void (*DPScurrentmiterlimit_)
149         (NSGraphicsContext*, SEL, CGFloat*);
150   void (*DPScurrentpoint__)
151         (NSGraphicsContext*, SEL, CGFloat*, CGFloat*);
152   void (*DPScurrentstrokeadjust_)
153         (NSGraphicsContext*, SEL, int*);
154   void (*DPSsetdash___)
155         (NSGraphicsContext*, SEL, const CGFloat*, NSInteger, CGFloat);
156   void (*DPSsetflat_)
157         (NSGraphicsContext*, SEL, CGFloat);
158   void (*DPSsethalftonephase__)
159         (NSGraphicsContext*, SEL, CGFloat, CGFloat);
160   void (*DPSsetlinecap_)
161         (NSGraphicsContext*, SEL, int);
162   void (*DPSsetlinejoin_)
163         (NSGraphicsContext*, SEL, int);
164   void (*DPSsetlinewidth_)
165         (NSGraphicsContext*, SEL, CGFloat);
166   void (*DPSsetmiterlimit_)
167         (NSGraphicsContext*, SEL, CGFloat);
168   void (*DPSsetstrokeadjust_)
169         (NSGraphicsContext*, SEL, int);
170 
171 /* ----------------------------------------------------------------------- */
172 /* Matrix operations */
173 /* ----------------------------------------------------------------------- */
174   void (*DPSconcat_)
175         (NSGraphicsContext*, SEL, const CGFloat*);
176   void (*DPSinitmatrix)
177         (NSGraphicsContext*, SEL);
178   void (*DPSrotate_)
179         (NSGraphicsContext*, SEL, CGFloat);
180   void (*DPSscale__)
181         (NSGraphicsContext*, SEL, CGFloat, CGFloat);
182   void (*DPStranslate__)
183         (NSGraphicsContext*, SEL, CGFloat, CGFloat);
184 
185   NSAffineTransform * (*GSCurrentCTM)
186         (NSGraphicsContext*, SEL);
187   void (*GSSetCTM_)
188         (NSGraphicsContext*, SEL, NSAffineTransform *);
189   void (*GSConcatCTM_)
190         (NSGraphicsContext*, SEL, NSAffineTransform *);
191 
192 /* ----------------------------------------------------------------------- */
193 /* Paint operations */
194 /* ----------------------------------------------------------------------- */
195   void (*DPSarc_____)
196         (NSGraphicsContext*, SEL, CGFloat, CGFloat, CGFloat, CGFloat, CGFloat);
197   void (*DPSarcn_____)
198         (NSGraphicsContext*, SEL, CGFloat, CGFloat, CGFloat, CGFloat, CGFloat);
199   void (*DPSarct_____)
200         (NSGraphicsContext*, SEL, CGFloat, CGFloat, CGFloat, CGFloat, CGFloat);
201   void (*DPSclip)
202         (NSGraphicsContext*, SEL);
203   void (*DPSclosepath)
204         (NSGraphicsContext*, SEL);
205   void (*DPScurveto______)
206         (NSGraphicsContext*, SEL, CGFloat, CGFloat, CGFloat, CGFloat, CGFloat, CGFloat);
207   void (*DPSeoclip)
208         (NSGraphicsContext*, SEL);
209   void (*DPSeofill)
210         (NSGraphicsContext*, SEL);
211   void (*DPSfill)
212         (NSGraphicsContext*, SEL);
213   void (*DPSflattenpath)
214         (NSGraphicsContext*, SEL);
215   void (*DPSinitclip)
216         (NSGraphicsContext*, SEL);
217   void (*DPSlineto__)
218         (NSGraphicsContext*, SEL, CGFloat, CGFloat);
219   void (*DPSmoveto__)
220         (NSGraphicsContext*, SEL, CGFloat, CGFloat);
221   void (*DPSnewpath)
222         (NSGraphicsContext*, SEL);
223   void (*DPSpathbbox____)
224         (NSGraphicsContext*, SEL, CGFloat*, CGFloat*, CGFloat*, CGFloat*);
225   void (*DPSrcurveto______)
226         (NSGraphicsContext*, SEL, CGFloat, CGFloat, CGFloat, CGFloat, CGFloat, CGFloat);
227   void (*DPSrectclip____)
228         (NSGraphicsContext*, SEL, CGFloat, CGFloat, CGFloat, CGFloat);
229   void (*DPSrectfill____)
230         (NSGraphicsContext*, SEL, CGFloat, CGFloat, CGFloat, CGFloat);
231   void (*DPSrectstroke____)
232         (NSGraphicsContext*, SEL, CGFloat, CGFloat, CGFloat, CGFloat);
233   void (*DPSreversepath)
234         (NSGraphicsContext*, SEL);
235   void (*DPSrlineto__)
236         (NSGraphicsContext*, SEL, CGFloat, CGFloat);
237   void (*DPSrmoveto__)
238         (NSGraphicsContext*, SEL, CGFloat, CGFloat);
239   void (*DPSstroke)
240         (NSGraphicsContext*, SEL);
241 
242   void (*GSSendBezierPath_)
243         (NSGraphicsContext*, SEL, NSBezierPath *);
244   void (*GSRectClipList__)
245         (NSGraphicsContext*, SEL, const NSRect *, int);
246   void (*GSRectFillList__)
247         (NSGraphicsContext*, SEL, const NSRect *, int);
248 
249 /* ----------------------------------------------------------------------- */
250 /* Window system ops */
251 /* ----------------------------------------------------------------------- */
252   void (*GSCurrentDevice___)
253         (NSGraphicsContext*, SEL, void**, int*, int*);
254   void (*DPScurrentoffset__)
255         (NSGraphicsContext*, SEL, int*, int*);
256   void (*GSSetDevice___)
257         (NSGraphicsContext*, SEL, void*, int, int);
258   void (*DPSsetoffset__)
259         (NSGraphicsContext*, SEL, short int, short int);
260 
261 /*-------------------------------------------------------------------------*/
262 /* Graphics Extensions Ops */
263 /*-------------------------------------------------------------------------*/
264   void (*DPScomposite________)
265         (NSGraphicsContext*, SEL, CGFloat, CGFloat, CGFloat, CGFloat, NSInteger, CGFloat, CGFloat, NSCompositingOperation);
266   void (*DPScompositerect_____)
267         (NSGraphicsContext*, SEL, CGFloat, CGFloat, CGFloat, CGFloat, NSCompositingOperation);
268   void (*DPSdissolve________)
269         (NSGraphicsContext*, SEL, CGFloat, CGFloat, CGFloat, CGFloat, NSInteger, CGFloat, CGFloat, CGFloat);
270 
271   void (*GSDrawImage__)
272         (NSGraphicsContext*, SEL, NSRect, void *);
273 
274 /* ----------------------------------------------------------------------- */
275 /* Postscript Client functions */
276 /* ----------------------------------------------------------------------- */
277   void (*DPSPrintf__)
278         (NSGraphicsContext*, SEL, const char *, va_list);
279   void (*DPSWriteData__)
280         (NSGraphicsContext*, SEL, const char *, unsigned int);
281 
282 /* ----------------------------------------------------------------------- */
283 /* NSGraphics Ops */
284 /* ----------------------------------------------------------------------- */
285   NSDictionary * (*GSReadRect_)
286         (NSGraphicsContext*, SEL, NSRect);
287 
288   void (*NSBeep)
289         (NSGraphicsContext*, SEL);
290 
291 /* Context helper wraps */
292   void (*GSWSetViewIsFlipped_)
293         (NSGraphicsContext*, SEL, BOOL);
294   BOOL (*GSWViewIsFlipped)
295         (NSGraphicsContext*, SEL);
296 
297 /*
298  * Render Bitmap Images
299  */
300   void (*NSDrawBitmap___________)(NSGraphicsContext*, SEL, NSRect rect,
301                   NSInteger pixelsWide,
302                   NSInteger pixelsHigh,
303                   NSInteger bitsPerSample,
304                   NSInteger samplesPerPixel,
305                   NSInteger bitsPerPixel,
306                   NSInteger bytesPerRow,
307                   BOOL isPlanar,
308                   BOOL hasAlpha,
309                   NSString *colorSpaceName,
310                   const unsigned char *const data[5]);
311 
312   /* This probably belongs next to DPSstroke, but inserting members in this
313   struct breaks apps that use PS* or DPS* functions and were compiled with
314   an earlier version, so it's here until we figure out how to handle that.
315   */
316   void (*DPSshfill)
317         (NSGraphicsContext*, SEL, NSDictionary *);
318 } gsMethodTable;
319 
320 #endif
321