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 ImplFontMetricData;
41 {
45  FreetypeFont* m_pFreetypeFont[ MAX_FALLBACK ];
46 public:
48  virtual ~GenPspGraphics() override;
50  void Init( psp::JobData* pJob, psp::PrinterGfx* pGfx );
52  // helper methods
53  static const void * DoGetEmbedFontData(psp::fontID aFont, long* pDataLen);
54  static void DoFreeEmbedFontData( const void* pData, long nLen );
56  // helper methods for sharing with X11SalGraphics
57  static void DoGetGlyphWidths( psp::fontID aFont,
58  bool bVertical,
59  std::vector< sal_Int32 >& rWidths,
60  Ucs2UIntMap& rUnicodeEnc );
62  static FontAttributes Info2FontAttributes( const psp::FastPrintFontInfo& );
63  static void AnnounceFonts( PhysicalFontCollection*,
64  const psp::FastPrintFontInfo& );
66  // override all pure virtual methods
67  virtual SalGraphicsImpl*GetImpl() const override { return nullptr; };
68  virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) override;
69  virtual sal_uInt16 GetBitCount() const override;
70  virtual long GetGraphicsWidth() const override;
72  virtual void ResetClipRegion() override;
73  virtual bool setClipRegion( const vcl::Region& ) override;
75  virtual void SetLineColor() override;
76  virtual void SetLineColor( Color nColor ) override;
77  virtual void SetFillColor() override;
78  virtual void SetFillColor( Color nColor ) override;
79  virtual void SetXORMode( bool bSet, bool ) override;
80  virtual void SetROPLineColor( SalROPColor nROPColor ) override;
81  virtual void SetROPFillColor( SalROPColor nROPColor ) override;
83  virtual void SetTextColor( Color nColor ) override;
84  virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) override;
85  virtual void GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
86  virtual FontCharMapRef GetFontCharMap() const override;
87  virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
88  virtual void GetDevFontList( PhysicalFontCollection* ) override;
89  // graphics must drop any cached font info
90  virtual void ClearDevFontCache() override;
92  const OUString& rFileURL,
93  const OUString& rFontName ) override;
94  static bool AddTempDevFontHelper( PhysicalFontCollection* pFontCollection,
95  const OUString& rFileURL,
96  const OUString& rFontName);
98  virtual bool CreateFontSubset( const OUString& rToFile,
99  const PhysicalFontFace*,
100  const sal_GlyphId* pGlyphIDs,
101  const sal_uInt8* pEncoding,
102  sal_Int32* pWidths,
103  int nGlyphs,
104  FontSubsetInfo& rInfo ) override;
105  virtual const void* GetEmbedFontData(const PhysicalFontFace*, long* pDataLen) override;
106  virtual void FreeEmbedFontData( const void* pData, long nDataLen ) override;
107  virtual void GetGlyphWidths( const PhysicalFontFace*,
108  bool bVertical,
109  std::vector< sal_Int32 >& rWidths,
110  Ucs2UIntMap& rUnicodeEnc ) override;
111  virtual std::unique_ptr<GenericSalLayout>
112  GetTextLayout(int nFallbackLevel) override;
113  virtual void DrawTextLayout( const GenericSalLayout& ) override;
114  virtual bool supportsOperation( OutDevSupportType ) const override;
115  virtual void drawPixel( long nX, long nY ) override;
116  virtual void drawPixel( long nX, long nY, Color nColor ) override;
117  virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ) override;
118  virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) override;
119  virtual void drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
120  virtual void drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
121  virtual void drawPolyPolygon( sal_uInt32 nPoly,
122  const sal_uInt32* pPoints,
123  PCONSTSALPOINT* pPtAry ) override;
125  virtual bool drawPolyPolygon(
126  const basegfx::B2DHomMatrix& rObjectToDevice,
128  double fTransparency) override;
130  virtual bool drawPolyLine(
131  const basegfx::B2DHomMatrix& rObjectToDevice,
132  const basegfx::B2DPolygon&,
133  double fTransparency,
134  const basegfx::B2DVector& rLineWidths,
135  const std::vector< double >* pStroke, // MM01
137  css::drawing::LineCap,
138  double fMiterMinimumAngle,
139  bool bPixelSnapHairline) override;
140  virtual bool drawPolyLineBezier( sal_uInt32 nPoints,
141  const SalPoint* pPtAry,
142  const PolyFlags* pFlgAry ) override;
143  virtual bool drawPolygonBezier( sal_uInt32 nPoints,
144  const SalPoint* pPtAry,
145  const PolyFlags* pFlgAry ) override;
146  virtual bool drawPolyPolygonBezier( sal_uInt32 nPoly,
147  const sal_uInt32* pPoints,
148  const SalPoint* const* pPtAry,
149  const PolyFlags* const* pFlgAry ) override;
150  virtual bool drawGradient( const tools::PolyPolygon&, const Gradient& ) override { return false; };
152  virtual void copyArea( long nDestX,
153  long nDestY,
154  long nSrcX,
155  long nSrcY,
156  long nSrcWidth,
157  long nSrcHeight,
158  bool bWindowInvalidate) override;
159  virtual void copyBits( const SalTwoRect& rPosAry,
160  SalGraphics* pSrcGraphics ) override;
161  virtual void drawBitmap( const SalTwoRect& rPosAry,
162  const SalBitmap& rSalBitmap ) override;
163  virtual void drawBitmap( const SalTwoRect& rPosAry,
164  const SalBitmap& rSalBitmap,
165  const SalBitmap& rTransparentBitmap ) override;
166  virtual void drawMask( const SalTwoRect& rPosAry,
167  const SalBitmap& rSalBitmap,
168  Color nMaskColor ) override;
169  virtual std::shared_ptr<SalBitmap> getBitmap( long nX, long nY, long nWidth, long nHeight ) override;
170  virtual Color getPixel( long nX, long nY ) override;
171  virtual void invert( long nX, long nY, long nWidth, long nHeight,
172  SalInvert nFlags ) override;
173  virtual void invert( sal_uInt32 nPoints, const SalPoint* pPtAry,
174  SalInvert nFlags ) override;
176  virtual bool drawEPS( long nX, long nY, long nWidth, long nHeight,
177  void* pPtr, sal_uInt32 nSize ) override;
178  virtual bool blendBitmap( const SalTwoRect&,
179  const SalBitmap& rBitmap ) override;
180  virtual bool blendAlphaBitmap( const SalTwoRect&,
181  const SalBitmap& rSrcBitmap,
182  const SalBitmap& rMaskBitmap,
183  const SalBitmap& rAlphaBitmap ) override;
184  virtual bool drawAlphaBitmap( const SalTwoRect&,
185  const SalBitmap& rSourceBitmap,
186  const SalBitmap& rAlphaBitmap ) override;
187  virtual bool drawTransformedBitmap( const basegfx::B2DPoint& rNull,
188  const basegfx::B2DPoint& rX,
189  const basegfx::B2DPoint& rY,
190  const SalBitmap& rSourceBitmap,
191  const SalBitmap* pAlphaBitmap) override;
192  virtual bool drawAlphaRect( long nX, long nY, long nWidth, long nHeight,
193  sal_uInt8 nTransparency ) override;
195  virtual SystemGraphicsData GetGraphicsData() const override;
197  virtual OUString getRenderBackendName() const override { return "genpsp"; }
200  virtual bool SupportsCairo() const override;
201  virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override;
202  virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const override;
203  virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice, const BitmapSystemData& rData, const Size& rSize) const override;
204  virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const override;
206  virtual SystemFontData GetSysFontData( int nFallbacklevel ) const override;
208 };
212 /* 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
virtual OUString getRenderBackendName() const override
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:198
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:48
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