Branch libreoffice-5-0-4
[LibreOffice.git] / vcl / win / source / gdi / gdiimpl.hxx
blob8e7d7f8b427ca13b5ea5df3f74a3512fec7d1ed1
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 WinSalGraphicsImpl(WinSalGraphics& rParent);
54 virtual ~WinSalGraphicsImpl();
56 virtual void Init() SAL_OVERRIDE;
58 virtual void freeResources() SAL_OVERRIDE;
60 virtual bool setClipRegion( const vcl::Region& ) SAL_OVERRIDE;
62 // get the depth of the device
63 virtual sal_uInt16 GetBitCount() const SAL_OVERRIDE;
65 // get the width of the device
66 virtual long GetGraphicsWidth() const SAL_OVERRIDE;
68 // set the clip region to empty
69 virtual void ResetClipRegion() SAL_OVERRIDE;
71 // set the line color to transparent (= don't draw lines)
73 virtual void SetLineColor() SAL_OVERRIDE;
75 // set the line color to a specific color
76 virtual void SetLineColor( SalColor nSalColor ) SAL_OVERRIDE;
78 // set the fill color to transparent (= don't fill)
79 virtual void SetFillColor() SAL_OVERRIDE;
81 // set the fill color to a specific color, shapes will be
82 // filled accordingly
83 virtual void SetFillColor( SalColor nSalColor ) SAL_OVERRIDE;
85 // enable/disable XOR drawing
86 virtual void SetXORMode( bool bSet, bool bInvertOnly ) SAL_OVERRIDE;
88 // set line color for raster operations
89 virtual void SetROPLineColor( SalROPColor nROPColor ) SAL_OVERRIDE;
91 // set fill color for raster operations
92 virtual void SetROPFillColor( SalROPColor nROPColor ) SAL_OVERRIDE;
94 // draw --> LineColor and FillColor and RasterOp and ClipRegion
95 virtual void drawPixel( long nX, long nY ) SAL_OVERRIDE;
96 virtual void drawPixel( long nX, long nY, SalColor nSalColor ) SAL_OVERRIDE;
98 virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ) SAL_OVERRIDE;
100 virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) SAL_OVERRIDE;
102 virtual void drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) SAL_OVERRIDE;
104 virtual void drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) SAL_OVERRIDE;
106 virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ) SAL_OVERRIDE;
107 virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ) SAL_OVERRIDE;
109 virtual bool drawPolyLine(
110 const ::basegfx::B2DPolygon&,
111 double fTransparency,
112 const ::basegfx::B2DVector& rLineWidths,
113 basegfx::B2DLineJoin,
114 com::sun::star::drawing::LineCap) SAL_OVERRIDE;
116 virtual bool drawPolyLineBezier(
117 sal_uInt32 nPoints,
118 const SalPoint* pPtAry,
119 const sal_uInt8* pFlgAry ) SAL_OVERRIDE;
121 virtual bool drawPolygonBezier(
122 sal_uInt32 nPoints,
123 const SalPoint* pPtAry,
124 const sal_uInt8* pFlgAry ) SAL_OVERRIDE;
126 virtual bool drawPolyPolygonBezier(
127 sal_uInt32 nPoly,
128 const sal_uInt32* pPoints,
129 const SalPoint* const* pPtAry,
130 const sal_uInt8* const* pFlgAry ) SAL_OVERRIDE;
132 // CopyArea --> No RasterOp, but ClipRegion
133 virtual void copyArea(
134 long nDestX, long nDestY,
135 long nSrcX, long nSrcY,
136 long nSrcWidth, long nSrcHeight,
137 sal_uInt16 nFlags ) SAL_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 ) SAL_OVERRIDE;
143 virtual void drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) SAL_OVERRIDE;
145 virtual void drawBitmap(
146 const SalTwoRect& rPosAry,
147 const SalBitmap& rSalBitmap,
148 SalColor nTransparentColor ) SAL_OVERRIDE;
150 virtual void drawBitmap(
151 const SalTwoRect& rPosAry,
152 const SalBitmap& rSalBitmap,
153 const SalBitmap& rMaskBitmap ) SAL_OVERRIDE;
155 virtual void drawMask(
156 const SalTwoRect& rPosAry,
157 const SalBitmap& rSalBitmap,
158 SalColor nMaskColor ) SAL_OVERRIDE;
160 virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ) SAL_OVERRIDE;
162 virtual SalColor getPixel( long nX, long nY ) SAL_OVERRIDE;
164 // invert --> ClipRegion (only Windows or VirDevs)
165 virtual void invert(
166 long nX, long nY,
167 long nWidth, long nHeight,
168 SalInvert nFlags) SAL_OVERRIDE;
170 virtual void invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nFlags ) SAL_OVERRIDE;
172 virtual bool drawEPS(
173 long nX, long nY,
174 long nWidth, long nHeight,
175 void* pPtr,
176 sal_uLong nSize ) SAL_OVERRIDE;
178 virtual bool blendBitmap(
179 const SalTwoRect&,
180 const SalBitmap& rBitmap ) SAL_OVERRIDE;
182 virtual bool blendAlphaBitmap(
183 const SalTwoRect&,
184 const SalBitmap& rSrcBitmap,
185 const SalBitmap& rMaskBitmap,
186 const SalBitmap& rAlphaBitmap ) SAL_OVERRIDE;
188 /** Render bitmap with alpha channel
190 @param rSourceBitmap
191 Source bitmap to blit
193 @param rAlphaBitmap
194 Alpha channel to use for blitting
196 @return true, if the operation succeeded, and false
197 otherwise. In this case, clients should try to emulate alpha
198 compositing themselves
200 virtual bool drawAlphaBitmap(
201 const SalTwoRect&,
202 const SalBitmap& rSourceBitmap,
203 const SalBitmap& rAlphaBitmap ) SAL_OVERRIDE;
205 /** draw transformed bitmap (maybe with alpha) where Null, X, Y define the coordinate system */
206 virtual bool drawTransformedBitmap(
207 const basegfx::B2DPoint& rNull,
208 const basegfx::B2DPoint& rX,
209 const basegfx::B2DPoint& rY,
210 const SalBitmap& rSourceBitmap,
211 const SalBitmap* pAlphaBitmap) SAL_OVERRIDE;
213 /** Render solid rectangle with given transparency
215 @param nTransparency
216 Transparency value (0-255) to use. 0 blits and opaque, 255 a
217 fully transparent rectangle
219 virtual bool drawAlphaRect(
220 long nX, long nY,
221 long nWidth, long nHeight,
222 sal_uInt8 nTransparency ) SAL_OVERRIDE;
225 virtual bool drawGradient(const tools::PolyPolygon& rPolygon,
226 const Gradient& rGradient) SAL_OVERRIDE;
228 virtual bool TryRenderCachedNativeControl(ControlCacheKey& rControlCacheKey, int nX, int nY);
230 virtual bool RenderAndCacheNativeControl(OpenGLCompatibleDC& rWhite, OpenGLCompatibleDC& rBlack,
231 int nX, int nY , ControlCacheKey& aControlCacheKey);
234 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */