1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_INC_SALGDIIMPL_HXX
21 #define INCLUDED_VCL_INC_SALGDIIMPL_HXX
23 #include <vcl/dllapi.h>
25 #include <rtl/ustring.hxx>
27 #include <tools/solar.h>
29 #include <vcl/salgtype.hxx>
30 #include <vcl/region.hxx>
31 #include <vcl/salnativewidgets.hxx>
33 #include <com/sun/star/drawing/LineCap.hpp>
40 class SalVirtualDevice
;
42 class VCL_PLUGIN_PUBLIC SalGraphicsImpl
46 virtual ~SalGraphicsImpl();
48 virtual void Init() = 0;
50 virtual void DeInit() {}
52 virtual void freeResources() = 0;
54 virtual bool setClipRegion( const vcl::Region
& ) = 0;
56 // get the depth of the device
57 virtual sal_uInt16
GetBitCount() const = 0;
59 // get the width of the device
60 virtual long GetGraphicsWidth() const = 0;
62 // set the clip region to empty
63 virtual void ResetClipRegion() = 0;
65 // set the line color to transparent (= don't draw lines)
67 virtual void SetLineColor() = 0;
69 // set the line color to a specific color
70 virtual void SetLineColor( SalColor nSalColor
) = 0;
72 // set the fill color to transparent (= don't fill)
73 virtual void SetFillColor() = 0;
75 // set the fill color to a specific color, shapes will be
77 virtual void SetFillColor( SalColor nSalColor
) = 0;
79 // enable/disable XOR drawing
80 virtual void SetXORMode( bool bSet
, bool bInvertOnly
) = 0;
82 // set line color for raster operations
83 virtual void SetROPLineColor( SalROPColor nROPColor
) = 0;
85 // set fill color for raster operations
86 virtual void SetROPFillColor( SalROPColor nROPColor
) = 0;
88 // draw --> LineColor and FillColor and RasterOp and ClipRegion
89 virtual void drawPixel( long nX
, long nY
) = 0;
90 virtual void drawPixel( long nX
, long nY
, SalColor nSalColor
) = 0;
92 virtual void drawLine( long nX1
, long nY1
, long nX2
, long nY2
) = 0;
94 virtual void drawRect( long nX
, long nY
, long nWidth
, long nHeight
) = 0;
96 virtual void drawPolyLine( sal_uInt32 nPoints
, const SalPoint
* pPtAry
) = 0;
98 virtual void drawPolygon( sal_uInt32 nPoints
, const SalPoint
* pPtAry
) = 0;
100 virtual void drawPolyPolygon( sal_uInt32 nPoly
, const sal_uInt32
* pPoints
, PCONSTSALPOINT
* pPtAry
) = 0;
101 virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon
&, double fTransparency
) = 0;
103 virtual bool drawPolyLine(
104 const ::basegfx::B2DPolygon
&,
105 double fTransparency
,
106 const ::basegfx::B2DVector
& rLineWidths
,
107 basegfx::B2DLineJoin
,
108 com::sun::star::drawing::LineCap
) = 0;
110 virtual bool drawPolyLineBezier(
112 const SalPoint
* pPtAry
,
113 const sal_uInt8
* pFlgAry
) = 0;
115 virtual bool drawPolygonBezier(
117 const SalPoint
* pPtAry
,
118 const sal_uInt8
* pFlgAry
) = 0;
120 virtual bool drawPolyPolygonBezier(
122 const sal_uInt32
* pPoints
,
123 const SalPoint
* const* pPtAry
,
124 const sal_uInt8
* const* pFlgAry
) = 0;
126 // CopyArea --> No RasterOp, but ClipRegion
127 virtual void copyArea(
128 long nDestX
, long nDestY
,
129 long nSrcX
, long nSrcY
,
130 long nSrcWidth
, long nSrcHeight
,
131 sal_uInt16 nFlags
) = 0;
133 // CopyBits and DrawBitmap --> RasterOp and ClipRegion
134 // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics
135 virtual void copyBits( const SalTwoRect
& rPosAry
, SalGraphics
* pSrcGraphics
) = 0;
137 virtual void drawBitmap( const SalTwoRect
& rPosAry
, const SalBitmap
& rSalBitmap
) = 0;
139 virtual void drawBitmap(
140 const SalTwoRect
& rPosAry
,
141 const SalBitmap
& rSalBitmap
,
142 SalColor nTransparentColor
) = 0;
144 virtual void drawBitmap(
145 const SalTwoRect
& rPosAry
,
146 const SalBitmap
& rSalBitmap
,
147 const SalBitmap
& rMaskBitmap
) = 0;
149 virtual void drawMask(
150 const SalTwoRect
& rPosAry
,
151 const SalBitmap
& rSalBitmap
,
152 SalColor nMaskColor
) = 0;
154 virtual SalBitmap
* getBitmap( long nX
, long nY
, long nWidth
, long nHeight
) = 0;
156 virtual SalColor
getPixel( long nX
, long nY
) = 0;
158 // invert --> ClipRegion (only Windows or VirDevs)
161 long nWidth
, long nHeight
,
162 SalInvert nFlags
) = 0;
164 virtual void invert( sal_uInt32 nPoints
, const SalPoint
* pPtAry
, SalInvert nFlags
) = 0;
166 virtual bool drawEPS(
168 long nWidth
, long nHeight
,
170 sal_uLong nSize
) = 0;
172 virtual bool blendBitmap(
174 const SalBitmap
& rBitmap
) = 0;
176 virtual bool blendAlphaBitmap(
178 const SalBitmap
& rSrcBitmap
,
179 const SalBitmap
& rMaskBitmap
,
180 const SalBitmap
& rAlphaBitmap
) = 0;
182 /** Render bitmap with alpha channel
185 Source bitmap to blit
188 Alpha channel to use for blitting
190 @return true, if the operation succeeded, and false
191 otherwise. In this case, clients should try to emulate alpha
192 compositing themselves
194 virtual bool drawAlphaBitmap(
196 const SalBitmap
& rSourceBitmap
,
197 const SalBitmap
& rAlphaBitmap
) = 0;
199 /** draw transformed bitmap (maybe with alpha) where Null, X, Y define the coordinate system */
200 virtual bool drawTransformedBitmap(
201 const basegfx::B2DPoint
& rNull
,
202 const basegfx::B2DPoint
& rX
,
203 const basegfx::B2DPoint
& rY
,
204 const SalBitmap
& rSourceBitmap
,
205 const SalBitmap
* pAlphaBitmap
) = 0;
207 /** Render solid rectangle with given transparency
210 Transparency value (0-255) to use. 0 blits and opaque, 255 a
211 fully transparent rectangle
213 virtual bool drawAlphaRect(
215 long nWidth
, long nHeight
,
216 sal_uInt8 nTransparency
) = 0;
218 virtual bool drawGradient(const tools::PolyPolygon
& rPolygon
, const Gradient
& rGradient
) = 0;
220 virtual OpenGLContext
*beginPaint() { return NULL
; }
225 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */