nss: upgrade to release 3.73
[LibreOffice.git] / vcl / unx / generic / gdi / gdiimpl.hxx
blobbb3092b253564ad0e98290fe4340979cff3cc81d
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_GENERIC_GDI_GDIIMPL_HXX
21 #define INCLUDED_VCL_GENERIC_GDI_GDIIMPL_HXX
23 #include <X11/Xlib.h>
25 #include <unx/x11/x11gdiimpl.h>
27 #include <salgdiimpl.hxx>
29 #include <basegfx/polygon/b2dtrapezoid.hxx>
30 #include <basegfx/polygon/b2dpolygontriangulator.hxx>
31 #include <ControlCacheKey.hxx>
33 /* From <X11/Intrinsic.h> */
34 typedef unsigned long Pixel;
36 class SalGraphics;
37 class SalBitmap;
38 class SalPolyLine;
39 class X11SalGraphics;
40 class Gradient;
42 class X11SalGraphicsImpl : public SalGraphicsImpl, public X11GraphicsImpl
44 private:
45 X11SalGraphics& mrParent;
47 Color mnBrushColor;
48 GC mpBrushGC; // Brush attributes
49 Pixel mnBrushPixel;
51 bool mbPenGC : 1; // is Pen GC valid
52 bool mbBrushGC : 1; // is Brush GC valid
53 bool mbCopyGC : 1; // is Copy GC valid
54 bool mbInvertGC : 1; // is Invert GC valid
55 bool mbInvert50GC : 1; // is Invert50 GC valid
56 bool mbStippleGC : 1; // is Stipple GC valid
57 bool mbTrackingGC : 1; // is Tracking GC valid
58 bool mbDitherBrush : 1; // is solid or tile
60 bool mbXORMode : 1; // is ROP XOR Mode set
62 GC mpPenGC; // Pen attributes
63 Color mnPenColor;
64 Pixel mnPenPixel;
67 GC mpMonoGC;
68 GC mpCopyGC;
69 GC mpMaskGC;
70 GC mpInvertGC;
71 GC mpInvert50GC;
72 GC mpStippleGC;
73 GC mpTrackingGC;
75 GC CreateGC( Drawable hDrawable,
76 unsigned long nMask = GCGraphicsExposures );
78 GC SelectBrush();
79 GC SelectPen();
80 inline GC GetCopyGC();
81 inline GC GetStippleGC();
82 GC GetTrackingGC();
83 GC GetInvertGC();
84 GC GetInvert50GC();
86 void DrawLines( sal_uInt32 nPoints,
87 const SalPolyLine &rPoints,
88 GC pGC,
89 bool bClose
92 XID GetXRenderPicture();
93 bool drawFilledTrapezoids( const basegfx::B2DTrapezoid*, int nTrapCount, double fTransparency );
94 bool drawFilledTriangles(
95 const basegfx::B2DHomMatrix& rObjectToDevice,
96 const basegfx::triangulator::B2DTriangleVector& rTriangles,
97 double fTransparency);
99 tools::Long GetGraphicsHeight() const;
101 void drawMaskedBitmap( const SalTwoRect& rPosAry,
102 const SalBitmap& rSalBitmap,
103 const SalBitmap& rTransparentBitmap );
105 void drawPolyLine( sal_uInt32 nPoints, const Point* pPtAry, bool bClose );
107 public:
109 explicit X11SalGraphicsImpl(X11SalGraphics& rParent);
111 virtual void freeResources() override;
113 virtual ~X11SalGraphicsImpl() override;
115 virtual OUString getRenderBackendName() const override { return "gen"; }
117 virtual bool setClipRegion( const vcl::Region& ) override;
119 // get the depth of the device
120 virtual sal_uInt16 GetBitCount() const override;
122 // get the width of the device
123 virtual tools::Long GetGraphicsWidth() const override;
125 // set the clip region to empty
126 virtual void ResetClipRegion() override;
128 // set the line color to transparent (= don't draw lines)
130 virtual void SetLineColor() override;
132 // set the line color to a specific color
133 virtual void SetLineColor( Color nColor ) override;
135 // set the fill color to transparent (= don't fill)
136 virtual void SetFillColor() override;
138 // set the fill color to a specific color, shapes will be
139 // filled accordingly
140 virtual void SetFillColor( Color nColor ) override;
142 // enable/disable XOR drawing
143 virtual void SetXORMode( bool bSet, bool bInvertOnly ) override;
145 // set line color for raster operations
146 virtual void SetROPLineColor( SalROPColor nROPColor ) override;
148 // set fill color for raster operations
149 virtual void SetROPFillColor( SalROPColor nROPColor ) override;
151 // draw --> LineColor and FillColor and RasterOp and ClipRegion
152 virtual void drawPixel( tools::Long nX, tools::Long nY ) override;
153 virtual void drawPixel( tools::Long nX, tools::Long nY, Color nColor ) override;
155 virtual void drawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) override;
157 virtual void drawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override;
159 virtual void drawPolyLine( sal_uInt32 nPoints, const Point* pPtAry ) override;
161 virtual void drawPolygon( sal_uInt32 nPoints, const Point* pPtAry ) override;
163 virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, const Point** pPtAry ) override;
165 virtual bool drawPolyPolygon(
166 const basegfx::B2DHomMatrix& rObjectToDevice,
167 const basegfx::B2DPolyPolygon&,
168 double fTransparency) override;
170 virtual bool drawPolyLine(
171 const basegfx::B2DHomMatrix& rObjectToDevice,
172 const basegfx::B2DPolygon&,
173 double fTransparency,
174 double fLineWidth,
175 const std::vector< double >* pStroke, // MM01
176 basegfx::B2DLineJoin,
177 css::drawing::LineCap,
178 double fMiterMinimumAngle,
179 bool bPixelSnapHairline) override;
181 virtual bool drawPolyLineBezier(
182 sal_uInt32 nPoints,
183 const Point* pPtAry,
184 const PolyFlags* pFlgAry ) override;
186 virtual bool drawPolygonBezier(
187 sal_uInt32 nPoints,
188 const Point* pPtAry,
189 const PolyFlags* pFlgAry ) override;
191 virtual bool drawPolyPolygonBezier(
192 sal_uInt32 nPoly,
193 const sal_uInt32* pPoints,
194 const Point* const* pPtAry,
195 const PolyFlags* const* pFlgAry ) override;
197 // CopyArea --> No RasterOp, but ClipRegion
198 virtual void copyArea(
199 tools::Long nDestX, tools::Long nDestY,
200 tools::Long nSrcX, tools::Long nSrcY,
201 tools::Long nSrcWidth, tools::Long nSrcHeight,
202 bool bWindowInvalidate ) override;
204 // CopyBits and DrawBitmap --> RasterOp and ClipRegion
205 // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics
206 virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) override;
208 virtual void drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) override;
210 virtual void drawBitmap(
211 const SalTwoRect& rPosAry,
212 const SalBitmap& rSalBitmap,
213 const SalBitmap& rMaskBitmap ) override;
215 virtual void drawMask(
216 const SalTwoRect& rPosAry,
217 const SalBitmap& rSalBitmap,
218 Color nMaskColor ) override;
220 virtual std::shared_ptr<SalBitmap> getBitmap( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override;
222 virtual Color getPixel( tools::Long nX, tools::Long nY ) override;
224 // invert --> ClipRegion (only Windows or VirDevs)
225 virtual void invert(
226 tools::Long nX, tools::Long nY,
227 tools::Long nWidth, tools::Long nHeight,
228 SalInvert nFlags) override;
230 virtual void invert( sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags ) override;
232 virtual bool drawEPS(
233 tools::Long nX, tools::Long nY,
234 tools::Long nWidth, tools::Long nHeight,
235 void* pPtr,
236 sal_uInt32 nSize ) override;
238 /** Blend bitmap with color channels */
239 virtual bool blendBitmap(
240 const SalTwoRect&,
241 const SalBitmap& rBitmap ) override;
243 /** Render bitmap by blending using the mask and alpha channel */
244 virtual bool blendAlphaBitmap(
245 const SalTwoRect&,
246 const SalBitmap& rSrcBitmap,
247 const SalBitmap& rMaskBitmap,
248 const SalBitmap& rAlphaBitmap ) override;
250 /** Render bitmap with alpha channel
252 @param rSourceBitmap
253 Source bitmap to blit
255 @param rAlphaBitmap
256 Alpha channel to use for blitting
258 @return true, if the operation succeeded, and false
259 otherwise. In this case, clients should try to emulate alpha
260 compositing themselves
262 virtual bool drawAlphaBitmap(
263 const SalTwoRect&,
264 const SalBitmap& rSourceBitmap,
265 const SalBitmap& rAlphaBitmap ) override;
267 /** draw transformed bitmap (maybe with alpha) where Null, X, Y define the coordinate system */
268 virtual bool drawTransformedBitmap(
269 const basegfx::B2DPoint& rNull,
270 const basegfx::B2DPoint& rX,
271 const basegfx::B2DPoint& rY,
272 const SalBitmap& rSourceBitmap,
273 const SalBitmap* pAlphaBitmap) override;
275 /** Render solid rectangle with given transparency
277 @param nTransparency
278 Transparency value (0-255) to use. 0 blits and opaque, 255 a
279 fully transparent rectangle
281 virtual bool drawAlphaRect(
282 tools::Long nX, tools::Long nY,
283 tools::Long nWidth, tools::Long nHeight,
284 sal_uInt8 nTransparency ) override;
286 virtual bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) override;
287 virtual bool implDrawGradient(basegfx::B2DPolyPolygon const & rPolyPolygon, SalGradient const & rGradient) override;
289 virtual bool supportsOperation(OutDevSupportType eType) const override;
291 public:
292 void Init() override;
295 #endif
297 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */