Update git submodules
[LibreOffice.git] / vcl / inc / salgdi.hxx
blob26daad069101bc092b6b227e75214341ba498c00
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>
25 #include <config_vclplug.h>
27 #include "font/FontMetricData.hxx"
28 #include "salgdiimpl.hxx"
29 #include "sallayout.hxx"
30 #include "SalGradient.hxx"
31 #include <basegfx/matrix/b2dhommatrix.hxx>
32 #include "WidgetDrawInterface.hxx"
34 #include <config_cairo_canvas.h>
36 #include <vector>
38 class SalBitmap;
39 class FontAttributes;
40 namespace vcl::font {
41 class FontSelectPattern;
42 class PhysicalFontFace;
43 class PhysicalFontCollection;
45 class SalLayout;
46 namespace tools { class Rectangle; }
47 class OutputDevice;
48 class FreetypeFont;
49 struct SystemGraphicsData;
51 namespace basegfx {
52 class B2DVector;
53 class B2DPolygon;
54 class B2DPolyPolygon;
57 namespace vcl
59 class AbstractTrueTypeFont;
60 class FileDefinitionWidgetDraw;
61 typedef struct TTGlobalFontInfo_ TTGlobalFontInfo;
64 typedef sal_Unicode sal_Ucs; // TODO: use sal_UCS4 instead of sal_Unicode
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.
72 // note: all positions are in pixel and relative to
73 // the top/left-position of the virtual output area
75 class VCL_PLUGIN_PUBLIC SalGraphics : protected vcl::WidgetDrawInterface
77 public:
78 SalGraphics();
79 ~SalGraphics() COVERITY_NOEXCEPT_FALSE override;
81 virtual SalGraphicsImpl* GetImpl() const = 0;
83 void setAntiAlias(bool bNew)
85 m_bAntiAlias = bNew;
87 // Temporary store in both
88 if (GetImpl())
89 GetImpl()->setAntiAlias(bNew);
92 bool getAntiAlias() const
94 return m_bAntiAlias;
97 // public SalGraphics methods, the interface to the independent vcl part
99 // get device resolution
100 virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) = 0;
102 // get the depth of the device
103 virtual sal_uInt16 GetBitCount() const = 0;
105 // get the width of the device
106 virtual tools::Long GetGraphicsWidth() const = 0;
108 // set the clip region to empty
109 virtual void ResetClipRegion() = 0;
111 // set the line color to transparent (= don't draw lines)
113 virtual void SetLineColor() = 0;
115 // set the line color to a specific color
116 virtual void SetLineColor( Color nColor ) = 0;
118 // set the fill color to transparent (= don't fill)
119 virtual void SetFillColor() = 0;
121 // set the fill color to a specific color, shapes will be
122 // filled accordingly
123 virtual void SetFillColor( Color nColor ) = 0;
125 // enable/disable XOR drawing
126 virtual void SetXORMode( bool bSet, bool bInvertOnly ) = 0;
128 // set line color for raster operations
129 virtual void SetROPLineColor( SalROPColor nROPColor ) = 0;
131 // set fill color for raster operations
132 virtual void SetROPFillColor( SalROPColor nROPColor ) = 0;
134 // set the text color to a specific color
135 virtual void SetTextColor( Color nColor ) = 0;
137 // set the font
138 virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) = 0;
140 // release the fonts
141 void ReleaseFonts() { SetFont( nullptr, 0 ); }
143 // get the current font's metrics
144 virtual void GetFontMetric( FontMetricDataRef&, int nFallbackLevel ) = 0;
146 // get the repertoire of the current font
147 virtual FontCharMapRef GetFontCharMap() const = 0;
149 // get the layout capabilities of the current font
150 virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const = 0;
152 // graphics must fill supplied font list
153 virtual void GetDevFontList( vcl::font::PhysicalFontCollection* ) = 0;
155 // graphics must drop any cached font info
156 virtual void ClearDevFontCache() = 0;
158 virtual bool AddTempDevFont(
159 vcl::font::PhysicalFontCollection*,
160 const OUString& rFileURL,
161 const OUString& rFontName ) = 0;
163 virtual std::unique_ptr<GenericSalLayout>
164 GetTextLayout(int nFallbackLevel) = 0;
165 virtual void DrawTextLayout( const GenericSalLayout& ) = 0;
166 virtual void DrawSalLayout(const GenericSalLayout&, void*, const basegfx::BColor&, bool ) const {}
168 virtual bool supportsOperation( OutDevSupportType ) const = 0;
170 // mirroring specifics
171 SalLayoutFlags GetLayout() const { return m_nLayout; }
172 void SetLayout( SalLayoutFlags aLayout ) { m_nLayout = aLayout;}
174 SAL_DLLPRIVATE void mirror( tools::Long& nX, const OutputDevice& rOutDev ) const;
175 // only called mirror2 to avoid ambiguity
176 [[nodiscard]] SAL_DLLPRIVATE tools::Long mirror2( tools::Long nX, const OutputDevice& rOutDev ) const;
177 SAL_DLLPRIVATE void mirror( tools::Long& nX, tools::Long nWidth, const OutputDevice& rOutDev, bool bBack = false ) const;
178 SAL_DLLPRIVATE bool mirror( sal_uInt32 nPoints, const Point *pPtAry, Point *pPtAry2, const OutputDevice& rOutDev ) const;
179 SAL_DLLPRIVATE void mirror( tools::Rectangle& rRect, const OutputDevice&, bool bBack = false ) const;
180 SAL_DLLPRIVATE void mirror( vcl::Region& rRgn, const OutputDevice& rOutDev ) const;
181 SAL_DLLPRIVATE void mirror( ImplControlValue&, const OutputDevice& ) const;
182 SAL_DLLPRIVATE basegfx::B2DPolyPolygon mirror( const basegfx::B2DPolyPolygon& i_rPoly, const OutputDevice& rOutDev ) const;
183 SAL_DLLPRIVATE const basegfx::B2DHomMatrix& getMirror( const OutputDevice& rOutDev ) const;
185 // non virtual methods; these do possible coordinate mirroring and
186 // then delegate to protected virtual methods
187 SAL_DLLPRIVATE void SetClipRegion( const vcl::Region&, const OutputDevice& rOutDev );
189 // draw --> LineColor and FillColor and RasterOp and ClipRegion
190 SAL_DLLPRIVATE void DrawPixel( tools::Long nX, tools::Long nY, const OutputDevice& rOutDev );
191 SAL_DLLPRIVATE void DrawPixel( tools::Long nX, tools::Long nY, Color nColor, const OutputDevice& rOutDev );
193 SAL_DLLPRIVATE void DrawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2, const OutputDevice& rOutDev );
195 SAL_DLLPRIVATE void DrawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, const OutputDevice& rOutDev );
197 SAL_DLLPRIVATE void DrawPolyLine( sal_uInt32 nPoints, Point const * pPtAry, const OutputDevice& rOutDev );
199 SAL_DLLPRIVATE void DrawPolygon( sal_uInt32 nPoints, const Point* pPtAry, const OutputDevice& rOutDev );
201 SAL_DLLPRIVATE void DrawPolyPolygon(
202 sal_uInt32 nPoly,
203 const sal_uInt32* pPoints,
204 const Point** pPtAry,
205 const OutputDevice& rOutDev );
207 SAL_DLLPRIVATE void DrawPolyPolygon(
208 const basegfx::B2DHomMatrix& rObjectToDevice,
209 const basegfx::B2DPolyPolygon &i_rPolyPolygon,
210 double i_fTransparency,
211 const OutputDevice& i_rOutDev);
213 SAL_DLLPRIVATE bool DrawPolyLine(
214 const basegfx::B2DHomMatrix& rObjectToDevice,
215 const basegfx::B2DPolygon& i_rPolygon,
216 double i_fTransparency,
217 double i_fLineWidth,
218 const std::vector< double >* i_pStroke, // MM01
219 basegfx::B2DLineJoin i_eLineJoin,
220 css::drawing::LineCap i_eLineCap,
221 double i_fMiterMinimumAngle,
222 bool bPixelSnapHairline,
223 const OutputDevice& i_rOutDev);
225 SAL_DLLPRIVATE bool DrawPolyLineBezier(
226 sal_uInt32 nPoints,
227 const Point* pPtAry,
228 const PolyFlags* pFlgAry,
229 const OutputDevice& rOutDev );
231 SAL_DLLPRIVATE bool DrawPolygonBezier(
232 sal_uInt32 nPoints,
233 const Point* pPtAry,
234 const PolyFlags* pFlgAry,
235 const OutputDevice& rOutDev );
237 SAL_DLLPRIVATE bool DrawPolyPolygonBezier(
238 sal_uInt32 nPoly,
239 const sal_uInt32* pPoints,
240 const Point* const* pPtAry,
241 const PolyFlags* const* pFlgAry,
242 const OutputDevice& rOutDev );
244 SAL_DLLPRIVATE bool DrawGradient(
245 const tools::PolyPolygon& rPolyPoly,
246 const Gradient& rGradient,
247 const OutputDevice& rOutDev);
249 // CopyArea --> No RasterOp, but ClipRegion
250 void CopyArea(
251 tools::Long nDestX, tools::Long nDestY,
252 tools::Long nSrcX, tools::Long nSrcY,
253 tools::Long nSrcWidth, tools::Long nSrcHeight,
254 const OutputDevice& rOutDev );
256 // CopyBits --> RasterOp and ClipRegion
257 // CopyBits() CopyBits on same Graphics
258 SAL_DLLPRIVATE void CopyBits(
259 const SalTwoRect& rPosAry,
260 const OutputDevice& rOutDev);
262 // CopyBits --> RasterOp and ClipRegion
263 // CopyBits() CopyBits on different Graphics
264 void CopyBits(
265 const SalTwoRect& rPosAry,
266 SalGraphics& rSrcGraphics,
267 const OutputDevice& rOutDev,
268 const OutputDevice& rSrcOutDev );
271 SAL_DLLPRIVATE void DrawBitmap(
272 const SalTwoRect& rPosAry,
273 const SalBitmap& rSalBitmap,
274 const OutputDevice& rOutDev );
276 SAL_DLLPRIVATE void DrawMask(
277 const SalTwoRect& rPosAry,
278 const SalBitmap& rSalBitmap,
279 Color nMaskColor,
280 const OutputDevice& rOutDev );
282 SAL_DLLPRIVATE std::shared_ptr<SalBitmap> GetBitmap(
283 tools::Long nX, tools::Long nY,
284 tools::Long nWidth, tools::Long nHeight,
285 const OutputDevice& rOutDev );
287 SAL_DLLPRIVATE Color GetPixel(
288 tools::Long nX, tools::Long nY,
289 const OutputDevice& rOutDev );
291 // invert --> ClipRegion (only Windows)
292 SAL_DLLPRIVATE void Invert(
293 tools::Long nX, tools::Long nY,
294 tools::Long nWidth, tools::Long nHeight,
295 SalInvert nFlags,
296 const OutputDevice& rOutDev );
298 SAL_DLLPRIVATE void Invert(
299 sal_uInt32 nPoints,
300 const Point* pPtAry,
301 SalInvert nFlags,
302 const OutputDevice& rOutDev );
304 SAL_DLLPRIVATE bool DrawEPS(
305 tools::Long nX, tools::Long nY,
306 tools::Long nWidth, tools::Long nHeight,
307 void* pPtr,
308 sal_uInt32 nSize,
309 const OutputDevice& rOutDev );
311 // native widget rendering functions
314 * @see WidgetDrawInterface::isNativeControlSupported
316 inline bool IsNativeControlSupported(ControlType, ControlPart);
319 * @see WidgetDrawInterface::hitTestNativeControl
321 SAL_DLLPRIVATE bool HitTestNativeScrollbar(
322 ControlPart nPart,
323 const tools::Rectangle& rControlRegion,
324 const Point& aPos,
325 bool& rIsInside,
326 const OutputDevice& rOutDev);
329 * @see WidgetDrawInterface::drawNativeControl
331 SAL_DLLPRIVATE bool DrawNativeControl(
332 ControlType nType,
333 ControlPart nPart,
334 const tools::Rectangle& rControlRegion,
335 ControlState nState,
336 const ImplControlValue& aValue,
337 const OUString& aCaption,
338 const OutputDevice& rOutDev,
339 const Color& rBackgroundColor = COL_AUTO );
342 * @see WidgetDrawInterface::getNativeControlRegion
344 SAL_DLLPRIVATE bool GetNativeControlRegion(
345 ControlType nType,
346 ControlPart nPart,
347 const tools::Rectangle& rControlRegion,
348 ControlState nState,
349 const ImplControlValue& aValue,
350 tools::Rectangle &rNativeBoundingRegion,
351 tools::Rectangle &rNativeContentRegion,
352 const OutputDevice& rOutDev );
355 * @see WidgetDrawInterface::updateSettings
357 inline bool UpdateSettings(AllSettings&);
359 SAL_DLLPRIVATE bool BlendBitmap(
360 const SalTwoRect& rPosAry,
361 const SalBitmap& rSalBitmap,
362 const OutputDevice& rOutDev );
364 SAL_DLLPRIVATE bool BlendAlphaBitmap(
365 const SalTwoRect& rPosAry,
366 const SalBitmap& rSalSrcBitmap,
367 const SalBitmap& rSalMaskBitmap,
368 const SalBitmap& rSalAlphaBitmap,
369 const OutputDevice& rOutDev );
371 SAL_DLLPRIVATE bool DrawAlphaBitmap(
372 const SalTwoRect&,
373 const SalBitmap& rSourceBitmap,
374 const SalBitmap& rAlphaBitmap,
375 const OutputDevice& rOutDev );
377 SAL_DLLPRIVATE bool DrawTransformedBitmap(
378 const basegfx::B2DPoint& rNull,
379 const basegfx::B2DPoint& rX,
380 const basegfx::B2DPoint& rY,
381 const SalBitmap& rSourceBitmap,
382 const SalBitmap* pAlphaBitmap,
383 double fAlpha,
384 const OutputDevice& rOutDev );
386 SAL_DLLPRIVATE bool HasFastDrawTransformedBitmap() const;
388 SAL_DLLPRIVATE bool DrawAlphaRect(
389 tools::Long nX, tools::Long nY,
390 tools::Long nWidth, tools::Long nHeight,
391 sal_uInt8 nTransparency,
392 const OutputDevice& rOutDev );
394 SAL_DLLPRIVATE virtual OUString getRenderBackendName() const;
396 virtual SystemGraphicsData GetGraphicsData() const = 0;
397 #if USE_HEADLESS_CODE
398 virtual void ApplyFullDamage() const {}
399 #endif
401 // Backends like the svp/gtk ones use cairo and hidpi scale at the surface
402 // but bitmaps aren't hidpi, so if this returns true for the case that the
403 // surface is hidpi then pScaleOut contains the scaling factor. So we can
404 // create larger hires bitmaps which we know will be logically scaled down
405 // by this factor but physically just copied
406 virtual bool ShouldDownscaleIconsAtSurface(double& rScaleOut) const;
409 #if ENABLE_CAIRO_CANVAS
411 /// Check whether cairo will work
412 virtual bool SupportsCairo() const = 0;
413 /// Create Surface from given cairo surface
414 virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const = 0;
415 /// Create surface with given dimensions
416 virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const = 0;
417 /// Create Surface for given bitmap data
418 virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice, const BitmapSystemData& rData, const Size& rSize) const = 0;
419 virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const = 0;
421 #endif // ENABLE_CAIRO_CANVAS
423 protected:
425 friend class vcl::FileDefinitionWidgetDraw;
427 virtual void setClipRegion( const vcl::Region& ) = 0;
429 // draw --> LineColor and FillColor and RasterOp and ClipRegion
430 virtual void drawPixel( tools::Long nX, tools::Long nY ) = 0;
431 virtual void drawPixel( tools::Long nX, tools::Long nY, Color nColor ) = 0;
433 virtual void drawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) = 0;
435 virtual void drawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) = 0;
437 virtual void drawPolyLine( sal_uInt32 nPoints, const Point* pPtAry ) = 0;
439 virtual void drawPolygon( sal_uInt32 nPoints, const Point* pPtAry ) = 0;
441 virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, const Point** pPtAry ) = 0;
443 virtual void drawPolyPolygon(
444 const basegfx::B2DHomMatrix& rObjectToDevice,
445 const basegfx::B2DPolyPolygon&,
446 double fTransparency) = 0;
448 virtual bool drawPolyLine(
449 const basegfx::B2DHomMatrix& rObjectToDevice,
450 const basegfx::B2DPolygon&,
451 double fTransparency,
452 double fLineWidth,
453 const std::vector< double >* pStroke, // MM01
454 basegfx::B2DLineJoin,
455 css::drawing::LineCap,
456 double fMiterMinimumAngle,
457 bool bPixelSnapHairline) = 0;
459 virtual bool drawPolyLineBezier(
460 sal_uInt32 nPoints,
461 const Point* pPtAry,
462 const PolyFlags* pFlgAry ) = 0;
464 virtual bool drawPolygonBezier(
465 sal_uInt32 nPoints,
466 const Point* pPtAry,
467 const PolyFlags* pFlgAry ) = 0;
469 virtual bool drawPolyPolygonBezier(
470 sal_uInt32 nPoly,
471 const sal_uInt32* pPoints,
472 const Point* const* pPtAry,
473 const PolyFlags* const* pFlgAry ) = 0;
475 virtual bool drawGradient(
476 const tools::PolyPolygon& rPolyPoly,
477 const Gradient& rGradient ) = 0;
479 virtual bool implDrawGradient(basegfx::B2DPolyPolygon const & /*rPolyPolygon*/,
480 SalGradient const & /*rGradient*/)
482 return false;
485 // CopyArea --> No RasterOp, but ClipRegion
486 virtual void copyArea(
487 tools::Long nDestX, tools::Long nDestY,
488 tools::Long nSrcX, tools::Long nSrcY,
489 tools::Long nSrcWidth, tools::Long nSrcHeight,
490 bool bWindowInvalidate ) = 0;
492 // CopyBits and DrawBitmap --> RasterOp and ClipRegion
493 // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics
494 virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) = 0;
496 virtual void drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) = 0;
498 virtual void drawBitmap(
499 const SalTwoRect& rPosAry,
500 const SalBitmap& rSalBitmap,
501 const SalBitmap& rMaskBitmap ) = 0;
503 virtual void drawMask(
504 const SalTwoRect& rPosAry,
505 const SalBitmap& rSalBitmap,
506 Color nMaskColor ) = 0;
508 virtual std::shared_ptr<SalBitmap> getBitmap( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) = 0;
510 virtual Color getPixel( tools::Long nX, tools::Long nY ) = 0;
512 // invert --> ClipRegion (only Windows or VirDevs)
513 virtual void invert(
514 tools::Long nX, tools::Long nY,
515 tools::Long nWidth, tools::Long nHeight,
516 SalInvert nFlags) = 0;
518 virtual void invert( sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags ) = 0;
520 /// Only implemented by the macOS Quartz backend and the MS-Windows GDI backend.
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*/ ) { return false; }
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 /// Only currently true for SkiaSalGraphicsImpl
576 virtual bool hasFastDrawTransformedBitmap() const { return false; }
578 /** Render solid rectangle with given transparency
580 * @param nX Top left coordinate of rectangle
581 * @param nY Bottom right coordinate of rectangle
582 * @param nWidth Width of rectangle
583 * @param nHeight Height of rectangle
584 * @param nTransparency Transparency value (0-255) to use. 0 blits and opaque, 255 a
585 * fully transparent rectangle
586 * @returns true if successfully drawn, false if not able to draw rectangle
588 virtual bool drawAlphaRect(
589 tools::Long nX, tools::Long nY,
590 tools::Long nWidth, tools::Long nHeight,
591 sal_uInt8 nTransparency ) = 0;
593 private:
594 SalLayoutFlags m_nLayout; //< 0: mirroring off, 1: mirror x-axis
596 // for buffering the Mirror-Matrix, see ::getMirror
597 enum class MirrorMode
599 NONE,
600 Antiparallel,
601 AntiparallelBiDi,
602 BiDi
604 MirrorMode m_eLastMirrorMode;
605 tools::Long m_nLastMirrorTranslation;
606 basegfx::B2DHomMatrix m_aLastMirror;
608 SAL_DLLPRIVATE MirrorMode GetMirrorMode(const OutputDevice& rOutDev) const;
610 protected:
611 /// flags which hold the SetAntialiasing() value from OutputDevice
612 bool m_bAntiAlias : 1;
614 inline tools::Long GetDeviceWidth(const OutputDevice& rOutDev) const;
617 * Handle damage done by drawing with a widget draw override
619 * If a m_pWidgetDraw is set and successfully draws using drawNativeControl,
620 * this function is called to handle the damage done to the graphics buffer.
622 * @param rDamagedRegion the region damaged by drawNativeControl.
624 virtual inline void handleDamage(const tools::Rectangle& rDamagedRegion);
626 // native controls
627 bool initWidgetDrawBackends(bool bForce = false);
629 std::unique_ptr<vcl::WidgetDrawInterface> m_pWidgetDraw;
630 vcl::WidgetDrawInterface* forWidget() { return m_pWidgetDraw ? m_pWidgetDraw.get() : this; }
633 bool SalGraphics::IsNativeControlSupported(ControlType eType, ControlPart ePart)
635 return forWidget()->isNativeControlSupported(eType, ePart);
638 bool SalGraphics::UpdateSettings(AllSettings& rSettings)
640 return forWidget()->updateSettings(rSettings);
643 void SalGraphics::handleDamage(const tools::Rectangle&) {}
646 class VCL_DLLPUBLIC SalGraphicsAutoDelegateToImpl : public SalGraphics
648 public:
649 sal_uInt16 GetBitCount() const override
651 return GetImpl()->GetBitCount();
654 tools::Long GetGraphicsWidth() const override
656 return GetImpl()->GetGraphicsWidth();
659 void ResetClipRegion() override
661 GetImpl()->ResetClipRegion();
664 void setClipRegion( const vcl::Region& i_rClip ) override
666 GetImpl()->setClipRegion(i_rClip);
669 void SetLineColor() override
671 GetImpl()->SetLineColor();
674 void SetLineColor( Color nColor ) override
676 GetImpl()->SetLineColor(nColor);
679 void SetFillColor() override
681 GetImpl()->SetFillColor();
684 void SetFillColor( Color nColor ) override
686 GetImpl()->SetFillColor (nColor);
689 void SetROPLineColor(SalROPColor aColor) override
691 GetImpl()->SetROPLineColor(aColor);
694 void SetROPFillColor( SalROPColor aColor) override
696 GetImpl()->SetROPFillColor(aColor);
699 void SetXORMode(bool bSet, bool bInvertOnly) override
701 GetImpl()->SetXORMode(bSet, bInvertOnly);
704 void drawPixel( tools::Long nX, tools::Long nY ) override
706 GetImpl()->drawPixel(nX, nY);
709 void drawPixel( tools::Long nX, tools::Long nY, Color nColor ) override
711 GetImpl()->drawPixel(nX, nY, nColor);
714 void drawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) override
716 GetImpl()->drawLine(nX1, nY1, nX2, nY2);
719 void drawRect( tools::Long nX, tools::Long nY, tools::Long nDX, tools::Long nDY ) override
721 GetImpl()->drawRect(nX, nY, nDX, nDY);
724 void drawPolyLine( sal_uInt32 nPoints, const Point *pPtAry ) override
726 GetImpl()->drawPolyLine(nPoints, pPtAry);
729 void drawPolygon( sal_uInt32 nPoints, const Point* pPtAry ) override
731 GetImpl()->drawPolygon(nPoints, pPtAry);
734 void drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPoints, const Point** pPtAry) override
736 GetImpl()->drawPolyPolygon (nPoly, pPoints, pPtAry);
739 void drawPolyPolygon(
740 const basegfx::B2DHomMatrix& rObjectToDevice,
741 const basegfx::B2DPolyPolygon& rPolyPolygon,
742 double fTransparency) override
744 GetImpl()->drawPolyPolygon(rObjectToDevice, rPolyPolygon, fTransparency);
747 bool drawPolyLine(
748 const basegfx::B2DHomMatrix& rObjectToDevice,
749 const basegfx::B2DPolygon& rPolygon,
750 double fTransparency,
751 double fLineWidth,
752 const std::vector< double >* pStroke,
753 basegfx::B2DLineJoin eJoin,
754 css::drawing::LineCap eLineCap,
755 double fMiterMinimumAngle,
756 bool bPixelSnapHairline) override
758 return GetImpl()->drawPolyLine(rObjectToDevice, rPolygon, fTransparency, fLineWidth, pStroke, eJoin, eLineCap, fMiterMinimumAngle, bPixelSnapHairline);
761 bool drawPolyLineBezier( sal_uInt32 nPoints, const Point* pPtAry, const PolyFlags* pFlgAry ) override
763 return GetImpl()->drawPolyLineBezier(nPoints, pPtAry, pFlgAry);
766 bool drawPolygonBezier( sal_uInt32 nPoints, const Point* pPtAry, const PolyFlags* pFlgAry ) override
768 return GetImpl()->drawPolygonBezier(nPoints, pPtAry, pFlgAry);
771 bool drawPolyPolygonBezier( sal_uInt32 nPoly,
772 const sal_uInt32* pPoints,
773 const Point* const* pPtAry,
774 const PolyFlags* const* pFlgAry) override
776 return GetImpl()->drawPolyPolygonBezier(nPoly, pPoints, pPtAry, pFlgAry);
779 void invert(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight,
780 SalInvert nFlags) override
782 GetImpl()->invert(nX, nY, nWidth, nHeight, nFlags);
785 void invert(sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags) override
787 GetImpl()->invert(nPoints, pPtAry, nFlags);
790 bool drawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth,
791 tools::Long nHeight, void* pPtr, sal_uInt32 nSize) override
793 return GetImpl()->drawEPS(nX, nY, nWidth, nHeight, pPtr, nSize);
796 void copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics) override
798 GetImpl()->copyBits(rPosAry, pSrcGraphics);
801 void copyArea (tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX,
802 tools::Long nSrcY, tools::Long nSrcWidth, tools::Long nSrcHeight,
803 bool bWindowInvalidate) override
805 GetImpl()->copyArea(nDestX, nDestY, nSrcX, nSrcY, nSrcWidth, nSrcHeight, bWindowInvalidate);
808 void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) override
810 GetImpl()->drawBitmap(rPosAry, rSalBitmap);
813 void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, const SalBitmap& rMaskBitmap) override
815 GetImpl()->drawBitmap(rPosAry, rSalBitmap, rMaskBitmap);
818 void drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, Color nMaskColor) override
820 GetImpl()->drawMask(rPosAry, rSalBitmap, nMaskColor);
823 std::shared_ptr<SalBitmap> getBitmap(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight) override
825 return GetImpl()->getBitmap(nX, nY, nWidth, nHeight);
828 Color getPixel(tools::Long nX, tools::Long nY) override
830 return GetImpl()->getPixel(nX, nY);
833 bool blendBitmap(const SalTwoRect& rPosAry, const SalBitmap& rBitmap) override
835 return GetImpl()->blendBitmap(rPosAry, rBitmap);
838 bool blendAlphaBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSourceBitmap,
839 const SalBitmap& rMaskBitmap, const SalBitmap& rAlphaBitmap) override
841 return GetImpl()->blendAlphaBitmap(rPosAry, rSourceBitmap, rMaskBitmap, rAlphaBitmap);
844 bool drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSourceBitmap,
845 const SalBitmap& rAlphaBitmap) override
847 return GetImpl()->drawAlphaBitmap(rPosAry, rSourceBitmap, rAlphaBitmap);
850 bool drawTransformedBitmap(const basegfx::B2DPoint& rNull,
851 const basegfx::B2DPoint& rX,
852 const basegfx::B2DPoint& rY,
853 const SalBitmap& rSourceBitmap,
854 const SalBitmap* pAlphaBitmap, double fAlpha) override
856 return GetImpl()->drawTransformedBitmap(rNull, rX, rY, rSourceBitmap, pAlphaBitmap, fAlpha);
859 bool hasFastDrawTransformedBitmap() const override
861 return GetImpl()->hasFastDrawTransformedBitmap();
864 bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth,
865 tools::Long nHeight, sal_uInt8 nTransparency) override
867 return GetImpl()->drawAlphaRect(nX, nY, nWidth, nHeight, nTransparency);
870 bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) override
872 return GetImpl()->drawGradient(rPolygon, rGradient);
875 bool implDrawGradient(basegfx::B2DPolyPolygon const& rPolyPolygon,
876 SalGradient const& rGradient) override
878 return GetImpl()->implDrawGradient(rPolyPolygon, rGradient);
881 bool supportsOperation(OutDevSupportType eType) const override
883 return GetImpl()->supportsOperation(eType);
886 OUString getRenderBackendName() const override
888 return GetImpl()->getRenderBackendName();
892 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */