bump product version to 4.1.6.2
[LibreOffice.git] / vcl / inc / headless / svpgdi.hxx
blobbe80d29f13b520cb05a0587dee53573790ec4e09
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _SVP_SVPGDI_HXX
21 #define _SVP_SVPGDI_HXX
23 #include <basebmp/bitmapdevice.hxx>
24 #include <basebmp/color.hxx>
26 #include "salgdi.hxx"
27 #include "sallayout.hxx"
29 #ifdef IOS
30 #include "coretext/salgdi2.h"
31 #include <premac.h>
32 #include <CoreGraphics/CoreGraphics.h>
33 #include <postmac.h>
34 #endif
36 class ServerFont;
38 #ifdef IOS
39 // To keep changes to the CoreText code shared with AOO to a minimum,
40 // let's continue calling the SalGraphics subclass "AquaSalGraphics" even if it
41 // is used by us also on iOS, where of course the term "Aqua" has no meaning at all.
42 // (Note that even on OS X, using the term "Aqua" is a misunderstanding or obsolete.)
43 #define SvpSalGraphics AquaSalGraphics
44 #endif
46 class SvpSalGraphics : public SalGraphics
48 basebmp::BitmapDeviceSharedPtr m_aDevice;
49 basebmp::BitmapDeviceSharedPtr m_aOrigDevice;
51 bool m_bUseLineColor;
52 basebmp::Color m_aLineColor;
53 bool m_bUseFillColor;
54 basebmp::Color m_aFillColor;
56 basebmp::DrawMode m_aDrawMode;
58 #ifndef IOS
59 // These fields are used only when we use FreeType to draw into a
60 // headless backend, i.e. not on iOS.
61 basebmp::Color m_aTextColor;
62 ServerFont* m_pServerFont[ MAX_FALLBACK ];
63 sal_uInt32 m_eTextFmt;
64 #endif
66 basebmp::BitmapDeviceSharedPtr m_aClipMap;
68 protected:
69 Region m_aClipRegion;
70 basegfx::B2IVector GetSize() { return m_aOrigDevice->getSize(); }
72 private:
73 bool m_bClipSetup;
74 struct ClipUndoHandle {
75 SvpSalGraphics &m_rGfx;
76 basebmp::BitmapDeviceSharedPtr m_aDevice;
77 ClipUndoHandle( SvpSalGraphics *pGfx ) : m_rGfx( *pGfx ) {}
78 ~ClipUndoHandle();
80 bool isClippedSetup( const basegfx::B2IBox &aRange, ClipUndoHandle &rUndo );
81 void ensureClip();
83 protected:
85 #ifdef IOS
86 friend class CTLayout;
88 CGContextRef mrContext;
89 double mfFakeDPIScale;
91 // Device Font settings
92 const ImplMacFontData* mpMacFontData;
93 ImplMacTextStyle* mpMacTextStyle;
94 RGBAColor maTextColor;
95 /// allows text to be rendered without antialiasing
96 bool mbNonAntialiasedText;
98 #endif
100 virtual bool drawAlphaBitmap( const SalTwoRect&, const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap );
101 virtual bool drawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency );
103 public:
104 SvpSalGraphics();
105 virtual ~SvpSalGraphics();
107 const basebmp::BitmapDeviceSharedPtr& getDevice() const { return m_aDevice; }
108 void setDevice( basebmp::BitmapDeviceSharedPtr& rDevice );
110 virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY );
111 virtual sal_uInt16 GetBitCount() const;
112 virtual long GetGraphicsWidth() const;
114 virtual void ResetClipRegion();
115 virtual bool setClipRegion( const Region& );
117 virtual void SetLineColor();
118 virtual void SetLineColor( SalColor nSalColor );
119 virtual void SetFillColor();
120 virtual void SetFillColor( SalColor nSalColor );
122 virtual void SetXORMode( bool bSet, bool );
124 virtual void SetROPLineColor( SalROPColor nROPColor );
125 virtual void SetROPFillColor( SalROPColor nROPColor );
127 virtual void SetTextColor( SalColor nSalColor );
128 virtual sal_uInt16 SetFont( FontSelectPattern*, int nFallbackLevel );
129 virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
130 virtual sal_uLong GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs );
131 virtual const ImplFontCharMap* GetImplFontCharMap() const;
132 virtual bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const;
133 virtual void GetDevFontList( ImplDevFontList* );
134 virtual void ClearDevFontCache();
135 virtual void GetDevFontSubstList( OutputDevice* );
136 virtual bool AddTempDevFont( ImplDevFontList*, const OUString& rFileURL, const OUString& rFontName );
137 virtual sal_Bool CreateFontSubset( const OUString& rToFile,
138 const PhysicalFontFace*,
139 sal_Int32* pGlyphIDs,
140 sal_uInt8* pEncoding,
141 sal_Int32* pWidths,
142 int nGlyphs,
143 FontSubsetInfo& rInfo
145 virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded );
146 virtual const void* GetEmbedFontData( const PhysicalFontFace*,
147 const sal_Ucs* pUnicodes,
148 sal_Int32* pWidths,
149 FontSubsetInfo& rInfo,
150 long* pDataLen );
151 virtual void FreeEmbedFontData( const void* pData, long nDataLen );
152 virtual void GetGlyphWidths( const PhysicalFontFace*,
153 bool bVertical,
154 Int32Vector& rWidths,
155 Ucs2UIntMap& rUnicodeEnc );
156 virtual sal_Bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& );
157 virtual sal_Bool GetGlyphOutline( sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon& );
158 virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel );
159 virtual void DrawServerFontLayout( const ServerFontLayout& );
160 virtual bool supportsOperation( OutDevSupportType ) const;
161 virtual void drawPixel( long nX, long nY );
162 virtual void drawPixel( long nX, long nY, SalColor nSalColor );
163 virtual void drawLine( long nX1, long nY1, long nX2, long nY2 );
164 virtual void drawRect( long nX, long nY, long nWidth, long nHeight );
165 virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency );
166 virtual bool drawPolyLine( const ::basegfx::B2DPolygon&,
167 double fTransparency,
168 const ::basegfx::B2DVector& rLineWidths,
169 basegfx::B2DLineJoin,
170 com::sun::star::drawing::LineCap);
171 virtual void drawPolyLine( sal_uLong nPoints, const SalPoint* pPtAry );
172 virtual void drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry );
173 virtual void drawPolyPolygon( sal_uInt32 nPoly,
174 const sal_uInt32* pPoints,
175 PCONSTSALPOINT* pPtAry );
176 virtual sal_Bool drawPolyLineBezier( sal_uLong nPoints,
177 const SalPoint* pPtAry,
178 const sal_uInt8* pFlgAry );
179 virtual sal_Bool drawPolygonBezier( sal_uLong nPoints,
180 const SalPoint* pPtAry,
181 const sal_uInt8* pFlgAry );
182 virtual sal_Bool drawPolyPolygonBezier( sal_uInt32 nPoly,
183 const sal_uInt32* pPoints,
184 const SalPoint* const* pPtAry,
185 const sal_uInt8* const* pFlgAry );
187 virtual void copyArea( long nDestX,
188 long nDestY,
189 long nSrcX,
190 long nSrcY,
191 long nSrcWidth,
192 long nSrcHeight,
193 sal_uInt16 nFlags );
194 virtual void copyBits( const SalTwoRect* pPosAry,
195 SalGraphics* pSrcGraphics );
196 virtual void drawBitmap( const SalTwoRect* pPosAry,
197 const SalBitmap& rSalBitmap );
198 virtual void drawBitmap( const SalTwoRect* pPosAry,
199 const SalBitmap& rSalBitmap,
200 SalColor nTransparentColor );
201 virtual void drawBitmap( const SalTwoRect* pPosAry,
202 const SalBitmap& rSalBitmap,
203 const SalBitmap& rTransparentBitmap );
204 virtual void drawMask( const SalTwoRect* pPosAry,
205 const SalBitmap& rSalBitmap,
206 SalColor nMaskColor );
207 virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight );
208 virtual SalColor getPixel( long nX, long nY );
209 virtual void invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags );
210 virtual void invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInvert nFlags );
212 virtual sal_Bool drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize );
214 virtual SystemGraphicsData GetGraphicsData() const;
215 virtual SystemFontData GetSysFontData( int nFallbacklevel ) const;
217 #ifdef IOS
218 bool CheckContext();
219 CGContextRef GetContext();
220 bool GetRawFontData( const PhysicalFontFace* pFontData,
221 std::vector<unsigned char>& rBuffer,
222 bool* pJustCFF );
223 #endif
226 #endif
228 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */