1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _SVP_SVPGDI_HXX 25 26 #include <basebmp/bitmapdevice.hxx> 27 #include <basebmp/color.hxx> 28 29 #include <salgdi.hxx> 30 #include <sallayout.hxx> 31 32 class ServerFont; 33 34 class SvpSalGraphics : public SalGraphics 35 { 36 basebmp::BitmapDeviceSharedPtr m_aDevice; 37 basebmp::BitmapDeviceSharedPtr m_aOrigDevice; 38 basebmp::BitmapDeviceSharedPtr m_aClipMap; 39 40 bool m_bUseLineColor; 41 basebmp::Color m_aLineColor; 42 bool m_bUseFillColor; 43 basebmp::Color m_aFillColor; 44 basebmp::Color m_aTextColor; 45 46 basebmp::DrawMode m_aDrawMode; 47 48 ServerFont* m_pServerFont[ MAX_FALLBACK ]; 49 sal_uInt32 m_eTextFmt; 50 51 protected: 52 virtual bool drawAlphaBitmap( const SalTwoRect&, const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap ); 53 virtual bool drawTransformedBitmap( 54 const basegfx::B2DPoint& rNull, 55 const basegfx::B2DPoint& rX, 56 const basegfx::B2DPoint& rY, 57 const SalBitmap& rSourceBitmap, 58 const SalBitmap* pAlphaBitmap); 59 virtual bool drawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency ); 60 61 public: 62 SvpSalGraphics(); 63 virtual ~SvpSalGraphics(); 64 65 const basebmp::BitmapDeviceSharedPtr& getDevice() const { return m_aDevice; } 66 void setDevice( basebmp::BitmapDeviceSharedPtr& rDevice ); 67 68 // overload all pure virtual methods 69 virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ); 70 virtual sal_uInt16 GetBitCount(); 71 virtual long GetGraphicsWidth() const; 72 73 virtual void ResetClipRegion(); 74 virtual bool setClipRegion( const Region& ); 75 76 virtual void SetLineColor(); 77 virtual void SetLineColor( SalColor nSalColor ); 78 virtual void SetFillColor(); 79 80 virtual void SetFillColor( SalColor nSalColor ); 81 82 virtual void SetXORMode( bool bSet, bool ); 83 84 virtual void SetROPLineColor( SalROPColor nROPColor ); 85 virtual void SetROPFillColor( SalROPColor nROPColor ); 86 87 virtual void SetTextColor( SalColor nSalColor ); 88 virtual sal_uInt16 SetFont( ImplFontSelectData*, int nFallbackLevel ); 89 virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel ); 90 virtual sal_uLong GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs ); 91 virtual const ImplFontCharMap* GetImplFontCharMap() const; 92 virtual void GetDevFontList( ImplDevFontList* ); 93 virtual void GetDevFontSubstList( OutputDevice* ); 94 virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName ); 95 virtual sal_Bool CreateFontSubset( const rtl::OUString& rToFile, 96 const ImplFontData*, 97 sal_GlyphId* pGlyphIds, 98 sal_uInt8* pEncoding, 99 sal_Int32* pWidths, 100 int nGlyphs, 101 FontSubsetInfo& rInfo 102 ); 103 virtual const Ucs2SIntMap* GetFontEncodingVector( const ImplFontData*, const Ucs2OStrMap** ppNonEncoded ); 104 virtual const void* GetEmbedFontData( const ImplFontData*, 105 const sal_Ucs* pUnicodes, 106 sal_Int32* pWidths, 107 FontSubsetInfo& rInfo, 108 long* pDataLen ); 109 virtual void FreeEmbedFontData( const void* pData, long nDataLen ); 110 virtual void GetGlyphWidths( const ImplFontData*, 111 bool bVertical, 112 Int32Vector& rWidths, 113 Ucs2UIntMap& rUnicodeEnc ); 114 virtual bool GetGlyphBoundRect( sal_GlyphId, Rectangle& ); 115 virtual bool GetGlyphOutline( sal_GlyphId, ::basegfx::B2DPolyPolygon& ); 116 virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ); 117 virtual void DrawServerFontLayout( const ServerFontLayout& ); 118 virtual bool supportsOperation( OutDevSupportType ) const; 119 virtual void drawPixel( long nX, long nY ); 120 virtual void drawPixel( long nX, long nY, SalColor nSalColor ); 121 virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ); 122 virtual void drawRect( long nX, long nY, long nWidth, long nHeight ); 123 virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); 124 virtual bool drawPolyLine( 125 const ::basegfx::B2DPolygon&, 126 double fTransparency, 127 const ::basegfx::B2DVector& rLineWidths, 128 basegfx::B2DLineJoin, 129 com::sun::star::drawing::LineCap); 130 virtual void drawPolyLine( sal_uLong nPoints, const SalPoint* pPtAry ); 131 virtual void drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry ); 132 virtual void drawPolyPolygon( sal_uInt32 nPoly, 133 const sal_uInt32* pPoints, 134 PCONSTSALPOINT* pPtAry ); 135 virtual sal_Bool drawPolyLineBezier( sal_uLong nPoints, 136 const SalPoint* pPtAry, 137 const sal_uInt8* pFlgAry ); 138 virtual sal_Bool drawPolygonBezier( sal_uLong nPoints, 139 const SalPoint* pPtAry, 140 const sal_uInt8* pFlgAry ); 141 virtual sal_Bool drawPolyPolygonBezier( sal_uInt32 nPoly, 142 const sal_uInt32* pPoints, 143 const SalPoint* const* pPtAry, 144 const sal_uInt8* const* pFlgAry ); 145 146 virtual void copyArea( long nDestX, 147 long nDestY, 148 long nSrcX, 149 long nSrcY, 150 long nSrcWidth, 151 long nSrcHeight, 152 sal_uInt16 nFlags ); 153 virtual void copyBits( const SalTwoRect& rPosAry, 154 SalGraphics* pSrcGraphics ); 155 virtual void drawBitmap( const SalTwoRect& rPosAry, 156 const SalBitmap& rSalBitmap ); 157 virtual void drawBitmap( const SalTwoRect& rPosAry, 158 const SalBitmap& rSalBitmap, 159 SalColor nTransparentColor ); 160 virtual void drawBitmap( const SalTwoRect& rPosAry, 161 const SalBitmap& rSalBitmap, 162 const SalBitmap& rTransparentBitmap ); 163 virtual void drawMask( const SalTwoRect& rPosAry, 164 const SalBitmap& rSalBitmap, 165 SalColor nMaskColor ); 166 virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ); 167 virtual SalColor getPixel( long nX, long nY ); 168 virtual void invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags ); 169 virtual void invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInvert nFlags ); 170 171 virtual sal_Bool drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize ); 172 173 virtual SystemGraphicsData GetGraphicsData() const; 174 virtual SystemFontData GetSysFontData( int nFallbacklevel ) const; 175 }; 176 177 #endif 178 179