1 /*****************************************************************************\
2 capture.cpp : Implimentation for capturing functions
4 Copyright (c) 1996 - 2001, Hewlett-Packard Co.
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions
10 1. Redistributions of source code must retain the above copyright
11 notice, this list of conditions and the following disclaimer.
12 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
15 3. Neither the name of Hewlett-Packard nor the names of its
16 contributors may be used to endorse or promote products derived
17 from this software without specific prior written permission.
19 THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
20 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
22 NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
24 TO, PATENT INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
25 OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 \*****************************************************************************/
38 //////////////////////////////////////////////////////////////
39 // Capture functions belonging to API
42 void PrintContext::Capture_PrintContext(unsigned int InputPixelsPerRow,
43 unsigned int OutputPixelsPerRow,
51 Scripter *pS = pSS->pScripter;
53 pS->PutDebugToken(tokPrintContext);
54 pS->PutDebugInt(InputPixelsPerRow);
55 pS->PutDebugInt(OutputPixelsPerRow);
57 pS->PutDebugByte(IOMode.bDevID);
58 pS->PutDebugByte(IOMode.bStatus);
62 // need to simulate bidi, remember model and pens
63 pS->PutDebugString((const char*)pSS->strModel,strlen(pSS->strModel));
64 pS->PutDebugString((const char*)pSS->strPens,strlen(pSS->strPens));
69 void PrintContext::Capture_RealizeFont(const unsigned int ptr,
70 const unsigned int index,
72 const TEXTCOLOR eColor,
75 const BOOL bUnderline)
81 Scripter *pS = pSS->pScripter;
83 pS->PutDebugToken(tokRealizeFont);
85 pS->PutDebugByte(index);
86 pS->PutDebugByte(bSize);
87 pS->PutDebugByte(eColor);
88 pS->PutDebugByte(bBold);
89 pS->PutDebugByte(bItalic);
90 pS->PutDebugByte(bUnderline);
94 void PrintContext::Capture_SetPixelsPerRow(unsigned int InputPixelsPerRow,
95 unsigned int OutputPixelsPerRow)
101 Scripter *pS = pSS->pScripter;
103 pS->PutDebugToken(tokSetPixelsPerRow);
104 pS->PutDebugInt(InputPixelsPerRow);
105 pS->PutDebugInt(OutputPixelsPerRow);
108 void PrintContext::Capture_SetInputResolution(unsigned int Res)
111 if (! pSS->Capturing)
114 Scripter *pS = pSS->pScripter;
116 pS->PutDebugToken(tokSetRes);
117 pS->PutDebugInt(Res);
122 void PrintContext::Capture_SelectDevice(const PRINTER_TYPE Model)
125 if (! pSS->Capturing)
128 Scripter *pS = pSS->pScripter;
130 pS->PutDebugToken(tokSelectDevice);
131 pS->PutDebugByte(Model);
136 void PrintContext::Capture_SelectDevice(const char* szDevIdString)
138 if (! pSS->Capturing)
141 Scripter *pS = pSS->pScripter;
143 pS->PutDebugToken(tokSelectDevice);
144 pS->PutDebugString(szDevIdString, strlen(szDevIdString));
148 void PrintContext::Capture_SelectPrintMode(unsigned int modenum)
151 if (! pSS->Capturing)
154 Scripter *pS = pSS->pScripter;
156 pS->PutDebugToken(tokSelectPrintMode);
157 pS->PutDebugByte(modenum);
160 void PrintContext::Capture_SetPaperSize(PAPER_SIZE ps, BOOL bFullBleed)
163 if (! pSS->Capturing)
166 Scripter *pS = pSS->pScripter;
168 pS->PutDebugToken(tokSetPaperSize);
169 pS->PutDebugByte(ps);
170 pS->PutDebugByte (bFullBleed);
176 void Job::Capture_Job(PrintContext* pPC)
179 if (! thePrintContext->pSS->Capturing)
182 Scripter *pS = thePrintContext->pSS->pScripter;
184 pS->PutDebugToken(tokJob);
188 void Job::Capture_SendRasters(BYTE* BlackImageData, BYTE* ColorImageData)
191 if (! thePrintContext->pSS->Capturing)
194 Scripter *pS = thePrintContext->pSS->pScripter;
196 pS->PutDebugToken(tokSendRasters);
198 if (BlackImageData != NULL)
199 len= (thePrintContext->InputWidth/8) + (thePrintContext->InputWidth%8);
200 pS->PutDebugStream(BlackImageData, len);
202 if (ColorImageData != NULL)
203 len= thePrintContext->OutputWidth*3;
204 pS->PutDebugStream(ColorImageData, len);
208 #if defined(APDK_FONTS_NEEDED)
209 void Job::Capture_TextOut(const char* pTextString,
210 unsigned int iLenString,
215 SystemServices* pSS = thePrintContext->pSS;
217 if (! pSS->Capturing)
220 Scripter *pS = pSS->pScripter;
222 pS->PutDebugToken(tokTextOut);
223 pS->PutDebugInt((int)&font);
224 pS->PutDebugString(pTextString,iLenString);
225 pS->PutDebugInt(iAbsX);
226 pS->PutDebugInt(iAbsY);
230 void Job::Capture_NewPage()
232 SystemServices* pSS = thePrintContext->pSS;
233 if (! pSS->Capturing)
236 Scripter *pS = pSS->pScripter;
238 pS->PutDebugToken(tokNewPage);
243 void Job::Capture_dJob()
245 SystemServices* pSS = thePrintContext->pSS;
246 if (! pSS->Capturing)
249 Scripter *pS = pSS->pScripter;
251 pS->PutDebugToken(tokdJob);
255 #if defined(APDK_FONTS_NEEDED)
256 void Font::Capture_dFont(const unsigned int ptr)
261 if (! pSS->Capturing)
264 Scripter *pS = pSS->pScripter;
266 pS->PutDebugToken(tokdFont);
267 pS->PutDebugInt(ptr);
271 void PrintContext::Capture_dPrintContext()
274 if (! pSS->Capturing)
277 Scripter *pS = pSS->pScripter;
279 pS->PutDebugToken(tokdPrintContext);