1 /*****************************************************************************\
2 hpprint_c_api.h : Interface for C access to APDK
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 \*****************************************************************************/
33 // 'C' interface functions to APDK external C++ interfaces
34 // For use when calling environment is written in 'C' not C++
35 // (a C++ compiler is still required, however; and there must
36 // be a derived SystemServices class defined for the host environment)
38 #ifndef APDK_HPPRINT_C_API_H
39 #define APDK_HPPRINT_C_API_H
41 #include "global_types.h"
42 #include "printerfactory.h"
44 typedef void * JobHandle;
45 typedef void * PrintContextHandle;
46 typedef void * FontHandle;
47 typedef void * ReferenceFontHandle;
48 typedef void * SystemServicesHandle;
52 //////////////////////////////////////////
53 // 'C' interface to Job class
60 extern DRIVER_ERROR C_Job_Create(JobHandle *phNewJob, PrintContextHandle hPrintContext);
62 extern void C_Job_Destroy(JobHandle hJob);
64 extern DRIVER_ERROR C_Job_SendRasters(JobHandle hJob, BYTE* ImageData);
66 extern DRIVER_ERROR C_Job_SupportSeparateBlack(JobHandle hJob, BOOL* bSeparateBlack);
68 extern DRIVER_ERROR C_Job_SendMultiPlaneRasters(JobHandle hJob, BYTE* BlackImageData, BYTE* ColorImageData);
70 #if defined(APDK_FONTS_NEEDED)
71 extern DRIVER_ERROR C_Job_TextOut(JobHandle hJob, const char* pTextString,
72 unsigned int iLenString, const FontHandle hFont,
73 int iAbsX, int iAbsY );
76 extern DRIVER_ERROR C_Job_NewPage(JobHandle hJob);
79 //////////////////////////////////////////
80 // 'C' interface to PrintContext class
83 extern DRIVER_ERROR C_PrintContext_Create(PrintContextHandle *phNewPrintContext,
84 SystemServicesHandle hSysServ,
85 unsigned int InputPixelsPerRow,
86 unsigned int OutputPixelsPerRow,
89 extern void C_PrintContext_Destroy(PrintContextHandle hPrintContext);
91 extern void C_PrintContext_Flush(PrintContextHandle hPrintContext, int FlushSize);
93 extern DRIVER_ERROR C_PrintContext_SelectDevice(PrintContextHandle hPrintContext, const PRINTER_TYPE Model);
95 extern unsigned int C_PrintContext_GetModeCount(PrintContextHandle hPrintContext);
97 extern DRIVER_ERROR C_PrintContext_OldSelectPrintMode(PrintContextHandle hPrintContext, const unsigned int index);
99 extern DRIVER_ERROR C_PrintContext_SelectPrintMode(PrintContextHandle hPrintContext,
100 const QUALITY_MODE quality_mode,
101 const MEDIATYPE media_type,
102 const COLORMODE color_mode,
103 const BOOL device_text);
105 extern unsigned int C_PrintContext_OldCurrentPrintMode(PrintContextHandle hPrintContext);
107 extern DRIVER_ERROR C_PrintContext_CurrentPrintMode(PrintContextHandle hPrintContext,
108 QUALITY_MODE quality_mode,
109 MEDIATYPE media_type,
110 COLORMODE color_mode,
113 extern const char* C_PrintContext_GetModeName(PrintContextHandle hPrintContext);
115 extern PRINTER_TYPE C_PrintContext_SelectedDevice(PrintContextHandle hPrintContext);
117 #if defined(APDK_FONTS_NEEDED)
118 extern ReferenceFontHandle C_PrintContext_EnumFont(PrintContextHandle hPrintContext, int * iCurrIdx);
120 extern FontHandle C_PrintContext_RealizeFont(PrintContextHandle hPrintContext,
121 const int index, const BYTE bSize, const TEXTCOLOR eColor,
122 const BOOL bBold, const BOOL bItalic, const BOOL bUnderline);
125 extern PRINTER_TYPE C_PrintContext_EnumDevices(const PrintContextHandle hPrintContext, FAMILY_HANDLE& familyHandle);
127 extern DRIVER_ERROR C_PrintContext_PerformPrinterFunction(PrintContextHandle hPrintContext, PRINTER_FUNC eFunc);
129 extern DRIVER_ERROR C_PrintContext_SetPaperSize(PrintContextHandle hPrintContext, PAPER_SIZE ps, BOOL bFullBleed);
131 extern DRIVER_ERROR C_PrintContext_SetPixelsPerRow(PrintContextHandle hPrintContext,
132 unsigned int InputPixelsPerRow,
133 unsigned int OutputPixelsPerRow);
135 extern BOOL C_PrintContext_PrinterSelected(PrintContextHandle hPrintContext);
137 extern BOOL C_PrintContext_PrinterFontsAvailable(PrintContextHandle hPrintContext);
139 extern unsigned int C_PrintContext_InputPixelsPerRow(PrintContextHandle hPrintContext);
141 extern unsigned int C_PrintContext_OutputPixelsPerRow(PrintContextHandle hPrintContext);
143 extern PAPER_SIZE C_PrintContext_GetPaperSize(PrintContextHandle hPrintContext);
145 extern const char* C_PrintContext_PrinterModel(PrintContextHandle hPrintContext);
147 extern const char* C_PrintContext_PrintertypeToString(PrintContextHandle hPrintContext, PRINTER_TYPE pt);
149 extern unsigned int C_PrintContext_InputResolution(PrintContextHandle hPrintContext);
151 extern DRIVER_ERROR C_PrintContext_SetInputResolution(PrintContextHandle hPrintContext, unsigned int Res);
153 extern unsigned int C_PrintContext_EffectiveResolutionX(PrintContextHandle hPrintContext);
155 extern unsigned int C_PrintContext_EffectiveResolutionY(PrintContextHandle hPrintContext);
157 extern float C_PrintContext_PrintableWidth(PrintContextHandle hPrintContext);
159 extern float C_PrintContext_PrintableHeight(PrintContextHandle hPrintContext);
161 extern float C_PrintContext_PhysicalPageSizeX(PrintContextHandle hPrintContext);
163 extern float C_PrintContext_PhysicalPageSizeY(PrintContextHandle hPrintContext);
165 extern float C_PrintContext_PrintableStartX(PrintContextHandle hPrintContext);
167 extern float C_PrintContext_PrintableStartY(PrintContextHandle hPrintContext);
169 extern DRIVER_ERROR C_PrintContext_SendPrinterReadyData(PrintContextHandle hPrintContext, BYTE* stream, unsigned int size);
172 //////////////////////////////////////////
173 // 'C' interface to Font class
175 #if defined(APDK_FONTS_NEEDED)
177 extern void C_Font_Destroy(FontHandle hFont);
179 extern DRIVER_ERROR C_Font_GetTextExtent(PrintContextHandle hPrintContext,FontHandle hFont,
180 const char* pTextString, const int iLenString,
181 int * iHeight, int * iWidth);
183 extern const char* C_Font_GetName(const FontHandle hFont);
185 extern BOOL C_Font_IsBoldAllowed(const FontHandle hFont);
187 extern BOOL C_Font_IsItalicAllowed(const FontHandle hFont);
189 extern BOOL C_Font_IsUnderlineAllowed(const FontHandle hFont);
191 extern BOOL C_Font_IsColorAllowed(const FontHandle hFont);
193 extern BOOL C_Font_IsProportional(const FontHandle hFont);
195 extern BOOL C_Font_HasSerif(const FontHandle hFont);
197 extern BYTE C_Font_GetPitch(const FontHandle hFont, const BYTE pointsize);
199 extern int C_Font_Get_iPointsize(const FontHandle hFont);
201 extern void C_Font_Set_iPointsize(const FontHandle hFont, int iPointsize);
203 extern BOOL C_Font_Get_bBold(const FontHandle hFont);
205 extern void C_Font_Set_bBold(const FontHandle hFont, BOOL bBold);
207 extern BOOL C_Font_Get_bItalic(const FontHandle hFont);
209 extern void C_Font_Set_bItalic(const FontHandle hFont, BOOL bItalic);
211 extern BOOL C_Font_Get_bUnderline(const FontHandle hFont);
213 extern void C_Font_Set_bUnderline(const FontHandle hFont, BOOL bUnderline);
215 extern TEXTCOLOR C_Font_Get_eColor(const FontHandle hFont);
217 extern void C_Font_Set_eColor(const FontHandle hFont, TEXTCOLOR eColor);
219 extern int C_Font_Get_iPitch(const FontHandle hFont);
221 extern void C_Font_Set_iPitch(const FontHandle hFont, int iPitch);
223 extern int C_Font_Index(FontHandle hFont);
225 #endif // defined(APDK_FONTS_NEEDED)
231 #endif // APDK_HPPRINT_C_API_H