fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / canvas / rendering / bitmap.hxx
blob295057bd832b74beee8eefb24471ec0031c05520
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_CANVAS_BITMAP_HXX
21 #define INCLUDED_CANVAS_BITMAP_HXX
23 #include <com/sun/star/uno/Reference.hxx>
24 #include <com/sun/star/rendering/XCanvas.hpp>
25 #include <com/sun/star/rendering/IntegerBitmapLayout.hpp>
26 #include <com/sun/star/geometry/IntegerRectangle2D.hpp>
27 #include <com/sun/star/geometry/IntegerPoint2D.hpp>
28 #include <canvas/rendering/icolorbuffer.hxx>
29 #include <canvas/rendering/icachedprimitive.hxx>
30 #include <canvas/rendering/isurfaceproxymanager.hxx>
32 #include <boost/shared_ptr.hpp>
33 #include <boost/scoped_ptr.hpp>
34 #include <vector>
36 namespace basegfx
38 class B2IVector;
39 class B2DPoint;
40 class B2DHomMatrix;
41 class B2DPolyPolygon;
44 namespace canvas
46 class ImplBitmap;
48 /** Bitmap class, with XCanvas-like render interface.
50 This class provides a bitmap, that can be rendered into,
51 with an interface compatible to XCanvas. Furthermore, the
52 bitmaps held here can optionally be backed by (possibly
53 hw-accelerated) textures.
55 class Bitmap
57 public:
58 /** Create bitmap with given size
60 @param rSize
61 Size of the bitmap, in pixel
63 @param rMgr
64 SurfaceProxyManager, to use for HW acceleration
66 @param bWithAlpha
67 When true, the created bitmap will have an alpha channel,
68 false otherwise
70 Bitmap( const ::basegfx::B2IVector& rSize,
71 const ISurfaceProxyManagerSharedPtr& rMgr,
72 bool bWithAlpha );
73 ~Bitmap();
75 /// Query whether this bitmap contains alpha channel information
76 bool hasAlpha() const;
78 /// Query size of the bitmap in pixel
79 ::basegfx::B2IVector getSize() const;
81 ::com::sun::star::uno::Sequence< sal_Int8 > getData(
82 ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
83 const ::com::sun::star::geometry::IntegerRectangle2D& rect );
85 void setData(
86 const ::com::sun::star::uno::Sequence< sal_Int8 >& data,
87 const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
88 const ::com::sun::star::geometry::IntegerRectangle2D& rect );
90 void setPixel(
91 const ::com::sun::star::uno::Sequence< sal_Int8 >& color,
92 const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
93 const ::com::sun::star::geometry::IntegerPoint2D& pos );
95 ::com::sun::star::uno::Sequence< sal_Int8 > getPixel(
96 ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
97 const ::com::sun::star::geometry::IntegerPoint2D& pos );
99 /** Render the bitmap content to associated
100 SurfaceProxyManager's screen.
102 @param fAlpha
103 Overall alpha for content
105 @param rPos
106 Output position
108 @param rTransform
109 Output transformation (does not affect output position)
111 bool draw( double fAlpha,
112 const ::basegfx::B2DPoint& rPos,
113 const ::basegfx::B2DHomMatrix& rTransform );
115 /** Render the bitmap content to associated
116 SurfaceProxyManager's screen.
118 @param fAlpha
119 Overall alpha for content
121 @param rPos
122 Output position
124 @param rArea
125 Subset of the surface to render. Coordinate system are
126 surface area pixel, given area will be clipped to the
127 surface bounds.
129 @param rTransform
130 Output transformation (does not affect output position)
132 bool draw( double fAlpha,
133 const ::basegfx::B2DPoint& rPos,
134 const ::basegfx::B2DRange& rArea,
135 const ::basegfx::B2DHomMatrix& rTransform );
137 /** Render the bitmap content to associated
138 SurfaceProxyManager's screen.
140 @param fAlpha
141 Overall alpha for content
143 @param rPos
144 Output position
146 @param rClipPoly
147 Clip polygon for the surface. The clip polygon is also
148 subject to the output transformation.
150 @param rTransform
151 Output transformation (does not affect output position)
153 bool draw( double fAlpha,
154 const ::basegfx::B2DPoint& rPos,
155 const ::basegfx::B2DPolyPolygon& rClipPoly,
156 const ::basegfx::B2DHomMatrix& rTransform );
158 /** Clear whole bitmap with given color.
160 This method sets every single pixel of the bitmap to the
161 specified color value.
163 void clear( const ::com::sun::star::uno::Sequence< double >& color );
165 void fillB2DPolyPolygon(
166 const ::basegfx::B2DPolyPolygon& rPolyPolygon,
167 const ::com::sun::star::rendering::ViewState& viewState,
168 const ::com::sun::star::rendering::RenderState& renderState );
171 // High-level drawing operations (from the XCanvas interface)
172 // ==========================================================
174 /// See XCanvas interface
175 void drawPoint( const ::com::sun::star::geometry::RealPoint2D& aPoint,
176 const ::com::sun::star::rendering::ViewState& viewState,
177 const ::com::sun::star::rendering::RenderState& renderState );
178 /// See XCanvas interface
179 void drawLine( const ::com::sun::star::geometry::RealPoint2D& aStartPoint,
180 const ::com::sun::star::geometry::RealPoint2D& aEndPoint,
181 const ::com::sun::star::rendering::ViewState& viewState,
182 const ::com::sun::star::rendering::RenderState& renderState );
183 /// See XCanvas interface
184 void drawBezier( const ::com::sun::star::geometry::RealBezierSegment2D& aBezierSegment,
185 const ::com::sun::star::geometry::RealPoint2D& aEndPoint,
186 const ::com::sun::star::rendering::ViewState& viewState,
187 const ::com::sun::star::rendering::RenderState& renderState );
188 /// See XCanvas interface
189 ICachedPrimitiveSharedPtr drawPolyPolygon(
190 const ::com::sun::star::uno::Reference<
191 ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
192 const ::com::sun::star::rendering::ViewState& viewState,
193 const ::com::sun::star::rendering::RenderState& renderState );
195 /// See XCanvas interface
196 ICachedPrimitiveSharedPtr strokePolyPolygon(
197 const ::com::sun::star::uno::Reference<
198 ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
199 const ::com::sun::star::rendering::ViewState& viewState,
200 const ::com::sun::star::rendering::RenderState& renderState,
201 const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
202 /** See XCanvas interface
204 @param textureAnnotations
205 Vector of shared pointers to bitmap textures,
206 <em>corresponding</em> in indices to the textures
207 sequence. This is to decouple this interface from the
208 client's XBitmap-implementation class.
210 ICachedPrimitiveSharedPtr strokeTexturedPolyPolygon(
211 const ::com::sun::star::uno::Reference<
212 ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
213 const ::com::sun::star::rendering::ViewState& viewState,
214 const ::com::sun::star::rendering::RenderState& renderState,
215 const ::com::sun::star::uno::Sequence<
216 ::com::sun::star::rendering::Texture >& textures,
217 const ::std::vector< ::boost::shared_ptr<Bitmap> >& textureAnnotations,
218 const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
219 /** See XCanvas interface
221 @param textureAnnotations
222 Vector of shared pointers to bitmap textures,
223 <em>corresponding</em> in indices to the textures
224 sequence. This is to decouple this interface from the
225 client's XBitmap-implementation class.
227 ICachedPrimitiveSharedPtr strokeTextureMappedPolyPolygon(
228 const ::com::sun::star::uno::Reference<
229 ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
230 const ::com::sun::star::rendering::ViewState& viewState,
231 const ::com::sun::star::rendering::RenderState& renderState,
232 const ::com::sun::star::uno::Sequence<
233 ::com::sun::star::rendering::Texture >& textures,
234 const ::std::vector< ::boost::shared_ptr<Bitmap> >& textureAnnotations,
235 const ::com::sun::star::uno::Reference<
236 ::com::sun::star::geometry::XMapping2D >& xMapping,
237 const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
238 /// See XCanvas interface
239 ICachedPrimitiveSharedPtr fillPolyPolygon(
240 const ::com::sun::star::uno::Reference<
241 ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
242 const ::com::sun::star::rendering::ViewState& viewState,
243 const ::com::sun::star::rendering::RenderState& renderState );
244 /** See XCanvas interface
246 @param textureAnnotations
247 Vector of shared pointers to bitmap textures,
248 <em>corresponding</em> in indices to the textures
249 sequence. This is to decouple this interface from the
250 client's XBitmap-implementation class.
252 ICachedPrimitiveSharedPtr fillTexturedPolyPolygon(
253 const ::com::sun::star::uno::Reference<
254 ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
255 const ::com::sun::star::rendering::ViewState& viewState,
256 const ::com::sun::star::rendering::RenderState& renderState,
257 const ::com::sun::star::uno::Sequence<
258 ::com::sun::star::rendering::Texture >& textures,
259 const ::std::vector< ::boost::shared_ptr<Bitmap> >& textureAnnotations );
260 /** See XCanvas interface
262 @param textureAnnotations
263 Vector of shared pointers to bitmap textures,
264 <em>corresponding</em> in indices to the textures
265 sequence. This is to decouple this interface from the
266 client's XBitmap-implementation class.
268 ICachedPrimitiveSharedPtr fillTextureMappedPolyPolygon(
269 const ::com::sun::star::uno::Reference<
270 ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
271 const ::com::sun::star::rendering::ViewState& viewState,
272 const ::com::sun::star::rendering::RenderState& renderState,
273 const ::com::sun::star::uno::Sequence<
274 ::com::sun::star::rendering::Texture >& textures,
275 const ::std::vector< ::boost::shared_ptr<Bitmap> >& textureAnnotations,
276 const ::com::sun::star::uno::Reference<
277 ::com::sun::star::geometry::XMapping2D >& xMapping );
279 /// See XCanvas interface
280 ICachedPrimitiveSharedPtr drawBitmap(
281 const ::com::sun::star::uno::Reference<
282 ::com::sun::star::rendering::XBitmap >& xBitmap,
283 const ::com::sun::star::rendering::ViewState& viewState,
284 const ::com::sun::star::rendering::RenderState& renderState );
285 /// See XCanvas interface
286 ICachedPrimitiveSharedPtr drawBitmap(
287 const ::boost::shared_ptr<Bitmap>& rImage,
288 const ::com::sun::star::rendering::ViewState& viewState,
289 const ::com::sun::star::rendering::RenderState& renderState );
291 /// See XCanvas interface
292 ICachedPrimitiveSharedPtr drawBitmapModulated(
293 const ::com::sun::star::uno::Reference<
294 ::com::sun::star::rendering::XBitmap >& xBitmap,
295 const ::com::sun::star::rendering::ViewState& viewState,
296 const ::com::sun::star::rendering::RenderState& renderState );
297 /// See XCanvas interface
298 ICachedPrimitiveSharedPtr drawBitmapModulated(
299 const ::boost::shared_ptr<Bitmap>& rImage,
300 const ::com::sun::star::rendering::ViewState& viewState,
301 const ::com::sun::star::rendering::RenderState& renderState );
303 private:
304 friend class ImplBitmap;
306 const ::boost::scoped_ptr< ImplBitmap > mpImpl;
309 typedef ::boost::shared_ptr< Bitmap > BitmapSharedPtr;
312 #endif /* INCLUDED_CANVAS_BITMAP_HXX */
314 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */