/src/libreoffice/vcl/inc/salgdiimpl.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
5 | | * This Source Code Form is subject to the terms of the Mozilla Public |
6 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
11 | | * Licensed to the Apache Software Foundation (ASF) under one or more |
12 | | * contributor license agreements. See the NOTICE file distributed |
13 | | * with this work for additional information regarding copyright |
14 | | * ownership. The ASF licenses this file to you under the Apache |
15 | | * License, Version 2.0 (the "License"); you may not use this file |
16 | | * except in compliance with the License. You may obtain a copy of |
17 | | * the License at http://www.apache.org/licenses/LICENSE-2.0 . |
18 | | */ |
19 | | |
20 | | #pragma once |
21 | | |
22 | | #include <vcl/dllapi.h> |
23 | | |
24 | | #include <basegfx/vector/b2enums.hxx> |
25 | | #include <tools/color.hxx> |
26 | | #include <tools/poly.hxx> |
27 | | |
28 | | #include <vcl/salgtype.hxx> |
29 | | #include <vcl/region.hxx> |
30 | | #include <vcl/vclenum.hxx> |
31 | | |
32 | | #include <com/sun/star/drawing/LineCap.hpp> |
33 | | |
34 | | class SalGraphics; |
35 | | class SalBitmap; |
36 | | class Gradient; |
37 | | struct SalGradient; |
38 | | |
39 | | /** |
40 | | Implementation class for SalGraphics. |
41 | | |
42 | | This class allows having an implementation of drawing calls that is separate from SalGraphics, |
43 | | and SalGraphics can forward all such calls to SalGraphicsImpl. For example X11SalGraphics |
44 | | may internally use either Cairo-based X11CairoSalGraphicsImpl or Skia-based SkiaSalGraphicsImpl, |
45 | | and the latter may be used also by other SalGraphics implementations. All the functions |
46 | | here should be implementations of the relevant SalGraphics functions. |
47 | | */ |
48 | | class VCL_PLUGIN_PUBLIC SalGraphicsImpl |
49 | | { |
50 | | bool m_bAntiAlias; |
51 | | public: |
52 | | |
53 | | void setAntiAlias(bool bNew) |
54 | 676k | { |
55 | 676k | m_bAntiAlias = bNew; |
56 | 676k | } |
57 | | |
58 | | bool getAntiAlias() const |
59 | 16.1M | { |
60 | 16.1M | return m_bAntiAlias; |
61 | 16.1M | } |
62 | | |
63 | | SalGraphicsImpl() |
64 | 676k | : m_bAntiAlias(false) |
65 | 676k | {} |
66 | | |
67 | | virtual ~SalGraphicsImpl(); |
68 | | |
69 | | // All the functions are implementations of functions from the SalGraphics class, |
70 | | // so see the SalGraphics class for documentation (both uppercase and lowercase |
71 | | // function variants). |
72 | | |
73 | | /// Only used by the X11SkiaSalGraphicsImpl backend |
74 | 0 | virtual void UpdateX11GeometryProvider() {} |
75 | | |
76 | 0 | virtual void DeInit() {} |
77 | | |
78 | | virtual OUString getRenderBackendName() const = 0; |
79 | | |
80 | | virtual void setClipRegion( const vcl::Region& ) = 0; |
81 | | |
82 | | virtual sal_uInt16 GetBitCount() const = 0; |
83 | | |
84 | | virtual tools::Long GetGraphicsWidth() const = 0; |
85 | | |
86 | | virtual void ResetClipRegion() = 0; |
87 | | |
88 | | virtual void SetLineColor() = 0; |
89 | | |
90 | | virtual void SetLineColor( Color nColor ) = 0; |
91 | | |
92 | | virtual void SetFillColor() = 0; |
93 | | |
94 | | virtual void SetFillColor( Color nColor ) = 0; |
95 | | |
96 | | virtual void SetXORMode( bool bSet, bool bInvertOnly ) = 0; |
97 | | |
98 | | virtual void SetROPLineColor( SalROPColor nROPColor ) = 0; |
99 | | |
100 | | virtual void SetROPFillColor( SalROPColor nROPColor ) = 0; |
101 | | |
102 | | virtual void drawPixel( tools::Long nX, tools::Long nY ) = 0; |
103 | | virtual void drawPixel( tools::Long nX, tools::Long nY, Color nColor ) = 0; |
104 | | |
105 | | virtual void drawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) = 0; |
106 | | |
107 | | virtual void drawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) = 0; |
108 | | |
109 | | virtual void drawPolyLine( sal_uInt32 nPoints, const Point* pPtAry ) = 0; |
110 | | |
111 | | virtual void drawPolygon( sal_uInt32 nPoints, const Point* pPtAry ) = 0; |
112 | | |
113 | | virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, const Point** pPtAry ) = 0; |
114 | | |
115 | | virtual void drawPolyPolygon( |
116 | | const basegfx::B2DHomMatrix& rObjectToDevice, |
117 | | const basegfx::B2DPolyPolygon&, |
118 | | double fTransparency) = 0; |
119 | | |
120 | | virtual bool drawPolyLine( |
121 | | const basegfx::B2DHomMatrix& rObjectToDevice, |
122 | | const basegfx::B2DPolygon&, |
123 | | double fTransparency, |
124 | | double fLineWidth, |
125 | | const std::vector< double >* pStroke, |
126 | | basegfx::B2DLineJoin, |
127 | | css::drawing::LineCap, |
128 | | double fMiterMinimumAngle, |
129 | | bool bPixelSnapHairline) = 0; |
130 | | |
131 | | virtual bool drawPolyLineBezier( |
132 | | sal_uInt32 nPoints, |
133 | | const Point* pPtAry, |
134 | | const PolyFlags* pFlgAry ) = 0; |
135 | | |
136 | | virtual bool drawPolygonBezier( |
137 | | sal_uInt32 nPoints, |
138 | | const Point* pPtAry, |
139 | | const PolyFlags* pFlgAry ) = 0; |
140 | | |
141 | | virtual bool drawPolyPolygonBezier( |
142 | | sal_uInt32 nPoly, |
143 | | const sal_uInt32* pPoints, |
144 | | const Point* const* pPtAry, |
145 | | const PolyFlags* const* pFlgAry ) = 0; |
146 | | |
147 | | virtual void copyArea( |
148 | | tools::Long nDestX, tools::Long nDestY, |
149 | | tools::Long nSrcX, tools::Long nSrcY, |
150 | | tools::Long nSrcWidth, tools::Long nSrcHeight, |
151 | | bool bWindowInvalidate ) = 0; |
152 | | |
153 | | virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) = 0; |
154 | | |
155 | | virtual void drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) = 0; |
156 | | |
157 | | virtual void drawMask( |
158 | | const SalTwoRect& rPosAry, |
159 | | const SalBitmap& rSalBitmap, |
160 | | Color nMaskColor ) = 0; |
161 | | |
162 | | virtual std::shared_ptr<SalBitmap> getBitmap( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, bool bWithoutAlpha ) = 0; |
163 | | |
164 | | virtual Color getPixel( tools::Long nX, tools::Long nY ) = 0; |
165 | | |
166 | | virtual void invert( |
167 | | tools::Long nX, tools::Long nY, |
168 | | tools::Long nWidth, tools::Long nHeight, |
169 | | SalInvert nFlags) = 0; |
170 | | |
171 | | virtual void invert( sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags ) = 0; |
172 | | |
173 | | /// Only implemented by the macOS Quartz backend and the MS-Windows GDI backend. |
174 | | virtual bool drawEPS( |
175 | | tools::Long /*nX*/, tools::Long /*nY*/, |
176 | | tools::Long /*nWidth*/, tools::Long /*nHeight*/, |
177 | | void* /*pPtr*/, |
178 | 1.18k | sal_uInt32 /*nSize*/ ) { return false; } |
179 | | |
180 | | virtual void drawAlphaBitmap( |
181 | | const SalTwoRect&, |
182 | | const SalBitmap& rSourceBitmap ) = 0; |
183 | | |
184 | | virtual bool drawTransformedBitmap( |
185 | | const basegfx::B2DPoint& rNull, |
186 | | const basegfx::B2DPoint& rX, |
187 | | const basegfx::B2DPoint& rY, |
188 | | const SalBitmap& rSourceBitmap, |
189 | | double fAlpha) = 0; |
190 | | |
191 | | /// Only currently true for SkiaSalGraphicsImpl |
192 | 0 | virtual bool hasFastDrawTransformedBitmap() const { return false; } |
193 | | |
194 | | virtual bool drawAlphaRect( |
195 | | tools::Long nX, tools::Long nY, |
196 | | tools::Long nWidth, tools::Long nHeight, |
197 | | sal_uInt8 nTransparency ) = 0; |
198 | | |
199 | | virtual bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) = 0; |
200 | | virtual bool implDrawGradient(basegfx::B2DPolyPolygon const & rPolyPolygon, SalGradient const & rGradient) = 0; |
201 | | |
202 | | virtual bool supportsOperation(OutDevSupportType eType) const = 0; |
203 | | |
204 | 0 | virtual bool DrawBitmapWallpaper(tools::Long /*nStartX*/, tools::Long /*nStartY*/, tools::Long /*nRight*/, tools::Long /*nBottom*/, tools::Long /*nBmpWidth*/, tools::Long /*nBmpHeight*/, const SalBitmap& /*rBmp*/) { return false; } |
205 | | }; |
206 | | |
207 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |