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>
29 #include <vclpluginapi.h>
31 class PhysicalFontFace
;
32 class PhysicalFontCollection
;
34 namespace psp
{ struct JobData
; class PrinterGfx
; }
40 class ImplFontMetricData
;
42 class VCL_DLLPUBLIC GenPspGraphics
: public SalGraphics
44 psp::JobData
* m_pJobData
;
45 psp::PrinterGfx
* m_pPrinterGfx
;
47 FreetypeFont
* m_pFreetypeFont
[ MAX_FALLBACK
];
50 virtual ~GenPspGraphics() override
;
52 void Init( psp::JobData
* pJob
, psp::PrinterGfx
* pGfx
);
55 static const void * DoGetEmbedFontData(psp::fontID aFont
, long* pDataLen
);
56 static void DoFreeEmbedFontData( const void* pData
, long nLen
);
58 // helper methods for sharing with X11SalGraphics
59 static void DoGetGlyphWidths( psp::fontID aFont
,
61 std::vector
< sal_Int32
>& rWidths
,
62 Ucs2UIntMap
& rUnicodeEnc
);
64 static FontAttributes
Info2FontAttributes( const psp::FastPrintFontInfo
& );
65 static void AnnounceFonts( PhysicalFontCollection
*,
66 const psp::FastPrintFontInfo
& );
68 // override all pure virtual methods
69 virtual SalGraphicsImpl
*GetImpl() const override
{ return nullptr; };
70 virtual void GetResolution( sal_Int32
& rDPIX
, sal_Int32
& rDPIY
) override
;
71 virtual sal_uInt16
GetBitCount() const override
;
72 virtual long GetGraphicsWidth() const override
;
74 virtual void ResetClipRegion() override
;
75 virtual bool setClipRegion( const vcl::Region
& ) override
;
77 virtual void SetLineColor() override
;
78 virtual void SetLineColor( Color nColor
) override
;
79 virtual void SetFillColor() override
;
80 virtual void SetFillColor( Color nColor
) override
;
81 virtual void SetXORMode( bool bSet
) override
;
82 virtual void SetROPLineColor( SalROPColor nROPColor
) override
;
83 virtual void SetROPFillColor( SalROPColor nROPColor
) override
;
85 virtual void SetTextColor( Color nColor
) override
;
86 virtual void SetFont( const FontSelectPattern
*, int nFallbackLevel
) override
;
87 virtual void GetFontMetric( ImplFontMetricDataRef
&, int nFallbackLevel
) override
;
88 virtual const FontCharMapRef
GetFontCharMap() const override
;
89 virtual bool GetFontCapabilities(vcl::FontCapabilities
&rFontCapabilities
) const override
;
90 virtual void GetDevFontList( PhysicalFontCollection
* ) override
;
91 // graphics must drop any cached font info
92 virtual void ClearDevFontCache() override
;
93 virtual bool AddTempDevFont( PhysicalFontCollection
*,
94 const OUString
& rFileURL
,
95 const OUString
& rFontName
) override
;
96 static bool AddTempDevFontHelper( PhysicalFontCollection
* pFontCollection
,
97 const OUString
& rFileURL
,
98 const OUString
& rFontName
,
101 virtual bool CreateFontSubset( const OUString
& rToFile
,
102 const PhysicalFontFace
*,
103 const sal_GlyphId
* pGlyphIDs
,
104 const sal_uInt8
* pEncoding
,
107 FontSubsetInfo
& rInfo
) override
;
108 virtual const void* GetEmbedFontData(const PhysicalFontFace
*, long* pDataLen
) override
;
109 virtual void FreeEmbedFontData( const void* pData
, long nDataLen
) override
;
110 virtual void GetGlyphWidths( const PhysicalFontFace
*,
112 std::vector
< sal_Int32
>& rWidths
,
113 Ucs2UIntMap
& rUnicodeEnc
) override
;
114 virtual bool GetGlyphBoundRect(const GlyphItem
&, tools::Rectangle
&) override
;
115 virtual bool GetGlyphOutline(const GlyphItem
&, basegfx::B2DPolyPolygon
&) override
;
116 virtual std::unique_ptr
<SalLayout
>
117 GetTextLayout( ImplLayoutArgs
&, int nFallbackLevel
) override
;
118 virtual void DrawTextLayout( const GenericSalLayout
& ) override
;
119 virtual bool supportsOperation( OutDevSupportType
) const override
;
120 virtual void drawPixel( long nX
, long nY
) override
;
121 virtual void drawPixel( long nX
, long nY
, Color nColor
) override
;
122 virtual void drawLine( long nX1
, long nY1
, long nX2
, long nY2
) override
;
123 virtual void drawRect( long nX
, long nY
, long nWidth
, long nHeight
) override
;
124 virtual void drawPolyLine( sal_uInt32 nPoints
, const SalPoint
* pPtAry
) override
;
125 virtual void drawPolygon( sal_uInt32 nPoints
, const SalPoint
* pPtAry
) override
;
126 virtual void drawPolyPolygon( sal_uInt32 nPoly
,
127 const sal_uInt32
* pPoints
,
128 PCONSTSALPOINT
* pPtAry
) override
;
129 virtual bool drawPolyPolygon( const basegfx::B2DPolyPolygon
&,
130 double fTransparency
) override
;
131 virtual bool drawPolyLine( const basegfx::B2DPolygon
&,
132 double fTransparency
,
133 const basegfx::B2DVector
& rLineWidths
,
134 basegfx::B2DLineJoin
,
135 css::drawing::LineCap
,
136 double fMiterMinimumAngle
) override
;
137 virtual bool drawPolyLineBezier( sal_uInt32 nPoints
,
138 const SalPoint
* pPtAry
,
139 const PolyFlags
* pFlgAry
) override
;
140 virtual bool drawPolygonBezier( sal_uInt32 nPoints
,
141 const SalPoint
* pPtAry
,
142 const PolyFlags
* pFlgAry
) override
;
143 virtual bool drawPolyPolygonBezier( sal_uInt32 nPoly
,
144 const sal_uInt32
* pPoints
,
145 const SalPoint
* const* pPtAry
,
146 const PolyFlags
* const* pFlgAry
) override
;
147 virtual bool drawGradient( const tools::PolyPolygon
&, const Gradient
& ) override
{ return false; };
149 virtual void copyArea( long nDestX
,
155 bool bWindowInvalidate
) override
;
156 virtual void copyBits( const SalTwoRect
& rPosAry
,
157 SalGraphics
* pSrcGraphics
) override
;
158 virtual void drawBitmap( const SalTwoRect
& rPosAry
,
159 const SalBitmap
& rSalBitmap
) override
;
160 virtual void drawBitmap( const SalTwoRect
& rPosAry
,
161 const SalBitmap
& rSalBitmap
,
162 const SalBitmap
& rTransparentBitmap
) override
;
163 virtual void drawMask( const SalTwoRect
& rPosAry
,
164 const SalBitmap
& rSalBitmap
,
165 Color nMaskColor
) override
;
166 virtual SalBitmap
* getBitmap( long nX
, long nY
, long nWidth
, long nHeight
) override
;
167 virtual Color
getPixel( long nX
, long nY
) override
;
168 virtual void invert( long nX
, long nY
, long nWidth
, long nHeight
,
169 SalInvert nFlags
) override
;
170 virtual void invert( sal_uInt32 nPoints
, const SalPoint
* pPtAry
,
171 SalInvert nFlags
) override
;
173 virtual bool drawEPS( long nX
, long nY
, long nWidth
, long nHeight
,
174 void* pPtr
, sal_uIntPtr nSize
) override
;
175 virtual bool blendBitmap( const SalTwoRect
&,
176 const SalBitmap
& rBitmap
) override
;
177 virtual bool blendAlphaBitmap( const SalTwoRect
&,
178 const SalBitmap
& rSrcBitmap
,
179 const SalBitmap
& rMaskBitmap
,
180 const SalBitmap
& rAlphaBitmap
) override
;
181 virtual bool drawAlphaBitmap( const SalTwoRect
&,
182 const SalBitmap
& rSourceBitmap
,
183 const SalBitmap
& rAlphaBitmap
) override
;
184 virtual bool drawTransformedBitmap( const basegfx::B2DPoint
& rNull
,
185 const basegfx::B2DPoint
& rX
,
186 const basegfx::B2DPoint
& rY
,
187 const SalBitmap
& rSourceBitmap
,
188 const SalBitmap
* pAlphaBitmap
) override
;
189 virtual bool drawAlphaRect( long nX
, long nY
, long nWidth
, long nHeight
,
190 sal_uInt8 nTransparency
) override
;
192 virtual SystemGraphicsData
GetGraphicsData() const override
;
194 #if ENABLE_CAIRO_CANVAS
195 virtual bool SupportsCairo() const override
;
196 virtual cairo::SurfaceSharedPtr
CreateSurface(const cairo::CairoSurfaceSharedPtr
& rSurface
) const override
;
197 virtual cairo::SurfaceSharedPtr
CreateSurface(const OutputDevice
& rRefDevice
, int x
, int y
, int width
, int height
) const override
;
198 virtual cairo::SurfaceSharedPtr
CreateBitmapSurface(const OutputDevice
& rRefDevice
, const BitmapSystemData
& rData
, const Size
& rSize
) const override
;
199 virtual css::uno::Any
GetNativeSurfaceHandle(cairo::SurfaceSharedPtr
& rSurface
, const basegfx::B2ISize
& rSize
) const override
;
201 virtual SystemFontData
GetSysFontData( int nFallbacklevel
) const override
;
202 #endif // ENABLE_CAIRO_CANVAS
205 #endif // INCLUDED_VCL_INC_GENERIC_GENPSPGRAPHICS_H
207 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */