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