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