VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.1.0/Ps.h

Last change on this file was 51223, checked in by vboxsync, 11 years ago

Additions/x11/x11include: added header files for X.Org Server 1.0 and 1.1.

  • Property svn:eol-style set to native
File size: 18.8 KB
Line 
1/* $Xorg: Ps.h,v 1.5 2001/02/09 02:04:35 xorgcvs Exp $ */
2/*
3
4Copyright 1996, 1998 The Open Group
5
6Permission to use, copy, modify, distribute, and sell this software and its
7documentation for any purpose is hereby granted without fee, provided that
8the above copyright notice appear in all copies and that both that
9copyright notice and this permission notice appear in supporting
10documentation.
11
12The above copyright notice and this permission notice shall be included in
13all copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22Except as contained in this notice, the name of The Open Group shall not be
23used in advertising or otherwise to promote the sale, use or other dealings
24in this Software without prior written authorization from The Open Group.
25
26*/
27/*
28 * (c) Copyright 1996 Hewlett-Packard Company
29 * (c) Copyright 1996 International Business Machines Corp.
30 * (c) Copyright 1996 Sun Microsystems, Inc.
31 * (c) Copyright 1996 Novell, Inc.
32 * (c) Copyright 1996 Digital Equipment Corp.
33 * (c) Copyright 1996 Fujitsu Limited
34 * (c) Copyright 1996 Hitachi, Ltd.
35 *
36 * Permission is hereby granted, free of charge, to any person obtaining
37 * a copy of this software and associated documentation files (the
38 * "Software"), to deal in the Software without restriction, including
39 * without limitation the rights to use, copy, modify, merge, publish,
40 * distribute, sublicense, and/or sell copies of the Software, and to
41 * permit persons to whom the Software is furnished to do so, subject
42 * to the following conditions:
43 *
44 * The above copyright notice and this permission notice shall be included
45 * in all copies or substantial portions of the Software.
46 *
47 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
48 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
49 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
50 * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
51 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
52 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
53 * SOFTWARE.
54 *
55 * Except as contained in this notice, the names of the copyright holders
56 * shall not be used in advertising or otherwise to promote the sale, use
57 * or other dealings in this Software without prior written authorization
58 * from said copyright holders.
59 */
60
61/*******************************************************************
62**
63** *********************************************************
64** *
65** * File: Ps.h
66** *
67** * Contents: defines and includes for the Ps driver
68** * for a printing X server.
69** *
70** * Created By: Roger Helmendach (Liberty Systems)
71** *
72** * Copyright: Copyright 1996 The Open Group, Inc.
73** *
74** *********************************************************
75**
76********************************************************************/
77
78#ifdef HAVE_DIX_CONFIG_H
79#include <dix-config.h>
80#endif
81
82#ifndef _PS_H_
83#define _PS_H_
84
85#include <stdio.h>
86
87#ifdef abs
88#undef abs /* this is because of a non-Spec1170ness in misc.h */
89#endif
90#include <stdlib.h>
91#include "scrnintstr.h"
92#include "dix.h"
93
94#include "PsDef.h"
95#include "psout.h"
96
97#include <X11/extensions/Print.h>
98#include <X11/extensions/Printstr.h>
99
100#include "regionstr.h"
101#include <X11/fonts/fontstruct.h>
102#include "dixfontstr.h"
103#include "gcstruct.h"
104
105/*
106 * Some sleazes to force the XrmDB stuff into the server
107 */
108#ifndef HAVE_XPointer
109typedef char *XPointer;
110#define Status int
111#define True 1
112#define False 0
113#endif
114
115#include "misc.h"
116#include <X11/Xfuncproto.h>
117#include <X11/Xresource.h>
118#include "attributes.h"
119
120
121/*
122 * Public index variables from PsInit.c
123 */
124
125extern int PsScreenPrivateIndex;
126extern int PsWindowPrivateIndex;
127extern int PsContextPrivateIndex;
128extern int PsPixmapPrivateIndex;
129extern XpValidatePoolsRec PsValidatePoolsRec;
130
131/*
132 * Display list structures
133 */
134
135#define DPY_BLOCKSIZE 4096
136
137typedef struct
138{
139 int mode;
140 int nPoints;
141 xPoint *pPoints;
142} PsPolyPointsRec;
143
144typedef struct
145{
146 int nSegments;
147 xSegment *pSegments;
148} PsSegmentsRec;
149
150typedef struct
151{
152 int nRects;
153 xRectangle *pRects;
154} PsRectanglesRec;
155
156typedef struct
157{
158 int nArcs;
159 xArc *pArcs;
160} PsArcsRec;
161
162typedef struct
163{
164 int x;
165 int y;
166 int count;
167 char *string;
168} PsText8Rec;
169
170typedef struct
171{
172 int x;
173 int y;
174 int count;
175 unsigned short *string;
176} PsText16Rec;
177
178typedef struct
179{
180 int depth;
181 int x;
182 int y;
183 int w;
184 int h;
185 int leftPad;
186 int format;
187 int res; /* image resolution */
188 char *pData;
189} PsImageRec;
190
191typedef struct
192{
193 int x;
194 int y;
195 int w;
196 int h;
197} PsFrameRec;
198
199typedef enum
200{
201 PolyPointCmd,
202 PolyLineCmd,
203 PolySegmentCmd,
204 PolyRectangleCmd,
205 FillPolygonCmd,
206 PolyFillRectCmd,
207 PolyArcCmd,
208 PolyFillArcCmd,
209 Text8Cmd,
210 Text16Cmd,
211 TextI8Cmd,
212 TextI16Cmd,
213 PutImageCmd,
214 BeginFrameCmd,
215 EndFrameCmd
216} DisplayElmType;
217
218typedef struct _DisplayElmRec
219{
220 DisplayElmType type;
221 GCPtr gc;
222 union
223 {
224 PsPolyPointsRec polyPts;
225 PsSegmentsRec segments;
226 PsRectanglesRec rects;
227 PsArcsRec arcs;
228 PsText8Rec text8;
229 PsText16Rec text16;
230 PsImageRec image;
231 PsFrameRec frame;
232 } c;
233} DisplayElmRec;
234
235typedef DisplayElmRec *DisplayElmPtr;
236
237typedef struct _DisplayListRec
238{
239 struct _DisplayListRec *next;
240 int nelms;
241 DisplayElmRec elms[DPY_BLOCKSIZE];
242} DisplayListRec;
243
244typedef DisplayListRec *DisplayListPtr;
245
246/*
247 * Private structures
248 */
249
250typedef struct
251{
252 XrmDatabase resDB;
253 Bool (*DestroyWindow)(WindowPtr);
254} PsScreenPrivRec, *PsScreenPrivPtr;
255
256typedef struct PsFontTypeInfoRec PsFontTypeInfoRec;
257
258/* Structure to hold information about one font on disk
259 * Notes:
260 * - multiple XLFD names can refer to the same |PsFontTypeInfoRec| (if
261 * they all use the same font on the disk)
262 * - the FreeType font download code uses multiple |PsFontTypeInfoRec|
263 * records for one font on disk if they differ in the encoding being
264 * used (this is an exception from the
265 * 'one-|PsFontTypeInfoRec|-per-font-on-disk'-design; maybe it it is better
266 * to rework that in a later step and add a new per-encoding structure).
267 */
268struct PsFontTypeInfoRec
269{
270 PsFontTypeInfoRec *next; /* Next record in list... */
271 char *adobe_ps_name; /* PostScript font name (from the
272 * "_ADOBE_POSTSCRIPT_FONTNAME" atom) */
273 char *download_ps_name; /* PostScript font name used for font download */
274 char *filename; /* File name of font */
275#ifdef XP_USE_FREETYPE
276 char *ft_download_encoding; /* encoding used for download */
277 PsFTDownloadFontType ft_download_font_type; /* PS font type used for download (e.g. Type1/Type3/CID/etc.) */
278#endif /* XP_USE_FREETYPE */
279 int is_iso_encoding; /* Is this font encoded in ISO Latin 1 ? */
280 int font_type; /* See PSFTI_FONT_TYPE_* below... */
281 Bool downloadableFont; /* Font can be downloaded */
282 Bool alreadyDownloaded[256]; /* Font has been downloaded (for 256 8bit "sub"-font) */
283};
284
285#define PSFTI_FONT_TYPE_OTHER (0)
286#define PSFTI_FONT_TYPE_PMF (1)
287#define PSFTI_FONT_TYPE_PS_TYPE1_PFA (2)
288#define PSFTI_FONT_TYPE_PS_TYPE1_PFB (3)
289#define PSFTI_FONT_TYPE_TRUETYPE (4)
290/* PSFTI_FONT_TYPE_FREETYPE is means the font is handled by the freetype engine */
291#define PSFTI_FONT_TYPE_FREETYPE (5)
292
293typedef struct PsFontInfoRec PsFontInfoRec;
294
295/* Structure which represents our context info for a single XLFD font
296 * Note that multiple |PsFontInfoRec| records can share the same
297 * |PsFontTypeInfoRec| record - the |PsFontInfoRec| records represent
298 * different appearances of the same font on disk(=|PsFontTypeInfoRec|)).
299 */
300struct PsFontInfoRec
301{
302 PsFontInfoRec *next; /* Next record in list... */
303 /* |font| and |font_fontPrivate| are used by |PsFindFontInfoRec()| to
304 * identify a font */
305 FontPtr font; /* The font this record is for */
306 pointer font_fontPrivate;
307 PsFontTypeInfoRec *ftir; /* Record about the font file on disk */
308 const char *dfl_name; /* XLFD for this font */
309 int size; /* Font size. Use |mtx| if |size==0| */
310 float mtx[4]; /* Transformation matrix (see |size|) */
311};
312
313typedef struct
314{
315 char *jobFileName;
316 FILE *pJobFile;
317 GC lastGC;
318 unsigned char *dash;
319 int validGC;
320 ClientPtr getDocClient;
321 int getDocBufSize;
322 PsOutPtr pPsOut;
323 PsFontTypeInfoRec *fontTypeInfoRecords;
324 PsFontInfoRec *fontInfoRecords;
325} PsContextPrivRec, *PsContextPrivPtr;
326
327typedef struct
328{
329 int validContext;
330 XpContextPtr context;
331} PsWindowPrivRec, *PsWindowPrivPtr;
332
333typedef struct
334{
335 XpContextPtr context;
336 GC lastGC;
337 int validGC;
338 DisplayListPtr dispList;
339} PsPixmapPrivRec, *PsPixmapPrivPtr;
340
341/*
342 * Macro functions
343 */
344
345#define SEND_PS(f,c) fwrite( c, sizeof( char ), strlen( c ), f )
346#define MIN(a,b) (((a)<(b))?(a):(b))
347#ifndef MAX
348#define MAX(a,b) (((a)>(b))?(a):(b))
349#endif
350
351/*
352 * Functions in PsInit.c
353 */
354
355extern Bool InitializePsDriver(int ndx, ScreenPtr pScreen, int argc,
356 char **argv);
357extern XpContextPtr PsGetContextFromWindow(WindowPtr win);
358
359/*
360 * Functions in PsPrint.c
361 */
362
363extern int PsStartJob(XpContextPtr pCon, Bool sendClientData, ClientPtr client);
364extern int PsEndJob(XpContextPtr pCon, Bool cancel);
365extern int PsStartPage(XpContextPtr pCon, WindowPtr pWin);
366extern int PsEndPage(XpContextPtr pCon, WindowPtr pWin);
367extern int PsStartDoc(XpContextPtr pCon, XPDocumentType type);
368extern int PsEndDoc(XpContextPtr pCon, Bool cancel);
369extern int PsDocumentData(XpContextPtr pCon, DrawablePtr pDraw, char *pData,
370 int len_data, char *pFmt, int len_fmt, char *pOpt, int len_opt,
371 ClientPtr client);
372extern int PsGetDocumentData(XpContextPtr pCon, ClientPtr client,
373 int maxBufferSize);
374
375/*
376 * Functions in PsGC.c
377 */
378
379extern Bool PsCreateGC(GCPtr pGC);
380extern PsContextPrivPtr PsGetPsContextPriv( DrawablePtr pDrawable );
381extern int PsUpdateDrawableGC(GCPtr pGC, DrawablePtr pDrawable,
382 PsOutPtr *psOut, ColormapPtr *cMap);
383extern void PsValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
384extern void PsChangeGC(GCPtr pGC, unsigned long changes);
385extern void PsCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
386extern void PsDestroyGC(GCPtr pGC);
387extern void PsChangeClip(GCPtr pGC, int type, pointer pValue, int nrects);
388extern void PsDestroyClip(GCPtr pGC);
389extern void PsCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
390
391extern GCPtr PsCreateAndCopyGC(DrawablePtr pDrawable, GCPtr pSrc);
392
393/*
394 * Functions in PsMisc.c
395 */
396
397extern void PsQueryBestSize(int type, short *pwidth, short *pheight,
398 ScreenPtr pScreen);
399extern Bool PsCloseScreen(int index, ScreenPtr pScreen);
400extern void PsLineAttrs(PsOutPtr psOut, GCPtr pGC, ColormapPtr cMap);
401extern int PsGetMediumDimensions(
402 XpContextPtr pCon,
403 CARD16 *pWidth,
404 CARD16 *pHeight);
405extern int PsGetReproducibleArea(
406 XpContextPtr pCon,
407 xRectangle *pRect);
408extern int PsSetImageResolution(
409 XpContextPtr pCon,
410 int imageRes,
411 Bool *status);
412
413/*
414 * Functions in PsSpans.c
415 */
416
417extern void PsFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nSpans,
418 DDXPointPtr pPoints, int *pWidths, int fSorted);
419extern void PsSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *pSrc,
420 DDXPointPtr pPoints, int *pWidths, int nSpans,
421 int fSorted);
422
423/*
424 * Functions in PsArea.c
425 */
426
427extern void PsPutScaledImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
428 int x, int y, int w, int h, int leftPad, int format,
429 int imageRes, char *pImage);
430extern void PsPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
431 int x, int y, int w, int h, int leftPad, int format,
432 char *pImage);
433extern void PsPutImageMask(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
434 int w, int h, int leftPad, int format, char *pImage);
435extern RegionPtr PsCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
436 int srcx, int srcy, int width, int height,
437 int dstx, int dsty);
438extern RegionPtr PsCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
439 int srcx, int srcy, int width, int height,
440 int dstx, int dsty, unsigned long plane);
441
442/*
443 * Functions in PsPixel.c
444 */
445
446extern void PsPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
447 int nPoints, xPoint *pPoints);
448extern void PsPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDrawable,
449 int width, int height, int x, int y);
450
451/*
452 * Functions in PsLine.c
453 */
454
455extern void PsPolyLine(DrawablePtr pDrawable, GCPtr pGC, int mode,
456 int nPoints, xPoint *pPoints);
457extern void PsPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nSegments,
458 xSegment *pSegments);
459
460/*
461 * Functions in PsPolygon.c
462 */
463
464extern void PsPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nRects,
465 xRectangle *pRects);
466extern void PsFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape,
467 int mode, int nPoints, DDXPointPtr pPoints);
468extern void PsPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nRects,
469 xRectangle *pRects);
470
471/*
472 * Functions in PsPolygon.c
473 */
474
475extern void PsPolyArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs,
476 xArc *pArcs);
477extern void PsPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs,
478 xArc *pArcs);
479
480/*
481 * Functions in PsText.c
482 */
483
484extern int PsPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
485 int count, char *string);
486extern int PsPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
487 int count, unsigned short *string);
488extern void PsImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
489 int count, char *string);
490extern void PsImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
491 int count, unsigned short *string);
492extern void PsImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
493 unsigned int nGlyphs, CharInfoPtr *pCharInfo,
494 pointer pGlyphBase);
495extern void PsPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
496 unsigned int nGlyphs, CharInfoPtr *pCharInfo,
497 pointer pGlyphBase);
498
499/*
500 * Functions in PsWindow.c
501 */
502
503extern Bool PsCreateWindow(WindowPtr pWin);
504extern Bool PsMapWindow(WindowPtr pWin);
505extern Bool PsPositionWindow(WindowPtr pWin, int x, int y);
506extern Bool PsUnmapWindow(WindowPtr pWin);
507extern void PsCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
508 RegionPtr prgnSrc);
509extern Bool PsChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
510extern void PsPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what);
511extern Bool PsDestroyWindow(WindowPtr pWin);
512
513/*
514 * Functions in PsFonts.c
515 */
516
517extern Bool PsRealizeFont(ScreenPtr pscr, FontPtr pFont);
518extern Bool PsUnrealizeFont(ScreenPtr pscr, FontPtr pFont);
519extern char *PsGetFontName(FontPtr pFont);
520extern int PsGetFontSize(FontPtr pFont, float *mtx);
521extern char *PsGetPSFontName(FontPtr pFont);
522extern char *PsGetPSFaceOrFontName(FontPtr pFont);
523extern int PsIsISOLatin1Encoding(FontPtr pFont);
524extern char *PsGetEncodingName(FontPtr pFont);
525extern PsFontInfoRec *PsGetFontInfoRec(DrawablePtr pDrawable, FontPtr pFont);
526extern void PsFreeFontInfoRecords(PsContextPrivPtr priv);
527extern PsFTDownloadFontType PsGetFTDownloadFontType(void);
528
529/*
530 * Functions in PsFTFonts.c
531 */
532
533extern char *PsGetFTFontFileName(FontPtr pFont);
534extern Bool PsIsFreeTypeFont(FontPtr pFont);
535
536/*
537 * Functions in PsAttr.c
538 */
539
540extern char *PsGetAttributes(XpContextPtr pCon, XPAttributes pool);
541extern char *PsGetOneAttribute(XpContextPtr pCon, XPAttributes pool,
542 char *attr);
543extern int PsAugmentAttributes(XpContextPtr pCon, XPAttributes pool,
544 char *attrs);
545extern int PsSetAttributes(XpContextPtr pCon, XPAttributes pool, char *attrs);
546
547/*
548 * Functions in PsColor.c
549 */
550
551extern Bool PsCreateColormap(ColormapPtr pColor);
552extern void PsDestroyColormap(ColormapPtr pColor);
553extern void PsInstallColormap(ColormapPtr pColor);
554extern void PsUninstallColormap(ColormapPtr pColor);
555extern int PsListInstalledColormaps(ScreenPtr pScreen, XID *pCmapList);
556extern void PsStoreColors(ColormapPtr pColor, int ndef, xColorItem *pdefs);
557extern void PsResolveColor(unsigned short *pRed, unsigned short *pGreen,
558 unsigned short *pBlue, VisualPtr pVisual);
559extern PsOutColor PsGetPixelColor(ColormapPtr cMap, int pixval);
560extern void PsSetFillColor(DrawablePtr pDrawable, GCPtr pGC, PsOutPtr psOut,
561 ColormapPtr cMap);
562
563/*
564 * Functions in PsPixmap.c
565 */
566
567extern PixmapPtr PsCreatePixmap(ScreenPtr pScreen, int width, int height,
568 int depth);
569extern void PsScrubPixmap(PixmapPtr pPixmap);
570extern Bool PsDestroyPixmap(PixmapPtr pPixmap);
571extern DisplayListPtr PsGetFreeDisplayBlock(PsPixmapPrivPtr priv);
572extern void PsReplayPixmap(PixmapPtr pix, DrawablePtr pDrawable);
573extern int PsCloneDisplayElm(PixmapPtr dst,
574 DisplayElmPtr elm, DisplayElmPtr newElm,
575 int xoff, int yoff);
576extern void PsCopyDisplayList(PixmapPtr src, PixmapPtr dst, int xoff,
577 int yoff, int x, int y, int w, int h);
578extern PsElmPtr PsCreateFillElementList(PixmapPtr pix, int *nElms);
579extern PsElmPtr PsCloneFillElementList(int nElms, PsElmPtr elms);
580extern void PsDestroyFillElementList(int nElms, PsElmPtr elms);
581
582/*
583 * Functions in PsImageUtil.c
584 */
585
586extern unsigned long
587PsGetImagePixel(char *pImage, int depth, int w, int h, int leftPad, int format,
588 int px, int py);
589
590#endif /* _PS_H_ */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette