LibreOffice Module vcl (master)  1
Go to the documentation of this file.
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
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 .
18  */
23 #include <vcl/vclenum.hxx>
24 #include <config_cairo_canvas.h>
26 #include <unx/fontmanager.hxx>
27 #include <salgdi.hxx>
28 #include <sallayout.hxx>
30 class PhysicalFontFace;
33 namespace psp { struct JobData; class PrinterGfx; }
35 class FreetypeFont;
36 class FontAttributes;
37 class SalInfoPrinter;
38 class GlyphCache;
39 class ImplFontMetricData;
42 {
46  FreetypeFont* m_pFreetypeFont[ MAX_FALLBACK ];
47 public:
49  virtual ~GenPspGraphics() override;
51  void Init( psp::JobData* pJob, psp::PrinterGfx* pGfx );
53  // helper methods
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,
59  bool bVertical,
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;
93  const OUString& rFileURL,
94  const OUString& rFontName ) override;
95  static bool AddTempDevFontHelper( PhysicalFontCollection* pFontCollection,
96  const OUString& rFileURL,
97  const OUString& rFontName,
98  GlyphCache &rGC );
100  virtual bool CreateFontSubset( const OUString& rToFile,
101  const PhysicalFontFace*,
102  const sal_GlyphId* pGlyphIDs,
103  const sal_uInt8* pEncoding,
104  sal_Int32* pWidths,
105  int nGlyphs,
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*,
110  bool bVertical,
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,
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,
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,
154  long nDestY,
155  long nSrcX,
156  long nSrcY,
157  long nSrcWidth,
158  long nSrcHeight,
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;
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;
207 };
211 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool drawAlphaBitmap(const SalTwoRect &, const SalBitmap &rSourceBitmap, const SalBitmap &rAlphaBitmap)=0
Render bitmap with alpha channel.
virtual long GetGraphicsWidth() const =0
virtual void ClearDevFontCache()=0
virtual bool drawTransformedBitmap(const basegfx::B2DPoint &rNull, const basegfx::B2DPoint &rX, const basegfx::B2DPoint &rY, const SalBitmap &rSourceBitmap, const SalBitmap *pAlphaBitmap)=0
draw transformed bitmap (maybe with alpha) where Null, X, Y define the coordinate system ...
psp::PrinterGfx * m_pPrinterGfx
void Init()
virtual void DrawTextLayout(const GenericSalLayout &)=0
Definition: salgtype.hxx:80
virtual bool blendAlphaBitmap(const SalTwoRect &, const SalBitmap &rSrcBitmap, const SalBitmap &rMaskBitmap, const SalBitmap &rAlphaBitmap)=0
Draw the bitmap by blending using the mask and alpha channel.
virtual const void * GetEmbedFontData(const PhysicalFontFace *pFont, long *pDataLen)=0
psp::JobData * m_pJobData
virtual bool supportsOperation(OutDevSupportType) const =0
Definition: dllapi.h:29
virtual bool drawGradient(const tools::PolyPolygon &, const Gradient &) override
Definition: sallayout.hxx:41
virtual void copyArea(long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, long nSrcHeight, bool bWindowInvalidate)=0
virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const =0
virtual void invert(long nX, long nY, long nWidth, long nHeight, SalInvert nFlags)=0
virtual bool drawPolyPolygonBezier(sal_uInt32 nPoly, const sal_uInt32 *pPoints, const SalPoint *const *pPtAry, const PolyFlags *const *pFlgAry)=0
virtual bool blendBitmap(const SalTwoRect &, const SalBitmap &rBitmap)=0
Blend the bitmap with the current buffer.
virtual void drawPolygon(sal_uInt32 nPoints, const SalPoint *pPtAry)=0
virtual bool drawPolyLineBezier(sal_uInt32 nPoints, const SalPoint *pPtAry, const PolyFlags *pFlgAry)=0
virtual bool CreateFontSubset(const OUString &rToFile, const PhysicalFontFace *pFont, const sal_GlyphId *pGlyphIDs, const sal_uInt8 *pEncoding, sal_Int32 *pWidths, int nGlyphs, FontSubsetInfo &rInfo)=0
virtual std::unique_ptr< GenericSalLayout > GetTextLayout(int nFallbackLevel)=0
sal_uInt16 sal_GlyphId
Definition: glyphitem.hxx:26
Definition: vclenum.hxx:195
virtual FontCharMapRef GetFontCharMap() const =0
virtual SalGraphicsImpl * GetImpl() const override
virtual void SetROPLineColor(SalROPColor nROPColor)=0
virtual void FreeEmbedFontData(const void *pData, long nDataLen)=0
virtual void drawBitmap(const SalTwoRect &rPosAry, const SalBitmap &rSalBitmap)=0
abstract base class for physical font faces
std::shared_ptr< Surface > SurfaceSharedPtr
Definition: cairo.hxx:36
virtual void SetFillColor()=0
virtual Color getPixel(long nX, long nY)=0
virtual bool setClipRegion(const vcl::Region &)=0
virtual void GetResolution(sal_Int32 &rDPIX, sal_Int32 &rDPIY)=0
virtual void SetLineColor()=0
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:304
virtual std::shared_ptr< SalBitmap > getBitmap(long nX, long nY, long nWidth, long nHeight)=0
Definition: salgtype.hxx:84
std::shared_ptr< cairo_surface_t > CairoSurfaceSharedPtr
Definition: cairo.hxx:34
virtual SystemGraphicsData GetGraphicsData() const =0
virtual void copyBits(const SalTwoRect &rPosAry, SalGraphics *pSrcGraphics)=0
virtual void GetGlyphWidths(const PhysicalFontFace *pFont, bool bVertical, std::vector< sal_Int32 > &rWidths, Ucs2UIntMap &rUnicodeEnc)=0
virtual void SetXORMode(bool bSet, bool bInvertOnly)=0
virtual sal_uInt16 GetBitCount() const =0
virtual void drawRect(long nX, long nY, long nWidth, long nHeight)=0
virtual bool drawPolygonBezier(sal_uInt32 nPoints, const SalPoint *pPtAry, const PolyFlags *pFlgAry)=0
virtual void drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32 *pPoints, PCONSTSALPOINT *pPtAry)=0
unsigned char sal_uInt8
virtual void SetROPFillColor(SalROPColor nROPColor)=0
virtual void drawMask(const SalTwoRect &rPosAry, const SalBitmap &rSalBitmap, Color nMaskColor)=0
virtual void drawLine(long nX1, long nY1, long nX2, long nY2)=0
virtual void drawPixel(long nX, long nY)=0
virtual void drawPolyLine(sal_uInt32 nPoints, const SalPoint *pPtAry)=0
int fontID
Definition: fontmanager.hxx:47
virtual void GetFontMetric(ImplFontMetricDataRef &, int nFallbackLevel)=0
virtual bool AddTempDevFont(PhysicalFontCollection *, const OUString &rFileURL, const OUString &rFontName)=0
virtual void SetFont(LogicalFontInstance *, int nFallbackLevel)=0
virtual bool drawAlphaRect(long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency)=0
Render solid rectangle with given transparency.
std::map< sal_Ucs, sal_uInt32 > Ucs2UIntMap
Definition: salgdi.hxx:62
virtual void ResetClipRegion()=0
virtual bool drawEPS(long nX, long nY, long nWidth, long nHeight, void *pPtr, sal_uInt32 nSize)=0
virtual void SetTextColor(Color nColor)=0
virtual void GetDevFontList(PhysicalFontCollection *)=0