Version 7.1.7.1, tag libreoffice-7.1.7.1
[LibreOffice.git] / vcl / win / gdi / gdiimpl.hxx
blobb7e87ce97116a378d232afebc6c0b594236acc84
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 #ifndef INCLUDED_VCL_WIN_GDI_GDIIMPL_HXX
21 #define INCLUDED_VCL_WIN_GDI_GDIIMPL_HXX
23 #include <salgdiimpl.hxx>
24 #include <tools/long.hxx>
25 #include <win/salgdi.h>
26 #include <win/wingdiimpl.hxx>
28 #include <vcl/gradient.hxx>
30 #include <svsys.h>
31 #include <ControlCacheKey.hxx>
33 class WinSalGraphics;
35 class WinSalGraphicsImpl : public SalGraphicsImpl, public WinSalGraphicsImplBase
37 private:
39 WinSalGraphics& mrParent;
40 bool mbXORMode : 1; // _every_ output with RasterOp XOR
41 bool mbPen : 1; // is Pen (FALSE == NULL_PEN)
42 HPEN mhPen; // Pen
43 bool mbStockPen : 1; // is Pen a stockpen
44 bool mbBrush : 1; // is Brush (FALSE == NULL_BRUSH)
45 bool mbStockBrush : 1; // is Brush a stockbrush
46 HBRUSH mhBrush; // Brush
47 COLORREF mnPenColor; // PenColor
48 COLORREF mnBrushColor; // BrushColor
50 // remember RGB values for SetLineColor/SetFillColor
51 Color maLineColor;
52 Color maFillColor;
54 bool TryDrawBitmapGDIPlus(const SalTwoRect& rTR, const SalBitmap& rSrcBitmap);
55 void DrawPixelImpl(tools::Long nX, tools::Long nY, COLORREF crColor);
57 HPEN SearchStockPen(COLORREF nPenColor);
58 HPEN MakePen(Color nColor);
59 void ResetPen(HPEN hNewPen);
61 HBRUSH SearchStockBrush(COLORREF nBrushColor);
62 HBRUSH MakeBrush(Color nColor);
63 void ResetBrush(HBRUSH hNewBrush);
64 public:
66 explicit WinSalGraphicsImpl(WinSalGraphics& rParent);
68 virtual ~WinSalGraphicsImpl() override;
70 virtual void Init() override;
72 virtual void freeResources() override;
74 virtual OUString getRenderBackendName() const override { return "gdi"; }
76 virtual bool setClipRegion( const vcl::Region& ) override;
78 // get the depth of the device
79 virtual sal_uInt16 GetBitCount() const override;
81 // get the width of the device
82 virtual tools::Long GetGraphicsWidth() const override;
84 // set the clip region to empty
85 virtual void ResetClipRegion() override;
87 // set the line color to transparent (= don't draw lines)
89 virtual void SetLineColor() override;
91 // set the line color to a specific color
92 virtual void SetLineColor( Color nColor ) override;
94 // set the fill color to transparent (= don't fill)
95 virtual void SetFillColor() override;
97 // set the fill color to a specific color, shapes will be
98 // filled accordingly
99 virtual void SetFillColor( Color nColor ) override;
101 // enable/disable XOR drawing
102 virtual void SetXORMode( bool bSet, bool bInvertOnly ) override;
104 // set line color for raster operations
105 virtual void SetROPLineColor( SalROPColor nROPColor ) override;
107 // set fill color for raster operations
108 virtual void SetROPFillColor( SalROPColor nROPColor ) override;
110 // draw --> LineColor and FillColor and RasterOp and ClipRegion
111 virtual void drawPixel( tools::Long nX, tools::Long nY ) override;
112 virtual void drawPixel( tools::Long nX, tools::Long nY, Color nColor ) override;
114 virtual void drawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) override;
116 virtual void drawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override;
118 virtual void drawPolyLine( sal_uInt32 nPoints, const Point* pPtAry ) override;
120 virtual void drawPolygon( sal_uInt32 nPoints, const Point* pPtAry ) override;
122 virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, const Point** pPtAry ) override;
124 virtual bool drawPolyPolygon(
125 const basegfx::B2DHomMatrix& rObjectToDevice,
126 const basegfx::B2DPolyPolygon&,
127 double fTransparency) override;
129 virtual bool drawPolyLine(
130 const basegfx::B2DHomMatrix& rObjectToDevice,
131 const basegfx::B2DPolygon&,
132 double fTransparency,
133 double fLineWidth,
134 const std::vector< double >* pStroke, // MM01
135 basegfx::B2DLineJoin,
136 css::drawing::LineCap,
137 double fMiterMinimumAngle,
138 bool bPixelSnapHairline) override;
140 virtual bool drawPolyLineBezier(
141 sal_uInt32 nPoints,
142 const Point* pPtAry,
143 const PolyFlags* pFlgAry ) override;
145 virtual bool drawPolygonBezier(
146 sal_uInt32 nPoints,
147 const Point* pPtAry,
148 const PolyFlags* pFlgAry ) override;
150 virtual bool drawPolyPolygonBezier(
151 sal_uInt32 nPoly,
152 const sal_uInt32* pPoints,
153 const Point* const* pPtAry,
154 const PolyFlags* const* pFlgAry ) override;
156 // CopyArea --> No RasterOp, but ClipRegion
157 virtual void copyArea(
158 tools::Long nDestX, tools::Long nDestY,
159 tools::Long nSrcX, tools::Long nSrcY,
160 tools::Long nSrcWidth, tools::Long nSrcHeight, bool bWindowInvalidate ) override;
162 // CopyBits and DrawBitmap --> RasterOp and ClipRegion
163 // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics
164 virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) override;
166 virtual void drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) override;
168 virtual void drawBitmap(
169 const SalTwoRect& rPosAry,
170 const SalBitmap& rSalBitmap,
171 const SalBitmap& rMaskBitmap ) override;
173 virtual void drawMask(
174 const SalTwoRect& rPosAry,
175 const SalBitmap& rSalBitmap,
176 Color nMaskColor ) override;
178 virtual std::shared_ptr<SalBitmap> getBitmap( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override;
180 virtual Color getPixel( tools::Long nX, tools::Long nY ) override;
182 // invert --> ClipRegion (only Windows or VirDevs)
183 virtual void invert(
184 tools::Long nX, tools::Long nY,
185 tools::Long nWidth, tools::Long nHeight,
186 SalInvert nFlags) override;
188 virtual void invert( sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags ) override;
190 virtual bool drawEPS(
191 tools::Long nX, tools::Long nY,
192 tools::Long nWidth, tools::Long nHeight,
193 void* pPtr,
194 sal_uInt32 nSize ) override;
196 virtual bool blendBitmap(
197 const SalTwoRect&,
198 const SalBitmap& rBitmap ) override;
200 virtual bool blendAlphaBitmap(
201 const SalTwoRect&,
202 const SalBitmap& rSrcBitmap,
203 const SalBitmap& rMaskBitmap,
204 const SalBitmap& rAlphaBitmap ) override;
206 /** Render bitmap with alpha channel
208 @param rSourceBitmap
209 Source bitmap to blit
211 @param rAlphaBitmap
212 Alpha channel to use for blitting
214 @return true, if the operation succeeded, and false
215 otherwise. In this case, clients should try to emulate alpha
216 compositing themselves
218 virtual bool drawAlphaBitmap(
219 const SalTwoRect&,
220 const SalBitmap& rSourceBitmap,
221 const SalBitmap& rAlphaBitmap ) override;
223 /** draw transformed bitmap (maybe with alpha) where Null, X, Y define the coordinate system */
224 virtual bool drawTransformedBitmap(
225 const basegfx::B2DPoint& rNull,
226 const basegfx::B2DPoint& rX,
227 const basegfx::B2DPoint& rY,
228 const SalBitmap& rSourceBitmap,
229 const SalBitmap* pAlphaBitmap) override;
231 /** Render solid rectangle with given transparency
233 @param nTransparency
234 Transparency value (0-255) to use. 0 blits and opaque, 255 a
235 fully transparent rectangle
237 virtual bool drawAlphaRect(
238 tools::Long nX, tools::Long nY,
239 tools::Long nWidth, tools::Long nHeight,
240 sal_uInt8 nTransparency ) override;
243 virtual bool drawGradient(const tools::PolyPolygon& rPolygon,
244 const Gradient& rGradient) override;
245 virtual bool implDrawGradient(basegfx::B2DPolyPolygon const & rPolyPolygon,
246 SalGradient const & rGradient) override;
248 virtual bool supportsOperation(OutDevSupportType eType) const override;
251 #endif // INCLUDED_VCL_WIN_GDI_GDIIMPL_HXX
253 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */