LibreOffice Module vcl (master)  1
salgdi.hxx
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 http://mozilla.org/MPL/2.0/.
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 http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #pragma once
21 
22 #include <sal/config.h>
23 
24 #include <vcl/outdev.hxx>
25 
26 #include "impfontmetricdata.hxx"
27 #include "salgdiimpl.hxx"
28 #include "sallayout.hxx"
29 #include "SalGradient.hxx"
31 #include "WidgetDrawInterface.hxx"
32 
33 #include <config_cairo_canvas.h>
34 
35 #include <map>
36 #include <vector>
37 
38 class SalBitmap;
39 class FontAttributes;
40 namespace vcl::font {
41  class FontSelectPattern;
42  class PhysicalFontFace;
43  class PhysicalFontCollection;
44 }
45 class SalLayout;
46 namespace tools { class Rectangle; }
47 class FontSubsetInfo;
48 class OutputDevice;
49 class FreetypeFont;
50 struct SystemGraphicsData;
51 
52 namespace basegfx {
53  class B2DVector;
54  class B2DPolygon;
55  class B2DPolyPolygon;
56 }
57 
58 namespace vcl
59 {
60 class AbstractTrueTypeFont;
61 class FileDefinitionWidgetDraw;
63 }
64 
65 typedef sal_Unicode sal_Ucs; // TODO: use sal_UCS4 instead of sal_Unicode
66 typedef std::map< sal_Ucs, sal_uInt32 > Ucs2UIntMap;
67 
68 // note: if you add any new methods to class SalGraphics using coordinates
69 // make sure they have a corresponding protected pure virtual method
70 // which has to be implemented by the platform dependent part.
71 // Add a method that performs coordinate mirroring if required, (see
72 // existing methods as sample) and then calls the equivalent pure method.
73 
74 // note: all positions are in pixel and relative to
75 // the top/left-position of the virtual output area
76 
78 {
79 public:
80  SalGraphics();
81  ~SalGraphics() COVERITY_NOEXCEPT_FALSE override;
82 
83  virtual SalGraphicsImpl* GetImpl() const = 0;
84 
85  void setAntiAlias(bool bNew)
86  {
87  m_bAntiAlias = bNew;
88 
89  // Temporary store in both
90  if (GetImpl())
91  GetImpl()->setAntiAlias(bNew);
92  }
93 
94  bool getAntiAlias() const
95  {
96  return m_bAntiAlias;
97  }
98 
99  // public SalGraphics methods, the interface to the independent vcl part
100 
101  // get device resolution
102  virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) = 0;
103 
104  // get the depth of the device
105  virtual sal_uInt16 GetBitCount() const = 0;
106 
107  // get the width of the device
108  virtual tools::Long GetGraphicsWidth() const = 0;
109 
110  // set the clip region to empty
111  virtual void ResetClipRegion() = 0;
112 
113  // set the line color to transparent (= don't draw lines)
114 
115  virtual void SetLineColor() = 0;
116 
117  // set the line color to a specific color
118  virtual void SetLineColor( Color nColor ) = 0;
119 
120  // set the fill color to transparent (= don't fill)
121  virtual void SetFillColor() = 0;
122 
123  // set the fill color to a specific color, shapes will be
124  // filled accordingly
125  virtual void SetFillColor( Color nColor ) = 0;
126 
127  // enable/disable XOR drawing
128  virtual void SetXORMode( bool bSet, bool bInvertOnly ) = 0;
129 
130  // set line color for raster operations
131  virtual void SetROPLineColor( SalROPColor nROPColor ) = 0;
132 
133  // set fill color for raster operations
134  virtual void SetROPFillColor( SalROPColor nROPColor ) = 0;
135 
136  // set the text color to a specific color
137  virtual void SetTextColor( Color nColor ) = 0;
138 
139  // set the font
140  virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) = 0;
141 
142  // release the fonts
143  void ReleaseFonts() { SetFont( nullptr, 0 ); }
144 
145  // get the current font's metrics
146  virtual void GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) = 0;
147 
148  // get the repertoire of the current font
149  virtual FontCharMapRef GetFontCharMap() const = 0;
150 
151  // get the layout capabilities of the current font
152  virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const = 0;
153 
154  // graphics must fill supplied font list
155  virtual void GetDevFontList( vcl::font::PhysicalFontCollection* ) = 0;
156 
157  // graphics must drop any cached font info
158  virtual void ClearDevFontCache() = 0;
159 
160  virtual bool AddTempDevFont(
162  const OUString& rFileURL,
163  const OUString& rFontName ) = 0;
164 
165  // CreateFontSubset: a method to get a subset of glyhps of a font
166  // inside a new valid font file
167  // returns true if creation of subset was successful
168  // parameters: rToFile: contains an osl file URL to write the subset to
169  // pFont: describes from which font to create a subset
170  // pGlyphIDs: the glyph ids to be extracted
171  // pEncoding: the character code corresponding to each glyph
172  // pWidths: the advance widths of the corresponding glyphs (in PS font units)
173  // nGlyphs: the number of glyphs
174  // rInfo: additional outgoing information
175  // implementation note: encoding 0 with glyph id 0 should be added implicitly
176  // as "undefined character"
177  virtual bool CreateFontSubset(
178  const OUString& rToFile,
179  const vcl::font::PhysicalFontFace* pFont,
180  const sal_GlyphId* pGlyphIDs,
181  const sal_uInt8* pEncoding,
182  sal_Int32* pWidths,
183  int nGlyphs,
184  FontSubsetInfo& rInfo ) = 0;
185 
186  // GetEmbedFontData: gets the font data for a font marked
187  // embeddable by GetDevFontList or NULL in case of error
188  // parameters: pFont: describes the font in question
189  // pDataLen: out parameter, contains the byte length of the returned buffer
190  virtual const void* GetEmbedFontData(const vcl::font::PhysicalFontFace* pFont, tools::Long* pDataLen) = 0;
191 
192  // free the font data again
193  virtual void FreeEmbedFontData( const void* pData, tools::Long nDataLen ) = 0;
194 
195  // get the same widths as in CreateFontSubset
196  // in case of an embeddable font also fill the mapping
197  // between unicode and glyph id
198  // leave widths vector and mapping untouched in case of failure
199  virtual void GetGlyphWidths(
200  const vcl::font::PhysicalFontFace* pFont,
201  bool bVertical,
202  std::vector< sal_Int32 >& rWidths,
203  Ucs2UIntMap& rUnicodeEnc ) = 0;
204 
205  virtual std::unique_ptr<GenericSalLayout>
206  GetTextLayout(int nFallbackLevel) = 0;
207  virtual void DrawTextLayout( const GenericSalLayout& ) = 0;
208 
209  virtual bool supportsOperation( OutDevSupportType ) const = 0;
210 
211  // mirroring specifics
212  SalLayoutFlags GetLayout() const { return m_nLayout; }
213  void SetLayout( SalLayoutFlags aLayout ) { m_nLayout = aLayout;}
214 
215  void mirror( tools::Long& nX, const OutputDevice& rOutDev ) const;
216  // only called mirror2 to avoid ambiguity
217  [[nodiscard]] tools::Long mirror2( tools::Long nX, const OutputDevice& rOutDev ) const;
218  void mirror( tools::Long& nX, tools::Long nWidth, const OutputDevice& rOutDev, bool bBack = false ) const;
219  bool mirror( sal_uInt32 nPoints, const Point *pPtAry, Point *pPtAry2, const OutputDevice& rOutDev ) const;
220  void mirror( tools::Rectangle& rRect, const OutputDevice&, bool bBack = false ) const;
221  void mirror( vcl::Region& rRgn, const OutputDevice& rOutDev ) const;
222  void mirror( ImplControlValue&, const OutputDevice& ) const;
223  basegfx::B2DPolyPolygon mirror( const basegfx::B2DPolyPolygon& i_rPoly, const OutputDevice& rOutDev ) const;
224  const basegfx::B2DHomMatrix& getMirror( const OutputDevice& rOutDev ) const;
225 
226  // non virtual methods; these do possible coordinate mirroring and
227  // then delegate to protected virtual methods
228  bool SetClipRegion( const vcl::Region&, const OutputDevice& rOutDev );
229 
230  // draw --> LineColor and FillColor and RasterOp and ClipRegion
231  void DrawPixel( tools::Long nX, tools::Long nY, const OutputDevice& rOutDev );
232  void DrawPixel( tools::Long nX, tools::Long nY, Color nColor, const OutputDevice& rOutDev );
233 
234  void DrawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2, const OutputDevice& rOutDev );
235 
236  void DrawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, const OutputDevice& rOutDev );
237 
238  void DrawPolyLine( sal_uInt32 nPoints, Point const * pPtAry, const OutputDevice& rOutDev );
239 
240  void DrawPolygon( sal_uInt32 nPoints, const Point* pPtAry, const OutputDevice& rOutDev );
241 
242  void DrawPolyPolygon(
243  sal_uInt32 nPoly,
244  const sal_uInt32* pPoints,
245  const Point** pPtAry,
246  const OutputDevice& rOutDev );
247 
248  bool DrawPolyPolygon(
249  const basegfx::B2DHomMatrix& rObjectToDevice,
250  const basegfx::B2DPolyPolygon &i_rPolyPolygon,
251  double i_fTransparency,
252  const OutputDevice& i_rOutDev);
253 
254  bool DrawPolyLine(
255  const basegfx::B2DHomMatrix& rObjectToDevice,
256  const basegfx::B2DPolygon& i_rPolygon,
257  double i_fTransparency,
258  double i_fLineWidth,
259  const std::vector< double >* i_pStroke, // MM01
260  basegfx::B2DLineJoin i_eLineJoin,
261  css::drawing::LineCap i_eLineCap,
262  double i_fMiterMinimumAngle,
263  bool bPixelSnapHairline,
264  const OutputDevice& i_rOutDev);
265 
266  bool DrawPolyLineBezier(
267  sal_uInt32 nPoints,
268  const Point* pPtAry,
269  const PolyFlags* pFlgAry,
270  const OutputDevice& rOutDev );
271 
272  bool DrawPolygonBezier(
273  sal_uInt32 nPoints,
274  const Point* pPtAry,
275  const PolyFlags* pFlgAry,
276  const OutputDevice& rOutDev );
277 
278  bool DrawPolyPolygonBezier(
279  sal_uInt32 nPoly,
280  const sal_uInt32* pPoints,
281  const Point* const* pPtAry,
282  const PolyFlags* const* pFlgAry,
283  const OutputDevice& rOutDev );
284 
285  bool DrawGradient(
286  const tools::PolyPolygon& rPolyPoly,
287  const Gradient& rGradient,
288  const OutputDevice& rOutDev);
289 
290  // CopyArea --> No RasterOp, but ClipRegion
291  void CopyArea(
292  tools::Long nDestX, tools::Long nDestY,
293  tools::Long nSrcX, tools::Long nSrcY,
294  tools::Long nSrcWidth, tools::Long nSrcHeight,
295  const OutputDevice& rOutDev );
296 
297  // CopyBits --> RasterOp and ClipRegion
298  // CopyBits() CopyBits on same Graphics
299  void CopyBits(
300  const SalTwoRect& rPosAry,
301  const OutputDevice& rOutDev);
302 
303  // CopyBits --> RasterOp and ClipRegion
304  // CopyBits() CopyBits on different Graphics
305  void CopyBits(
306  const SalTwoRect& rPosAry,
307  SalGraphics& rSrcGraphics,
308  const OutputDevice& rOutDev,
309  const OutputDevice& rSrcOutDev );
310 
311 
312  void DrawBitmap(
313  const SalTwoRect& rPosAry,
314  const SalBitmap& rSalBitmap,
315  const OutputDevice& rOutDev );
316 
317  void DrawBitmap(
318  const SalTwoRect& rPosAry,
319  const SalBitmap& rSalBitmap,
320  const SalBitmap& rTransparentBitmap,
321  const OutputDevice& rOutDev );
322 
323  void DrawMask(
324  const SalTwoRect& rPosAry,
325  const SalBitmap& rSalBitmap,
326  Color nMaskColor,
327  const OutputDevice& rOutDev );
328 
329  std::shared_ptr<SalBitmap> GetBitmap(
330  tools::Long nX, tools::Long nY,
331  tools::Long nWidth, tools::Long nHeight,
332  const OutputDevice& rOutDev );
333 
334  Color GetPixel(
335  tools::Long nX, tools::Long nY,
336  const OutputDevice& rOutDev );
337 
338  // invert --> ClipRegion (only Windows)
339  void Invert(
340  tools::Long nX, tools::Long nY,
341  tools::Long nWidth, tools::Long nHeight,
342  SalInvert nFlags,
343  const OutputDevice& rOutDev );
344 
345  void Invert(
346  sal_uInt32 nPoints,
347  const Point* pPtAry,
348  SalInvert nFlags,
349  const OutputDevice& rOutDev );
350 
351  bool DrawEPS(
352  tools::Long nX, tools::Long nY,
353  tools::Long nWidth, tools::Long nHeight,
354  void* pPtr,
355  sal_uInt32 nSize,
356  const OutputDevice& rOutDev );
357 
358  // native widget rendering functions
359 
363  inline bool IsNativeControlSupported(ControlType, ControlPart);
364 
368  bool HitTestNativeScrollbar(
369  ControlPart nPart,
370  const tools::Rectangle& rControlRegion,
371  const Point& aPos,
372  bool& rIsInside,
373  const OutputDevice& rOutDev);
374 
378  bool DrawNativeControl(
379  ControlType nType,
380  ControlPart nPart,
381  const tools::Rectangle& rControlRegion,
382  ControlState nState,
383  const ImplControlValue& aValue,
384  const OUString& aCaption,
385  const OutputDevice& rOutDev,
386  const Color& rBackgroundColor = COL_AUTO );
387 
391  bool GetNativeControlRegion(
392  ControlType nType,
393  ControlPart nPart,
394  const tools::Rectangle& rControlRegion,
395  ControlState nState,
396  const ImplControlValue& aValue,
397  tools::Rectangle &rNativeBoundingRegion,
398  tools::Rectangle &rNativeContentRegion,
399  const OutputDevice& rOutDev );
400 
404  inline bool UpdateSettings(AllSettings&);
405 
406  bool BlendBitmap(
407  const SalTwoRect& rPosAry,
408  const SalBitmap& rSalBitmap,
409  const OutputDevice& rOutDev );
410 
411  bool BlendAlphaBitmap(
412  const SalTwoRect& rPosAry,
413  const SalBitmap& rSalSrcBitmap,
414  const SalBitmap& rSalMaskBitmap,
415  const SalBitmap& rSalAlphaBitmap,
416  const OutputDevice& rOutDev );
417 
418  bool DrawAlphaBitmap(
419  const SalTwoRect&,
420  const SalBitmap& rSourceBitmap,
421  const SalBitmap& rAlphaBitmap,
422  const OutputDevice& rOutDev );
423 
424  bool DrawTransformedBitmap(
425  const basegfx::B2DPoint& rNull,
426  const basegfx::B2DPoint& rX,
427  const basegfx::B2DPoint& rY,
428  const SalBitmap& rSourceBitmap,
429  const SalBitmap* pAlphaBitmap,
430  double fAlpha,
431  const OutputDevice& rOutDev );
432 
433  bool HasFastDrawTransformedBitmap() const;
434 
435  bool DrawAlphaRect(
436  tools::Long nX, tools::Long nY,
437  tools::Long nWidth, tools::Long nHeight,
438  sal_uInt8 nTransparency,
439  const OutputDevice& rOutDev );
440 
441  virtual OUString getRenderBackendName() const;
442 
443  virtual SystemGraphicsData GetGraphicsData() const = 0;
444 
445 #if ENABLE_CAIRO_CANVAS
446 
448  virtual bool SupportsCairo() const = 0;
450  virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const = 0;
452  virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const = 0;
454  virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice, const BitmapSystemData& rData, const Size& rSize) const = 0;
455  virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const = 0;
456 
457 #endif // ENABLE_CAIRO_CANVAS
458 
459 protected:
460 
462 
463  virtual bool setClipRegion( const vcl::Region& ) = 0;
464 
465  // draw --> LineColor and FillColor and RasterOp and ClipRegion
466  virtual void drawPixel( tools::Long nX, tools::Long nY ) = 0;
467  virtual void drawPixel( tools::Long nX, tools::Long nY, Color nColor ) = 0;
468 
469  virtual void drawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) = 0;
470 
471  virtual void drawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) = 0;
472 
473  virtual void drawPolyLine( sal_uInt32 nPoints, const Point* pPtAry ) = 0;
474 
475  virtual void drawPolygon( sal_uInt32 nPoints, const Point* pPtAry ) = 0;
476 
477  virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, const Point** pPtAry ) = 0;
478 
479  virtual bool drawPolyPolygon(
480  const basegfx::B2DHomMatrix& rObjectToDevice,
482  double fTransparency) = 0;
483 
484  virtual bool drawPolyLine(
485  const basegfx::B2DHomMatrix& rObjectToDevice,
486  const basegfx::B2DPolygon&,
487  double fTransparency,
488  double fLineWidth,
489  const std::vector< double >* pStroke, // MM01
491  css::drawing::LineCap,
492  double fMiterMinimumAngle,
493  bool bPixelSnapHairline) = 0;
494 
495  virtual bool drawPolyLineBezier(
496  sal_uInt32 nPoints,
497  const Point* pPtAry,
498  const PolyFlags* pFlgAry ) = 0;
499 
500  virtual bool drawPolygonBezier(
501  sal_uInt32 nPoints,
502  const Point* pPtAry,
503  const PolyFlags* pFlgAry ) = 0;
504 
505  virtual bool drawPolyPolygonBezier(
506  sal_uInt32 nPoly,
507  const sal_uInt32* pPoints,
508  const Point* const* pPtAry,
509  const PolyFlags* const* pFlgAry ) = 0;
510 
511  virtual bool drawGradient(
512  const tools::PolyPolygon& rPolyPoly,
513  const Gradient& rGradient ) = 0;
514 
515  virtual bool implDrawGradient(basegfx::B2DPolyPolygon const & /*rPolyPolygon*/,
516  SalGradient const & /*rGradient*/)
517  {
518  return false;
519  }
520 
521  // CopyArea --> No RasterOp, but ClipRegion
522  virtual void copyArea(
523  tools::Long nDestX, tools::Long nDestY,
524  tools::Long nSrcX, tools::Long nSrcY,
525  tools::Long nSrcWidth, tools::Long nSrcHeight,
526  bool bWindowInvalidate ) = 0;
527 
528  // CopyBits and DrawBitmap --> RasterOp and ClipRegion
529  // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics
530  virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) = 0;
531 
532  virtual void drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) = 0;
533 
534  virtual void drawBitmap(
535  const SalTwoRect& rPosAry,
536  const SalBitmap& rSalBitmap,
537  const SalBitmap& rMaskBitmap ) = 0;
538 
539  virtual void drawMask(
540  const SalTwoRect& rPosAry,
541  const SalBitmap& rSalBitmap,
542  Color nMaskColor ) = 0;
543 
544  virtual std::shared_ptr<SalBitmap> getBitmap( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) = 0;
545 
546  virtual Color getPixel( tools::Long nX, tools::Long nY ) = 0;
547 
548  // invert --> ClipRegion (only Windows or VirDevs)
549  virtual void invert(
550  tools::Long nX, tools::Long nY,
551  tools::Long nWidth, tools::Long nHeight,
552  SalInvert nFlags) = 0;
553 
554  virtual void invert( sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags ) = 0;
555 
556  virtual bool drawEPS(
557  tools::Long nX, tools::Long nY,
558  tools::Long nWidth, tools::Long nHeight,
559  void* pPtr,
560  sal_uInt32 nSize ) = 0;
561 
563  virtual bool blendBitmap(
564  const SalTwoRect&,
565  const SalBitmap& rBitmap ) = 0;
566 
568  virtual bool blendAlphaBitmap(
569  const SalTwoRect&,
570  const SalBitmap& rSrcBitmap,
571  const SalBitmap& rMaskBitmap,
572  const SalBitmap& rAlphaBitmap ) = 0;
573 
586  virtual bool drawAlphaBitmap(
587  const SalTwoRect&,
588  const SalBitmap& rSourceBitmap,
589  const SalBitmap& rAlphaBitmap ) = 0;
590 
595  virtual bool drawTransformedBitmap(
596  const basegfx::B2DPoint& rNull,
597  const basegfx::B2DPoint& rX,
598  const basegfx::B2DPoint& rY,
599  const SalBitmap& rSourceBitmap,
600  const SalBitmap* pAlphaBitmap,
601  double fAlpha) = 0;
602 
605  virtual bool hasFastDrawTransformedBitmap() const = 0;
606 
617  virtual bool drawAlphaRect(
618  tools::Long nX, tools::Long nY,
619  tools::Long nWidth, tools::Long nHeight,
620  sal_uInt8 nTransparency ) = 0;
621 
622 private:
623  SalLayoutFlags m_nLayout; //< 0: mirroring off, 1: mirror x-axis
624 
625  // for buffering the Mirror-Matrix, see ::getMirror
630 
631 protected:
633  bool m_bAntiAlias : 1;
634 
635  inline tools::Long GetDeviceWidth(const OutputDevice& rOutDev) const;
636 
645  virtual inline void handleDamage(const tools::Rectangle& rDamagedRegion);
646 
647  // native controls
648  bool initWidgetDrawBackends(bool bForce = false);
649 
650  std::unique_ptr<vcl::WidgetDrawInterface> m_pWidgetDraw;
651  vcl::WidgetDrawInterface* forWidget() { return m_pWidgetDraw ? m_pWidgetDraw.get() : this; }
652 
653  static void GetGlyphWidths(const vcl::AbstractTrueTypeFont& rTTF,
654  const vcl::font::PhysicalFontFace& rFontFace, bool bVertical,
655  std::vector<sal_Int32>& rWidths, Ucs2UIntMap& rUnicodeEnc);
656 
657  static bool CreateTTFfontSubset(vcl::AbstractTrueTypeFont& aTTF, const OString& rSysPath,
658  const bool bVertical, const sal_GlyphId* pGlyphIds,
659  const sal_uInt8* pEncoding, sal_Int32* pGlyphWidths,
660  int nGlyphCount);
661 
662  static bool CreateCFFfontSubset(const unsigned char* pFontBytes, int nByteLength,
663  const OString& rSysPath, const sal_GlyphId* pGlyphIds,
664  const sal_uInt8* pEncoding, sal_Int32* pGlyphWidths,
665  int nGlyphCount, FontSubsetInfo& rInfo);
666 
667  static void FillFontSubsetInfo(const vcl::TTGlobalFontInfo& rTTInfo, const OUString& pPSName,
668  FontSubsetInfo& rInfo);
669 };
670 
672 {
673  return forWidget()->isNativeControlSupported(eType, ePart);
674 }
675 
677 {
678  return forWidget()->updateSettings(rSettings);
679 }
680 
682 
683 
685 {
686 public:
687  sal_uInt16 GetBitCount() const override
688  {
689  return GetImpl()->GetBitCount();
690  }
691 
692  tools::Long GetGraphicsWidth() const override
693  {
694  return GetImpl()->GetGraphicsWidth();
695  }
696 
697  void ResetClipRegion() override
698  {
700  }
701 
702  bool setClipRegion( const vcl::Region& i_rClip ) override
703  {
704  return GetImpl()->setClipRegion(i_rClip);
705  }
706 
707  void SetLineColor() override
708  {
709  GetImpl()->SetLineColor();
710  }
711 
712  void SetLineColor( Color nColor ) override
713  {
714  GetImpl()->SetLineColor(nColor);
715  }
716 
717  void SetFillColor() override
718  {
719  GetImpl()->SetFillColor();
720  }
721 
722  void SetFillColor( Color nColor ) override
723  {
724  GetImpl()->SetFillColor (nColor);
725  }
726 
727  void SetROPLineColor(SalROPColor aColor) override
728  {
729  GetImpl()->SetROPLineColor(aColor);
730  }
731 
732  void SetROPFillColor( SalROPColor aColor) override
733  {
734  GetImpl()->SetROPFillColor(aColor);
735  }
736 
737  void SetXORMode(bool bSet, bool bInvertOnly) override
738  {
739  GetImpl()->SetXORMode(bSet, bInvertOnly);
740  }
741 
742  void drawPixel( tools::Long nX, tools::Long nY ) override
743  {
744  GetImpl()->drawPixel(nX, nY);
745  }
746 
747  void drawPixel( tools::Long nX, tools::Long nY, Color nColor ) override
748  {
749  GetImpl()->drawPixel(nX, nY, nColor);
750  }
751 
752  void drawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) override
753  {
754  GetImpl()->drawLine(nX1, nY1, nX2, nY2);
755  }
756 
757  void drawRect( tools::Long nX, tools::Long nY, tools::Long nDX, tools::Long nDY ) override
758  {
759  GetImpl()->drawRect(nX, nY, nDX, nDY);
760  }
761 
762  void drawPolyLine( sal_uInt32 nPoints, const Point *pPtAry ) override
763  {
764  GetImpl()->drawPolyLine(nPoints, pPtAry);
765  }
766 
767  void drawPolygon( sal_uInt32 nPoints, const Point* pPtAry ) override
768  {
769  GetImpl()->drawPolygon(nPoints, pPtAry);
770  }
771 
772  void drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPoints, const Point** pPtAry) override
773  {
774  GetImpl()->drawPolyPolygon (nPoly, pPoints, pPtAry);
775  }
776 
778  const basegfx::B2DHomMatrix& rObjectToDevice,
779  const basegfx::B2DPolyPolygon& rPolyPolygon,
780  double fTransparency) override
781  {
782  return GetImpl()->drawPolyPolygon(rObjectToDevice, rPolyPolygon, fTransparency);
783  }
784 
786  const basegfx::B2DHomMatrix& rObjectToDevice,
787  const basegfx::B2DPolygon& rPolygon,
788  double fTransparency,
789  double fLineWidth,
790  const std::vector< double >* pStroke,
791  basegfx::B2DLineJoin eJoin,
792  css::drawing::LineCap eLineCap,
793  double fMiterMinimumAngle,
794  bool bPixelSnapHairline) override
795  {
796  return GetImpl()->drawPolyLine(rObjectToDevice, rPolygon, fTransparency, fLineWidth, pStroke, eJoin, eLineCap, fMiterMinimumAngle, bPixelSnapHairline);
797  }
798 
799  bool drawPolyLineBezier( sal_uInt32 nPoints, const Point* pPtAry, const PolyFlags* pFlgAry ) override
800  {
801  return GetImpl()->drawPolyLineBezier(nPoints, pPtAry, pFlgAry);
802  }
803 
804  bool drawPolygonBezier( sal_uInt32 nPoints, const Point* pPtAry, const PolyFlags* pFlgAry ) override
805  {
806  return GetImpl()->drawPolygonBezier(nPoints, pPtAry, pFlgAry);
807  }
808 
809  bool drawPolyPolygonBezier( sal_uInt32 nPoly,
810  const sal_uInt32* pPoints,
811  const Point* const* pPtAry,
812  const PolyFlags* const* pFlgAry) override
813  {
814  return GetImpl()->drawPolyPolygonBezier(nPoly, pPoints, pPtAry, pFlgAry);
815  }
816 
817  void invert(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight,
818  SalInvert nFlags) override
819  {
820  GetImpl()->invert(nX, nY, nWidth, nHeight, nFlags);
821  }
822 
823  void invert(sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags) override
824  {
825  GetImpl()->invert(nPoints, pPtAry, nFlags);
826  }
827 
829  tools::Long nHeight, void* pPtr, sal_uInt32 nSize) override
830  {
831  return GetImpl()->drawEPS(nX, nY, nWidth, nHeight, pPtr, nSize);
832  }
833 
834  void copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics) override
835  {
836  GetImpl()->copyBits(rPosAry, pSrcGraphics);
837  }
838 
839  void copyArea (tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX,
840  tools::Long nSrcY, tools::Long nSrcWidth, tools::Long nSrcHeight,
841  bool bWindowInvalidate) override
842  {
843  GetImpl()->copyArea(nDestX, nDestY, nSrcX, nSrcY, nSrcWidth, nSrcHeight, bWindowInvalidate);
844  }
845 
846  void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) override
847  {
848  GetImpl()->drawBitmap(rPosAry, rSalBitmap);
849  }
850 
851  void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, const SalBitmap& rMaskBitmap) override
852  {
853  GetImpl()->drawBitmap(rPosAry, rSalBitmap, rMaskBitmap);
854  }
855 
856  void drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, Color nMaskColor) override
857  {
858  GetImpl()->drawMask(rPosAry, rSalBitmap, nMaskColor);
859  }
860 
861  std::shared_ptr<SalBitmap> getBitmap(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight) override
862  {
863  return GetImpl()->getBitmap(nX, nY, nWidth, nHeight);
864  }
865 
867  {
868  return GetImpl()->getPixel(nX, nY);
869  }
870 
871  bool blendBitmap(const SalTwoRect& rPosAry, const SalBitmap& rBitmap) override
872  {
873  return GetImpl()->blendBitmap(rPosAry, rBitmap);
874  }
875 
876  bool blendAlphaBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSourceBitmap,
877  const SalBitmap& rMaskBitmap, const SalBitmap& rAlphaBitmap) override
878  {
879  return GetImpl()->blendAlphaBitmap(rPosAry, rSourceBitmap, rMaskBitmap, rAlphaBitmap);
880  }
881 
882  bool drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSourceBitmap,
883  const SalBitmap& rAlphaBitmap) override
884  {
885  return GetImpl()->drawAlphaBitmap(rPosAry, rSourceBitmap, rAlphaBitmap);
886  }
887 
889  const basegfx::B2DPoint& rX,
890  const basegfx::B2DPoint& rY,
891  const SalBitmap& rSourceBitmap,
892  const SalBitmap* pAlphaBitmap, double fAlpha) override
893  {
894  return GetImpl()->drawTransformedBitmap(rNull, rX, rY, rSourceBitmap, pAlphaBitmap, fAlpha);
895  }
896 
897  bool hasFastDrawTransformedBitmap() const override
898  {
900  }
901 
903  tools::Long nHeight, sal_uInt8 nTransparency) override
904  {
905  return GetImpl()->drawAlphaRect(nX, nY, nWidth, nHeight, nTransparency);
906  }
907 
908  bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) override
909  {
910  return GetImpl()->drawGradient(rPolygon, rGradient);
911  }
912 
913  bool implDrawGradient(basegfx::B2DPolyPolygon const& rPolyPolygon,
914  SalGradient const& rGradient) override
915  {
916  return GetImpl()->implDrawGradient(rPolyPolygon, rGradient);
917  }
918 
919  bool supportsOperation(OutDevSupportType eType) const override
920  {
921  return GetImpl()->supportsOperation(eType);
922  }
923 
924  OUString getRenderBackendName() const override
925  {
926  return GetImpl()->getRenderBackendName();
927  }
928 };
929 
930 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::shared_ptr< SalBitmap > getBitmap(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight) override
Definition: salgdi.hxx:861
virtual void drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32 *pPoints, const Point **pPtAry)=0
virtual void drawPolygon(sal_uInt32 nPoints, const Point *pPtAry)=0
bool drawGradient(const tools::PolyPolygon &rPolygon, const Gradient &rGradient) override
Definition: salgdi.hxx:908
virtual void drawBitmap(const SalTwoRect &rPosAry, const SalBitmap &rSalBitmap)=0
SalROPColor
Definition: salgtype.hxx:70
sal_Unicode sal_Ucs
Definition: salgdi.hxx:65
static void drawPolyLine(SalGraphics &rGraphics, const basegfx::B2DHomMatrix &rObjectToDevice, const basegfx::B2DPolygon &i_rPolygon, double i_fTransparency, double i_fLineWidth, const std::vector< double > *i_pStroke, basegfx::B2DLineJoin i_eLineJoin, css::drawing::LineCap i_eLineCap, double i_fMiterMinimumAngle, bool bPixelSnapHairline)
virtual bool drawAlphaBitmap(const SalTwoRect &, const SalBitmap &rSourceBitmap, const SalBitmap &rAlphaBitmap)=0
virtual void copyBits(const SalTwoRect &rPosAry, SalGraphics *pSrcGraphics)=0
virtual void SetXORMode(bool bSet, bool bInvertOnly)=0
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
long Long
void drawRect(tools::Long nX, tools::Long nY, tools::Long nDX, tools::Long nDY) override
Definition: salgdi.hxx:757
virtual void copyArea(tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX, tools::Long nSrcY, tools::Long nSrcWidth, tools::Long nSrcHeight, bool bWindowInvalidate)=0
void drawPolygon(VirtualDevice *dev, bool drawFrame, tools::Polygon const &orig, Size const &pSize)
draws a polygon knowing penSize
Definition: shape.cxx:218
virtual bool supportsOperation(OutDevSupportType eType) const =0
void ResetClipRegion() override
Definition: salgdi.hxx:697
void SetLineColor(Color nColor) override
Definition: salgdi.hxx:712
bool hasFastDrawTransformedBitmap() const override
Used e.g.
Definition: salgdi.hxx:897
sal_uInt16 sal_GlyphId
Definition: glyphitem.hxx:29
OutDevSupportType
Definition: vclenum.hxx:194
virtual void drawRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight)=0
void drawPixel(tools::Long nX, tools::Long nY, Color nColor) override
Definition: salgdi.hxx:747
virtual bool implDrawGradient(basegfx::B2DPolyPolygon const &, SalGradient const &)
Definition: salgdi.hxx:515
virtual bool drawGradient(const tools::PolyPolygon &rPolygon, const Gradient &rGradient)=0
void drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32 *pPoints, const Point **pPtAry) override
Definition: salgdi.hxx:772
bool blendBitmap(const SalTwoRect &rPosAry, const SalBitmap &rBitmap) override
Blend the bitmap with the current buffer.
Definition: salgdi.hxx:871
sal_uInt16 sal_Unicode
virtual bool blendBitmap(const SalTwoRect &, const SalBitmap &rBitmap)=0
void drawBitmap(const SalTwoRect &rPosAry, const SalBitmap &rSalBitmap, const SalBitmap &rMaskBitmap) override
Definition: salgdi.hxx:851
basegfx::B2DHomMatrix m_aLastMirror
Definition: salgdi.hxx:626
static void drawPolyPolygon(SalGraphics &rGraphics, const basegfx::B2DHomMatrix &rObjectToDevice, const basegfx::B2DPolyPolygon &i_rPolyPolygon, double i_fTransparency)
bool drawPolyPolygonBezier(sal_uInt32 nPoly, const sal_uInt32 *pPoints, const Point *const *pPtAry, const PolyFlags *const *pFlgAry) override
Definition: salgdi.hxx:809
void SetLineColor() override
Definition: salgdi.hxx:707
tools::Long GetGraphicsWidth() const override
Definition: salgdi.hxx:692
void copyArea(tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX, tools::Long nSrcY, tools::Long nSrcWidth, tools::Long nSrcHeight, bool bWindowInvalidate) override
Definition: salgdi.hxx:839
std::shared_ptr< Surface > SurfaceSharedPtr
Definition: cairo.hxx:36
void drawLine(tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2) override
Definition: salgdi.hxx:752
virtual void SetLineColor()=0
virtual void drawLine(tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2)=0
void drawPolygon(sal_uInt32 nPoints, const Point *pPtAry) override
Definition: salgdi.hxx:767
virtual bool implDrawGradient(basegfx::B2DPolyPolygon const &rPolyPolygon, SalGradient const &rGradient)=0
SalLayoutFlags m_nLayout
Definition: salgdi.hxx:623
bool supportsOperation(OutDevSupportType eType) const override
Definition: salgdi.hxx:919
virtual tools::Long GetGraphicsWidth() const =0
virtual bool hasFastDrawTransformedBitmap() const =0
Used e.g.
bool drawPolygonBezier(sal_uInt32 nPoints, const Point *pPtAry, const PolyFlags *pFlgAry) override
Definition: salgdi.hxx:804
bool drawPolyLineBezier(sal_uInt32 nPoints, const Point *pPtAry, const PolyFlags *pFlgAry) override
Definition: salgdi.hxx:799
virtual bool isNativeControlSupported(ControlType eType, ControlPart ePart)
Query the platform layer for native control support.
void drawLine(VirtualDevice *dev, Point const &orig, Point const &dest, Size const &pSize)
draws a line from orig to dest knowing penSize
Definition: shape.cxx:111
bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency) override
Render solid rectangle with given transparency.
Definition: salgdi.hxx:902
void copyBits(const SalTwoRect &rPosAry, SalGraphics *pSrcGraphics) override
Definition: salgdi.hxx:834
void invert(sal_uInt32 nPoints, const Point *pPtAry, SalInvert nFlags) override
Definition: salgdi.hxx:823
void drawPixel(tools::Long nX, tools::Long nY) override
Definition: salgdi.hxx:742
bool implDrawGradient(basegfx::B2DPolyPolygon const &rPolyPolygon, SalGradient const &rGradient) override
Definition: salgdi.hxx:913
A PhysicalFontFaceCollection is created by a PhysicalFontCollection and becomes invalid when original...
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:167
bool setClipRegion(const vcl::Region &i_rClip) override
Definition: salgdi.hxx:702
std::unique_ptr< vcl::WidgetDrawInterface > m_pWidgetDraw
Definition: salgdi.hxx:650
virtual bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency)=0
void SetFillColor() override
Definition: salgdi.hxx:717
SalInvert
Definition: salgtype.hxx:74
tools::Long m_nLastMirrorDeviceLTRButBiDiRtlTranslate
Definition: salgdi.hxx:628
std::shared_ptr< cairo_surface_t > CairoSurfaceSharedPtr
Definition: cairo.hxx:34
virtual OUString getRenderBackendName() const =0
virtual bool setClipRegion(const vcl::Region &)=0
virtual SalGraphicsImpl * GetImpl() const =0
bool blendAlphaBitmap(const SalTwoRect &rPosAry, const SalBitmap &rSourceBitmap, const SalBitmap &rMaskBitmap, const SalBitmap &rAlphaBitmap) override
Draw the bitmap by blending using the mask and alpha channel.
Definition: salgdi.hxx:876
virtual bool drawPolyPolygonBezier(sal_uInt32 nPoly, const sal_uInt32 *pPoints, const Point *const *pPtAry, const PolyFlags *const *pFlgAry)=0
void ReleaseFonts()
Definition: salgdi.hxx:143
void SetFillColor(Color nColor) override
Definition: salgdi.hxx:722
abstract base class for physical font faces
vcl::WidgetDrawInterface * forWidget()
Definition: salgdi.hxx:651
ControlType
These types are all based on the supported variants vcl/salnativewidgets.hxx and must be kept in-sync...
#define VCL_PLUGIN_PUBLIC
Definition: dllapi.h:40
virtual void invert(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, SalInvert nFlags)=0
void setAntiAlias(bool bNew)
Definition: salgdi.hxx:85
bool UpdateSettings(AllSettings &)
Definition: salgdi.hxx:676
virtual bool blendAlphaBitmap(const SalTwoRect &, const SalBitmap &rSrcBitmap, const SalBitmap &rMaskBitmap, const SalBitmap &rAlphaBitmap)=0
void SetROPLineColor(SalROPColor aColor) override
Definition: salgdi.hxx:727
void drawMask(const SalTwoRect &rPosAry, const SalBitmap &rSalBitmap, Color nMaskColor) override
Definition: salgdi.hxx:856
unsigned char sal_uInt8
void SetXORMode(bool bSet, bool bInvertOnly) override
Definition: salgdi.hxx:737
SalLayoutFlags GetLayout() const
Definition: salgdi.hxx:212
bool m_bLastMirrorDeviceLTRButBiDiRtlSet
Definition: salgdi.hxx:629
OUString getRenderBackendName() const override
Definition: salgdi.hxx:924
bool drawPolyLine(const basegfx::B2DHomMatrix &rObjectToDevice, const basegfx::B2DPolygon &rPolygon, double fTransparency, double fLineWidth, const std::vector< double > *pStroke, basegfx::B2DLineJoin eJoin, css::drawing::LineCap eLineCap, double fMiterMinimumAngle, bool bPixelSnapHairline) override
Definition: salgdi.hxx:785
tools::Long m_aLastMirrorW
Definition: salgdi.hxx:627
virtual bool drawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, void *pPtr, sal_uInt32 nSize)=0
void drawPolyLine(sal_uInt32 nPoints, const Point *pPtAry) override
Definition: salgdi.hxx:762
bool drawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, void *pPtr, sal_uInt32 nSize) override
Definition: salgdi.hxx:828
void SetROPFillColor(SalROPColor aColor) override
Definition: salgdi.hxx:732
sal_uInt16 GetBitCount() const override
Definition: salgdi.hxx:687
virtual void ResetClipRegion()=0
virtual void SetFillColor()=0
virtual void SetROPFillColor(SalROPColor nROPColor)=0
virtual void drawPixel(tools::Long nX, tools::Long nY)=0
virtual bool updateSettings(AllSettings &rSettings)
void invert(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, SalInvert nFlags) override
Definition: salgdi.hxx:817
bool drawTransformedBitmap(const basegfx::B2DPoint &rNull, const basegfx::B2DPoint &rX, const basegfx::B2DPoint &rY, const SalBitmap &rSourceBitmap, const SalBitmap *pAlphaBitmap, double fAlpha) override
draw transformed bitmap (maybe with alpha) where Null, X, Y define the coordinate system ...
Definition: salgdi.hxx:888
bool drawPolyPolygon(const basegfx::B2DHomMatrix &rObjectToDevice, const basegfx::B2DPolyPolygon &rPolyPolygon, double fTransparency) override
Definition: salgdi.hxx:777
void SetLayout(SalLayoutFlags aLayout)
Definition: salgdi.hxx:213
virtual Color getPixel(tools::Long nX, tools::Long nY)=0
void SetLineColor(const css::uno::Reference< css::beans::XPropertySet > &xGridProperties, sal_Int32 nColor)
virtual std::shared_ptr< SalBitmap > getBitmap(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight)=0
static void drawBitmap(SalGraphics &rGraphics, const SalTwoRect &rPosAry, const SalBitmap &rSalBitmap)
virtual void drawMask(const SalTwoRect &rPosAry, const SalBitmap &rSalBitmap, Color nMaskColor)=0
bool getAntiAlias() const
Definition: salgdi.hxx:94
std::map< sal_Ucs, sal_uInt32 > Ucs2UIntMap
Definition: salgdi.hxx:66
virtual bool drawPolyLineBezier(sal_uInt32 nPoints, const Point *pPtAry, const PolyFlags *pFlgAry)=0
virtual void drawPolyLine(sal_uInt32 nPoints, const Point *pPtAry)=0
void drawBitmap(const SalTwoRect &rPosAry, const SalBitmap &rSalBitmap) override
Definition: salgdi.hxx:846
virtual void SetROPLineColor(SalROPColor nROPColor)=0
virtual sal_uInt16 GetBitCount() const =0
virtual bool drawTransformedBitmap(const basegfx::B2DPoint &rNull, const basegfx::B2DPoint &rX, const basegfx::B2DPoint &rY, const SalBitmap &rSourceBitmap, const SalBitmap *pAlphaBitmap, double fAlpha)=0
draw transformed bitmap (maybe with alpha) where Null, X, Y define the coordinate system ...
bool IsNativeControlSupported(ControlType, ControlPart)
Definition: salgdi.hxx:671
virtual void handleDamage(const tools::Rectangle &rDamagedRegion)
Handle damage done by drawing with a widget draw override.
Definition: salgdi.hxx:681
Return value of GetTTGlobalFontInfo()
Definition: sft.hxx:147
Color getPixel(tools::Long nX, tools::Long nY) override
Definition: salgdi.hxx:866
virtual bool drawPolygonBezier(sal_uInt32 nPoints, const Point *pPtAry, const PolyFlags *pFlgAry)=0
PolyFlags
bool drawAlphaBitmap(const SalTwoRect &rPosAry, const SalBitmap &rSourceBitmap, const SalBitmap &rAlphaBitmap) override
Render bitmap with alpha channel.
Definition: salgdi.hxx:882
SalLayoutFlags