update dev300-m58
[ooovba.git] / canvas / source / null / null_canvashelper.hxx
blob0f3ffd02f8e235be218f23e33e4144e4baff23c2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: null_canvashelper.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _NULLCANVAS_CANVASHELPER_HXX_
32 #define _NULLCANVAS_CANVASHELPER_HXX_
34 #include <com/sun/star/rendering/XCanvas.hpp>
35 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
37 #include <basegfx/vector/b2isize.hxx>
38 #include <basegfx/vector/b2dsize.hxx>
40 #include <boost/utility.hpp>
43 namespace nullcanvas
45 class SpriteCanvas;
47 /** Helper class for basic canvas functionality. Also offers
48 optional backbuffer painting, when providing it with a second
49 HDC to render into.
51 class CanvasHelper : private ::boost::noncopyable
53 public:
54 CanvasHelper();
56 /// Release all references
57 void disposing();
59 /** Initialize canvas helper
61 This method late-initializes the canvas helper, providing
62 it with the necessary device and size. Note that the
63 CanvasHelper does <em>not</em> take ownership of the
64 passed rDevice reference, nor does it perform any
65 reference counting. Thus, to prevent the reference counted
66 SpriteCanvas object from deletion, the user of this class
67 is responsible for holding ref-counted references itself!
69 @param rSizePixel
70 Size of the output surface in pixel.
72 @param rDevice
73 Reference device this canvas is associated with
76 void init( const ::basegfx::B2ISize& rSizePixel,
77 SpriteCanvas& rDevice,
78 bool bHasAlpha );
81 // CanvasHelper functionality
82 // ==========================
84 // XCanvas (only providing, not implementing the
85 // interface. Also note subtle method parameter differences)
86 void clear();
87 void drawPoint( const ::com::sun::star::rendering::XCanvas* pCanvas,
88 const ::com::sun::star::geometry::RealPoint2D& aPoint,
89 const ::com::sun::star::rendering::ViewState& viewState,
90 const ::com::sun::star::rendering::RenderState& renderState );
91 void drawLine( const ::com::sun::star::rendering::XCanvas* pCanvas,
92 const ::com::sun::star::geometry::RealPoint2D& aStartPoint,
93 const ::com::sun::star::geometry::RealPoint2D& aEndPoint,
94 const ::com::sun::star::rendering::ViewState& viewState,
95 const ::com::sun::star::rendering::RenderState& renderState );
96 void drawBezier( const ::com::sun::star::rendering::XCanvas* pCanvas,
97 const ::com::sun::star::geometry::RealBezierSegment2D& aBezierSegment,
98 const ::com::sun::star::geometry::RealPoint2D& aEndPoint,
99 const ::com::sun::star::rendering::ViewState& viewState,
100 const ::com::sun::star::rendering::RenderState& renderState );
101 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
102 drawPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas,
103 const ::com::sun::star::uno::Reference<
104 ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
105 const ::com::sun::star::rendering::ViewState& viewState,
106 const ::com::sun::star::rendering::RenderState& renderState );
107 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
108 strokePolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas,
109 const ::com::sun::star::uno::Reference<
110 ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
111 const ::com::sun::star::rendering::ViewState& viewState,
112 const ::com::sun::star::rendering::RenderState& renderState,
113 const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
114 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
115 strokeTexturedPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas,
116 const ::com::sun::star::uno::Reference<
117 ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
118 const ::com::sun::star::rendering::ViewState& viewState,
119 const ::com::sun::star::rendering::RenderState& renderState,
120 const ::com::sun::star::uno::Sequence<
121 ::com::sun::star::rendering::Texture >& textures,
122 const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
123 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
124 strokeTextureMappedPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas,
125 const ::com::sun::star::uno::Reference<
126 ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
127 const ::com::sun::star::rendering::ViewState& viewState,
128 const ::com::sun::star::rendering::RenderState& renderState,
129 const ::com::sun::star::uno::Sequence<
130 ::com::sun::star::rendering::Texture >& textures,
131 const ::com::sun::star::uno::Reference<
132 ::com::sun::star::geometry::XMapping2D >& xMapping,
133 const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
134 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >
135 queryStrokeShapes( const ::com::sun::star::rendering::XCanvas* pCanvas,
136 const ::com::sun::star::uno::Reference<
137 ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
138 const ::com::sun::star::rendering::ViewState& viewState,
139 const ::com::sun::star::rendering::RenderState& renderState,
140 const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
141 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
142 fillPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas,
143 const ::com::sun::star::uno::Reference<
144 ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
145 const ::com::sun::star::rendering::ViewState& viewState,
146 const ::com::sun::star::rendering::RenderState& renderState );
147 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
148 fillTexturedPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas,
149 const ::com::sun::star::uno::Reference<
150 ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
151 const ::com::sun::star::rendering::ViewState& viewState,
152 const ::com::sun::star::rendering::RenderState& renderState,
153 const ::com::sun::star::uno::Sequence<
154 ::com::sun::star::rendering::Texture >& textures );
155 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
156 fillTextureMappedPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas,
157 const ::com::sun::star::uno::Reference<
158 ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
159 const ::com::sun::star::rendering::ViewState& viewState,
160 const ::com::sun::star::rendering::RenderState& renderState,
161 const ::com::sun::star::uno::Sequence<
162 ::com::sun::star::rendering::Texture >& textures,
163 const ::com::sun::star::uno::Reference<
164 ::com::sun::star::geometry::XMapping2D >& xMapping );
166 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvasFont > SAL_CALL
167 createFont( const ::com::sun::star::rendering::XCanvas* pCanvas,
168 const ::com::sun::star::rendering::FontRequest& fontRequest,
169 const ::com::sun::star::uno::Sequence<
170 ::com::sun::star::beans::PropertyValue >& extraFontProperties,
171 const ::com::sun::star::geometry::Matrix2D& fontMatrix );
173 ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::FontInfo >
174 queryAvailableFonts( const ::com::sun::star::rendering::XCanvas* pCanvas,
175 const ::com::sun::star::rendering::FontInfo& aFilter,
176 const ::com::sun::star::uno::Sequence<
177 ::com::sun::star::beans::PropertyValue >& aFontProperties );
179 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
180 drawText( const ::com::sun::star::rendering::XCanvas* pCanvas,
181 const ::com::sun::star::rendering::StringContext& text,
182 const ::com::sun::star::uno::Reference<
183 ::com::sun::star::rendering::XCanvasFont >& xFont,
184 const ::com::sun::star::rendering::ViewState& viewState,
185 const ::com::sun::star::rendering::RenderState& renderState,
186 sal_Int8 textDirection );
188 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
189 drawTextLayout( const ::com::sun::star::rendering::XCanvas* pCanvas,
190 const ::com::sun::star::uno::Reference<
191 ::com::sun::star::rendering::XTextLayout >& layoutetText,
192 const ::com::sun::star::rendering::ViewState& viewState,
193 const ::com::sun::star::rendering::RenderState& renderState );
195 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
196 drawBitmap( const ::com::sun::star::rendering::XCanvas* pCanvas,
197 const ::com::sun::star::uno::Reference<
198 ::com::sun::star::rendering::XBitmap >& xBitmap,
199 const ::com::sun::star::rendering::ViewState& viewState,
200 const ::com::sun::star::rendering::RenderState& renderState );
201 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
202 drawBitmapModulated( const ::com::sun::star::rendering::XCanvas* pCanvas,
203 const ::com::sun::star::uno::Reference<
204 ::com::sun::star::rendering::XBitmap >& xBitmap,
205 const ::com::sun::star::rendering::ViewState& viewState,
206 const ::com::sun::star::rendering::RenderState& renderState );
207 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >
208 getDevice();
210 // BitmapCanvasHelper functionality
211 // ================================
213 void copyRect( const ::com::sun::star::rendering::XCanvas* pCanvas,
214 const ::com::sun::star::uno::Reference<
215 ::com::sun::star::rendering::XBitmapCanvas >& sourceCanvas,
216 const ::com::sun::star::geometry::RealRectangle2D& sourceRect,
217 const ::com::sun::star::rendering::ViewState& sourceViewState,
218 const ::com::sun::star::rendering::RenderState& sourceRenderState,
219 const ::com::sun::star::geometry::RealRectangle2D& destRect,
220 const ::com::sun::star::rendering::ViewState& destViewState,
221 const ::com::sun::star::rendering::RenderState& destRenderState );
223 ::com::sun::star::geometry::IntegerSize2D getSize();
225 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap >
226 getScaledBitmap( const ::com::sun::star::geometry::RealSize2D& newSize,
227 sal_Bool beFast );
229 ::com::sun::star::uno::Sequence< sal_Int8 >
230 getData( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
231 const ::com::sun::star::geometry::IntegerRectangle2D& rect );
233 void setData( const ::com::sun::star::uno::Sequence< sal_Int8 >& data,
234 const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
235 const ::com::sun::star::geometry::IntegerRectangle2D& rect );
237 void setPixel( const ::com::sun::star::uno::Sequence< sal_Int8 >& color,
238 const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
239 const ::com::sun::star::geometry::IntegerPoint2D& pos );
241 ::com::sun::star::uno::Sequence< sal_Int8 >
242 getPixel( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
243 const ::com::sun::star::geometry::IntegerPoint2D& pos );
245 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapPalette > getPalette();
247 ::com::sun::star::rendering::IntegerBitmapLayout getMemoryLayout();
249 // Flush drawing queue to screen
250 void flush() const;
252 /** Called from XCanvas base classes, to notify that content
253 is _about_ to change
255 void modifying() {}
257 bool hasAlpha() const;
259 protected:
260 /** Phyical output device
262 Deliberately not a refcounted reference, because of
263 potential circular references for spritecanvas.
265 SpriteCanvas* mpDevice;
267 private:
268 /// Current size of the output surface in pixel
269 ::basegfx::B2ISize maSize;
271 /// When true, content is able to represent alpha
272 bool mbHaveAlpha;
276 #endif /* _NULLCANVAS_CANVASHELPER_HXX_ */