Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _SVP_SVPGDI_HXX
21 : #define _SVP_SVPGDI_HXX
22 :
23 : #include <basebmp/bitmapdevice.hxx>
24 : #include <basebmp/color.hxx>
25 :
26 : #include <salgdi.hxx>
27 : #include <sallayout.hxx>
28 :
29 : class ServerFont;
30 :
31 : class SvpSalGraphics : public SalGraphics
32 : {
33 : basebmp::BitmapDeviceSharedPtr m_aDevice;
34 : basebmp::BitmapDeviceSharedPtr m_aOrigDevice;
35 :
36 : bool m_bUseLineColor;
37 : basebmp::Color m_aLineColor;
38 : bool m_bUseFillColor;
39 : basebmp::Color m_aFillColor;
40 : basebmp::Color m_aTextColor;
41 :
42 : basebmp::DrawMode m_aDrawMode;
43 :
44 : ServerFont* m_pServerFont[ MAX_FALLBACK ];
45 : sal_uInt32 m_eTextFmt;
46 :
47 : basebmp::BitmapDeviceSharedPtr m_aClipMap;
48 :
49 : protected:
50 : Region m_aClipRegion;
51 : basegfx::B2IVector GetSize() { return m_aOrigDevice->getSize(); }
52 : private:
53 : bool m_bClipSetup;
54 : struct ClipUndoHandle {
55 : SvpSalGraphics &m_rGfx;
56 : basebmp::BitmapDeviceSharedPtr m_aDevice;
57 18850 : ClipUndoHandle( SvpSalGraphics *pGfx ) : m_rGfx( *pGfx ) {}
58 : ~ClipUndoHandle();
59 : };
60 : bool isClippedSetup( const basegfx::B2IBox &aRange, ClipUndoHandle &rUndo );
61 : void ensureClip();
62 :
63 : protected:
64 : virtual bool drawAlphaBitmap( const SalTwoRect&, const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap );
65 : virtual bool drawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency );
66 :
67 : public:
68 : SvpSalGraphics();
69 : virtual ~SvpSalGraphics();
70 :
71 : const basebmp::BitmapDeviceSharedPtr& getDevice() const { return m_aDevice; }
72 : void setDevice( basebmp::BitmapDeviceSharedPtr& rDevice );
73 :
74 : // overload all pure virtual methods
75 : virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY );
76 : virtual sal_uInt16 GetBitCount() const;
77 : virtual long GetGraphicsWidth() const;
78 :
79 : virtual void ResetClipRegion();
80 : virtual bool setClipRegion( const Region& );
81 :
82 : virtual void SetLineColor();
83 : virtual void SetLineColor( SalColor nSalColor );
84 : virtual void SetFillColor();
85 : virtual void SetFillColor( SalColor nSalColor );
86 :
87 : virtual void SetXORMode( bool bSet, bool );
88 :
89 : virtual void SetROPLineColor( SalROPColor nROPColor );
90 : virtual void SetROPFillColor( SalROPColor nROPColor );
91 :
92 : virtual void SetTextColor( SalColor nSalColor );
93 : virtual sal_uInt16 SetFont( FontSelectPattern*, int nFallbackLevel );
94 : virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
95 : virtual sal_uLong GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs );
96 : virtual const ImplFontCharMap* GetImplFontCharMap() const;
97 : virtual bool GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const;
98 : virtual void GetDevFontList( ImplDevFontList* );
99 : virtual void ClearDevFontCache();
100 : virtual void GetDevFontSubstList( OutputDevice* );
101 : virtual bool AddTempDevFont( ImplDevFontList*, const rtl::OUString& rFileURL, const rtl::OUString& rFontName );
102 : virtual sal_Bool CreateFontSubset( const rtl::OUString& rToFile,
103 : const PhysicalFontFace*,
104 : sal_Int32* pGlyphIDs,
105 : sal_uInt8* pEncoding,
106 : sal_Int32* pWidths,
107 : int nGlyphs,
108 : FontSubsetInfo& rInfo
109 : );
110 : virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded );
111 : virtual const void* GetEmbedFontData( const PhysicalFontFace*,
112 : const sal_Ucs* pUnicodes,
113 : sal_Int32* pWidths,
114 : FontSubsetInfo& rInfo,
115 : long* pDataLen );
116 : virtual void FreeEmbedFontData( const void* pData, long nDataLen );
117 : virtual void GetGlyphWidths( const PhysicalFontFace*,
118 : bool bVertical,
119 : Int32Vector& rWidths,
120 : Ucs2UIntMap& rUnicodeEnc );
121 : virtual sal_Bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& );
122 : virtual sal_Bool GetGlyphOutline( sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon& );
123 : virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel );
124 : virtual void DrawServerFontLayout( const ServerFontLayout& );
125 : virtual bool supportsOperation( OutDevSupportType ) const;
126 : virtual void drawPixel( long nX, long nY );
127 : virtual void drawPixel( long nX, long nY, SalColor nSalColor );
128 : virtual void drawLine( long nX1, long nY1, long nX2, long nY2 );
129 : virtual void drawRect( long nX, long nY, long nWidth, long nHeight );
130 : virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency );
131 : virtual bool drawPolyLine(
132 : const ::basegfx::B2DPolygon&,
133 : double fTransparency,
134 : const ::basegfx::B2DVector& rLineWidths,
135 : basegfx::B2DLineJoin,
136 : com::sun::star::drawing::LineCap);
137 : virtual void drawPolyLine( sal_uLong nPoints, const SalPoint* pPtAry );
138 : virtual void drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry );
139 : virtual void drawPolyPolygon( sal_uInt32 nPoly,
140 : const sal_uInt32* pPoints,
141 : PCONSTSALPOINT* pPtAry );
142 : virtual sal_Bool drawPolyLineBezier( sal_uLong nPoints,
143 : const SalPoint* pPtAry,
144 : const sal_uInt8* pFlgAry );
145 : virtual sal_Bool drawPolygonBezier( sal_uLong nPoints,
146 : const SalPoint* pPtAry,
147 : const sal_uInt8* pFlgAry );
148 : virtual sal_Bool drawPolyPolygonBezier( sal_uInt32 nPoly,
149 : const sal_uInt32* pPoints,
150 : const SalPoint* const* pPtAry,
151 : const sal_uInt8* const* pFlgAry );
152 :
153 : virtual void copyArea( long nDestX,
154 : long nDestY,
155 : long nSrcX,
156 : long nSrcY,
157 : long nSrcWidth,
158 : long nSrcHeight,
159 : sal_uInt16 nFlags );
160 : virtual void copyBits( const SalTwoRect* pPosAry,
161 : SalGraphics* pSrcGraphics );
162 : virtual void drawBitmap( const SalTwoRect* pPosAry,
163 : const SalBitmap& rSalBitmap );
164 : virtual void drawBitmap( const SalTwoRect* pPosAry,
165 : const SalBitmap& rSalBitmap,
166 : SalColor nTransparentColor );
167 : virtual void drawBitmap( const SalTwoRect* pPosAry,
168 : const SalBitmap& rSalBitmap,
169 : const SalBitmap& rTransparentBitmap );
170 : virtual void drawMask( const SalTwoRect* pPosAry,
171 : const SalBitmap& rSalBitmap,
172 : SalColor nMaskColor );
173 : virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight );
174 : virtual SalColor getPixel( long nX, long nY );
175 : virtual void invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags );
176 : virtual void invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInvert nFlags );
177 :
178 : virtual sal_Bool drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize );
179 :
180 : virtual SystemGraphicsData GetGraphicsData() const;
181 : virtual SystemFontData GetSysFontData( int nFallbacklevel ) const;
182 : };
183 :
184 : #endif
185 :
186 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|