1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_VCL_INC_SALGDIIMPL_HXX
21 #define INCLUDED_VCL_INC_SALGDIIMPL_HXX
23 #include <vcl/dllapi.h>
25 #include <tools/color.hxx>
26 #include <tools/poly.hxx>
28 #include <vcl/salgtype.hxx>
29 #include <vcl/region.hxx>
30 #include <vcl/vclenum.hxx>
32 #include <com/sun/star/drawing/LineCap.hpp>
38 class SalVirtualDevice
;
41 class VCL_PLUGIN_PUBLIC SalGraphicsImpl
46 void setAntiAlias(bool bNew
)
51 bool getAntiAlias() const
60 virtual ~SalGraphicsImpl();
62 virtual void Init() = 0;
64 virtual void DeInit() {}
66 virtual void freeResources() = 0;
68 virtual OUString
getRenderBackendName() const = 0;
70 virtual bool setClipRegion( const vcl::Region
& ) = 0;
72 // get the depth of the device
73 virtual sal_uInt16
GetBitCount() const = 0;
75 // get the width of the device
76 virtual tools::Long
GetGraphicsWidth() const = 0;
78 // set the clip region to empty
79 virtual void ResetClipRegion() = 0;
81 // set the line color to transparent (= don't draw lines)
83 virtual void SetLineColor() = 0;
85 // set the line color to a specific color
86 virtual void SetLineColor( Color nColor
) = 0;
88 // set the fill color to transparent (= don't fill)
89 virtual void SetFillColor() = 0;
91 // set the fill color to a specific color, shapes will be
93 virtual void SetFillColor( Color nColor
) = 0;
95 // enable/disable XOR drawing
96 virtual void SetXORMode( bool bSet
, bool bInvertOnly
) = 0;
98 // set line color for raster operations
99 virtual void SetROPLineColor( SalROPColor nROPColor
) = 0;
101 // set fill color for raster operations
102 virtual void SetROPFillColor( SalROPColor nROPColor
) = 0;
104 // draw --> LineColor and FillColor and RasterOp and ClipRegion
105 virtual void drawPixel( tools::Long nX
, tools::Long nY
) = 0;
106 virtual void drawPixel( tools::Long nX
, tools::Long nY
, Color nColor
) = 0;
108 virtual void drawLine( tools::Long nX1
, tools::Long nY1
, tools::Long nX2
, tools::Long nY2
) = 0;
110 virtual void drawRect( tools::Long nX
, tools::Long nY
, tools::Long nWidth
, tools::Long nHeight
) = 0;
112 virtual void drawPolyLine( sal_uInt32 nPoints
, const Point
* pPtAry
) = 0;
114 virtual void drawPolygon( sal_uInt32 nPoints
, const Point
* pPtAry
) = 0;
116 virtual void drawPolyPolygon( sal_uInt32 nPoly
, const sal_uInt32
* pPoints
, const Point
** pPtAry
) = 0;
118 virtual bool drawPolyPolygon(
119 const basegfx::B2DHomMatrix
& rObjectToDevice
,
120 const basegfx::B2DPolyPolygon
&,
121 double fTransparency
) = 0;
123 virtual bool drawPolyLine(
124 const basegfx::B2DHomMatrix
& rObjectToDevice
,
125 const basegfx::B2DPolygon
&,
126 double fTransparency
,
128 const std::vector
< double >* pStroke
, // MM01
129 basegfx::B2DLineJoin
,
130 css::drawing::LineCap
,
131 double fMiterMinimumAngle
,
132 bool bPixelSnapHairline
) = 0;
134 virtual bool drawPolyLineBezier(
137 const PolyFlags
* pFlgAry
) = 0;
139 virtual bool drawPolygonBezier(
142 const PolyFlags
* pFlgAry
) = 0;
144 virtual bool drawPolyPolygonBezier(
146 const sal_uInt32
* pPoints
,
147 const Point
* const* pPtAry
,
148 const PolyFlags
* const* pFlgAry
) = 0;
150 // CopyArea --> No RasterOp, but ClipRegion
151 virtual void copyArea(
152 tools::Long nDestX
, tools::Long nDestY
,
153 tools::Long nSrcX
, tools::Long nSrcY
,
154 tools::Long nSrcWidth
, tools::Long nSrcHeight
,
155 bool bWindowInvalidate
) = 0;
157 // CopyBits and DrawBitmap --> RasterOp and ClipRegion
158 // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics
159 virtual void copyBits( const SalTwoRect
& rPosAry
, SalGraphics
* pSrcGraphics
) = 0;
161 virtual void drawBitmap( const SalTwoRect
& rPosAry
, const SalBitmap
& rSalBitmap
) = 0;
163 virtual void drawBitmap(
164 const SalTwoRect
& rPosAry
,
165 const SalBitmap
& rSalBitmap
,
166 const SalBitmap
& rMaskBitmap
) = 0;
168 virtual void drawMask(
169 const SalTwoRect
& rPosAry
,
170 const SalBitmap
& rSalBitmap
,
171 Color nMaskColor
) = 0;
173 virtual std::shared_ptr
<SalBitmap
> getBitmap( tools::Long nX
, tools::Long nY
, tools::Long nWidth
, tools::Long nHeight
) = 0;
175 virtual Color
getPixel( tools::Long nX
, tools::Long nY
) = 0;
177 // invert --> ClipRegion (only Windows or VirDevs)
179 tools::Long nX
, tools::Long nY
,
180 tools::Long nWidth
, tools::Long nHeight
,
181 SalInvert nFlags
) = 0;
183 virtual void invert( sal_uInt32 nPoints
, const Point
* pPtAry
, SalInvert nFlags
) = 0;
185 virtual bool drawEPS(
186 tools::Long nX
, tools::Long nY
,
187 tools::Long nWidth
, tools::Long nHeight
,
189 sal_uInt32 nSize
) = 0;
191 virtual bool blendBitmap(
193 const SalBitmap
& rBitmap
) = 0;
195 virtual bool blendAlphaBitmap(
197 const SalBitmap
& rSrcBitmap
,
198 const SalBitmap
& rMaskBitmap
,
199 const SalBitmap
& rAlphaBitmap
) = 0;
201 virtual bool drawAlphaBitmap(
203 const SalBitmap
& rSourceBitmap
,
204 const SalBitmap
& rAlphaBitmap
) = 0;
206 /** draw transformed bitmap (maybe with alpha) where Null, X, Y define the coordinate system */
207 virtual bool drawTransformedBitmap(
208 const basegfx::B2DPoint
& rNull
,
209 const basegfx::B2DPoint
& rX
,
210 const basegfx::B2DPoint
& rY
,
211 const SalBitmap
& rSourceBitmap
,
212 const SalBitmap
* pAlphaBitmap
,
215 /// Used e.g. by canvas to know whether to cache the drawing.
216 /// See also tdf#138068.
217 virtual bool hasFastDrawTransformedBitmap() const = 0;
219 virtual bool drawAlphaRect(
220 tools::Long nX
, tools::Long nY
,
221 tools::Long nWidth
, tools::Long nHeight
,
222 sal_uInt8 nTransparency
) = 0;
224 virtual bool drawGradient(const tools::PolyPolygon
& rPolygon
, const Gradient
& rGradient
) = 0;
225 virtual bool implDrawGradient(basegfx::B2DPolyPolygon
const & rPolyPolygon
, SalGradient
const & rGradient
) = 0;
227 virtual bool supportsOperation(OutDevSupportType eType
) const = 0;
232 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */