1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _CAIROCANVAS_CANVASHELPER_HXX_
29*cdf0e10cSrcweir #define _CAIROCANVAS_CANVASHELPER_HXX_
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <com/sun/star/rendering/XCanvas.hpp>
32*cdf0e10cSrcweir #include <com/sun/star/rendering/XIntegerBitmap.hpp>
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir #include <basegfx/vector/b2isize.hxx>
35*cdf0e10cSrcweir #include <basegfx/vector/b2dsize.hxx>
36*cdf0e10cSrcweir #include <com/sun/star/rendering/XLinePolyPolygon2D.hpp>
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir #include <boost/utility.hpp>
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir #include "cairo_cairo.hxx"
41*cdf0e10cSrcweir #include "cairo_surfaceprovider.hxx"
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir class VirtualDevice;
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir namespace basegfx {
46*cdf0e10cSrcweir     class B2DPolyPolygon;
47*cdf0e10cSrcweir }
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir namespace cairocanvas
50*cdf0e10cSrcweir {
51*cdf0e10cSrcweir     class SpriteCanvas;
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir 	enum Operation {
54*cdf0e10cSrcweir 	    Stroke,
55*cdf0e10cSrcweir 	    Fill,
56*cdf0e10cSrcweir 	    Clip
57*cdf0e10cSrcweir 	};
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir     class CanvasHelper : private ::boost::noncopyable
60*cdf0e10cSrcweir     {
61*cdf0e10cSrcweir     public:
62*cdf0e10cSrcweir         CanvasHelper();
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir         /// Release all references
65*cdf0e10cSrcweir         void disposing();
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir 		/** Initialize canvas helper
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir         	This method late-initializes the canvas helper, providing
70*cdf0e10cSrcweir         	it with the necessary device and size. Note that the
71*cdf0e10cSrcweir         	CanvasHelper does <em>not</em> take ownership of the
72*cdf0e10cSrcweir         	passed rDevice reference, nor does it perform any
73*cdf0e10cSrcweir         	reference counting. Thus, to prevent the reference counted
74*cdf0e10cSrcweir         	SpriteCanvas object from deletion, the user of this class
75*cdf0e10cSrcweir         	is responsible for holding ref-counted references itself!
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir             @param rSizePixel
78*cdf0e10cSrcweir             Size of the output surface in pixel.
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir         	@param rDevice
81*cdf0e10cSrcweir             Reference device this canvas is associated with
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir          */
84*cdf0e10cSrcweir         void init( const ::basegfx::B2ISize& rSizePixel,
85*cdf0e10cSrcweir                    SurfaceProvider&          rSurfaceProvider,
86*cdf0e10cSrcweir                    ::com::sun::star::rendering::XGraphicDevice* pDevice );
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir         void setSize( const ::basegfx::B2ISize& rSize );
89*cdf0e10cSrcweir         void setSurface( const ::cairo::SurfaceSharedPtr& pSurface, bool bHasAlpha );
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir         // CanvasHelper functionality
92*cdf0e10cSrcweir         // ==========================
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir         // XCanvas (only providing, not implementing the
95*cdf0e10cSrcweir         // interface. Also note subtle method parameter differences)
96*cdf0e10cSrcweir         void clear();
97*cdf0e10cSrcweir         void drawPoint( const ::com::sun::star::rendering::XCanvas* 	pCanvas,
98*cdf0e10cSrcweir                         const ::com::sun::star::geometry::RealPoint2D& 	aPoint,
99*cdf0e10cSrcweir                         const ::com::sun::star::rendering::ViewState& 	viewState,
100*cdf0e10cSrcweir                         const ::com::sun::star::rendering::RenderState& renderState );
101*cdf0e10cSrcweir         void drawLine( const ::com::sun::star::rendering::XCanvas* 		pCanvas,
102*cdf0e10cSrcweir                        const ::com::sun::star::geometry::RealPoint2D& 	aStartPoint,
103*cdf0e10cSrcweir                        const ::com::sun::star::geometry::RealPoint2D& 	aEndPoint,
104*cdf0e10cSrcweir                        const ::com::sun::star::rendering::ViewState& 	viewState,
105*cdf0e10cSrcweir                        const ::com::sun::star::rendering::RenderState& 	renderState	);
106*cdf0e10cSrcweir         void drawBezier( const ::com::sun::star::rendering::XCanvas* 			pCanvas,
107*cdf0e10cSrcweir                          const ::com::sun::star::geometry::RealBezierSegment2D&	aBezierSegment,
108*cdf0e10cSrcweir                          const ::com::sun::star::geometry::RealPoint2D& 		aEndPoint,
109*cdf0e10cSrcweir                          const ::com::sun::star::rendering::ViewState& 			viewState,
110*cdf0e10cSrcweir                          const ::com::sun::star::rendering::RenderState& 		renderState );
111*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
112*cdf0e10cSrcweir         	drawPolyPolygon( const ::com::sun::star::rendering::XCanvas* 			pCanvas,
113*cdf0e10cSrcweir                              const ::com::sun::star::uno::Reference<
114*cdf0e10cSrcweir                              		::com::sun::star::rendering::XPolyPolygon2D >&	xPolyPolygon,
115*cdf0e10cSrcweir                              const ::com::sun::star::rendering::ViewState& 			viewState,
116*cdf0e10cSrcweir                              const ::com::sun::star::rendering::RenderState& 		renderState );
117*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
118*cdf0e10cSrcweir         	strokePolyPolygon( const ::com::sun::star::rendering::XCanvas* 			pCanvas,
119*cdf0e10cSrcweir                                const ::com::sun::star::uno::Reference<
120*cdf0e10cSrcweir                                		::com::sun::star::rendering::XPolyPolygon2D >& 	xPolyPolygon,
121*cdf0e10cSrcweir                                const ::com::sun::star::rendering::ViewState& 		viewState,
122*cdf0e10cSrcweir                                const ::com::sun::star::rendering::RenderState& 		renderState,
123*cdf0e10cSrcweir                                const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
124*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
125*cdf0e10cSrcweir         	strokeTexturedPolyPolygon( const ::com::sun::star::rendering::XCanvas* 			pCanvas,
126*cdf0e10cSrcweir                                        const ::com::sun::star::uno::Reference<
127*cdf0e10cSrcweir                                        		::com::sun::star::rendering::XPolyPolygon2D >& 	xPolyPolygon,
128*cdf0e10cSrcweir                                        const ::com::sun::star::rendering::ViewState& 		viewState,
129*cdf0e10cSrcweir                                        const ::com::sun::star::rendering::RenderState& 		renderState,
130*cdf0e10cSrcweir                                        const ::com::sun::star::uno::Sequence<
131*cdf0e10cSrcweir                                        		::com::sun::star::rendering::Texture >& 		textures,
132*cdf0e10cSrcweir                                        const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
133*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
134*cdf0e10cSrcweir         	strokeTextureMappedPolyPolygon( const ::com::sun::star::rendering::XCanvas* 			pCanvas,
135*cdf0e10cSrcweir                                             const ::com::sun::star::uno::Reference<
136*cdf0e10cSrcweir                                             		::com::sun::star::rendering::XPolyPolygon2D >& 	xPolyPolygon,
137*cdf0e10cSrcweir                                             const ::com::sun::star::rendering::ViewState& 			viewState,
138*cdf0e10cSrcweir                                             const ::com::sun::star::rendering::RenderState& 		renderState,
139*cdf0e10cSrcweir                                             const ::com::sun::star::uno::Sequence<
140*cdf0e10cSrcweir                                             		::com::sun::star::rendering::Texture >& 		textures,
141*cdf0e10cSrcweir                                             const ::com::sun::star::uno::Reference<
142*cdf0e10cSrcweir                                             		::com::sun::star::geometry::XMapping2D >& 		xMapping,
143*cdf0e10cSrcweir                                             const ::com::sun::star::rendering::StrokeAttributes& 	strokeAttributes );
144*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >
145*cdf0e10cSrcweir         	queryStrokeShapes( const ::com::sun::star::rendering::XCanvas* 			pCanvas,
146*cdf0e10cSrcweir                                const ::com::sun::star::uno::Reference<
147*cdf0e10cSrcweir                                		::com::sun::star::rendering::XPolyPolygon2D >& 	xPolyPolygon,
148*cdf0e10cSrcweir                                const ::com::sun::star::rendering::ViewState& 		viewState,
149*cdf0e10cSrcweir                                const ::com::sun::star::rendering::RenderState& 		renderState,
150*cdf0e10cSrcweir                                const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
151*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
152*cdf0e10cSrcweir         	fillPolyPolygon( const ::com::sun::star::rendering::XCanvas* 			pCanvas,
153*cdf0e10cSrcweir                              const ::com::sun::star::uno::Reference<
154*cdf0e10cSrcweir                              		::com::sun::star::rendering::XPolyPolygon2D >& 	xPolyPolygon,
155*cdf0e10cSrcweir                              const ::com::sun::star::rendering::ViewState& 			viewState,
156*cdf0e10cSrcweir                              const ::com::sun::star::rendering::RenderState& 		renderState );
157*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
158*cdf0e10cSrcweir         	fillTexturedPolyPolygon( const ::com::sun::star::rendering::XCanvas* 			pCanvas,
159*cdf0e10cSrcweir                                      const ::com::sun::star::uno::Reference<
160*cdf0e10cSrcweir                                      		::com::sun::star::rendering::XPolyPolygon2D >& 	xPolyPolygon,
161*cdf0e10cSrcweir                                      const ::com::sun::star::rendering::ViewState& 			viewState,
162*cdf0e10cSrcweir                                      const ::com::sun::star::rendering::RenderState& 		renderState,
163*cdf0e10cSrcweir                                      const ::com::sun::star::uno::Sequence<
164*cdf0e10cSrcweir                                      		::com::sun::star::rendering::Texture >& 		textures );
165*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
166*cdf0e10cSrcweir         	fillTextureMappedPolyPolygon( const ::com::sun::star::rendering::XCanvas* 			pCanvas,
167*cdf0e10cSrcweir                                           const ::com::sun::star::uno::Reference<
168*cdf0e10cSrcweir                                           		::com::sun::star::rendering::XPolyPolygon2D >& 	xPolyPolygon,
169*cdf0e10cSrcweir                                           const ::com::sun::star::rendering::ViewState& 		viewState,
170*cdf0e10cSrcweir                                           const ::com::sun::star::rendering::RenderState& 		renderState,
171*cdf0e10cSrcweir                                           const ::com::sun::star::uno::Sequence<
172*cdf0e10cSrcweir                                           		::com::sun::star::rendering::Texture >& 		textures,
173*cdf0e10cSrcweir                                           const ::com::sun::star::uno::Reference<
174*cdf0e10cSrcweir                                           		::com::sun::star::geometry::XMapping2D >& 		xMapping );
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvasFont > SAL_CALL
177*cdf0e10cSrcweir         	createFont( const ::com::sun::star::rendering::XCanvas* 			pCanvas,
178*cdf0e10cSrcweir                         const ::com::sun::star::rendering::FontRequest& 		fontRequest,
179*cdf0e10cSrcweir                         const ::com::sun::star::uno::Sequence<
180*cdf0e10cSrcweir                         		::com::sun::star::beans::PropertyValue >& 		extraFontProperties,
181*cdf0e10cSrcweir                         const ::com::sun::star::geometry::Matrix2D& 			fontMatrix );
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::FontInfo >
184*cdf0e10cSrcweir         	queryAvailableFonts( const ::com::sun::star::rendering::XCanvas* 		pCanvas,
185*cdf0e10cSrcweir                                  const ::com::sun::star::rendering::FontInfo& 		aFilter,
186*cdf0e10cSrcweir                                  const ::com::sun::star::uno::Sequence<
187*cdf0e10cSrcweir                                  		::com::sun::star::beans::PropertyValue >& 	aFontProperties );
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
190*cdf0e10cSrcweir         	drawText( const ::com::sun::star::rendering::XCanvas* 			pCanvas,
191*cdf0e10cSrcweir                       const ::com::sun::star::rendering::StringContext& 	text,
192*cdf0e10cSrcweir                       const ::com::sun::star::uno::Reference<
193*cdf0e10cSrcweir                       		::com::sun::star::rendering::XCanvasFont >& 	xFont,
194*cdf0e10cSrcweir                       const ::com::sun::star::rendering::ViewState& 		viewState,
195*cdf0e10cSrcweir                       const ::com::sun::star::rendering::RenderState& 		renderState,
196*cdf0e10cSrcweir                       sal_Int8 												textDirection );
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
199*cdf0e10cSrcweir         	drawTextLayout( const ::com::sun::star::rendering::XCanvas* 	pCanvas,
200*cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference<
201*cdf0e10cSrcweir                             	::com::sun::star::rendering::XTextLayout >& layoutetText,
202*cdf0e10cSrcweir                             const ::com::sun::star::rendering::ViewState& 	viewState,
203*cdf0e10cSrcweir                             const ::com::sun::star::rendering::RenderState& renderState );
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
206*cdf0e10cSrcweir         	drawBitmap( const ::com::sun::star::rendering::XCanvas* 	pCanvas,
207*cdf0e10cSrcweir                         const ::com::sun::star::uno::Reference<
208*cdf0e10cSrcweir                         		::com::sun::star::rendering::XBitmap >& xBitmap,
209*cdf0e10cSrcweir                         const ::com::sun::star::rendering::ViewState& 	viewState,
210*cdf0e10cSrcweir                         const ::com::sun::star::rendering::RenderState& renderState );
211*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
212*cdf0e10cSrcweir         	drawBitmapModulated( const ::com::sun::star::rendering::XCanvas* 		pCanvas,
213*cdf0e10cSrcweir                                  const ::com::sun::star::uno::Reference<
214*cdf0e10cSrcweir                                  		::com::sun::star::rendering::XBitmap >&		xBitmap,
215*cdf0e10cSrcweir                                  const ::com::sun::star::rendering::ViewState& 		viewState,
216*cdf0e10cSrcweir                                  const ::com::sun::star::rendering::RenderState& 	renderState );
217*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >
218*cdf0e10cSrcweir         	getDevice();
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir         // BitmapCanvasHelper functionality
221*cdf0e10cSrcweir         // ================================
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir         void copyRect( const ::com::sun::star::rendering::XCanvas* 			pCanvas,
224*cdf0e10cSrcweir                        const ::com::sun::star::uno::Reference<
225*cdf0e10cSrcweir                        		::com::sun::star::rendering::XBitmapCanvas >& 	sourceCanvas,
226*cdf0e10cSrcweir                        const ::com::sun::star::geometry::RealRectangle2D& 	sourceRect,
227*cdf0e10cSrcweir                        const ::com::sun::star::rendering::ViewState& 		sourceViewState,
228*cdf0e10cSrcweir                        const ::com::sun::star::rendering::RenderState& 		sourceRenderState,
229*cdf0e10cSrcweir                        const ::com::sun::star::geometry::RealRectangle2D& 	destRect,
230*cdf0e10cSrcweir                        const ::com::sun::star::rendering::ViewState& 		destViewState,
231*cdf0e10cSrcweir                        const ::com::sun::star::rendering::RenderState& 		destRenderState );
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir         ::com::sun::star::geometry::IntegerSize2D getSize();
234*cdf0e10cSrcweir 
235*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap >
236*cdf0e10cSrcweir         	getScaledBitmap( const ::com::sun::star::geometry::RealSize2D& 	newSize,
237*cdf0e10cSrcweir                              sal_Bool 										beFast );
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< sal_Int8 >
240*cdf0e10cSrcweir 	        getData( ::com::sun::star::rendering::IntegerBitmapLayout& 		bitmapLayout,
241*cdf0e10cSrcweir                      const ::com::sun::star::geometry::IntegerRectangle2D&  rect );
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir         void setData( const ::com::sun::star::uno::Sequence< sal_Int8 >&         data,
244*cdf0e10cSrcweir                       const ::com::sun::star::rendering::IntegerBitmapLayout&    bitmapLayout,
245*cdf0e10cSrcweir                       const ::com::sun::star::geometry::IntegerRectangle2D&      rect );
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir         void setPixel( const ::com::sun::star::uno::Sequence< sal_Int8 >&        color,
248*cdf0e10cSrcweir                        const ::com::sun::star::rendering::IntegerBitmapLayout&   bitmapLayout,
249*cdf0e10cSrcweir                        const ::com::sun::star::geometry::IntegerPoint2D&         pos );
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< sal_Int8 >
252*cdf0e10cSrcweir 	        getPixel( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
253*cdf0e10cSrcweir                       const ::com::sun::star::geometry::IntegerPoint2D& pos );
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapPalette > getPalette();
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir         ::com::sun::star::rendering::IntegerBitmapLayout getMemoryLayout();
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir         // Flush drawing queue to screen
260*cdf0e10cSrcweir         void					flush() const;
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir         /** Called from XCanvas base classes, to notify that content
263*cdf0e10cSrcweir             is _about_ to change
264*cdf0e10cSrcweir         */
265*cdf0e10cSrcweir         void modifying() {}
266*cdf0e10cSrcweir 
267*cdf0e10cSrcweir         bool hasAlpha() const;
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir         enum ColorType
270*cdf0e10cSrcweir         {
271*cdf0e10cSrcweir             LINE_COLOR, FILL_COLOR, TEXT_COLOR, IGNORE_COLOR
272*cdf0e10cSrcweir         };
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir 	void doPolyPolygonPath( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
275*cdf0e10cSrcweir 				  Operation aOperation,
276*cdf0e10cSrcweir                   bool bNoLineJoin = false,
277*cdf0e10cSrcweir 				  const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >* pTextures=NULL,
278*cdf0e10cSrcweir 				  ::cairo::Cairo* pCairo=NULL ) const;
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
281*cdf0e10cSrcweir 	implDrawBitmapSurface(
282*cdf0e10cSrcweir 			       const ::com::sun::star::rendering::XCanvas* 	    pCanvas,
283*cdf0e10cSrcweir                    const ::cairo::SurfaceSharedPtr&                 pSurface,
284*cdf0e10cSrcweir 			       const ::com::sun::star::rendering::ViewState& 	viewState,
285*cdf0e10cSrcweir 			       const ::com::sun::star::rendering::RenderState&  renderState,
286*cdf0e10cSrcweir 			       const ::com::sun::star::geometry::IntegerSize2D& rSize,
287*cdf0e10cSrcweir 			       bool bModulateColors,
288*cdf0e10cSrcweir 			       bool bHasAlpha );
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir         bool repaint( const ::cairo::SurfaceSharedPtr& pSurface,
291*cdf0e10cSrcweir 		      const ::com::sun::star::rendering::ViewState&	viewState,
292*cdf0e10cSrcweir 		      const ::com::sun::star::rendering::RenderState&	renderState );
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir     protected:
295*cdf0e10cSrcweir         /** Surface provider
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir             Deliberately not a refcounted reference, because of
298*cdf0e10cSrcweir             potential circular references for canvas. Provides us with
299*cdf0e10cSrcweir             our output surface and associated functionality.
300*cdf0e10cSrcweir          */
301*cdf0e10cSrcweir         SurfaceProvider* mpSurfaceProvider;
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir         /** Phyical output device
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir             Deliberately not a refcounted reference, because of
306*cdf0e10cSrcweir             potential circular references for spritecanvas.
307*cdf0e10cSrcweir          */
308*cdf0e10cSrcweir         ::com::sun::star::rendering::XGraphicDevice* mpDevice;
309*cdf0e10cSrcweir 
310*cdf0e10cSrcweir     private:
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir 		boost::shared_ptr<VirtualDevice> mpVirtualDevice;
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir 	void useStates( const ::com::sun::star::rendering::ViewState& viewState,
315*cdf0e10cSrcweir 			const ::com::sun::star::rendering::RenderState& renderState,
316*cdf0e10cSrcweir 			bool setColor );
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir         /// When true, content is able to represent alpha
319*cdf0e10cSrcweir         bool mbHaveAlpha;
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir 		CairoSharedPtr     mpCairo;
322*cdf0e10cSrcweir 		SurfaceSharedPtr   mpSurface;
323*cdf0e10cSrcweir         ::basegfx::B2ISize maSize;
324*cdf0e10cSrcweir     };
325*cdf0e10cSrcweir 
326*cdf0e10cSrcweir     /// also needed from SpriteHelper
327*cdf0e10cSrcweir     void doPolyPolygonImplementation( ::basegfx::B2DPolyPolygon aPolyPolygon,
328*cdf0e10cSrcweir                                       Operation aOperation,
329*cdf0e10cSrcweir                                       ::cairo::Cairo* pCairo,
330*cdf0e10cSrcweir                                       const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >* pTextures,
331*cdf0e10cSrcweir                                       const SurfaceProviderRef& pDevice,
332*cdf0e10cSrcweir                                       ::com::sun::star::rendering::FillRule eFillrule );
333*cdf0e10cSrcweir }
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir #endif /* _CAIROCANVAS_CANVASHELPER_HXX_ */
336