Release 980628
[wine/gsoc-2012-control.git] / graphics / psdrv / init.c
blobe99b519ce9bf0d4bf1b1b5ba3158b23a895e7e21
1 /*
2 * Postscript driver initialization functions
4 * Copyright 1998 Huw D M Davies
6 */
8 #include "windows.h"
9 #include "gdi.h"
10 #include "psdrv.h"
11 #include "debug.h"
12 #include "heap.h"
14 static BOOL32 PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
15 LPCSTR output, const DEVMODE16* initData );
16 static BOOL32 PSDRV_DeleteDC( DC *dc );
18 static const DC_FUNCTIONS PSDRV_Funcs =
20 NULL, /* pArc */
21 NULL, /* pBitBlt */
22 NULL, /* pChord */
23 PSDRV_CreateDC, /* pCreateDC */
24 PSDRV_DeleteDC, /* pDeleteDC */
25 NULL, /* pDeleteObject */
26 PSDRV_Ellipse, /* pEllipse */
27 PSDRV_EnumDeviceFonts, /* pEnumDeviceFonts */
28 PSDRV_Escape, /* pEscape */
29 NULL, /* pExcludeClipRect */
30 NULL, /* pExcludeVisRect */
31 NULL, /* pExtFloodFill */
32 PSDRV_ExtTextOut, /* pExtTextOut */
33 NULL, /* pGetCharWidth */
34 NULL, /* pGetPixel */
35 PSDRV_GetTextExtentPoint, /* pGetTextExtentPoint */
36 PSDRV_GetTextMetrics, /* pGetTextMetrics */
37 NULL, /* pIntersectClipRect */
38 NULL, /* pIntersectVisRect */
39 PSDRV_LineTo, /* pLineTo */
40 PSDRV_MoveToEx, /* pMoveToEx */
41 NULL, /* pOffsetClipRgn */
42 NULL, /* pOffsetViewportOrg (optional) */
43 NULL, /* pOffsetWindowOrg (optional) */
44 NULL, /* pPaintRgn */
45 NULL, /* pPatBlt */
46 NULL, /* pPie */
47 NULL, /* pPolyPolygon */
48 NULL, /* pPolyPolyline */
49 NULL, /* pPolygon */
50 NULL, /* pPolyline */
51 NULL, /* pRealizePalette */
52 PSDRV_Rectangle, /* pRectangle */
53 NULL, /* pRestoreDC */
54 NULL, /* pRoundRect */
55 NULL, /* pSaveDC */
56 NULL, /* pScaleViewportExt (optional) */
57 NULL, /* pScaleWindowExt (optional) */
58 NULL, /* pSelectClipRgn */
59 PSDRV_SelectObject, /* pSelectObject */
60 NULL, /* pSelectPalette */
61 NULL, /* pSetBkColor */
62 NULL, /* pSetBkMode */
63 NULL, /* pSetDeviceClipping */
64 NULL, /* pSetDIBitsToDevice */
65 NULL, /* pSetMapMode (optional) */
66 NULL, /* pSetMapperFlags */
67 NULL, /* pSetPixel */
68 NULL, /* pSetPolyFillMode */
69 NULL, /* pSetROP2 */
70 NULL, /* pSetRelAbs */
71 NULL, /* pSetStretchBltMode */
72 NULL, /* pSetTextAlign */
73 NULL, /* pSetTextCharacterExtra */
74 NULL, /* pSetTextColor */
75 NULL, /* pSetTextJustification */
76 NULL, /* pSetViewportExt (optional) */
77 NULL, /* pSetViewportOrg (optional) */
78 NULL, /* pSetWindowExt (optional) */
79 NULL, /* pSetWindowOrg (optional) */
80 NULL, /* pStretchBlt */
81 NULL /* pStretchDIBits */
85 /* Default entries for devcaps */
87 static DeviceCaps PSDRV_DevCaps = {
88 /* version */ 0,
89 /* technology */ DT_RASPRINTER,
90 /* horzSize */ 200,
91 /* vertSize */ 288,
92 /* horzRes */ 4733,
93 /* vertRes */ 6808,
94 /* bitsPixel */ 1,
95 /* planes */ 1,
96 /* numBrushes */ -1,
97 /* numPens */ 10,
98 /* numMarkers */ 0,
99 /* numFonts */ 39,
100 /* numColors */ 2,
101 /* pdeviceSize */ 0,
102 /* curveCaps */ CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES |
103 CC_WIDE | CC_STYLED | CC_WIDESTYLED | CC_INTERIORS |
104 CC_ROUNDRECT,
105 /* lineCaps */ LC_POLYLINE | LC_MARKER | LC_POLYMARKER | LC_WIDE |
106 LC_STYLED | LC_WIDESTYLED | LC_INTERIORS,
107 /* polygoalnCaps */ PC_POLYGON | PC_RECTANGLE | PC_WINDPOLYGON |
108 PC_SCANLINE | PC_WIDE | PC_STYLED | PC_WIDESTYLED |
109 PC_INTERIORS,
110 /* textCaps */ 0, /* psdrv 0x59f7 */
111 /* clipCaps */ CP_RECTANGLE,
112 /* rasterCaps */ RC_BITBLT | RC_BANDING | RC_SCALING | RC_BITMAP64 |
113 RC_DI_BITMAP | RC_DIBTODEV | RC_BIGFONT |
114 RC_STRETCHBLT | RC_STRETCHDIB | RC_DEVBITS,
115 /* psdrv 0x6e99 */
116 /* aspectX */ 600,
117 /* aspectY */ 600,
118 /* aspectXY */ 848,
119 /* pad1 */ { 0 },
120 /* logPixelsX */ 600,
121 /* logPixelsY */ 600,
122 /* pad2 */ { 0 },
123 /* palette size */ 0,
124 /* ..etc */ 0, 0 };
126 /*********************************************************************
127 * PSDRV_Init
129 * Initializes font metrics and registers driver. Called from GDI_Init()
132 BOOL32 PSDRV_Init(void)
134 TRACE(psdrv, "\n");
135 PSDRV_GetFontMetrics();
136 return DRIVER_RegisterDriver( "WINEPS", &PSDRV_Funcs );
140 /**********************************************************************
141 * PSDRV_CreateDC
143 static BOOL32 PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
144 LPCSTR output, const DEVMODE16* initData )
146 PSDRV_PDEVICE *physDev;
148 TRACE(psdrv, "(%s %s %s %p)\n", driver, device, output, initData);
150 if(!PSDRV_AFMFontList) {
151 MSG("To use WINEPS you need to install some AFM files.\n");
152 return FALSE;
155 dc->w.devCaps = &PSDRV_DevCaps;
156 dc->w.hVisRgn = CreateRectRgn32(0, 0, dc->w.devCaps->horzRes,
157 dc->w.devCaps->vertRes);
159 physDev = (PSDRV_PDEVICE *)HeapAlloc( GetProcessHeap(), 0,
160 sizeof(*physDev) );
161 if (!physDev) return FALSE;
162 dc->physDev = physDev;
163 physDev->job.output = HEAP_strdupA( GetProcessHeap(), 0, output );
164 if (!physDev->job.output) return FALSE;
165 physDev->job.hJob = 0;
166 return TRUE;
170 /**********************************************************************
171 * PSDRV_DeleteDC
173 static BOOL32 PSDRV_DeleteDC( DC *dc )
175 PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
177 TRACE(psdrv, "\n");
178 HeapFree( GetProcessHeap(), 0, physDev->job.output );
179 HeapFree( GetProcessHeap(), 0, physDev );
180 dc->physDev = NULL;
181 return TRUE;