Avoid potential negative array index access to cached text.
[LibreOffice.git] / vcl / inc / salgdi.hxx
blob7e73e59daf0ebbd7a416af19d08baa32a6030f82
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #pragma once
22 #include <sal/config.h>
24 #include <vcl/outdev.hxx>
26 #include "font/FontMetricData.hxx"
27 #include "salgdiimpl.hxx"
28 #include "sallayout.hxx"
29 #include "SalGradient.hxx"
30 #include <basegfx/matrix/b2dhommatrix.hxx>
31 #include "WidgetDrawInterface.hxx"
33 #include <config_cairo_canvas.h>
35 #include <vector>
37 class SalBitmap;
38 class FontAttributes;
39 namespace vcl::font {
40 class FontSelectPattern;
41 class PhysicalFontFace;
42 class PhysicalFontCollection;
44 class SalLayout;
45 namespace tools { class Rectangle; }
46 class OutputDevice;
47 class FreetypeFont;
48 struct SystemGraphicsData;
50 namespace basegfx {
51 class B2DVector;
52 class B2DPolygon;
53 class B2DPolyPolygon;
56 namespace vcl
58 class AbstractTrueTypeFont;
59 class FileDefinitionWidgetDraw;
60 typedef struct TTGlobalFontInfo_ TTGlobalFontInfo;
63 typedef sal_Unicode sal_Ucs; // TODO: use sal_UCS4 instead of sal_Unicode
65 // note: if you add any new methods to class SalGraphics using coordinates
66 // make sure they have a corresponding protected pure virtual method
67 // which has to be implemented by the platform dependent part.
68 // Add a method that performs coordinate mirroring if required, (see
69 // existing methods as sample) and then calls the equivalent pure method.
71 // note: all positions are in pixel and relative to
72 // the top/left-position of the virtual output area
74 class VCL_PLUGIN_PUBLIC SalGraphics : protected vcl::WidgetDrawInterface
76 public:
77 SalGraphics();
78 ~SalGraphics() COVERITY_NOEXCEPT_FALSE override;
80 virtual SalGraphicsImpl* GetImpl() const = 0;
82 void setAntiAlias(bool bNew)
84 m_bAntiAlias = bNew;
86 // Temporary store in both
87 if (GetImpl())
88 GetImpl()->setAntiAlias(bNew);
91 bool getAntiAlias() const
93 return m_bAntiAlias;
96 // public SalGraphics methods, the interface to the independent vcl part
98 // get device resolution
99 virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) = 0;
101 // get the depth of the device
102 virtual sal_uInt16 GetBitCount() const = 0;
104 // get the width of the device
105 virtual tools::Long GetGraphicsWidth() const = 0;
107 // set the clip region to empty
108 virtual void ResetClipRegion() = 0;
110 // set the line color to transparent (= don't draw lines)
112 virtual void SetLineColor() = 0;
114 // set the line color to a specific color
115 virtual void SetLineColor( Color nColor ) = 0;
117 // set the fill color to transparent (= don't fill)
118 virtual void SetFillColor() = 0;
120 // set the fill color to a specific color, shapes will be
121 // filled accordingly
122 virtual void SetFillColor( Color nColor ) = 0;
124 // enable/disable XOR drawing
125 virtual void SetXORMode( bool bSet, bool bInvertOnly ) = 0;
127 // set line color for raster operations
128 virtual void SetROPLineColor( SalROPColor nROPColor ) = 0;
130 // set fill color for raster operations
131 virtual void SetROPFillColor( SalROPColor nROPColor ) = 0;
133 // set the text color to a specific color
134 virtual void SetTextColor( Color nColor ) = 0;
136 // set the font
137 virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) = 0;
139 // release the fonts
140 void ReleaseFonts() { SetFont( nullptr, 0 ); }
142 // get the current font's metrics
143 virtual void GetFontMetric( FontMetricDataRef&, int nFallbackLevel ) = 0;
145 // get the repertoire of the current font
146 virtual FontCharMapRef GetFontCharMap() const = 0;
148 // get the layout capabilities of the current font
149 virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const = 0;
151 // graphics must fill supplied font list
152 virtual void GetDevFontList( vcl::font::PhysicalFontCollection* ) = 0;
154 // graphics must drop any cached font info
155 virtual void ClearDevFontCache() = 0;
157 virtual bool AddTempDevFont(
158 vcl::font::PhysicalFontCollection*,
159 const OUString& rFileURL,
160 const OUString& rFontName ) = 0;
162 virtual std::unique_ptr<GenericSalLayout>
163 GetTextLayout(int nFallbackLevel) = 0;
164 virtual void DrawTextLayout( const GenericSalLayout& ) = 0;
166 virtual bool supportsOperation( OutDevSupportType ) const = 0;
168 // mirroring specifics
169 SalLayoutFlags GetLayout() const { return m_nLayout; }
170 void SetLayout( SalLayoutFlags aLayout ) { m_nLayout = aLayout;}
172 void mirror( tools::Long& nX, const OutputDevice& rOutDev ) const;
173 // only called mirror2 to avoid ambiguity
174 [[nodiscard]] tools::Long mirror2( tools::Long nX, const OutputDevice& rOutDev ) const;
175 void mirror( tools::Long& nX, tools::Long nWidth, const OutputDevice& rOutDev, bool bBack = false ) const;
176 bool mirror( sal_uInt32 nPoints, const Point *pPtAry, Point *pPtAry2, const OutputDevice& rOutDev ) const;
177 void mirror( tools::Rectangle& rRect, const OutputDevice&, bool bBack = false ) const;
178 void mirror( vcl::Region& rRgn, const OutputDevice& rOutDev ) const;
179 void mirror( ImplControlValue&, const OutputDevice& ) const;
180 basegfx::B2DPolyPolygon mirror( const basegfx::B2DPolyPolygon& i_rPoly, const OutputDevice& rOutDev ) const;
181 const basegfx::B2DHomMatrix& getMirror( const OutputDevice& rOutDev ) const;
183 // non virtual methods; these do possible coordinate mirroring and
184 // then delegate to protected virtual methods
185 void SetClipRegion( const vcl::Region&, const OutputDevice& rOutDev );
187 // draw --> LineColor and FillColor and RasterOp and ClipRegion
188 void DrawPixel( tools::Long nX, tools::Long nY, const OutputDevice& rOutDev );
189 void DrawPixel( tools::Long nX, tools::Long nY, Color nColor, const OutputDevice& rOutDev );
191 void DrawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2, const OutputDevice& rOutDev );
193 void DrawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, const OutputDevice& rOutDev );
195 void DrawPolyLine( sal_uInt32 nPoints, Point const * pPtAry, const OutputDevice& rOutDev );
197 void DrawPolygon( sal_uInt32 nPoints, const Point* pPtAry, const OutputDevice& rOutDev );
199 void DrawPolyPolygon(
200 sal_uInt32 nPoly,
201 const sal_uInt32* pPoints,
202 const Point** pPtAry,
203 const OutputDevice& rOutDev );
205 void DrawPolyPolygon(
206 const basegfx::B2DHomMatrix& rObjectToDevice,
207 const basegfx::B2DPolyPolygon &i_rPolyPolygon,
208 double i_fTransparency,
209 const OutputDevice& i_rOutDev);
211 bool DrawPolyLine(
212 const basegfx::B2DHomMatrix& rObjectToDevice,
213 const basegfx::B2DPolygon& i_rPolygon,
214 double i_fTransparency,
215 double i_fLineWidth,
216 const std::vector< double >* i_pStroke, // MM01
217 basegfx::B2DLineJoin i_eLineJoin,
218 css::drawing::LineCap i_eLineCap,
219 double i_fMiterMinimumAngle,
220 bool bPixelSnapHairline,
221 const OutputDevice& i_rOutDev);
223 bool DrawPolyLineBezier(
224 sal_uInt32 nPoints,
225 const Point* pPtAry,
226 const PolyFlags* pFlgAry,
227 const OutputDevice& rOutDev );
229 bool DrawPolygonBezier(
230 sal_uInt32 nPoints,
231 const Point* pPtAry,
232 const PolyFlags* pFlgAry,
233 const OutputDevice& rOutDev );
235 bool DrawPolyPolygonBezier(
236 sal_uInt32 nPoly,
237 const sal_uInt32* pPoints,
238 const Point* const* pPtAry,
239 const PolyFlags* const* pFlgAry,
240 const OutputDevice& rOutDev );
242 bool DrawGradient(
243 const tools::PolyPolygon& rPolyPoly,
244 const Gradient& rGradient,
245 const OutputDevice& rOutDev);
247 // CopyArea --> No RasterOp, but ClipRegion
248 void CopyArea(
249 tools::Long nDestX, tools::Long nDestY,
250 tools::Long nSrcX, tools::Long nSrcY,
251 tools::Long nSrcWidth, tools::Long nSrcHeight,
252 const OutputDevice& rOutDev );
254 // CopyBits --> RasterOp and ClipRegion
255 // CopyBits() CopyBits on same Graphics
256 void CopyBits(
257 const SalTwoRect& rPosAry,
258 const OutputDevice& rOutDev);
260 // CopyBits --> RasterOp and ClipRegion
261 // CopyBits() CopyBits on different Graphics
262 void CopyBits(
263 const SalTwoRect& rPosAry,
264 SalGraphics& rSrcGraphics,
265 const OutputDevice& rOutDev,
266 const OutputDevice& rSrcOutDev );
269 void DrawBitmap(
270 const SalTwoRect& rPosAry,
271 const SalBitmap& rSalBitmap,
272 const OutputDevice& rOutDev );
274 void DrawBitmap(
275 const SalTwoRect& rPosAry,
276 const SalBitmap& rSalBitmap,
277 const SalBitmap& rTransparentBitmap,
278 const OutputDevice& rOutDev );
280 void DrawMask(
281 const SalTwoRect& rPosAry,
282 const SalBitmap& rSalBitmap,
283 Color nMaskColor,
284 const OutputDevice& rOutDev );
286 std::shared_ptr<SalBitmap> GetBitmap(
287 tools::Long nX, tools::Long nY,
288 tools::Long nWidth, tools::Long nHeight,
289 const OutputDevice& rOutDev );
291 Color GetPixel(
292 tools::Long nX, tools::Long nY,
293 const OutputDevice& rOutDev );
295 // invert --> ClipRegion (only Windows)
296 void Invert(
297 tools::Long nX, tools::Long nY,
298 tools::Long nWidth, tools::Long nHeight,
299 SalInvert nFlags,
300 const OutputDevice& rOutDev );
302 void Invert(
303 sal_uInt32 nPoints,
304 const Point* pPtAry,
305 SalInvert nFlags,
306 const OutputDevice& rOutDev );
308 bool DrawEPS(
309 tools::Long nX, tools::Long nY,
310 tools::Long nWidth, tools::Long nHeight,
311 void* pPtr,
312 sal_uInt32 nSize,
313 const OutputDevice& rOutDev );
315 // native widget rendering functions
318 * @see WidgetDrawInterface::isNativeControlSupported
320 inline bool IsNativeControlSupported(ControlType, ControlPart);
323 * @see WidgetDrawInterface::hitTestNativeControl
325 bool HitTestNativeScrollbar(
326 ControlPart nPart,
327 const tools::Rectangle& rControlRegion,
328 const Point& aPos,
329 bool& rIsInside,
330 const OutputDevice& rOutDev);
333 * @see WidgetDrawInterface::drawNativeControl
335 bool DrawNativeControl(
336 ControlType nType,
337 ControlPart nPart,
338 const tools::Rectangle& rControlRegion,
339 ControlState nState,
340 const ImplControlValue& aValue,
341 const OUString& aCaption,
342 const OutputDevice& rOutDev,
343 const Color& rBackgroundColor = COL_AUTO );
346 * @see WidgetDrawInterface::getNativeControlRegion
348 bool GetNativeControlRegion(
349 ControlType nType,
350 ControlPart nPart,
351 const tools::Rectangle& rControlRegion,
352 ControlState nState,
353 const ImplControlValue& aValue,
354 tools::Rectangle &rNativeBoundingRegion,
355 tools::Rectangle &rNativeContentRegion,
356 const OutputDevice& rOutDev );
359 * @see WidgetDrawInterface::updateSettings
361 inline bool UpdateSettings(AllSettings&);
363 bool BlendBitmap(
364 const SalTwoRect& rPosAry,
365 const SalBitmap& rSalBitmap,
366 const OutputDevice& rOutDev );
368 bool BlendAlphaBitmap(
369 const SalTwoRect& rPosAry,
370 const SalBitmap& rSalSrcBitmap,
371 const SalBitmap& rSalMaskBitmap,
372 const SalBitmap& rSalAlphaBitmap,
373 const OutputDevice& rOutDev );
375 bool DrawAlphaBitmap(
376 const SalTwoRect&,
377 const SalBitmap& rSourceBitmap,
378 const SalBitmap& rAlphaBitmap,
379 const OutputDevice& rOutDev );
381 bool DrawTransformedBitmap(
382 const basegfx::B2DPoint& rNull,
383 const basegfx::B2DPoint& rX,
384 const basegfx::B2DPoint& rY,
385 const SalBitmap& rSourceBitmap,
386 const SalBitmap* pAlphaBitmap,
387 double fAlpha,
388 const OutputDevice& rOutDev );
390 bool HasFastDrawTransformedBitmap() const;
392 bool DrawAlphaRect(
393 tools::Long nX, tools::Long nY,
394 tools::Long nWidth, tools::Long nHeight,
395 sal_uInt8 nTransparency,
396 const OutputDevice& rOutDev );
398 virtual OUString getRenderBackendName() const;
400 virtual SystemGraphicsData GetGraphicsData() const = 0;
402 // Backends like the svp/gtk ones use cairo and hidpi scale at the surface
403 // but bitmaps aren't hidpi, so if this returns true for the case that the
404 // surface is hidpi then pScaleOut contains the scaling factor. So we can
405 // create larger hires bitmaps which we know will be logically scaled down
406 // by this factor but physically just copied
407 virtual bool ShouldDownscaleIconsAtSurface(double* pScaleOut) const;
410 #if ENABLE_CAIRO_CANVAS
412 /// Check whether cairo will work
413 virtual bool SupportsCairo() const = 0;
414 /// Create Surface from given cairo surface
415 virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const = 0;
416 /// Create surface with given dimensions
417 virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const = 0;
418 /// Create Surface for given bitmap data
419 virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice, const BitmapSystemData& rData, const Size& rSize) const = 0;
420 virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const = 0;
422 #endif // ENABLE_CAIRO_CANVAS
424 protected:
426 friend class vcl::FileDefinitionWidgetDraw;
428 virtual void setClipRegion( const vcl::Region& ) = 0;
430 // draw --> LineColor and FillColor and RasterOp and ClipRegion
431 virtual void drawPixel( tools::Long nX, tools::Long nY ) = 0;
432 virtual void drawPixel( tools::Long nX, tools::Long nY, Color nColor ) = 0;
434 virtual void drawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) = 0;
436 virtual void drawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) = 0;
438 virtual void drawPolyLine( sal_uInt32 nPoints, const Point* pPtAry ) = 0;
440 virtual void drawPolygon( sal_uInt32 nPoints, const Point* pPtAry ) = 0;
442 virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, const Point** pPtAry ) = 0;
444 virtual void drawPolyPolygon(
445 const basegfx::B2DHomMatrix& rObjectToDevice,
446 const basegfx::B2DPolyPolygon&,
447 double fTransparency) = 0;
449 virtual bool drawPolyLine(
450 const basegfx::B2DHomMatrix& rObjectToDevice,
451 const basegfx::B2DPolygon&,
452 double fTransparency,
453 double fLineWidth,
454 const std::vector< double >* pStroke, // MM01
455 basegfx::B2DLineJoin,
456 css::drawing::LineCap,
457 double fMiterMinimumAngle,
458 bool bPixelSnapHairline) = 0;
460 virtual bool drawPolyLineBezier(
461 sal_uInt32 nPoints,
462 const Point* pPtAry,
463 const PolyFlags* pFlgAry ) = 0;
465 virtual bool drawPolygonBezier(
466 sal_uInt32 nPoints,
467 const Point* pPtAry,
468 const PolyFlags* pFlgAry ) = 0;
470 virtual bool drawPolyPolygonBezier(
471 sal_uInt32 nPoly,
472 const sal_uInt32* pPoints,
473 const Point* const* pPtAry,
474 const PolyFlags* const* pFlgAry ) = 0;
476 virtual bool drawGradient(
477 const tools::PolyPolygon& rPolyPoly,
478 const Gradient& rGradient ) = 0;
480 virtual bool implDrawGradient(basegfx::B2DPolyPolygon const & /*rPolyPolygon*/,
481 SalGradient const & /*rGradient*/)
483 return false;
486 // CopyArea --> No RasterOp, but ClipRegion
487 virtual void copyArea(
488 tools::Long nDestX, tools::Long nDestY,
489 tools::Long nSrcX, tools::Long nSrcY,
490 tools::Long nSrcWidth, tools::Long nSrcHeight,
491 bool bWindowInvalidate ) = 0;
493 // CopyBits and DrawBitmap --> RasterOp and ClipRegion
494 // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics
495 virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) = 0;
497 virtual void drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) = 0;
499 virtual void drawBitmap(
500 const SalTwoRect& rPosAry,
501 const SalBitmap& rSalBitmap,
502 const SalBitmap& rMaskBitmap ) = 0;
504 virtual void drawMask(
505 const SalTwoRect& rPosAry,
506 const SalBitmap& rSalBitmap,
507 Color nMaskColor ) = 0;
509 virtual std::shared_ptr<SalBitmap> getBitmap( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) = 0;
511 virtual Color getPixel( tools::Long nX, tools::Long nY ) = 0;
513 // invert --> ClipRegion (only Windows or VirDevs)
514 virtual void invert(
515 tools::Long nX, tools::Long nY,
516 tools::Long nWidth, tools::Long nHeight,
517 SalInvert nFlags) = 0;
519 virtual void invert( sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags ) = 0;
521 virtual bool drawEPS(
522 tools::Long nX, tools::Long nY,
523 tools::Long nWidth, tools::Long nHeight,
524 void* pPtr,
525 sal_uInt32 nSize ) = 0;
527 /** Blend the bitmap with the current buffer */
528 virtual bool blendBitmap(
529 const SalTwoRect&,
530 const SalBitmap& rBitmap ) = 0;
532 /** Draw the bitmap by blending using the mask and alpha channel */
533 virtual bool blendAlphaBitmap(
534 const SalTwoRect&,
535 const SalBitmap& rSrcBitmap,
536 const SalBitmap& rMaskBitmap,
537 const SalBitmap& rAlphaBitmap ) = 0;
539 /** Render bitmap with alpha channel
541 @param rSourceBitmap
542 Source bitmap to blit
544 @param rAlphaBitmap
545 Alpha channel to use for blitting
547 @return true, if the operation succeeded, and false
548 otherwise. In this case, clients should try to emulate alpha
549 compositing themselves
551 virtual bool drawAlphaBitmap(
552 const SalTwoRect&,
553 const SalBitmap& rSourceBitmap,
554 const SalBitmap& rAlphaBitmap ) = 0;
556 /** draw transformed bitmap (maybe with alpha) where Null, X, Y define the coordinate system
558 @param fAlpha additional alpha (0 to 1) to apply while drawing
560 virtual bool drawTransformedBitmap(
561 const basegfx::B2DPoint& rNull,
562 const basegfx::B2DPoint& rX,
563 const basegfx::B2DPoint& rY,
564 const SalBitmap& rSourceBitmap,
565 const SalBitmap* pAlphaBitmap,
566 double fAlpha) = 0;
568 /// Returns true if the drawTransformedBitmap() call is fast, and so it should
569 /// be used directly without trying to optimize some calls e.g. by calling drawBitmap()
570 /// instead (which is faster for most VCL backends). These optimizations are not
571 /// done unconditionally because they may be counter-productive for some fast VCL backends
572 /// (for example, some OutputDevice optimizations could try access the pixels, which
573 /// would make performance worse for GPU-backed backends).
574 /// See also tdf#138068.
575 virtual bool hasFastDrawTransformedBitmap() const = 0;
577 /** Render solid rectangle with given transparency
579 * @param nX Top left coordinate of rectangle
580 * @param nY Bottom right coordinate of rectangle
581 * @param nWidth Width of rectangle
582 * @param nHeight Height of rectangle
583 * @param nTransparency Transparency value (0-255) to use. 0 blits and opaque, 255 a
584 * fully transparent rectangle
585 * @returns true if successfully drawn, false if not able to draw rectangle
587 virtual bool drawAlphaRect(
588 tools::Long nX, tools::Long nY,
589 tools::Long nWidth, tools::Long nHeight,
590 sal_uInt8 nTransparency ) = 0;
592 private:
593 SalLayoutFlags m_nLayout; //< 0: mirroring off, 1: mirror x-axis
595 // for buffering the Mirror-Matrix, see ::getMirror
596 enum class MirrorMode
598 NONE,
599 Antiparallel,
600 AntiparallelBiDi,
601 BiDi
603 MirrorMode m_eLastMirrorMode;
604 tools::Long m_nLastMirrorTranslation;
605 basegfx::B2DHomMatrix m_aLastMirror;
607 MirrorMode GetMirrorMode(const OutputDevice& rOutDev) const;
609 protected:
610 /// flags which hold the SetAntialiasing() value from OutputDevice
611 bool m_bAntiAlias : 1;
613 inline tools::Long GetDeviceWidth(const OutputDevice& rOutDev) const;
616 * Handle damage done by drawing with a widget draw override
618 * If a m_pWidgetDraw is set and successfully draws using drawNativeControl,
619 * this function is called to handle the damage done to the graphics buffer.
621 * @param rDamagedRegion the region damaged by drawNativeControl.
623 virtual inline void handleDamage(const tools::Rectangle& rDamagedRegion);
625 // native controls
626 bool initWidgetDrawBackends(bool bForce = false);
628 std::unique_ptr<vcl::WidgetDrawInterface> m_pWidgetDraw;
629 vcl::WidgetDrawInterface* forWidget() { return m_pWidgetDraw ? m_pWidgetDraw.get() : this; }
632 bool SalGraphics::IsNativeControlSupported(ControlType eType, ControlPart ePart)
634 return forWidget()->isNativeControlSupported(eType, ePart);
637 bool SalGraphics::UpdateSettings(AllSettings& rSettings)
639 return forWidget()->updateSettings(rSettings);
642 void SalGraphics::handleDamage(const tools::Rectangle&) {}
645 class VCL_DLLPUBLIC SalGraphicsAutoDelegateToImpl : public SalGraphics
647 public:
648 sal_uInt16 GetBitCount() const override
650 return GetImpl()->GetBitCount();
653 tools::Long GetGraphicsWidth() const override
655 return GetImpl()->GetGraphicsWidth();
658 void ResetClipRegion() override
660 GetImpl()->ResetClipRegion();
663 void setClipRegion( const vcl::Region& i_rClip ) override
665 GetImpl()->setClipRegion(i_rClip);
668 void SetLineColor() override
670 GetImpl()->SetLineColor();
673 void SetLineColor( Color nColor ) override
675 GetImpl()->SetLineColor(nColor);
678 void SetFillColor() override
680 GetImpl()->SetFillColor();
683 void SetFillColor( Color nColor ) override
685 GetImpl()->SetFillColor (nColor);
688 void SetROPLineColor(SalROPColor aColor) override
690 GetImpl()->SetROPLineColor(aColor);
693 void SetROPFillColor( SalROPColor aColor) override
695 GetImpl()->SetROPFillColor(aColor);
698 void SetXORMode(bool bSet, bool bInvertOnly) override
700 GetImpl()->SetXORMode(bSet, bInvertOnly);
703 void drawPixel( tools::Long nX, tools::Long nY ) override
705 GetImpl()->drawPixel(nX, nY);
708 void drawPixel( tools::Long nX, tools::Long nY, Color nColor ) override
710 GetImpl()->drawPixel(nX, nY, nColor);
713 void drawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) override
715 GetImpl()->drawLine(nX1, nY1, nX2, nY2);
718 void drawRect( tools::Long nX, tools::Long nY, tools::Long nDX, tools::Long nDY ) override
720 GetImpl()->drawRect(nX, nY, nDX, nDY);
723 void drawPolyLine( sal_uInt32 nPoints, const Point *pPtAry ) override
725 GetImpl()->drawPolyLine(nPoints, pPtAry);
728 void drawPolygon( sal_uInt32 nPoints, const Point* pPtAry ) override
730 GetImpl()->drawPolygon(nPoints, pPtAry);
733 void drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPoints, const Point** pPtAry) override
735 GetImpl()->drawPolyPolygon (nPoly, pPoints, pPtAry);
738 void drawPolyPolygon(
739 const basegfx::B2DHomMatrix& rObjectToDevice,
740 const basegfx::B2DPolyPolygon& rPolyPolygon,
741 double fTransparency) override
743 GetImpl()->drawPolyPolygon(rObjectToDevice, rPolyPolygon, fTransparency);
746 bool drawPolyLine(
747 const basegfx::B2DHomMatrix& rObjectToDevice,
748 const basegfx::B2DPolygon& rPolygon,
749 double fTransparency,
750 double fLineWidth,
751 const std::vector< double >* pStroke,
752 basegfx::B2DLineJoin eJoin,
753 css::drawing::LineCap eLineCap,
754 double fMiterMinimumAngle,
755 bool bPixelSnapHairline) override
757 return GetImpl()->drawPolyLine(rObjectToDevice, rPolygon, fTransparency, fLineWidth, pStroke, eJoin, eLineCap, fMiterMinimumAngle, bPixelSnapHairline);
760 bool drawPolyLineBezier( sal_uInt32 nPoints, const Point* pPtAry, const PolyFlags* pFlgAry ) override
762 return GetImpl()->drawPolyLineBezier(nPoints, pPtAry, pFlgAry);
765 bool drawPolygonBezier( sal_uInt32 nPoints, const Point* pPtAry, const PolyFlags* pFlgAry ) override
767 return GetImpl()->drawPolygonBezier(nPoints, pPtAry, pFlgAry);
770 bool drawPolyPolygonBezier( sal_uInt32 nPoly,
771 const sal_uInt32* pPoints,
772 const Point* const* pPtAry,
773 const PolyFlags* const* pFlgAry) override
775 return GetImpl()->drawPolyPolygonBezier(nPoly, pPoints, pPtAry, pFlgAry);
778 void invert(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight,
779 SalInvert nFlags) override
781 GetImpl()->invert(nX, nY, nWidth, nHeight, nFlags);
784 void invert(sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags) override
786 GetImpl()->invert(nPoints, pPtAry, nFlags);
789 bool drawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth,
790 tools::Long nHeight, void* pPtr, sal_uInt32 nSize) override
792 return GetImpl()->drawEPS(nX, nY, nWidth, nHeight, pPtr, nSize);
795 void copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics) override
797 GetImpl()->copyBits(rPosAry, pSrcGraphics);
800 void copyArea (tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX,
801 tools::Long nSrcY, tools::Long nSrcWidth, tools::Long nSrcHeight,
802 bool bWindowInvalidate) override
804 GetImpl()->copyArea(nDestX, nDestY, nSrcX, nSrcY, nSrcWidth, nSrcHeight, bWindowInvalidate);
807 void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) override
809 GetImpl()->drawBitmap(rPosAry, rSalBitmap);
812 void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, const SalBitmap& rMaskBitmap) override
814 GetImpl()->drawBitmap(rPosAry, rSalBitmap, rMaskBitmap);
817 void drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, Color nMaskColor) override
819 GetImpl()->drawMask(rPosAry, rSalBitmap, nMaskColor);
822 std::shared_ptr<SalBitmap> getBitmap(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight) override
824 return GetImpl()->getBitmap(nX, nY, nWidth, nHeight);
827 Color getPixel(tools::Long nX, tools::Long nY) override
829 return GetImpl()->getPixel(nX, nY);
832 bool blendBitmap(const SalTwoRect& rPosAry, const SalBitmap& rBitmap) override
834 return GetImpl()->blendBitmap(rPosAry, rBitmap);
837 bool blendAlphaBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSourceBitmap,
838 const SalBitmap& rMaskBitmap, const SalBitmap& rAlphaBitmap) override
840 return GetImpl()->blendAlphaBitmap(rPosAry, rSourceBitmap, rMaskBitmap, rAlphaBitmap);
843 bool drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSourceBitmap,
844 const SalBitmap& rAlphaBitmap) override
846 return GetImpl()->drawAlphaBitmap(rPosAry, rSourceBitmap, rAlphaBitmap);
849 bool drawTransformedBitmap(const basegfx::B2DPoint& rNull,
850 const basegfx::B2DPoint& rX,
851 const basegfx::B2DPoint& rY,
852 const SalBitmap& rSourceBitmap,
853 const SalBitmap* pAlphaBitmap, double fAlpha) override
855 return GetImpl()->drawTransformedBitmap(rNull, rX, rY, rSourceBitmap, pAlphaBitmap, fAlpha);
858 bool hasFastDrawTransformedBitmap() const override
860 return GetImpl()->hasFastDrawTransformedBitmap();
863 bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth,
864 tools::Long nHeight, sal_uInt8 nTransparency) override
866 return GetImpl()->drawAlphaRect(nX, nY, nWidth, nHeight, nTransparency);
869 bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) override
871 return GetImpl()->drawGradient(rPolygon, rGradient);
874 bool implDrawGradient(basegfx::B2DPolyPolygon const& rPolyPolygon,
875 SalGradient const& rGradient) override
877 return GetImpl()->implDrawGradient(rPolyPolygon, rGradient);
880 bool supportsOperation(OutDevSupportType eType) const override
882 return GetImpl()->supportsOperation(eType);
885 OUString getRenderBackendName() const override
887 return GetImpl()->getRenderBackendName();
891 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */