Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_VCL_INC_SALGDIIMPL_HXX
21 : #define INCLUDED_VCL_INC_SALGDIIMPL_HXX
22 :
23 : #include <vcl/dllapi.h>
24 :
25 : #include <rtl/ustring.hxx>
26 :
27 : #include <tools/solar.h>
28 :
29 : #include <vcl/salgtype.hxx>
30 : #include <vcl/region.hxx>
31 : #include <vcl/salnativewidgets.hxx>
32 :
33 : #include <com/sun/star/drawing/LineCap.hpp>
34 :
35 : class SalGraphics;
36 : class SalBitmap;
37 : class SalFrame;
38 : class Gradient;
39 : class SalVirtualDevice;
40 :
41 208 : class VCL_PLUGIN_PUBLIC SalGraphicsImpl
42 : {
43 : public:
44 :
45 : virtual ~SalGraphicsImpl();
46 :
47 : virtual void Init() = 0;
48 :
49 : virtual void freeResources() = 0;
50 :
51 : virtual bool setClipRegion( const vcl::Region& ) = 0;
52 : //
53 : // get the depth of the device
54 : virtual sal_uInt16 GetBitCount() const = 0;
55 :
56 : // get the width of the device
57 : virtual long GetGraphicsWidth() const = 0;
58 :
59 : // set the clip region to empty
60 : virtual void ResetClipRegion() = 0;
61 :
62 : // set the line color to transparent (= don't draw lines)
63 :
64 : virtual void SetLineColor() = 0;
65 :
66 : // set the line color to a specific color
67 : virtual void SetLineColor( SalColor nSalColor ) = 0;
68 :
69 : // set the fill color to transparent (= don't fill)
70 : virtual void SetFillColor() = 0;
71 :
72 : // set the fill color to a specific color, shapes will be
73 : // filled accordingly
74 : virtual void SetFillColor( SalColor nSalColor ) = 0;
75 :
76 : // enable/disable XOR drawing
77 : virtual void SetXORMode( bool bSet, bool bInvertOnly ) = 0;
78 :
79 : // set line color for raster operations
80 : virtual void SetROPLineColor( SalROPColor nROPColor ) = 0;
81 :
82 : // set fill color for raster operations
83 : virtual void SetROPFillColor( SalROPColor nROPColor ) = 0;
84 :
85 : // draw --> LineColor and FillColor and RasterOp and ClipRegion
86 : virtual void drawPixel( long nX, long nY ) = 0;
87 : virtual void drawPixel( long nX, long nY, SalColor nSalColor ) = 0;
88 :
89 : virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ) = 0;
90 :
91 : virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) = 0;
92 :
93 : virtual void drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) = 0;
94 :
95 : virtual void drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) = 0;
96 :
97 : virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ) = 0;
98 : virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ) = 0;
99 :
100 : virtual bool drawPolyLine(
101 : const ::basegfx::B2DPolygon&,
102 : double fTransparency,
103 : const ::basegfx::B2DVector& rLineWidths,
104 : basegfx::B2DLineJoin,
105 : com::sun::star::drawing::LineCap) = 0;
106 :
107 : virtual bool drawPolyLineBezier(
108 : sal_uInt32 nPoints,
109 : const SalPoint* pPtAry,
110 : const sal_uInt8* pFlgAry ) = 0;
111 :
112 : virtual bool drawPolygonBezier(
113 : sal_uInt32 nPoints,
114 : const SalPoint* pPtAry,
115 : const sal_uInt8* pFlgAry ) = 0;
116 :
117 : virtual bool drawPolyPolygonBezier(
118 : sal_uInt32 nPoly,
119 : const sal_uInt32* pPoints,
120 : const SalPoint* const* pPtAry,
121 : const sal_uInt8* const* pFlgAry ) = 0;
122 :
123 : // CopyArea --> No RasterOp, but ClipRegion
124 : virtual void copyArea(
125 : long nDestX, long nDestY,
126 : long nSrcX, long nSrcY,
127 : long nSrcWidth, long nSrcHeight,
128 : sal_uInt16 nFlags ) = 0;
129 :
130 : // CopyBits and DrawBitmap --> RasterOp and ClipRegion
131 : // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics
132 : virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) = 0;
133 :
134 : virtual void drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) = 0;
135 :
136 : virtual void drawBitmap(
137 : const SalTwoRect& rPosAry,
138 : const SalBitmap& rSalBitmap,
139 : SalColor nTransparentColor ) = 0;
140 :
141 : virtual void drawBitmap(
142 : const SalTwoRect& rPosAry,
143 : const SalBitmap& rSalBitmap,
144 : const SalBitmap& rMaskBitmap ) = 0;
145 :
146 : virtual void drawMask(
147 : const SalTwoRect& rPosAry,
148 : const SalBitmap& rSalBitmap,
149 : SalColor nMaskColor ) = 0;
150 :
151 : virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ) = 0;
152 :
153 : virtual SalColor getPixel( long nX, long nY ) = 0;
154 :
155 : // invert --> ClipRegion (only Windows or VirDevs)
156 : virtual void invert(
157 : long nX, long nY,
158 : long nWidth, long nHeight,
159 : SalInvert nFlags) = 0;
160 :
161 : virtual void invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nFlags ) = 0;
162 :
163 : virtual bool drawEPS(
164 : long nX, long nY,
165 : long nWidth, long nHeight,
166 : void* pPtr,
167 : sal_uLong nSize ) = 0;
168 :
169 : virtual bool blendBitmap(
170 : const SalTwoRect&,
171 : const SalBitmap& rBitmap ) = 0;
172 :
173 : virtual bool blendAlphaBitmap(
174 : const SalTwoRect&,
175 : const SalBitmap& rSrcBitmap,
176 : const SalBitmap& rMaskBitmap,
177 : const SalBitmap& rAlphaBitmap ) = 0;
178 :
179 : /** Render bitmap with alpha channel
180 :
181 : @param rSourceBitmap
182 : Source bitmap to blit
183 :
184 : @param rAlphaBitmap
185 : Alpha channel to use for blitting
186 :
187 : @return true, if the operation succeeded, and false
188 : otherwise. In this case, clients should try to emulate alpha
189 : compositing themselves
190 : */
191 : virtual bool drawAlphaBitmap(
192 : const SalTwoRect&,
193 : const SalBitmap& rSourceBitmap,
194 : const SalBitmap& rAlphaBitmap ) = 0;
195 :
196 : /** draw transformed bitmap (maybe with alpha) where Null, X, Y define the coordinate system */
197 : virtual bool drawTransformedBitmap(
198 : const basegfx::B2DPoint& rNull,
199 : const basegfx::B2DPoint& rX,
200 : const basegfx::B2DPoint& rY,
201 : const SalBitmap& rSourceBitmap,
202 : const SalBitmap* pAlphaBitmap) = 0;
203 :
204 : /** Render solid rectangle with given transparency
205 :
206 : @param nTransparency
207 : Transparency value (0-255) to use. 0 blits and opaque, 255 a
208 : fully transparent rectangle
209 : */
210 : virtual bool drawAlphaRect(
211 : long nX, long nY,
212 : long nWidth, long nHeight,
213 : sal_uInt8 nTransparency ) = 0;
214 :
215 : virtual bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) = 0;
216 :
217 : virtual void beginPaint() = 0;
218 : virtual void endPaint() = 0;
219 : };
220 :
221 : #endif
222 :
223 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|