Tizen 2.1 base
[platform/upstream/hplip.git] / prnt / hpijs / hpprint_c_api.h
1 /*****************************************************************************\
2   hpprint_c_api.h : Interface for C access to APDK
3
4   Copyright (c) 1996 - 2001, Hewlett-Packard Co.
5   All rights reserved.
6
7   Redistribution and use in source and binary forms, with or without
8   modification, are permitted provided that the following conditions
9   are met:
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.
18
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 \*****************************************************************************/
30
31
32 // hpprint_c_api.h
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)
37
38 #ifndef APDK_HPPRINT_C_API_H
39 #define APDK_HPPRINT_C_API_H
40
41 #include "global_types.h"
42 #include "printerfactory.h"
43
44 typedef void * JobHandle;
45 typedef void * PrintContextHandle;
46 typedef void * FontHandle;
47 typedef void * ReferenceFontHandle;
48 typedef void * SystemServicesHandle;
49
50 APDK_USING_NAMESPACE
51
52 //////////////////////////////////////////
53 // 'C' interface to Job class
54 //
55
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59
60 extern DRIVER_ERROR C_Job_Create(JobHandle *phNewJob, PrintContextHandle hPrintContext);
61
62 extern void C_Job_Destroy(JobHandle hJob);
63
64 extern DRIVER_ERROR C_Job_SendRasters(JobHandle hJob, BYTE* ImageData);
65
66 extern DRIVER_ERROR C_Job_SupportSeparateBlack(JobHandle hJob, BOOL* bSeparateBlack);
67
68 extern DRIVER_ERROR C_Job_SendMultiPlaneRasters(JobHandle hJob, BYTE* BlackImageData, BYTE* ColorImageData);
69
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 );
74 #endif
75
76 extern DRIVER_ERROR C_Job_NewPage(JobHandle hJob);
77
78
79 //////////////////////////////////////////
80 // 'C' interface to PrintContext class
81 //
82
83 extern DRIVER_ERROR C_PrintContext_Create(PrintContextHandle *phNewPrintContext,
84                                           SystemServicesHandle hSysServ,
85                                           unsigned int InputPixelsPerRow,
86                                           unsigned int OutputPixelsPerRow,
87                                           PAPER_SIZE ps);
88
89 extern void C_PrintContext_Destroy(PrintContextHandle hPrintContext);
90
91 extern void C_PrintContext_Flush(PrintContextHandle hPrintContext, int FlushSize);
92
93 extern DRIVER_ERROR C_PrintContext_SelectDevice(PrintContextHandle hPrintContext, const PRINTER_TYPE Model);
94
95 extern unsigned int C_PrintContext_GetModeCount(PrintContextHandle hPrintContext);
96
97 extern DRIVER_ERROR C_PrintContext_OldSelectPrintMode(PrintContextHandle hPrintContext, const unsigned int index);
98
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);
104
105 extern unsigned int C_PrintContext_OldCurrentPrintMode(PrintContextHandle hPrintContext);
106
107 extern DRIVER_ERROR C_PrintContext_CurrentPrintMode(PrintContextHandle hPrintContext,
108                 QUALITY_MODE quality_mode,
109                 MEDIATYPE media_type,
110                 COLORMODE color_mode,
111                 BOOL device_text);
112
113 extern const char* C_PrintContext_GetModeName(PrintContextHandle hPrintContext);
114
115 extern PRINTER_TYPE C_PrintContext_SelectedDevice(PrintContextHandle hPrintContext);
116
117 #if defined(APDK_FONTS_NEEDED)
118 extern ReferenceFontHandle C_PrintContext_EnumFont(PrintContextHandle hPrintContext, int * iCurrIdx);
119
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);
123 #endif
124
125 extern PRINTER_TYPE C_PrintContext_EnumDevices(const PrintContextHandle hPrintContext, FAMILY_HANDLE&  familyHandle);
126
127 extern DRIVER_ERROR C_PrintContext_PerformPrinterFunction(PrintContextHandle hPrintContext, PRINTER_FUNC eFunc);
128
129 extern DRIVER_ERROR C_PrintContext_SetPaperSize(PrintContextHandle hPrintContext, PAPER_SIZE ps, BOOL bFullBleed);
130
131 extern DRIVER_ERROR C_PrintContext_SetPixelsPerRow(PrintContextHandle hPrintContext,
132                                                    unsigned int InputPixelsPerRow,
133                                                    unsigned int OutputPixelsPerRow);
134
135 extern BOOL C_PrintContext_PrinterSelected(PrintContextHandle hPrintContext);
136
137 extern BOOL C_PrintContext_PrinterFontsAvailable(PrintContextHandle hPrintContext);
138
139 extern unsigned int C_PrintContext_InputPixelsPerRow(PrintContextHandle hPrintContext);
140
141 extern unsigned int C_PrintContext_OutputPixelsPerRow(PrintContextHandle hPrintContext);
142
143 extern PAPER_SIZE C_PrintContext_GetPaperSize(PrintContextHandle hPrintContext);
144
145 extern const char* C_PrintContext_PrinterModel(PrintContextHandle hPrintContext);
146
147 extern const char* C_PrintContext_PrintertypeToString(PrintContextHandle hPrintContext, PRINTER_TYPE pt);
148
149 extern unsigned int C_PrintContext_InputResolution(PrintContextHandle hPrintContext);
150
151 extern DRIVER_ERROR C_PrintContext_SetInputResolution(PrintContextHandle hPrintContext, unsigned int Res);
152
153 extern unsigned int C_PrintContext_EffectiveResolutionX(PrintContextHandle hPrintContext);
154
155 extern unsigned int C_PrintContext_EffectiveResolutionY(PrintContextHandle hPrintContext);
156
157 extern float C_PrintContext_PrintableWidth(PrintContextHandle hPrintContext);
158
159 extern float C_PrintContext_PrintableHeight(PrintContextHandle hPrintContext);
160
161 extern float C_PrintContext_PhysicalPageSizeX(PrintContextHandle hPrintContext);
162
163 extern float C_PrintContext_PhysicalPageSizeY(PrintContextHandle hPrintContext);
164
165 extern float C_PrintContext_PrintableStartX(PrintContextHandle hPrintContext);
166
167 extern float C_PrintContext_PrintableStartY(PrintContextHandle hPrintContext);
168
169 extern DRIVER_ERROR C_PrintContext_SendPrinterReadyData(PrintContextHandle hPrintContext, BYTE* stream, unsigned int size);
170
171
172 //////////////////////////////////////////
173 // 'C' interface to Font class
174 //
175 #if defined(APDK_FONTS_NEEDED)
176
177 extern void C_Font_Destroy(FontHandle hFont);
178
179 extern DRIVER_ERROR C_Font_GetTextExtent(PrintContextHandle hPrintContext,FontHandle hFont,
180                                          const char* pTextString, const int iLenString,
181                                          int * iHeight, int * iWidth);
182
183 extern const char* C_Font_GetName(const FontHandle hFont);
184
185 extern BOOL C_Font_IsBoldAllowed(const FontHandle hFont);
186
187 extern BOOL C_Font_IsItalicAllowed(const FontHandle hFont);
188
189 extern BOOL C_Font_IsUnderlineAllowed(const FontHandle hFont);
190
191 extern BOOL C_Font_IsColorAllowed(const FontHandle hFont);
192
193 extern BOOL C_Font_IsProportional(const FontHandle hFont);
194
195 extern BOOL C_Font_HasSerif(const FontHandle hFont);
196
197 extern BYTE C_Font_GetPitch(const FontHandle hFont, const BYTE pointsize);
198
199 extern int C_Font_Get_iPointsize(const FontHandle hFont);
200
201 extern void C_Font_Set_iPointsize(const FontHandle hFont, int iPointsize);
202
203 extern BOOL C_Font_Get_bBold(const FontHandle hFont);
204
205 extern void C_Font_Set_bBold(const FontHandle hFont, BOOL bBold);
206
207 extern BOOL C_Font_Get_bItalic(const FontHandle hFont);
208
209 extern void C_Font_Set_bItalic(const FontHandle hFont, BOOL bItalic);
210
211 extern BOOL C_Font_Get_bUnderline(const FontHandle hFont);
212
213 extern void C_Font_Set_bUnderline(const FontHandle hFont, BOOL bUnderline);
214
215 extern TEXTCOLOR C_Font_Get_eColor(const FontHandle hFont);
216
217 extern void C_Font_Set_eColor(const FontHandle hFont, TEXTCOLOR eColor);
218
219 extern int C_Font_Get_iPitch(const FontHandle hFont);
220
221 extern void C_Font_Set_iPitch(const FontHandle hFont, int iPitch);
222
223 extern int C_Font_Index(FontHandle hFont);
224
225 #endif  // defined(APDK_FONTS_NEEDED)
226
227 #ifdef __cplusplus
228 }
229 #endif
230
231 #endif  // APDK_HPPRINT_C_API_H