2 * PostScript driver Escape function
4 * Copyright 1998 Huw D M Davies
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
32 #include "wine/wingdi16.h"
36 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(psdrv
);
41 DWORD
write_spool( print_ctx
*ctx
, const void *data
, DWORD num
)
45 if (!WritePrinter(ctx
->job
.hprinter
, (LPBYTE
) data
, num
, &written
) || (written
!= num
))
51 /**********************************************************************
52 * ExtEscape (WINEPS.@)
54 INT CDECL
PSDRV_ExtEscape( print_ctx
*ctx
, INT nEscape
, INT cbInput
, LPCVOID in_data
,
55 INT cbOutput
, LPVOID out_data
)
57 TRACE("%p,%d,%d,%p,%d,%p\n",
58 ctx
->hdc
, nEscape
, cbInput
, in_data
, cbOutput
, out_data
);
64 case POSTSCRIPT_PASSTHROUGH
:
66 /* Write directly to spool file, bypassing normal PS driver
67 * processing that is done along with writing PostScript code
69 * We have a WORD before the data counting the size, but
70 * cbInput is just this +2.
71 * However Photoshop 7 has a bug that sets cbInput to 2 less than the
72 * length of the string, rather than 2 more. So we'll use the WORD at
75 passthrough_enter(ctx
);
76 return write_spool(ctx
, ((char*)in_data
) + 2, *(const WORD
*)in_data
);
79 case POSTSCRIPT_IGNORE
:
81 BOOL ret
= ctx
->job
.quiet
;
82 TRACE("POSTSCRIPT_IGNORE %d\n", *(const short*)in_data
);
83 ctx
->job
.quiet
= *(const short*)in_data
;
88 TRACE("BEGIN_PATH\n");
90 FIXME("Nested paths not yet handled\n");
91 return ++ctx
->pathdepth
;
95 const struct PATH_INFO
*info
= (const struct PATH_INFO
*)in_data
;
99 ERR("END_PATH called without a BEGIN_PATH\n");
102 TRACE("RenderMode = %d, FillMode = %d, BkMode = %d\n",
103 info
->RenderMode
, info
->FillMode
, info
->BkMode
);
104 switch(info
->RenderMode
) {
105 case RENDERMODE_NO_DISPLAY
:
106 PSDRV_WriteClosePath(ctx
); /* not sure if this is necessary, but it can't hurt */
108 case RENDERMODE_OPEN
:
109 case RENDERMODE_CLOSED
:
111 FIXME("END_PATH: RenderMode %d, not yet supported\n", info
->RenderMode
);
114 return --ctx
->pathdepth
;
119 WORD mode
= *(const WORD
*)in_data
;
123 TRACE("CLIP_TO_PATH: CLIP_SAVE\n");
124 PSDRV_WriteGSave(ctx
);
127 TRACE("CLIP_TO_PATH: CLIP_RESTORE\n");
128 PSDRV_WriteGRestore(ctx
);
131 TRACE("CLIP_TO_PATH: CLIP_INCLUSIVE\n");
132 /* FIXME to clip or eoclip ? (see PATH_INFO.FillMode) */
133 PSDRV_WriteClip(ctx
);
134 PSDRV_WriteNewPath(ctx
);
137 FIXME("CLIP_EXCLUSIVE: not implemented\n");
140 FIXME("Unknown CLIP_TO_PATH mode %d\n", mode
);
150 /************************************************************************
153 INT CDECL
PSDRV_StartPage( print_ctx
*ctx
)
155 TRACE("%p\n", ctx
->hdc
);
157 if(!ctx
->job
.OutOfPage
) {
158 FIXME("Already started a page?\n");
164 if(!PSDRV_WriteNewPage( ctx
))
166 ctx
->job
.OutOfPage
= FALSE
;
171 /************************************************************************
174 INT CDECL
PSDRV_EndPage( print_ctx
*ctx
)
176 TRACE("%p\n", ctx
->hdc
);
178 if(ctx
->job
.OutOfPage
) {
179 FIXME("Already ended a page?\n");
183 passthrough_leave(ctx
);
184 if(!PSDRV_WriteEndPage( ctx
))
186 PSDRV_EmptyDownloadList(ctx
, FALSE
);
187 ctx
->job
.OutOfPage
= TRUE
;