Branch data 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_BASEBMP_BITMAPDEVICE_HXX
21 : : #define INCLUDED_BASEBMP_BITMAPDEVICE_HXX
22 : :
23 : : #include <sal/types.h>
24 : : #include <basebmp/drawmodes.hxx>
25 : : #include <basebmp/basebmpdllapi.h>
26 : :
27 : : #include <boost/scoped_ptr.hpp>
28 : : #include <boost/shared_ptr.hpp>
29 : : #include <boost/shared_array.hpp>
30 : : #include <boost/enable_shared_from_this.hpp>
31 : : #include <boost/noncopyable.hpp>
32 : : #include <vector>
33 : :
34 : : namespace basegfx
35 : : {
36 : : class B2IPoint;
37 : : class B2DPoint;
38 : : class B2IVector;
39 : : class B2IBox;
40 : : class B2DPolygon;
41 : : class B2DPolyPolygon;
42 : : }
43 : :
44 : : namespace basebmp
45 : : {
46 : :
47 : : // Temporary. Use like the tools color object
48 : : class Color;
49 : : typedef boost::shared_ptr< class BitmapDevice > BitmapDeviceSharedPtr;
50 : : typedef boost::shared_ptr< struct IBitmapDeviceDamageTracker > IBitmapDeviceDamageTrackerSharedPtr;
51 : : typedef boost::shared_array< sal_uInt8 > RawMemorySharedArray;
52 : : typedef boost::shared_ptr< const std::vector<Color> > PaletteMemorySharedVector;
53 : :
54 : : struct ImplBitmapDevice;
55 : :
56 : : /// Interface for getting damage tracking events
57 : 0 : struct IBitmapDeviceDamageTracker
58 : : {
59 : : /// gets called when said region is clobbered
60 : : virtual void damaged(const basegfx::B2IBox& rDamageRect) const = 0;
61 : :
62 : : protected:
63 : 0 : ~IBitmapDeviceDamageTracker() {}
64 : : };
65 : :
66 : : /** Definition of BitmapDevice interface
67 : :
68 : : Use the createBitmapDevice() function to create instances.
69 : :
70 : : Implementation note: the clip mask and bitmap parameter instances
71 : : of BitmapDevice that are passed to individual BitmapDevice
72 : : instances work best with 1 bit grey masks for the clip and a
73 : : format matching that of the target BitmapDevice for the other
74 : : parameters. The alpha mask passed to the drawMaskedColor() methods
75 : : works best when given as an eight bit grey bitmap. Everything else
76 : : is accepted, but potentially slow.
77 : : */
78 : : class BASEBMP_DLLPUBLIC BitmapDevice : public boost::enable_shared_from_this<BitmapDevice>,
79 : : private boost::noncopyable
80 : : {
81 : : public:
82 : : /** Query size of device in pixel
83 : : */
84 : : basegfx::B2IVector getSize() const;
85 : :
86 : : /** Query whether buffer starts with 0th scanline
87 : :
88 : : @return true, if the buffer memory starts with the 0th
89 : : scanline, and false if it starts with the last one. The latter
90 : : is e.g. the typical scan line ordering for the Windows BMP
91 : : format.
92 : : */
93 : : bool isTopDown() const;
94 : :
95 : : /** Query type of scanline memory format
96 : : */
97 : : sal_Int32 getScanlineFormat() const;
98 : :
99 : : /** Query byte offset to get from scanline n to scanline n+1
100 : :
101 : : @return the scanline stride in bytes. In the case of
102 : : isTopDown()==false, this offset will be negative.
103 : : */
104 : : sal_Int32 getScanlineStride() const;
105 : :
106 : : /** Get pointer to frame buffer
107 : :
108 : : @return a shared ptr to the bitmap buffer memory. As this is a
109 : : shared ptr, you can freely store and use the pointer, even
110 : : after this object has been deleted.
111 : : */
112 : : RawMemorySharedArray getBuffer() const;
113 : :
114 : : /// Query current damage tracking object (if any)
115 : : IBitmapDeviceDamageTrackerSharedPtr getDamageTracker() const;
116 : :
117 : : /** Set new damage tracking object
118 : :
119 : : @param rDamage
120 : : Object implementing the IBitmapDeviceDamageTracker interface -
121 : : everytime some area of the surface gets clobbered, that object
122 : : gets notified.
123 : : */
124 : : void setDamageTracker( const IBitmapDeviceDamageTrackerSharedPtr& rDamage );
125 : :
126 : : /** Get pointer to palette
127 : :
128 : : The returned pointer is const on purpose, since the
129 : : BitmapDevice might internally cache lookup information. Don't
130 : : modify the returned data, unless you want to enter the realm
131 : : of completely undefined behaviour.
132 : :
133 : : @return shared pointer to vector of Color entries.
134 : : */
135 : : PaletteMemorySharedVector getPalette() const;
136 : :
137 : : /** Clear whole device with given color
138 : :
139 : : This method works like a fill with the given color value,
140 : : resulting in a bitmap uniformly colored in fillColor.
141 : : */
142 : : void clear( Color fillColor );
143 : :
144 : : /** Set given pixel to specified color
145 : :
146 : : @param rPt
147 : : Pixel to set
148 : :
149 : : @param pixelColor
150 : : Color value to set the pixel to
151 : :
152 : : @param drawMode
153 : : Draw mode to use when changing the pixel value
154 : : */
155 : : void setPixel( const basegfx::B2IPoint& rPt,
156 : : Color pixelColor,
157 : : DrawMode drawMode );
158 : :
159 : : /** Set given pixel to specified color
160 : :
161 : : @param rPt
162 : : Pixel to set
163 : :
164 : : @param pixelColor
165 : : Color value to set the pixel to
166 : :
167 : : @param drawMode
168 : : Draw mode to use when changing the pixel value
169 : :
170 : : @param rClip
171 : : Clip mask to use. If the clip mask is 1 at the given pixel
172 : : position, no change will take place.
173 : : */
174 : : void setPixel( const basegfx::B2IPoint& rPt,
175 : : Color pixelColor,
176 : : DrawMode drawMode,
177 : : const BitmapDeviceSharedPtr& rClip );
178 : :
179 : : /** Get color value at given pixel
180 : : */
181 : : Color getPixel( const basegfx::B2IPoint& rPt );
182 : :
183 : : /** Get underlying pixel data value at given position
184 : :
185 : : This method returns the raw pixel data. In the case of
186 : : paletted bitmaps, this is the palette index, not the final
187 : : color value.
188 : : */
189 : : sal_uInt32 getPixelData( const basegfx::B2IPoint& rPt );
190 : :
191 : : /** Draw a line
192 : :
193 : : @param rPt1
194 : : Start point of the line
195 : :
196 : : @param rPt2
197 : : End point of the line. If the analytical line from rP1 to rPt2
198 : : (with the actual pixel positions assumed to be the center of
199 : : the pixel) is exactly in the middle between two pixel, this
200 : : method always selects the pixel closer to rPt1.
201 : :
202 : : @param lineColor
203 : : Color value to draw the line with
204 : :
205 : : @param drawMode
206 : : Draw mode to use when changing the pixel value
207 : : */
208 : : void drawLine( const basegfx::B2IPoint& rPt1,
209 : : const basegfx::B2IPoint& rPt2,
210 : : Color lineColor,
211 : : DrawMode drawMode );
212 : :
213 : : /** Draw a line
214 : :
215 : : @param rPt1
216 : : Start point of the line
217 : :
218 : : @param rPt2
219 : : End point of the line. If the analytical line from rP1 to rPt2
220 : : (with the actual pixel positions assumed to be the center of
221 : : the pixel) is exactly in the middle between two pixel, this
222 : : method always selects the pixel closer to rPt1.
223 : :
224 : : @param lineColor
225 : : Color value to draw the line with
226 : :
227 : : @param drawMode
228 : : Draw mode to use when changing the pixel value
229 : :
230 : : @param rClip
231 : : Clip mask to use. Pixel where the corresponding clip mask
232 : : pixel is 1 will not be modified.
233 : : */
234 : : void drawLine( const basegfx::B2IPoint& rPt1,
235 : : const basegfx::B2IPoint& rPt2,
236 : : Color lineColor,
237 : : DrawMode drawMode,
238 : : const BitmapDeviceSharedPtr& rClip );
239 : :
240 : : /** Draw a polygon
241 : :
242 : : @param rPoly
243 : : Polygon to draw. Depending on the value returned by rPoly's
244 : : isClosed() method, the resulting line polygon will be drawn
245 : : closed or not.
246 : :
247 : : @param lineColor
248 : : Color value to draw the polygon with
249 : :
250 : : @param drawMode
251 : : Draw mode to use when changing pixel values
252 : : */
253 : : void drawPolygon( const basegfx::B2DPolygon& rPoly,
254 : : Color lineColor,
255 : : DrawMode drawMode );
256 : :
257 : : /** Draw a polygon
258 : :
259 : : @param rPoly
260 : : Polygon to draw. Depending on the value returned by rPoly's
261 : : isClosed() method, the resulting line polygon will be drawn
262 : : closed or not.
263 : :
264 : : @param lineColor
265 : : Color value to draw the polygon with
266 : :
267 : : @param drawMode
268 : : Draw mode to use when changing pixel values
269 : :
270 : : @param rClip
271 : : Clip mask to use. Pixel where the corresponding clip mask
272 : : pixel is 1 will not be modified.
273 : : */
274 : : void drawPolygon( const basegfx::B2DPolygon& rPoly,
275 : : Color lineColor,
276 : : DrawMode drawMode,
277 : : const BitmapDeviceSharedPtr& rClip );
278 : :
279 : : /** Fill a poly-polygon
280 : :
281 : : @param rPoly
282 : : Poly-polygon to fill. Regardless of the value returned by
283 : : rPoly's isClosed() method, the resulting filled poly-polygon
284 : : is always considered closed. As usual, when filling a shape,
285 : : the rightmost and bottommost pixel are not filled, compared to
286 : : the drawPolygon() method. For example, the rectangle
287 : : (0,0),(1,1) will have four pixel set, when drawn via
288 : : drawPolygon(), and only one pixel, when filled via
289 : : fillPolyPolygon().
290 : :
291 : : @param fillColor
292 : : Color value to fill the poly-polygon with
293 : :
294 : : @param drawMode
295 : : Draw mode to use when changing pixel values
296 : : */
297 : : void fillPolyPolygon( const basegfx::B2DPolyPolygon& rPoly,
298 : : Color fillColor,
299 : : DrawMode drawMode );
300 : :
301 : : /** Fill a poly-polygon
302 : :
303 : : @param rPoly
304 : : Poly-polygon to fill. Regardless of the value returned by
305 : : rPoly's isClosed() method, the resulting filled poly-polygon
306 : : is always considered closed. As usual, when filling a shape,
307 : : the rightmost and bottommost pixel are not filled, compared to
308 : : the drawPolygon() method. For example, the rectangle
309 : : (0,0),(1,1) will have four pixel set, when drawn via
310 : : drawPolygon(), and only one pixel, when filled via
311 : : fillPolyPolygon().
312 : :
313 : : @param fillColor
314 : : Color value to fill the poly-polygon with
315 : :
316 : : @param drawMode
317 : : Draw mode to use when changing pixel values
318 : :
319 : : @param rClip
320 : : Clip mask to use. Pixel where the corresponding clip mask
321 : : pixel is 1 will not be modified.
322 : : */
323 : : void fillPolyPolygon( const basegfx::B2DPolyPolygon& rPoly,
324 : : Color fillColor,
325 : : DrawMode drawMode,
326 : : const BitmapDeviceSharedPtr& rClip );
327 : :
328 : : /** Draw another bitmap into this device
329 : :
330 : : @param rSrcBitmap
331 : : Bitmap to render into this one. It is permitted that source
332 : : and destination bitmap are the same.
333 : :
334 : : @param rSrcRect
335 : : Rectangle within the source bitmap to take the pixel from.
336 : :
337 : : @param rDstRect
338 : : Rectangle in the destination bitmap to put the pixel
339 : : into. Source and destination rectangle are permitted to have
340 : : differing sizes; this method will scale the source pixel
341 : : accordingly. Please note that both source and destination
342 : : rectangle are interpreted excluding the rightmost pixel column
343 : : and the bottommost pixel row, this is much like polygon
344 : : filling. As a result, filling a given rectangle with
345 : : fillPolyPolygon(), and using the same rectangle as the
346 : : destination rectangle of this method, will affect exactly the
347 : : same set of pixel.
348 : :
349 : : @param drawMode
350 : : Draw mode to use when changing pixel values
351 : : */
352 : : void drawBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
353 : : const basegfx::B2IBox& rSrcRect,
354 : : const basegfx::B2IBox& rDstRect,
355 : : DrawMode drawMode );
356 : :
357 : : /** Draw another bitmap into this device
358 : :
359 : : @param rSrcBitmap
360 : : Bitmap to render into this one. It is permitted that source
361 : : and destination bitmap are the same.
362 : :
363 : : @param rSrcRect
364 : : Rectangle within the source bitmap to take the pixel from.
365 : :
366 : : @param rDstRect
367 : : Rectangle in the destination bitmap to put the pixel
368 : : into. Source and destination rectangle are permitted to have
369 : : differing sizes; this method will scale the source pixel
370 : : accordingly. Please note that both source and destination
371 : : rectangle are interpreted excluding the rightmost pixel column
372 : : and the bottommost pixel row, this is much like polygon
373 : : filling. As a result, filling a given rectangle with
374 : : fillPolyPolygon(), and using the same rectangle as the
375 : : destination rectangle of this method, will affect exactly the
376 : : same set of pixel.
377 : :
378 : : @param drawMode
379 : : Draw mode to use when changing pixel values
380 : :
381 : : @param rClip
382 : : Clip mask to use. Pixel where the corresponding clip mask
383 : : pixel is 1 will not be modified.
384 : : */
385 : : void drawBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
386 : : const basegfx::B2IBox& rSrcRect,
387 : : const basegfx::B2IBox& rDstRect,
388 : : DrawMode drawMode,
389 : : const BitmapDeviceSharedPtr& rClip );
390 : :
391 : : /** Draw a color with an alpha-modulation bitmap into this device
392 : :
393 : : This method takes a fixed color value, and an alpha mask. For
394 : : each pixel in the alpha mask, the given color value is blended
395 : : with the corresponding alpha value against the content of this
396 : : object.
397 : :
398 : : @param aSrcColor
399 : : Color value to use for blending
400 : :
401 : : @param rAlphaMask
402 : : Alpha mask to use for blending. It is permitted that alpha
403 : : mask and this bitmap are the same object.
404 : :
405 : : @param rSrcRect
406 : : Rectangle within the alpha mask to take the pixel from.
407 : : Please note that the destination rectangle is interpreted
408 : : excluding the rightmost pixel column and the bottommost pixel
409 : : row, this is much like polygon filling. As a result, filling a
410 : : given rectangle with fillPolyPolygon(), and using the same
411 : : rectangle as the source rectangle of this method, will affect
412 : : exactly the same set of pixel.
413 : :
414 : : @param rDstPoint
415 : : Destination point, where to start placing the pixel from the
416 : : source rectangle
417 : : */
418 : : void drawMaskedColor( Color aSrcColor,
419 : : const BitmapDeviceSharedPtr& rAlphaMask,
420 : : const basegfx::B2IBox& rSrcRect,
421 : : const basegfx::B2IPoint& rDstPoint );
422 : :
423 : : /** Draw a color with an alpha-modulation bitmap into this device
424 : :
425 : : This method takes a fixed color value, and an alpha mask. For
426 : : each pixel in the alpha mask, the given color value is blended
427 : : with the corresponding alpha value against the content of this
428 : : object.
429 : :
430 : : @param aSrcColor
431 : : Color value to use for blending
432 : :
433 : : @param rAlphaMask
434 : : Alpha mask to use for blending. It is permitted that alpha
435 : : mask and this bitmap are the same object.
436 : :
437 : : @param rSrcRect
438 : : Rectangle within the alpha mask to take the pixel from.
439 : : Please note that the destination rectangle is interpreted
440 : : excluding the rightmost pixel column and the bottommost pixel
441 : : row, this is much like polygon filling. As a result, filling a
442 : : given rectangle with fillPolyPolygon(), and using the same
443 : : rectangle as the source rectangle of this method, will affect
444 : : exactly the same set of pixel.
445 : :
446 : : @param rDstPoint
447 : : Destination point, where to start placing the pixel from the
448 : : source rectangle
449 : :
450 : : @param rClip
451 : : Clip mask to use. Pixel where the corresponding clip mask
452 : : pixel is 1 will not be modified.
453 : : */
454 : : void drawMaskedColor( Color aSrcColor,
455 : : const BitmapDeviceSharedPtr& rAlphaMask,
456 : : const basegfx::B2IBox& rSrcRect,
457 : : const basegfx::B2IPoint& rDstPoint,
458 : : const BitmapDeviceSharedPtr& rClip );
459 : :
460 : : /** Draw another bitmap through a mask into this device
461 : :
462 : : This method renders a source bitmap into this device, much
463 : : like the drawBitmap() method. The only difference is the
464 : : additional mask parameter, which operates much like an
465 : : additional clip mask: pixel with value zero in this mask
466 : : result in destination pixel not being modified.
467 : :
468 : : @param rSrcBitmap
469 : : Bitmap to render into this one. It is permitted that source
470 : : and destination bitmap are the same.
471 : :
472 : : @param rMask
473 : : Bitmap to use as a mask. Pixel with value != zero in this mask
474 : : will result in destination pixel not being affected by the
475 : : blit operation.
476 : :
477 : : @param rSrcRect
478 : : Rectangle within the source bitmap to take the pixel from.
479 : :
480 : : @param rDstRect
481 : : Rectangle in the destination bitmap to put the pixel
482 : : into. Source and destination rectangle are permitted to have
483 : : differing sizes; this method will scale the source pixel
484 : : accordingly. Please note that both source and destination
485 : : rectangle are interpreted excluding the rightmost pixel column
486 : : and the bottommost pixel row, this is much like polygon
487 : : filling. As a result, filling a given rectangle with
488 : : fillPolyPolygon(), and using the same rectangle as the
489 : : destination rectangle of this method, will affect exactly the
490 : : same set of pixel.
491 : :
492 : : @param drawMode
493 : : Draw mode to use when changing pixel values
494 : : */
495 : : void drawMaskedBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
496 : : const BitmapDeviceSharedPtr& rMask,
497 : : const basegfx::B2IBox& rSrcRect,
498 : : const basegfx::B2IBox& rDstRect,
499 : : DrawMode drawMode );
500 : :
501 : : /** Draw another bitmap through a mask into this device
502 : :
503 : : This method renders a source bitmap into this device, much
504 : : like the drawBitmap() method. The only difference is the
505 : : additional mask parameter, which operates much like an
506 : : additional clip mask: pixel with value != zero in this mask
507 : : result in destination pixel not being modified.
508 : :
509 : : @param rSrcBitmap
510 : : Bitmap to render into this one. It is permitted that source
511 : : and destination bitmap are the same.
512 : :
513 : : @param rMask
514 : : Bitmap to use as a mask. Pixel with value != zero in this mask
515 : : will result in destination pixel not being affected by the
516 : : blit operation.
517 : :
518 : : @param rSrcRect
519 : : Rectangle within the source bitmap to take the pixel from.
520 : :
521 : : @param rDstRect
522 : : Rectangle in the destination bitmap to put the pixel
523 : : into. Source and destination rectangle are permitted to have
524 : : differing sizes; this method will scale the source pixel
525 : : accordingly. Please note that both source and destination
526 : : rectangle are interpreted excluding the rightmost pixel column
527 : : and the bottommost pixel row, this is much like polygon
528 : : filling. As a result, filling a given rectangle with
529 : : fillPolyPolygon(), and using the same rectangle as the
530 : : destination rectangle of this method, will affect exactly the
531 : : same set of pixel.
532 : :
533 : : @param drawMode
534 : : Draw mode to use when changing pixel values
535 : :
536 : : @param rClip
537 : : Clip mask to use. Pixel where the corresponding clip mask
538 : : pixel is 1 will not be modified.
539 : : */
540 : : void drawMaskedBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
541 : : const BitmapDeviceSharedPtr& rMask,
542 : : const basegfx::B2IBox& rSrcRect,
543 : : const basegfx::B2IBox& rDstRect,
544 : : DrawMode drawMode,
545 : : const BitmapDeviceSharedPtr& rClip );
546 : :
547 : : protected:
548 : : BASEBMP_DLLPRIVATE BitmapDevice( const basegfx::B2IBox& rBounds,
549 : : sal_Int32 nScanlineFormat,
550 : : sal_Int32 nScanlineStride,
551 : : sal_uInt8* pFirstScanline,
552 : : const RawMemorySharedArray& rMem,
553 : : const PaletteMemorySharedVector& rPalette );
554 : : BASEBMP_DLLPRIVATE virtual ~BitmapDevice();
555 : :
556 : : private:
557 : : BASEBMP_DLLPRIVATE virtual bool isCompatibleBitmap( const BitmapDeviceSharedPtr& bmp ) const = 0;
558 : : BASEBMP_DLLPRIVATE virtual bool isCompatibleClipMask( const BitmapDeviceSharedPtr& bmp ) const = 0;
559 : : BASEBMP_DLLPRIVATE virtual bool isCompatibleAlphaMask( const BitmapDeviceSharedPtr& bmp ) const = 0;
560 : :
561 : : BASEBMP_DLLPRIVATE virtual void clear_i( Color fillColor,
562 : : const basegfx::B2IBox& rBounds ) = 0;
563 : :
564 : : BASEBMP_DLLPRIVATE virtual void setPixel_i( const basegfx::B2IPoint& rPt,
565 : : Color lineColor,
566 : : DrawMode drawMode ) = 0;
567 : : BASEBMP_DLLPRIVATE virtual void setPixel_i( const basegfx::B2IPoint& rPt,
568 : : Color lineColor,
569 : : DrawMode drawMode,
570 : : const BitmapDeviceSharedPtr& rClip ) = 0;
571 : :
572 : : BASEBMP_DLLPRIVATE virtual Color getPixel_i( const basegfx::B2IPoint& rPt ) = 0;
573 : :
574 : : BASEBMP_DLLPRIVATE virtual sal_uInt32 getPixelData_i( const basegfx::B2IPoint& rPt ) = 0;
575 : :
576 : : BASEBMP_DLLPRIVATE virtual void drawLine_i( const basegfx::B2IPoint& rPt1,
577 : : const basegfx::B2IPoint& rPt2,
578 : : const basegfx::B2IBox& rBounds,
579 : : Color lineColor,
580 : : DrawMode drawMode ) = 0;
581 : : BASEBMP_DLLPRIVATE virtual void drawLine_i( const basegfx::B2IPoint& rPt1,
582 : : const basegfx::B2IPoint& rPt2,
583 : : const basegfx::B2IBox& rBounds,
584 : : Color lineColor,
585 : : DrawMode drawMode,
586 : : const BitmapDeviceSharedPtr& rClip ) = 0;
587 : :
588 : : BASEBMP_DLLPRIVATE virtual void drawPolygon_i( const basegfx::B2DPolygon& rPoly,
589 : : const basegfx::B2IBox& rBounds,
590 : : Color lineColor,
591 : : DrawMode drawMode ) = 0;
592 : : BASEBMP_DLLPRIVATE virtual void drawPolygon_i( const basegfx::B2DPolygon& rPoly,
593 : : const basegfx::B2IBox& rBounds,
594 : : Color lineColor,
595 : : DrawMode drawMode,
596 : : const BitmapDeviceSharedPtr& rClip ) = 0;
597 : :
598 : : BASEBMP_DLLPRIVATE virtual void fillPolyPolygon_i( const basegfx::B2DPolyPolygon& rPoly,
599 : : Color fillColor,
600 : : DrawMode drawMode,
601 : : const basegfx::B2IBox& rBounds ) = 0;
602 : : BASEBMP_DLLPRIVATE virtual void fillPolyPolygon_i( const basegfx::B2DPolyPolygon& rPoly,
603 : : Color fillColor,
604 : : DrawMode drawMode,
605 : : const basegfx::B2IBox& rBounds,
606 : : const BitmapDeviceSharedPtr& rClip ) = 0;
607 : :
608 : : // must work with *this == rSrcBitmap!
609 : : BASEBMP_DLLPRIVATE virtual void drawBitmap_i( const BitmapDeviceSharedPtr& rSrcBitmap,
610 : : const basegfx::B2IBox& rSrcRect,
611 : : const basegfx::B2IBox& rDstRect,
612 : : DrawMode drawMode ) = 0;
613 : : BASEBMP_DLLPRIVATE virtual void drawBitmap_i( const BitmapDeviceSharedPtr& rSrcBitmap,
614 : : const basegfx::B2IBox& rSrcRect,
615 : : const basegfx::B2IBox& rDstRect,
616 : : DrawMode drawMode,
617 : : const BitmapDeviceSharedPtr& rClip ) = 0;
618 : :
619 : : // must work with *this == rSrcBitmap!
620 : : BASEBMP_DLLPRIVATE virtual void drawMaskedColor_i( Color rSrcColor,
621 : : const BitmapDeviceSharedPtr& rAlphaMask,
622 : : const basegfx::B2IBox& rSrcRect,
623 : : const basegfx::B2IPoint& rDstPoint ) = 0;
624 : : BASEBMP_DLLPRIVATE virtual void drawMaskedColor_i( Color rSrcColor,
625 : : const BitmapDeviceSharedPtr& rAlphaMask,
626 : : const basegfx::B2IBox& rSrcRect,
627 : : const basegfx::B2IPoint& rDstPoint,
628 : : const BitmapDeviceSharedPtr& rClip ) = 0;
629 : :
630 : : // must work with *this == rSrcBitmap!
631 : : BASEBMP_DLLPRIVATE virtual void drawMaskedBitmap_i( const BitmapDeviceSharedPtr& rSrcBitmap,
632 : : const BitmapDeviceSharedPtr& rMask,
633 : : const basegfx::B2IBox& rSrcRect,
634 : : const basegfx::B2IBox& rDstRect,
635 : : DrawMode drawMode ) = 0;
636 : : BASEBMP_DLLPRIVATE virtual void drawMaskedBitmap_i( const BitmapDeviceSharedPtr& rSrcBitmap,
637 : : const BitmapDeviceSharedPtr& rMask,
638 : : const basegfx::B2IBox& rSrcRect,
639 : : const basegfx::B2IBox& rDstRect,
640 : : DrawMode drawMode,
641 : : const BitmapDeviceSharedPtr& rClip ) = 0;
642 : :
643 : : BASEBMP_DLLPRIVATE virtual IBitmapDeviceDamageTrackerSharedPtr getDamageTracker_i() const = 0;
644 : : BASEBMP_DLLPRIVATE virtual void setDamageTracker_i( const IBitmapDeviceDamageTrackerSharedPtr& rDamage ) = 0;
645 : :
646 : : BitmapDeviceSharedPtr getGenericRenderer() const;
647 : :
648 : : boost::scoped_ptr< ImplBitmapDevice > mpImpl;
649 : : };
650 : :
651 : : /** Function to create a BitmapDevice for given scanline format
652 : : */
653 : : BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC createBitmapDevice( const basegfx::B2IVector& rSize,
654 : : bool bTopDown,
655 : : sal_Int32 nScanlineFormat );
656 : :
657 : : /** Function to create a BitmapDevice for given scanline format
658 : : with the given palette
659 : :
660 : : Note: the provided palette must have sufficient size, to satisfy
661 : : lookups for the whole range of pixel values from the specified
662 : : format.
663 : : */
664 : : BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC createBitmapDevice( const basegfx::B2IVector& rSize,
665 : : bool bTopDown,
666 : : sal_Int32 nScanlineFormat,
667 : : const PaletteMemorySharedVector& rPalette );
668 : :
669 : : /** Function to create a BitmapDevice for given scanline format
670 : : from the given piece of raw memory and palette
671 : :
672 : : Note: the provided memory must have sufficient size, to store the
673 : : image of the specified area and format.
674 : : */
675 : : BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC createBitmapDevice( const basegfx::B2IVector& rSize,
676 : : bool bTopDown,
677 : : sal_Int32 nScanlineFormat,
678 : : const RawMemorySharedArray& rMem,
679 : : const PaletteMemorySharedVector& rPalette );
680 : :
681 : :
682 : : /** Function to retrieve a subsetted BitmapDevice to the same
683 : : memory.
684 : :
685 : : This method creates a second bitmap device instance, which renders
686 : : to the same memory as the original, but to a limited, rectangular
687 : : area. Useful to implement rectangular clips (usually faster than
688 : : setting up a 1bpp clip mask).
689 : : */
690 : : BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC subsetBitmapDevice( const BitmapDeviceSharedPtr& rProto,
691 : : const basegfx::B2IBox& rSubset );
692 : :
693 : : /** Function to clone a BitmapDevice from a given prototype.
694 : :
695 : : All attributes (like scanline format and top-down state) are
696 : : copied, only the size can be varied. Note that the prototype's
697 : : bitmap content is <em>not</em> copied, only a palette (if any).
698 : : */
699 : : BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC cloneBitmapDevice( const basegfx::B2IVector& rSize,
700 : : const BitmapDeviceSharedPtr& rProto );
701 : :
702 : : }
703 : :
704 : : #endif /* INCLUDED_BASEBMP_BITMAPDEVICE_HXX */
705 : :
706 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|