build fix
[LibreOffice.git] / vcl / win / gdi / gdiimpl.hxx
blob56588d07099c8c2fef92e7b4af8f4ad10d84e9e5
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 #include "salgdiimpl.hxx"
21 #include "win/salgdi.h"
23 #include <vcl/gradient.hxx>
25 #include "svsys.h"
27 class WinSalGraphics;
29 class WinSalGraphicsImpl : public SalGraphicsImpl
31 private:
33 WinSalGraphics& mrParent;
34 bool mbXORMode : 1; // _every_ output with RasterOp XOR
35 bool mbPen : 1; // is Pen (FALSE == NULL_PEN)
36 HPEN mhPen; // Pen
37 bool mbStockPen : 1; // is Pen a stockpen
38 bool mbBrush : 1; // is Brush (FALSE == NULL_BRUSH)
39 bool mbStockBrush : 1; // is Brush a stcokbrush
40 HBRUSH mhBrush; // Brush
41 COLORREF mnPenColor; // PenColor
42 COLORREF mnBrushColor; // BrushColor
44 // remember RGB values for SetLineColor/SetFillColor
45 SalColor maLineColor;
46 SalColor maFillColor;
48 bool tryDrawBitmapGdiPlus(const SalTwoRect& rTR, const SalBitmap& rSrcBitmap);
50 public:
52 explicit WinSalGraphicsImpl(WinSalGraphics& rParent);
54 virtual ~WinSalGraphicsImpl() override;
56 virtual void Init() override;
58 virtual void freeResources() override;
60 virtual bool setClipRegion( const vcl::Region& ) override;
62 // get the depth of the device
63 virtual sal_uInt16 GetBitCount() const override;
65 // get the width of the device
66 virtual long GetGraphicsWidth() const override;
68 // set the clip region to empty
69 virtual void ResetClipRegion() override;
71 // set the line color to transparent (= don't draw lines)
73 virtual void SetLineColor() override;
75 // set the line color to a specific color
76 virtual void SetLineColor( SalColor nSalColor ) override;
78 // set the fill color to transparent (= don't fill)
79 virtual void SetFillColor() override;
81 // set the fill color to a specific color, shapes will be
82 // filled accordingly
83 virtual void SetFillColor( SalColor nSalColor ) override;
85 // enable/disable XOR drawing
86 virtual void SetXORMode( bool bSet) override;
88 // set line color for raster operations
89 virtual void SetROPLineColor( SalROPColor nROPColor ) override;
91 // set fill color for raster operations
92 virtual void SetROPFillColor( SalROPColor nROPColor ) override;
94 // draw --> LineColor and FillColor and RasterOp and ClipRegion
95 virtual void drawPixel( long nX, long nY ) override;
96 virtual void drawPixel( long nX, long nY, SalColor nSalColor ) override;
98 virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ) override;
100 virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) override;
102 virtual void drawPolyLine( sal_uInt32 nPoints, SalPoint* pPtAry ) override;
104 virtual void drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
106 virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ) override;
107 virtual bool drawPolyPolygon( const basegfx::B2DPolyPolygon&, double fTransparency ) override;
109 virtual bool drawPolyLine(
110 const basegfx::B2DPolygon&,
111 double fTransparency,
112 const basegfx::B2DVector& rLineWidths,
113 basegfx::B2DLineJoin,
114 css::drawing::LineCap,
115 double fMiterMinimumAngle) override;
117 virtual bool drawPolyLineBezier(
118 sal_uInt32 nPoints,
119 const SalPoint* pPtAry,
120 const PolyFlags* pFlgAry ) override;
122 virtual bool drawPolygonBezier(
123 sal_uInt32 nPoints,
124 const SalPoint* pPtAry,
125 const PolyFlags* pFlgAry ) override;
127 virtual bool drawPolyPolygonBezier(
128 sal_uInt32 nPoly,
129 const sal_uInt32* pPoints,
130 const SalPoint* const* pPtAry,
131 const PolyFlags* const* pFlgAry ) override;
133 // CopyArea --> No RasterOp, but ClipRegion
134 virtual void copyArea(
135 long nDestX, long nDestY,
136 long nSrcX, long nSrcY,
137 long nSrcWidth, long nSrcHeight, bool bWindowInvalidate ) override;
139 // CopyBits and DrawBitmap --> RasterOp and ClipRegion
140 // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics
141 virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) override;
143 virtual void drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) override;
145 virtual void drawBitmap(
146 const SalTwoRect& rPosAry,
147 const SalBitmap& rSalBitmap,
148 const SalBitmap& rMaskBitmap ) override;
150 virtual void drawMask(
151 const SalTwoRect& rPosAry,
152 const SalBitmap& rSalBitmap,
153 SalColor nMaskColor ) override;
155 virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ) override;
157 virtual SalColor getPixel( long nX, long nY ) override;
159 // invert --> ClipRegion (only Windows or VirDevs)
160 virtual void invert(
161 long nX, long nY,
162 long nWidth, long nHeight,
163 SalInvert nFlags) override;
165 virtual void invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nFlags ) override;
167 virtual bool drawEPS(
168 long nX, long nY,
169 long nWidth, long nHeight,
170 void* pPtr,
171 sal_uLong nSize ) override;
173 virtual bool blendBitmap(
174 const SalTwoRect&,
175 const SalBitmap& rBitmap ) override;
177 virtual bool blendAlphaBitmap(
178 const SalTwoRect&,
179 const SalBitmap& rSrcBitmap,
180 const SalBitmap& rMaskBitmap,
181 const SalBitmap& rAlphaBitmap ) override;
183 /** Render bitmap with alpha channel
185 @param rSourceBitmap
186 Source bitmap to blit
188 @param rAlphaBitmap
189 Alpha channel to use for blitting
191 @return true, if the operation succeeded, and false
192 otherwise. In this case, clients should try to emulate alpha
193 compositing themselves
195 virtual bool drawAlphaBitmap(
196 const SalTwoRect&,
197 const SalBitmap& rSourceBitmap,
198 const SalBitmap& rAlphaBitmap ) override;
200 /** draw transformed bitmap (maybe with alpha) where Null, X, Y define the coordinate system */
201 virtual bool drawTransformedBitmap(
202 const basegfx::B2DPoint& rNull,
203 const basegfx::B2DPoint& rX,
204 const basegfx::B2DPoint& rY,
205 const SalBitmap& rSourceBitmap,
206 const SalBitmap* pAlphaBitmap) override;
208 /** Render solid rectangle with given transparency
210 @param nTransparency
211 Transparency value (0-255) to use. 0 blits and opaque, 255 a
212 fully transparent rectangle
214 virtual bool drawAlphaRect(
215 long nX, long nY,
216 long nWidth, long nHeight,
217 sal_uInt8 nTransparency ) override;
220 virtual bool drawGradient(const tools::PolyPolygon& rPolygon,
221 const Gradient& rGradient) override;
223 virtual bool TryRenderCachedNativeControl(ControlCacheKey& rControlCacheKey, int nX, int nY);
225 virtual bool RenderAndCacheNativeControl(OpenGLCompatibleDC& rWhite, OpenGLCompatibleDC& rBlack,
226 int nX, int nY , ControlCacheKey& aControlCacheKey);
229 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */