1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 INCLUDED_VCL_INC_GENERIC_GENPSPGRAPHICS_H
21 #define INCLUDED_VCL_INC_GENERIC_GENPSPGRAPHICS_H
23 #include <vcl/vclenum.hxx>
24 #include <config_cairo_canvas.h>
26 #include <unx/fontmanager.hxx>
28 #include <sallayout.hxx>
30 class PhysicalFontFace
;
31 class PhysicalFontCollection
;
33 namespace psp
{ struct JobData
; class PrinterGfx
; }
39 class ImplFontMetricData
;
41 class VCL_DLLPUBLIC GenPspGraphics
: public SalGraphics
43 psp::JobData
* m_pJobData
;
44 psp::PrinterGfx
* m_pPrinterGfx
;
46 FreetypeFont
* m_pFreetypeFont
[ MAX_FALLBACK
];
49 virtual ~GenPspGraphics() override
;
51 void Init( psp::JobData
* pJob
, psp::PrinterGfx
* pGfx
);
54 static const void * DoGetEmbedFontData(psp::fontID aFont
, long* pDataLen
);
55 static void DoFreeEmbedFontData( const void* pData
, long nLen
);
57 // helper methods for sharing with X11SalGraphics
58 static void DoGetGlyphWidths( psp::fontID aFont
,
60 std::vector
< sal_Int32
>& rWidths
,
61 Ucs2UIntMap
& rUnicodeEnc
);
63 static FontAttributes
Info2FontAttributes( const psp::FastPrintFontInfo
& );
64 static void AnnounceFonts( PhysicalFontCollection
*,
65 const psp::FastPrintFontInfo
& );
67 // override all pure virtual methods
68 virtual SalGraphicsImpl
*GetImpl() const override
{ return nullptr; };
69 virtual void GetResolution( sal_Int32
& rDPIX
, sal_Int32
& rDPIY
) override
;
70 virtual sal_uInt16
GetBitCount() const override
;
71 virtual long GetGraphicsWidth() const override
;
73 virtual void ResetClipRegion() override
;
74 virtual bool setClipRegion( const vcl::Region
& ) override
;
76 virtual void SetLineColor() override
;
77 virtual void SetLineColor( Color nColor
) override
;
78 virtual void SetFillColor() override
;
79 virtual void SetFillColor( Color nColor
) override
;
80 virtual void SetXORMode( bool bSet
, bool ) override
;
81 virtual void SetROPLineColor( SalROPColor nROPColor
) override
;
82 virtual void SetROPFillColor( SalROPColor nROPColor
) override
;
84 virtual void SetTextColor( Color nColor
) override
;
85 virtual void SetFont(LogicalFontInstance
*, int nFallbackLevel
) override
;
86 virtual void GetFontMetric( ImplFontMetricDataRef
&, int nFallbackLevel
) override
;
87 virtual FontCharMapRef
GetFontCharMap() const override
;
88 virtual bool GetFontCapabilities(vcl::FontCapabilities
&rFontCapabilities
) const override
;
89 virtual void GetDevFontList( PhysicalFontCollection
* ) override
;
90 // graphics must drop any cached font info
91 virtual void ClearDevFontCache() override
;
92 virtual bool AddTempDevFont( PhysicalFontCollection
*,
93 const OUString
& rFileURL
,
94 const OUString
& rFontName
) override
;
95 static bool AddTempDevFontHelper( PhysicalFontCollection
* pFontCollection
,
96 const OUString
& rFileURL
,
97 const OUString
& rFontName
,
100 virtual bool CreateFontSubset( const OUString
& rToFile
,
101 const PhysicalFontFace
*,
102 const sal_GlyphId
* pGlyphIDs
,
103 const sal_uInt8
* pEncoding
,
106 FontSubsetInfo
& rInfo
) override
;
107 virtual const void* GetEmbedFontData(const PhysicalFontFace
*, long* pDataLen
) override
;
108 virtual void FreeEmbedFontData( const void* pData
, long nDataLen
) override
;
109 virtual void GetGlyphWidths( const PhysicalFontFace
*,
111 std::vector
< sal_Int32
>& rWidths
,
112 Ucs2UIntMap
& rUnicodeEnc
) override
;
113 virtual std::unique_ptr
<GenericSalLayout
>
114 GetTextLayout(int nFallbackLevel
) override
;
115 virtual void DrawTextLayout( const GenericSalLayout
& ) override
;
116 virtual bool supportsOperation( OutDevSupportType
) const override
;
117 virtual void drawPixel( long nX
, long nY
) override
;
118 virtual void drawPixel( long nX
, long nY
, Color nColor
) override
;
119 virtual void drawLine( long nX1
, long nY1
, long nX2
, long nY2
) override
;
120 virtual void drawRect( long nX
, long nY
, long nWidth
, long nHeight
) override
;
121 virtual void drawPolyLine( sal_uInt32 nPoints
, const SalPoint
* pPtAry
) override
;
122 virtual void drawPolygon( sal_uInt32 nPoints
, const SalPoint
* pPtAry
) override
;
123 virtual void drawPolyPolygon( sal_uInt32 nPoly
,
124 const sal_uInt32
* pPoints
,
125 PCONSTSALPOINT
* pPtAry
) override
;
127 virtual bool drawPolyPolygon(
128 const basegfx::B2DHomMatrix
& rObjectToDevice
,
129 const basegfx::B2DPolyPolygon
&,
130 double fTransparency
) override
;
132 virtual bool drawPolyLine(
133 const basegfx::B2DHomMatrix
& rObjectToDevice
,
134 const basegfx::B2DPolygon
&,
135 double fTransparency
,
136 const basegfx::B2DVector
& rLineWidths
,
137 basegfx::B2DLineJoin
,
138 css::drawing::LineCap
,
139 double fMiterMinimumAngle
,
140 bool bPixelSnapHairline
) override
;
141 virtual bool drawPolyLineBezier( sal_uInt32 nPoints
,
142 const SalPoint
* pPtAry
,
143 const PolyFlags
* pFlgAry
) override
;
144 virtual bool drawPolygonBezier( sal_uInt32 nPoints
,
145 const SalPoint
* pPtAry
,
146 const PolyFlags
* pFlgAry
) override
;
147 virtual bool drawPolyPolygonBezier( sal_uInt32 nPoly
,
148 const sal_uInt32
* pPoints
,
149 const SalPoint
* const* pPtAry
,
150 const PolyFlags
* const* pFlgAry
) override
;
151 virtual bool drawGradient( const tools::PolyPolygon
&, const Gradient
& ) override
{ return false; };
153 virtual void copyArea( long nDestX
,
159 bool bWindowInvalidate
) override
;
160 virtual void copyBits( const SalTwoRect
& rPosAry
,
161 SalGraphics
* pSrcGraphics
) override
;
162 virtual void drawBitmap( const SalTwoRect
& rPosAry
,
163 const SalBitmap
& rSalBitmap
) override
;
164 virtual void drawBitmap( const SalTwoRect
& rPosAry
,
165 const SalBitmap
& rSalBitmap
,
166 const SalBitmap
& rTransparentBitmap
) override
;
167 virtual void drawMask( const SalTwoRect
& rPosAry
,
168 const SalBitmap
& rSalBitmap
,
169 Color nMaskColor
) override
;
170 virtual std::shared_ptr
<SalBitmap
> getBitmap( long nX
, long nY
, long nWidth
, long nHeight
) override
;
171 virtual Color
getPixel( long nX
, long nY
) override
;
172 virtual void invert( long nX
, long nY
, long nWidth
, long nHeight
,
173 SalInvert nFlags
) override
;
174 virtual void invert( sal_uInt32 nPoints
, const SalPoint
* pPtAry
,
175 SalInvert nFlags
) override
;
177 virtual bool drawEPS( long nX
, long nY
, long nWidth
, long nHeight
,
178 void* pPtr
, sal_uInt32 nSize
) override
;
179 virtual bool blendBitmap( const SalTwoRect
&,
180 const SalBitmap
& rBitmap
) override
;
181 virtual bool blendAlphaBitmap( const SalTwoRect
&,
182 const SalBitmap
& rSrcBitmap
,
183 const SalBitmap
& rMaskBitmap
,
184 const SalBitmap
& rAlphaBitmap
) override
;
185 virtual bool drawAlphaBitmap( const SalTwoRect
&,
186 const SalBitmap
& rSourceBitmap
,
187 const SalBitmap
& rAlphaBitmap
) override
;
188 virtual bool drawTransformedBitmap( const basegfx::B2DPoint
& rNull
,
189 const basegfx::B2DPoint
& rX
,
190 const basegfx::B2DPoint
& rY
,
191 const SalBitmap
& rSourceBitmap
,
192 const SalBitmap
* pAlphaBitmap
) override
;
193 virtual bool drawAlphaRect( long nX
, long nY
, long nWidth
, long nHeight
,
194 sal_uInt8 nTransparency
) override
;
196 virtual SystemGraphicsData
GetGraphicsData() const override
;
198 #if ENABLE_CAIRO_CANVAS
199 virtual bool SupportsCairo() const override
;
200 virtual cairo::SurfaceSharedPtr
CreateSurface(const cairo::CairoSurfaceSharedPtr
& rSurface
) const override
;
201 virtual cairo::SurfaceSharedPtr
CreateSurface(const OutputDevice
& rRefDevice
, int x
, int y
, int width
, int height
) const override
;
202 virtual cairo::SurfaceSharedPtr
CreateBitmapSurface(const OutputDevice
& rRefDevice
, const BitmapSystemData
& rData
, const Size
& rSize
) const override
;
203 virtual css::uno::Any
GetNativeSurfaceHandle(cairo::SurfaceSharedPtr
& rSurface
, const basegfx::B2ISize
& rSize
) const override
;
205 virtual SystemFontData
GetSysFontData( int nFallbacklevel
) const override
;
206 #endif // ENABLE_CAIRO_CANVAS
209 #endif // INCLUDED_VCL_INC_GENERIC_GENPSPGRAPHICS_H
211 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */