xref: /aoo41x/main/vcl/inc/printergfx.hxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _PSPRINT_PRINTERGFX_HXX_
29*cdf0e10cSrcweir #define _PSPRINT_PRINTERGFX_HXX_
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "vcl/helper.hxx"
32*cdf0e10cSrcweir #include "sallayout.hxx"
33*cdf0e10cSrcweir #include "osl/file.hxx"
34*cdf0e10cSrcweir #include "tools/gen.hxx"
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir #include <list>
37*cdf0e10cSrcweir #include <hash_map>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir namespace psp {
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir // forwards
42*cdf0e10cSrcweir class JobData;
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir /*
45*cdf0e10cSrcweir  * lightweight container to handle RGB values
46*cdf0e10cSrcweir  */
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir class PrinterColor
49*cdf0e10cSrcweir {
50*cdf0e10cSrcweir public:
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir     enum    ColorSpace { eInvalid, eRGB };
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir private:
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir     sal_uInt8       mnRed;
57*cdf0e10cSrcweir     sal_uInt8       mnGreen;
58*cdf0e10cSrcweir     sal_uInt8       mnBlue;
59*cdf0e10cSrcweir     ColorSpace      meColorspace;
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir public:
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir     PrinterColor () :
64*cdf0e10cSrcweir             meColorspace(eInvalid)
65*cdf0e10cSrcweir     {}
66*cdf0e10cSrcweir     PrinterColor (sal_uInt16 nRed, sal_uInt16 nGreen,
67*cdf0e10cSrcweir                   sal_uInt16 nBlue) :
68*cdf0e10cSrcweir             mnRed   (nRed),
69*cdf0e10cSrcweir             mnGreen (nGreen),
70*cdf0e10cSrcweir             mnBlue  (nBlue),
71*cdf0e10cSrcweir             meColorspace (eRGB)
72*cdf0e10cSrcweir     {}
73*cdf0e10cSrcweir     PrinterColor (sal_uInt32 nRGB) :
74*cdf0e10cSrcweir             mnRed   ((nRGB & 0x00ff0000) >> 16),
75*cdf0e10cSrcweir             mnGreen ((nRGB & 0x0000ff00) >>  8),
76*cdf0e10cSrcweir             mnBlue  ((nRGB & 0x000000ff)      ),
77*cdf0e10cSrcweir             meColorspace (eRGB)
78*cdf0e10cSrcweir     {}
79*cdf0e10cSrcweir     ~PrinterColor ()
80*cdf0e10cSrcweir     {}
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir     sal_Bool        Is () const
83*cdf0e10cSrcweir     { return meColorspace != eInvalid; }
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir     ColorSpace      GetColorSpace () const
86*cdf0e10cSrcweir     { return meColorspace; }
87*cdf0e10cSrcweir     sal_uInt16      GetRed () const
88*cdf0e10cSrcweir     { return mnRed; }
89*cdf0e10cSrcweir     sal_uInt16      GetGreen () const
90*cdf0e10cSrcweir     { return mnGreen; }
91*cdf0e10cSrcweir     sal_uInt16      GetBlue () const
92*cdf0e10cSrcweir     { return mnBlue; }
93*cdf0e10cSrcweir     sal_Bool        operator== (const PrinterColor& aColor) const
94*cdf0e10cSrcweir     {
95*cdf0e10cSrcweir         return aColor.Is() && this->Is()
96*cdf0e10cSrcweir             && mnRed   == aColor.mnRed
97*cdf0e10cSrcweir             && mnGreen == aColor.mnGreen
98*cdf0e10cSrcweir             && mnBlue  == aColor.mnBlue;
99*cdf0e10cSrcweir     }
100*cdf0e10cSrcweir     sal_Bool        operator!= (const PrinterColor& aColor) const
101*cdf0e10cSrcweir     { return ! (aColor==*this); }
102*cdf0e10cSrcweir     PrinterColor&   operator= (const PrinterColor& aColor)
103*cdf0e10cSrcweir     {
104*cdf0e10cSrcweir         meColorspace = aColor.meColorspace;
105*cdf0e10cSrcweir         mnRed   = aColor.mnRed;
106*cdf0e10cSrcweir         mnGreen = aColor.mnGreen;
107*cdf0e10cSrcweir         mnBlue  = aColor.mnBlue;
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir         return *this;
110*cdf0e10cSrcweir     }
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir     PrinterColor&   operator= (sal_uInt32 nRGB)
113*cdf0e10cSrcweir     {
114*cdf0e10cSrcweir         meColorspace = eRGB;
115*cdf0e10cSrcweir         mnBlue  = (nRGB & 0x000000ff);
116*cdf0e10cSrcweir         mnGreen = (nRGB & 0x0000ff00) >>  8;
117*cdf0e10cSrcweir         mnRed   = (nRGB & 0x00ff0000) >> 16;
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir         return *this;
120*cdf0e10cSrcweir     }
121*cdf0e10cSrcweir };
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir /*
124*cdf0e10cSrcweir  * forward declarations
125*cdf0e10cSrcweir  */
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir class Font3;
128*cdf0e10cSrcweir class GlyphSet;
129*cdf0e10cSrcweir class PrinterJob;
130*cdf0e10cSrcweir class PrintFontManager;
131*cdf0e10cSrcweir class KernPair;
132*cdf0e10cSrcweir struct CharacterMetric;
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir /*
135*cdf0e10cSrcweir  * Bitmap Interface, this has to be filled with your actual bitmap implementation
136*cdf0e10cSrcweir  * sample implementations can be found in:
137*cdf0e10cSrcweir  *      psprint/workben/cui/pspdem.cxx
138*cdf0e10cSrcweir  *      vcl/unx/source/gdi/salgdi2.cxx
139*cdf0e10cSrcweir  */
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir class PrinterBmp
142*cdf0e10cSrcweir {
143*cdf0e10cSrcweir public:
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir     virtual             ~PrinterBmp ()  = 0;
146*cdf0e10cSrcweir     virtual sal_uInt32  GetPaletteColor (sal_uInt32 nIdx) const = 0;
147*cdf0e10cSrcweir     virtual sal_uInt32  GetPaletteEntryCount ()           const = 0;
148*cdf0e10cSrcweir     virtual sal_uInt32  GetPixelRGB  (sal_uInt32 nRow, sal_uInt32 nColumn) const = 0;
149*cdf0e10cSrcweir     virtual sal_uInt8   GetPixelGray (sal_uInt32 nRow, sal_uInt32 nColumn) const = 0;
150*cdf0e10cSrcweir     virtual sal_uInt8   GetPixelIdx  (sal_uInt32 nRow, sal_uInt32 nColumn) const = 0;
151*cdf0e10cSrcweir     virtual sal_uInt32  GetWidth ()     const = 0;
152*cdf0e10cSrcweir     virtual sal_uInt32  GetHeight ()    const = 0;
153*cdf0e10cSrcweir     virtual sal_uInt32  GetDepth ()     const = 0;
154*cdf0e10cSrcweir };
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir typedef enum {
157*cdf0e10cSrcweir     InvalidType = 0,
158*cdf0e10cSrcweir     TrueColorImage,
159*cdf0e10cSrcweir     MonochromeImage,
160*cdf0e10cSrcweir     PaletteImage,
161*cdf0e10cSrcweir     GrayScaleImage
162*cdf0e10cSrcweir } ImageType;
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir /*
165*cdf0e10cSrcweir  * printer raster operations
166*cdf0e10cSrcweir  */
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir struct GraphicsStatus
169*cdf0e10cSrcweir {
170*cdf0e10cSrcweir     rtl::OString        maFont;
171*cdf0e10cSrcweir     rtl_TextEncoding	maEncoding;
172*cdf0e10cSrcweir     bool				mbArtItalic;
173*cdf0e10cSrcweir     bool				mbArtBold;
174*cdf0e10cSrcweir     sal_Int32           mnTextHeight;
175*cdf0e10cSrcweir     sal_Int32           mnTextWidth;
176*cdf0e10cSrcweir     PrinterColor        maColor;
177*cdf0e10cSrcweir     double             mfLineWidth;
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir     GraphicsStatus();
180*cdf0e10cSrcweir };
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir class Font3;
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir class PrinterGfx
185*cdf0e10cSrcweir {
186*cdf0e10cSrcweir private:
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir     /* common settings */
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir     double          mfScaleX;
191*cdf0e10cSrcweir     double          mfScaleY;
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir     sal_uInt32      mnDpi;
194*cdf0e10cSrcweir     sal_uInt16      mnDepth;
195*cdf0e10cSrcweir 
196*cdf0e10cSrcweir     sal_uInt16      mnPSLevel;
197*cdf0e10cSrcweir     sal_Bool        mbColor;
198*cdf0e10cSrcweir     sal_Bool        mbUploadPS42Fonts;
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir     osl::File*      mpPageHeader;
201*cdf0e10cSrcweir     osl::File*      mpPageBody;
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir     void            TranslateCoordinates (sal_Int32 &rXOut, sal_Int32 &rYOut,
204*cdf0e10cSrcweir                                           sal_Int32 nXIn, sal_Int32 nYIn )
205*cdf0e10cSrcweir     { rXOut = nXIn; rYOut = nYIn; }
206*cdf0e10cSrcweir     void            TranslateCoordinates (Point& rOut, const Point& rIn)
207*cdf0e10cSrcweir     { rOut = rIn; }
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir     /* text/font related data, for a type1 font it has to be checked
210*cdf0e10cSrcweir        whether this font has already been downloaded. A TrueType font
211*cdf0e10cSrcweir        will be converted into one or more Type3 fonts, containing glyphs
212*cdf0e10cSrcweir        in no particular order. In addition to the existence of the
213*cdf0e10cSrcweir        glyph in one of the subfonts, the mapping from unicode to the
214*cdf0e10cSrcweir        glyph has to be remembered */
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir     std::list< sal_Int32 > maPS1Font;
217*cdf0e10cSrcweir     std::list< GlyphSet > maPS3Font;
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir     sal_Int32       mnFontID;
220*cdf0e10cSrcweir     sal_Int32       mnFallbackID;
221*cdf0e10cSrcweir     sal_Int32       mnTextAngle;
222*cdf0e10cSrcweir     bool           mbTextVertical;
223*cdf0e10cSrcweir     PrintFontManager& mrFontMgr;
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir     /* bitmap drawing implementation */
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir     sal_Bool    mbCompressBmp;
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir     void    DrawPS1GrayImage      (const PrinterBmp& rBitmap, const Rectangle& rArea);
230*cdf0e10cSrcweir     void    writePS2ImageHeader   (const Rectangle& rArea, psp::ImageType nType);
231*cdf0e10cSrcweir     void    writePS2Colorspace    (const PrinterBmp& rBitmap, psp::ImageType nType);
232*cdf0e10cSrcweir     void    DrawPS2GrayImage      (const PrinterBmp& rBitmap, const Rectangle& rArea);
233*cdf0e10cSrcweir     void    DrawPS2PaletteImage   (const PrinterBmp& rBitmap, const Rectangle& rArea);
234*cdf0e10cSrcweir     void    DrawPS2TrueColorImage (const PrinterBmp& rBitmap, const Rectangle& rArea);
235*cdf0e10cSrcweir     void    DrawPS2MonoImage      (const PrinterBmp& rBitmap, const Rectangle& rArea);
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir     /* clip region */
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir     std::list< Rectangle > maClipRegion;
240*cdf0e10cSrcweir     sal_Bool JoinVerticalClipRectangles( std::list< Rectangle >::iterator& it,
241*cdf0e10cSrcweir                                          Point& aOldPoint, sal_Int32& nColumn );
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir     /* color settings */
244*cdf0e10cSrcweir     PrinterColor    maFillColor;
245*cdf0e10cSrcweir     PrinterColor    maTextColor;
246*cdf0e10cSrcweir     PrinterColor    maLineColor;
247*cdf0e10cSrcweir 
248*cdf0e10cSrcweir     /* graphics state */
249*cdf0e10cSrcweir     GraphicsStatus                  maVirtualStatus;
250*cdf0e10cSrcweir     std::list< GraphicsStatus >     maGraphicsStack;
251*cdf0e10cSrcweir     GraphicsStatus& currentState() { return maGraphicsStack.front(); }
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir     /* font / font substitution */
254*cdf0e10cSrcweir     friend class Font3;
255*cdf0e10cSrcweir     const ::std::hash_map< fontID, fontID >*    mpFontSubstitutes;
256*cdf0e10cSrcweir     int             getCharWidth (sal_Bool b_vert, sal_Unicode n_char,
257*cdf0e10cSrcweir                                   CharacterMetric *p_bbox);
258*cdf0e10cSrcweir     fontID          getCharMetric (const Font3 &rFont, sal_Unicode n_char,
259*cdf0e10cSrcweir                                    CharacterMetric *p_bbox);
260*cdf0e10cSrcweir     fontID          getFontSubstitute () const;
261*cdf0e10cSrcweir     fontID          getFallbackID () const { return mnFallbackID; }
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir     bool            mbStrictSO52Compatibility;
264*cdf0e10cSrcweir public:
265*cdf0e10cSrcweir     /* grahics status update */
266*cdf0e10cSrcweir     void            PSSetColor ();
267*cdf0e10cSrcweir     void            PSSetLineWidth ();
268*cdf0e10cSrcweir     void            PSSetFont ();
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir     /* graphics status functions */
271*cdf0e10cSrcweir     void            PSSetColor (const PrinterColor& rColor)
272*cdf0e10cSrcweir     { maVirtualStatus.maColor = rColor; }
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir     void            PSUploadPS1Font (sal_Int32 nFontID);
275*cdf0e10cSrcweir     void            PSSetFont (const rtl::OString& rName,
276*cdf0e10cSrcweir                                rtl_TextEncoding nEncoding = RTL_TEXTENCODING_DONTKNOW)
277*cdf0e10cSrcweir     { maVirtualStatus.maFont = rName; maVirtualStatus.maEncoding = nEncoding; }
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir     /* graphics status stack */
280*cdf0e10cSrcweir     void            PSGSave ();
281*cdf0e10cSrcweir     void            PSGRestore ();
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir     /* PS helpers */
285*cdf0e10cSrcweir     enum pspath_t { moveto = 0, lineto = 1 };
286*cdf0e10cSrcweir     void            PSBinLineTo (const Point& rCurrent, Point& rOld,
287*cdf0e10cSrcweir                                  sal_Int32& nColumn);
288*cdf0e10cSrcweir     void            PSBinMoveTo (const Point& rCurrent, Point& rOld,
289*cdf0e10cSrcweir                                  sal_Int32& nColumn);
290*cdf0e10cSrcweir     void            PSBinStartPath ();
291*cdf0e10cSrcweir     void            PSBinEndPath ();
292*cdf0e10cSrcweir     void            PSBinCurrentPath (sal_uInt32 nPoints, const Point* pPath);
293*cdf0e10cSrcweir     void            PSBinPath (const Point& rCurrent, Point& rOld,
294*cdf0e10cSrcweir                                pspath_t eType, sal_Int32& nColumn);
295*cdf0e10cSrcweir 
296*cdf0e10cSrcweir     void            PSRotate (sal_Int32 nAngle);
297*cdf0e10cSrcweir     void            PSTranslate (const Point& rPoint);
298*cdf0e10cSrcweir     void            PSMoveTo (const Point& rPoint);
299*cdf0e10cSrcweir     void            PSRMoveTo (sal_Int32 nDx, sal_Int32 nDy = 0);
300*cdf0e10cSrcweir     void            PSScale (double fScaleX, double fScaleY);
301*cdf0e10cSrcweir     void            PSLineTo(const Point& rPoint );
302*cdf0e10cSrcweir     void            PSPointOp (const Point& rPoint, const sal_Char* pOperator);
303*cdf0e10cSrcweir     void            PSHexString (const sal_uChar* pString, sal_Int16 nLen);
304*cdf0e10cSrcweir     void            PSDeltaArray (const sal_Int32 *pArray, sal_Int16 nEntries);
305*cdf0e10cSrcweir     void            PSShowText (const sal_uChar* pString,
306*cdf0e10cSrcweir                                 sal_Int16 nGlyphs, sal_Int16 nBytes,
307*cdf0e10cSrcweir                                 const sal_Int32* pDeltaArray = NULL);
308*cdf0e10cSrcweir     void			PSComment (const sal_Char* pComment );
309*cdf0e10cSrcweir     void            LicenseWarning (const Point& rPoint, const sal_Unicode* pStr,
310*cdf0e10cSrcweir                                     sal_Int16 nLen, const sal_Int32* pDeltaArray);
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir     void			OnEndPage ();
313*cdf0e10cSrcweir     void			OnEndJob ();
314*cdf0e10cSrcweir     void			writeResources( osl::File* pFile, std::list< rtl::OString >& rSuppliedFonts, std::list< rtl::OString >& rNeededFonts );
315*cdf0e10cSrcweir     PrintFontManager& GetFontMgr () { return mrFontMgr; }
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir     void            drawVerticalizedText (const Point& rPoint,
318*cdf0e10cSrcweir                                           const sal_Unicode* pStr,
319*cdf0e10cSrcweir                                           sal_Int16 nLen,
320*cdf0e10cSrcweir                                           const sal_Int32* pDeltaArray );
321*cdf0e10cSrcweir     void            drawText (const Point& rPoint,
322*cdf0e10cSrcweir                               const sal_Unicode* pStr, sal_Int16 nLen,
323*cdf0e10cSrcweir                               const sal_Int32* pDeltaArray = NULL);
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir     void			drawGlyphs( const Point& rPoint,
326*cdf0e10cSrcweir                                 sal_GlyphId* pGlyphIds,
327*cdf0e10cSrcweir                                 sal_Unicode* pUnicodes,
328*cdf0e10cSrcweir                                 sal_Int16 nLen,
329*cdf0e10cSrcweir                                 sal_Int32* pDeltaArray );
330*cdf0e10cSrcweir public:
331*cdf0e10cSrcweir     PrinterGfx();
332*cdf0e10cSrcweir     ~PrinterGfx();
333*cdf0e10cSrcweir     sal_Bool        Init (PrinterJob &rPrinterSpec);
334*cdf0e10cSrcweir     sal_Bool        Init (const JobData& rData);
335*cdf0e10cSrcweir     void            Clear();
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir     // query depth and size
338*cdf0e10cSrcweir     void            GetResolution (sal_Int32 &rDpiX, sal_Int32 &rDpiY) const;
339*cdf0e10cSrcweir     sal_uInt16      GetBitCount ();
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir     // clip region
342*cdf0e10cSrcweir     void            ResetClipRegion ();
343*cdf0e10cSrcweir     void            BeginSetClipRegion (sal_uInt32);
344*cdf0e10cSrcweir     sal_Bool        UnionClipRegion (sal_Int32 nX, sal_Int32 nY,
345*cdf0e10cSrcweir                                      sal_Int32 nDX, sal_Int32 nDY);
346*cdf0e10cSrcweir     void            EndSetClipRegion ();
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir     // set xy color
349*cdf0e10cSrcweir     void            SetLineColor (const PrinterColor& rLineColor = PrinterColor())
350*cdf0e10cSrcweir     { maLineColor = rLineColor; }
351*cdf0e10cSrcweir     void            SetFillColor (const PrinterColor& rFillColor = PrinterColor())
352*cdf0e10cSrcweir     { maFillColor = rFillColor; }
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir     // drawing primitives
355*cdf0e10cSrcweir     void            DrawPixel (const Point& rPoint, const PrinterColor& rPixelColor);
356*cdf0e10cSrcweir     void            DrawPixel (const Point& rPoint)
357*cdf0e10cSrcweir     { DrawPixel (rPoint, maLineColor); }
358*cdf0e10cSrcweir     void            DrawLine  (const Point& rFrom, const Point& rTo);
359*cdf0e10cSrcweir     void            DrawRect  (const Rectangle& rRectangle);
360*cdf0e10cSrcweir     void            DrawPolyLine (sal_uInt32 nPoints, const Point* pPath );
361*cdf0e10cSrcweir     void            DrawPolygon  (sal_uInt32 nPoints, const Point* pPath);
362*cdf0e10cSrcweir     void            DrawPolyPolygon (sal_uInt32 nPoly,
363*cdf0e10cSrcweir                                      const sal_uInt32 *pPolygonSize,
364*cdf0e10cSrcweir                                      const Point** pPolygonList);
365*cdf0e10cSrcweir     void            DrawPolyLineBezier (sal_uInt32 nPoints,
366*cdf0e10cSrcweir                                      const Point* pPath,
367*cdf0e10cSrcweir                                      const sal_uInt8* pFlgAry );
368*cdf0e10cSrcweir     void            DrawPolygonBezier  (sal_uInt32 nPoints,
369*cdf0e10cSrcweir                                      const Point* pPath,
370*cdf0e10cSrcweir                                      const sal_uInt8* pFlgAry);
371*cdf0e10cSrcweir     void            DrawPolyPolygonBezier  (sal_uInt32 nPoly,
372*cdf0e10cSrcweir                                      const sal_uInt32* pPoints,
373*cdf0e10cSrcweir                                      const Point* const* pPtAry,
374*cdf0e10cSrcweir                                      const sal_uInt8* const* pFlgAry);
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir     // eps
377*cdf0e10cSrcweir     sal_Bool        DrawEPS ( const Rectangle& rBoundingBox, void* pPtr, sal_uInt32 nSize);
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir     // image drawing
380*cdf0e10cSrcweir     void            DrawBitmap (const Rectangle& rDest, const Rectangle& rSrc,
381*cdf0e10cSrcweir                                 const PrinterBmp& rBitmap);
382*cdf0e10cSrcweir     void            DrawBitmap (const Rectangle& rDest, const Rectangle& rSrc,
383*cdf0e10cSrcweir                                 const PrinterBmp& rBitmap,
384*cdf0e10cSrcweir                                 const PrinterBmp& rTransBitmap);
385*cdf0e10cSrcweir     void            DrawMask   (const Rectangle& rDest, const Rectangle& rSrc,
386*cdf0e10cSrcweir                                 const PrinterBmp &rBitmap, PrinterColor& rMaskColor);
387*cdf0e10cSrcweir 
388*cdf0e10cSrcweir     // font and text handling
389*cdf0e10cSrcweir     sal_uInt16      SetFont (
390*cdf0e10cSrcweir                              sal_Int32 nFontID,
391*cdf0e10cSrcweir                              sal_Int32 nPointHeight,
392*cdf0e10cSrcweir                              sal_Int32 nPointWidth,
393*cdf0e10cSrcweir                              sal_Int32 nAngle,
394*cdf0e10cSrcweir                              bool bVertical,
395*cdf0e10cSrcweir                              bool bArtItalic,
396*cdf0e10cSrcweir                              bool bArtBold
397*cdf0e10cSrcweir                              );
398*cdf0e10cSrcweir     sal_uInt16      SetFallbackFont ( sal_Int32 nFontID );
399*cdf0e10cSrcweir     sal_Int32       GetFontAngle () const
400*cdf0e10cSrcweir     { return mnTextAngle; }
401*cdf0e10cSrcweir     sal_Int32       GetFontID () const
402*cdf0e10cSrcweir     { return mnFontID; }
403*cdf0e10cSrcweir     bool			GetFontVertical() const
404*cdf0e10cSrcweir     { return mbTextVertical; }
405*cdf0e10cSrcweir     sal_Int32       GetFontHeight () const
406*cdf0e10cSrcweir     { return maVirtualStatus.mnTextHeight; }
407*cdf0e10cSrcweir     sal_Int32       GetFontWidth () const
408*cdf0e10cSrcweir     { return maVirtualStatus.mnTextWidth; }
409*cdf0e10cSrcweir     bool			GetArtificialItalic() const
410*cdf0e10cSrcweir     { return maVirtualStatus.mbArtItalic; }
411*cdf0e10cSrcweir     bool			GetArtificialBold() const
412*cdf0e10cSrcweir     { return maVirtualStatus.mbArtBold; }
413*cdf0e10cSrcweir     void            DrawText (const Point& rPoint,
414*cdf0e10cSrcweir                               const sal_Unicode* pStr, sal_Int16 nLen,
415*cdf0e10cSrcweir                               const sal_Int32* pDeltaArray = NULL);
416*cdf0e10cSrcweir     void            SetTextColor (PrinterColor& rTextColor)
417*cdf0e10cSrcweir     { maTextColor = rTextColor; }
418*cdf0e10cSrcweir     sal_Int32       GetCharWidth (sal_uInt16 nFrom, sal_uInt16 nTo,
419*cdf0e10cSrcweir                                   long *pWidthArray);
420*cdf0e10cSrcweir     const ::std::list< KernPair >& getKernPairs( bool bVertical = false ) const;
421*cdf0e10cSrcweir     // advanced font handling
422*cdf0e10cSrcweir     sal_Bool        GetGlyphBoundRect (sal_Unicode c, Rectangle& rOutRect);
423*cdf0e10cSrcweir     sal_uInt32      GetGlyphOutline (sal_Unicode c,
424*cdf0e10cSrcweir                                      sal_uInt16 **ppPolySizes, Point **ppPoints,
425*cdf0e10cSrcweir                                      sal_uInt8 **ppFlags);
426*cdf0e10cSrcweir 
427*cdf0e10cSrcweir     // for CTL
428*cdf0e10cSrcweir     void			DrawGlyphs( const Point& rPoint,
429*cdf0e10cSrcweir                                 sal_GlyphId* pGlyphIds,
430*cdf0e10cSrcweir                                 sal_Unicode* pUnicodes,
431*cdf0e10cSrcweir                                 sal_Int16 nLen,
432*cdf0e10cSrcweir                                 sal_Int32* pDeltaArray );
433*cdf0e10cSrcweir 
434*cdf0e10cSrcweir     bool getStrictSO52Compatibility() const;
435*cdf0e10cSrcweir     void setStrictSO52Compatibility( bool );
436*cdf0e10cSrcweir };
437*cdf0e10cSrcweir 
438*cdf0e10cSrcweir } /* namespace psp */
439*cdf0e10cSrcweir 
440*cdf0e10cSrcweir 
441*cdf0e10cSrcweir #endif /* _PSPRINT_PRINTERGFX_HXX_ */
442*cdf0e10cSrcweir 
443