bump product version to 4.1.6.2
[LibreOffice.git] / include / basebmp / bitmapdevice.hxx
blob941b01c840c39bdf3c86732be979d3b2bf326929
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_BASEBMP_BITMAPDEVICE_HXX
21 #define INCLUDED_BASEBMP_BITMAPDEVICE_HXX
23 #include <sal/types.h>
24 #include <basebmp/drawmodes.hxx>
25 #include <basebmp/basebmpdllapi.h>
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>
34 namespace basegfx
36 class B2IPoint;
37 class B2DPoint;
38 class B2IVector;
39 class B2IBox;
40 class B2DPolygon;
41 class B2DPolyPolygon;
44 namespace basebmp
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;
54 struct ImplBitmapDevice;
56 /// Interface for getting damage tracking events
57 struct IBitmapDeviceDamageTracker
59 /// gets called when said region is clobbered
60 virtual void damaged(const basegfx::B2IBox& rDamageRect) const = 0;
62 protected:
63 ~IBitmapDeviceDamageTracker() {}
66 /** Definition of BitmapDevice interface
68 Use the createBitmapDevice() function to create instances.
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.
78 class BASEBMP_DLLPUBLIC BitmapDevice : public boost::enable_shared_from_this<BitmapDevice>,
79 private boost::noncopyable
81 public:
82 /** Query size of device in pixel columns (X) and rows (Y, "scanlines")
84 basegfx::B2IVector getSize() const;
86 /** Query whether buffer starts with 0th scanline
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.
93 bool isTopDown() const;
95 /** Query the size of the whole frame buffer
97 @ return the size of the whole frame buffer, the same as
98 getSize() unless this is a "subset" device.
100 basegfx::B2IVector getBufferSize() const;
102 /** Query type of scanline memory format
104 sal_Int32 getScanlineFormat() const;
106 /** Query byte offset to get from scanline n to scanline n+1
108 @return the scanline stride in bytes.
110 sal_Int32 getScanlineStride() const;
112 /** Get pointer to frame buffer
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.
118 RawMemorySharedArray getBuffer() const;
120 /// Query current damage tracking object (if any)
121 IBitmapDeviceDamageTrackerSharedPtr getDamageTracker() const;
123 /** Set new damage tracking object
125 @param rDamage
126 Object implementing the IBitmapDeviceDamageTracker interface -
127 everytime some area of the surface gets clobbered, that object
128 gets notified.
130 void setDamageTracker( const IBitmapDeviceDamageTrackerSharedPtr& rDamage );
132 /** Get pointer to palette
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.
139 @return shared pointer to vector of Color entries.
141 PaletteMemorySharedVector getPalette() const;
143 /** Clear whole device with given color
145 This method works like a fill with the given color value,
146 resulting in a bitmap uniformly colored in fillColor.
148 void clear( Color fillColor );
150 /** Set given pixel to specified color
152 @param rPt
153 Pixel to set
155 @param pixelColor
156 Color value to set the pixel to
158 @param drawMode
159 Draw mode to use when changing the pixel value
161 void setPixel( const basegfx::B2IPoint& rPt,
162 Color pixelColor,
163 DrawMode drawMode );
165 /** Set given pixel to specified color
167 @param rPt
168 Pixel to set
170 @param pixelColor
171 Color value to set the pixel to
173 @param drawMode
174 Draw mode to use when changing the pixel value
176 @param rClip
177 Clip mask to use. If the clip mask is 1 at the given pixel
178 position, no change will take place.
180 void setPixel( const basegfx::B2IPoint& rPt,
181 Color pixelColor,
182 DrawMode drawMode,
183 const BitmapDeviceSharedPtr& rClip );
185 /** Get color value at given pixel
187 Color getPixel( const basegfx::B2IPoint& rPt );
189 /** Get underlying pixel data value at given position
191 This method returns the raw pixel data. In the case of
192 paletted bitmaps, this is the palette index, not the final
193 color value.
195 sal_uInt32 getPixelData( const basegfx::B2IPoint& rPt );
197 /** Draw a line
199 @param rPt1
200 Start point of the line
202 @param rPt2
203 End point of the line. If the analytical line from rP1 to rPt2
204 (with the actual pixel positions assumed to be the center of
205 the pixel) is exactly in the middle between two pixel, this
206 method always selects the pixel closer to rPt1.
208 @param lineColor
209 Color value to draw the line with
211 @param drawMode
212 Draw mode to use when changing the pixel value
214 void drawLine( const basegfx::B2IPoint& rPt1,
215 const basegfx::B2IPoint& rPt2,
216 Color lineColor,
217 DrawMode drawMode );
219 /** Draw a line
221 @param rPt1
222 Start point of the line
224 @param rPt2
225 End point of the line. If the analytical line from rP1 to rPt2
226 (with the actual pixel positions assumed to be the center of
227 the pixel) is exactly in the middle between two pixel, this
228 method always selects the pixel closer to rPt1.
230 @param lineColor
231 Color value to draw the line with
233 @param drawMode
234 Draw mode to use when changing the pixel value
236 @param rClip
237 Clip mask to use. Pixel where the corresponding clip mask
238 pixel is 1 will not be modified.
240 void drawLine( const basegfx::B2IPoint& rPt1,
241 const basegfx::B2IPoint& rPt2,
242 Color lineColor,
243 DrawMode drawMode,
244 const BitmapDeviceSharedPtr& rClip );
246 /** Draw a polygon
248 @param rPoly
249 Polygon to draw. Depending on the value returned by rPoly's
250 isClosed() method, the resulting line polygon will be drawn
251 closed or not.
253 @param lineColor
254 Color value to draw the polygon with
256 @param drawMode
257 Draw mode to use when changing pixel values
259 void drawPolygon( const basegfx::B2DPolygon& rPoly,
260 Color lineColor,
261 DrawMode drawMode );
263 /** Draw a polygon
265 @param rPoly
266 Polygon to draw. Depending on the value returned by rPoly's
267 isClosed() method, the resulting line polygon will be drawn
268 closed or not.
270 @param lineColor
271 Color value to draw the polygon with
273 @param drawMode
274 Draw mode to use when changing pixel values
276 @param rClip
277 Clip mask to use. Pixel where the corresponding clip mask
278 pixel is 1 will not be modified.
280 void drawPolygon( const basegfx::B2DPolygon& rPoly,
281 Color lineColor,
282 DrawMode drawMode,
283 const BitmapDeviceSharedPtr& rClip );
285 /** Fill a poly-polygon
287 @param rPoly
288 Poly-polygon to fill. Regardless of the value returned by
289 rPoly's isClosed() method, the resulting filled poly-polygon
290 is always considered closed. As usual, when filling a shape,
291 the rightmost and bottommost pixel are not filled, compared to
292 the drawPolygon() method. For example, the rectangle
293 (0,0),(1,1) will have four pixel set, when drawn via
294 drawPolygon(), and only one pixel, when filled via
295 fillPolyPolygon().
297 @param fillColor
298 Color value to fill the poly-polygon with
300 @param drawMode
301 Draw mode to use when changing pixel values
303 void fillPolyPolygon( const basegfx::B2DPolyPolygon& rPoly,
304 Color fillColor,
305 DrawMode drawMode );
307 /** Fill a poly-polygon
309 @param rPoly
310 Poly-polygon to fill. Regardless of the value returned by
311 rPoly's isClosed() method, the resulting filled poly-polygon
312 is always considered closed. As usual, when filling a shape,
313 the rightmost and bottommost pixel are not filled, compared to
314 the drawPolygon() method. For example, the rectangle
315 (0,0),(1,1) will have four pixel set, when drawn via
316 drawPolygon(), and only one pixel, when filled via
317 fillPolyPolygon().
319 @param fillColor
320 Color value to fill the poly-polygon with
322 @param drawMode
323 Draw mode to use when changing pixel values
325 @param rClip
326 Clip mask to use. Pixel where the corresponding clip mask
327 pixel is 1 will not be modified.
329 void fillPolyPolygon( const basegfx::B2DPolyPolygon& rPoly,
330 Color fillColor,
331 DrawMode drawMode,
332 const BitmapDeviceSharedPtr& rClip );
334 /** Draw another bitmap into this device
336 @param rSrcBitmap
337 Bitmap to render into this one. It is permitted that source
338 and destination bitmap are the same.
340 @param rSrcRect
341 Rectangle within the source bitmap to take the pixel from.
343 @param rDstRect
344 Rectangle in the destination bitmap to put the pixel
345 into. Source and destination rectangle are permitted to have
346 differing sizes; this method will scale the source pixel
347 accordingly. Please note that both source and destination
348 rectangle are interpreted excluding the rightmost pixel column
349 and the bottommost pixel row, this is much like polygon
350 filling. As a result, filling a given rectangle with
351 fillPolyPolygon(), and using the same rectangle as the
352 destination rectangle of this method, will affect exactly the
353 same set of pixel.
355 @param drawMode
356 Draw mode to use when changing pixel values
358 void drawBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
359 const basegfx::B2IBox& rSrcRect,
360 const basegfx::B2IBox& rDstRect,
361 DrawMode drawMode );
363 /** Draw another bitmap into this device
365 @param rSrcBitmap
366 Bitmap to render into this one. It is permitted that source
367 and destination bitmap are the same.
369 @param rSrcRect
370 Rectangle within the source bitmap to take the pixel from.
372 @param rDstRect
373 Rectangle in the destination bitmap to put the pixel
374 into. Source and destination rectangle are permitted to have
375 differing sizes; this method will scale the source pixel
376 accordingly. Please note that both source and destination
377 rectangle are interpreted excluding the rightmost pixel column
378 and the bottommost pixel row, this is much like polygon
379 filling. As a result, filling a given rectangle with
380 fillPolyPolygon(), and using the same rectangle as the
381 destination rectangle of this method, will affect exactly the
382 same set of pixel.
384 @param drawMode
385 Draw mode to use when changing pixel values
387 @param rClip
388 Clip mask to use. Pixel where the corresponding clip mask
389 pixel is 1 will not be modified.
391 void drawBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
392 const basegfx::B2IBox& rSrcRect,
393 const basegfx::B2IBox& rDstRect,
394 DrawMode drawMode,
395 const BitmapDeviceSharedPtr& rClip );
397 /** Draw a color with an alpha-modulation bitmap into this device
399 This method takes a fixed color value, and an alpha mask. For
400 each pixel in the alpha mask, the given color value is blended
401 with the corresponding alpha value against the content of this
402 object.
404 @param aSrcColor
405 Color value to use for blending
407 @param rAlphaMask
408 Alpha mask to use for blending. It is permitted that alpha
409 mask and this bitmap are the same object.
411 @param rSrcRect
412 Rectangle within the alpha mask to take the pixel from.
413 Please note that the destination rectangle is interpreted
414 excluding the rightmost pixel column and the bottommost pixel
415 row, this is much like polygon filling. As a result, filling a
416 given rectangle with fillPolyPolygon(), and using the same
417 rectangle as the source rectangle of this method, will affect
418 exactly the same set of pixel.
420 @param rDstPoint
421 Destination point, where to start placing the pixel from the
422 source rectangle
424 void drawMaskedColor( Color aSrcColor,
425 const BitmapDeviceSharedPtr& rAlphaMask,
426 const basegfx::B2IBox& rSrcRect,
427 const basegfx::B2IPoint& rDstPoint );
429 /** Draw a color with an alpha-modulation bitmap into this device
431 This method takes a fixed color value, and an alpha mask. For
432 each pixel in the alpha mask, the given color value is blended
433 with the corresponding alpha value against the content of this
434 object.
436 @param aSrcColor
437 Color value to use for blending
439 @param rAlphaMask
440 Alpha mask to use for blending. It is permitted that alpha
441 mask and this bitmap are the same object.
443 @param rSrcRect
444 Rectangle within the alpha mask to take the pixel from.
445 Please note that the destination rectangle is interpreted
446 excluding the rightmost pixel column and the bottommost pixel
447 row, this is much like polygon filling. As a result, filling a
448 given rectangle with fillPolyPolygon(), and using the same
449 rectangle as the source rectangle of this method, will affect
450 exactly the same set of pixel.
452 @param rDstPoint
453 Destination point, where to start placing the pixel from the
454 source rectangle
456 @param rClip
457 Clip mask to use. Pixel where the corresponding clip mask
458 pixel is 1 will not be modified.
460 void drawMaskedColor( Color aSrcColor,
461 const BitmapDeviceSharedPtr& rAlphaMask,
462 const basegfx::B2IBox& rSrcRect,
463 const basegfx::B2IPoint& rDstPoint,
464 const BitmapDeviceSharedPtr& rClip );
466 /** Draw another bitmap through a mask into this device
468 This method renders a source bitmap into this device, much
469 like the drawBitmap() method. The only difference is the
470 additional mask parameter, which operates much like an
471 additional clip mask: pixel with value zero in this mask
472 result in destination pixel not being modified.
474 @param rSrcBitmap
475 Bitmap to render into this one. It is permitted that source
476 and destination bitmap are the same.
478 @param rMask
479 Bitmap to use as a mask. Pixel with value != zero in this mask
480 will result in destination pixel not being affected by the
481 blit operation.
483 @param rSrcRect
484 Rectangle within the source bitmap to take the pixel from.
486 @param rDstRect
487 Rectangle in the destination bitmap to put the pixel
488 into. Source and destination rectangle are permitted to have
489 differing sizes; this method will scale the source pixel
490 accordingly. Please note that both source and destination
491 rectangle are interpreted excluding the rightmost pixel column
492 and the bottommost pixel row, this is much like polygon
493 filling. As a result, filling a given rectangle with
494 fillPolyPolygon(), and using the same rectangle as the
495 destination rectangle of this method, will affect exactly the
496 same set of pixel.
498 @param drawMode
499 Draw mode to use when changing pixel values
501 void drawMaskedBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
502 const BitmapDeviceSharedPtr& rMask,
503 const basegfx::B2IBox& rSrcRect,
504 const basegfx::B2IBox& rDstRect,
505 DrawMode drawMode );
507 /** Draw another bitmap through a mask into this device
509 This method renders a source bitmap into this device, much
510 like the drawBitmap() method. The only difference is the
511 additional mask parameter, which operates much like an
512 additional clip mask: pixel with value != zero in this mask
513 result in destination pixel not being modified.
515 @param rSrcBitmap
516 Bitmap to render into this one. It is permitted that source
517 and destination bitmap are the same.
519 @param rMask
520 Bitmap to use as a mask. Pixel with value != zero in this mask
521 will result in destination pixel not being affected by the
522 blit operation.
524 @param rSrcRect
525 Rectangle within the source bitmap to take the pixel from.
527 @param rDstRect
528 Rectangle in the destination bitmap to put the pixel
529 into. Source and destination rectangle are permitted to have
530 differing sizes; this method will scale the source pixel
531 accordingly. Please note that both source and destination
532 rectangle are interpreted excluding the rightmost pixel column
533 and the bottommost pixel row, this is much like polygon
534 filling. As a result, filling a given rectangle with
535 fillPolyPolygon(), and using the same rectangle as the
536 destination rectangle of this method, will affect exactly the
537 same set of pixel.
539 @param drawMode
540 Draw mode to use when changing pixel values
542 @param rClip
543 Clip mask to use. Pixel where the corresponding clip mask
544 pixel is 1 will not be modified.
546 void drawMaskedBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
547 const BitmapDeviceSharedPtr& rMask,
548 const basegfx::B2IBox& rSrcRect,
549 const basegfx::B2IBox& rDstRect,
550 DrawMode drawMode,
551 const BitmapDeviceSharedPtr& rClip );
553 protected:
554 BASEBMP_DLLPRIVATE BitmapDevice( const basegfx::B2IBox& rBounds,
555 const basegfx::B2IVector& rBufferSize,
556 sal_Int32 nScanlineFormat,
557 sal_Int32 nScanlineStride,
558 sal_uInt8* pFirstScanline,
559 const RawMemorySharedArray& rMem,
560 const PaletteMemorySharedVector& rPalette );
561 BASEBMP_DLLPRIVATE virtual ~BitmapDevice();
563 private:
564 BASEBMP_DLLPRIVATE virtual bool isCompatibleBitmap( const BitmapDeviceSharedPtr& bmp ) const = 0;
565 BASEBMP_DLLPRIVATE virtual bool isCompatibleClipMask( const BitmapDeviceSharedPtr& bmp ) const = 0;
566 BASEBMP_DLLPRIVATE virtual bool isCompatibleAlphaMask( const BitmapDeviceSharedPtr& bmp ) const = 0;
568 BASEBMP_DLLPRIVATE virtual void clear_i( Color fillColor,
569 const basegfx::B2IBox& rBounds ) = 0;
571 BASEBMP_DLLPRIVATE virtual void setPixel_i( const basegfx::B2IPoint& rPt,
572 Color lineColor,
573 DrawMode drawMode ) = 0;
574 BASEBMP_DLLPRIVATE virtual void setPixel_i( const basegfx::B2IPoint& rPt,
575 Color lineColor,
576 DrawMode drawMode,
577 const BitmapDeviceSharedPtr& rClip ) = 0;
579 BASEBMP_DLLPRIVATE virtual Color getPixel_i( const basegfx::B2IPoint& rPt ) = 0;
581 BASEBMP_DLLPRIVATE virtual sal_uInt32 getPixelData_i( const basegfx::B2IPoint& rPt ) = 0;
583 BASEBMP_DLLPRIVATE virtual void drawLine_i( const basegfx::B2IPoint& rPt1,
584 const basegfx::B2IPoint& rPt2,
585 const basegfx::B2IBox& rBounds,
586 Color lineColor,
587 DrawMode drawMode ) = 0;
588 BASEBMP_DLLPRIVATE virtual void drawLine_i( const basegfx::B2IPoint& rPt1,
589 const basegfx::B2IPoint& rPt2,
590 const basegfx::B2IBox& rBounds,
591 Color lineColor,
592 DrawMode drawMode,
593 const BitmapDeviceSharedPtr& rClip ) = 0;
595 BASEBMP_DLLPRIVATE virtual void drawPolygon_i( const basegfx::B2DPolygon& rPoly,
596 const basegfx::B2IBox& rBounds,
597 Color lineColor,
598 DrawMode drawMode ) = 0;
599 BASEBMP_DLLPRIVATE virtual void drawPolygon_i( const basegfx::B2DPolygon& rPoly,
600 const basegfx::B2IBox& rBounds,
601 Color lineColor,
602 DrawMode drawMode,
603 const BitmapDeviceSharedPtr& rClip ) = 0;
605 BASEBMP_DLLPRIVATE virtual void fillPolyPolygon_i( const basegfx::B2DPolyPolygon& rPoly,
606 Color fillColor,
607 DrawMode drawMode,
608 const basegfx::B2IBox& rBounds ) = 0;
609 BASEBMP_DLLPRIVATE virtual void fillPolyPolygon_i( const basegfx::B2DPolyPolygon& rPoly,
610 Color fillColor,
611 DrawMode drawMode,
612 const basegfx::B2IBox& rBounds,
613 const BitmapDeviceSharedPtr& rClip ) = 0;
615 // must work with *this == rSrcBitmap!
616 BASEBMP_DLLPRIVATE virtual void drawBitmap_i( const BitmapDeviceSharedPtr& rSrcBitmap,
617 const basegfx::B2IBox& rSrcRect,
618 const basegfx::B2IBox& rDstRect,
619 DrawMode drawMode ) = 0;
620 BASEBMP_DLLPRIVATE virtual void drawBitmap_i( const BitmapDeviceSharedPtr& rSrcBitmap,
621 const basegfx::B2IBox& rSrcRect,
622 const basegfx::B2IBox& rDstRect,
623 DrawMode drawMode,
624 const BitmapDeviceSharedPtr& rClip ) = 0;
626 // must work with *this == rSrcBitmap!
627 BASEBMP_DLLPRIVATE virtual void drawMaskedColor_i( Color rSrcColor,
628 const BitmapDeviceSharedPtr& rAlphaMask,
629 const basegfx::B2IBox& rSrcRect,
630 const basegfx::B2IPoint& rDstPoint ) = 0;
631 BASEBMP_DLLPRIVATE virtual void drawMaskedColor_i( Color rSrcColor,
632 const BitmapDeviceSharedPtr& rAlphaMask,
633 const basegfx::B2IBox& rSrcRect,
634 const basegfx::B2IPoint& rDstPoint,
635 const BitmapDeviceSharedPtr& rClip ) = 0;
637 // must work with *this == rSrcBitmap!
638 BASEBMP_DLLPRIVATE virtual void drawMaskedBitmap_i( const BitmapDeviceSharedPtr& rSrcBitmap,
639 const BitmapDeviceSharedPtr& rMask,
640 const basegfx::B2IBox& rSrcRect,
641 const basegfx::B2IBox& rDstRect,
642 DrawMode drawMode ) = 0;
643 BASEBMP_DLLPRIVATE virtual void drawMaskedBitmap_i( const BitmapDeviceSharedPtr& rSrcBitmap,
644 const BitmapDeviceSharedPtr& rMask,
645 const basegfx::B2IBox& rSrcRect,
646 const basegfx::B2IBox& rDstRect,
647 DrawMode drawMode,
648 const BitmapDeviceSharedPtr& rClip ) = 0;
650 BASEBMP_DLLPRIVATE virtual IBitmapDeviceDamageTrackerSharedPtr getDamageTracker_i() const = 0;
651 BASEBMP_DLLPRIVATE virtual void setDamageTracker_i( const IBitmapDeviceDamageTrackerSharedPtr& rDamage ) = 0;
653 BitmapDeviceSharedPtr getGenericRenderer() const;
655 boost::scoped_ptr< ImplBitmapDevice > mpImpl;
658 /** Function to create a BitmapDevice for given scanline format
660 BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC createBitmapDevice( const basegfx::B2IVector& rSize,
661 bool bTopDown,
662 sal_Int32 nScanlineFormat );
664 /** Function to create a BitmapDevice for given scanline format
665 with the given palette
667 Note: the provided palette must have sufficient size, to satisfy
668 lookups for the whole range of pixel values from the specified
669 format.
671 BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC createBitmapDevice( const basegfx::B2IVector& rSize,
672 bool bTopDown,
673 sal_Int32 nScanlineFormat,
674 const PaletteMemorySharedVector& rPalette );
676 /** Function to create a BitmapDevice for given scanline format
677 from the given piece of raw memory and palette
679 Note: the provided memory must have sufficient size, to store the
680 image of the specified area and format.
682 BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC createBitmapDevice( const basegfx::B2IVector& rSize,
683 bool bTopDown,
684 sal_Int32 nScanlineFormat,
685 const RawMemorySharedArray& rMem,
686 const PaletteMemorySharedVector& rPalette );
689 /** Function to retrieve a subsetted BitmapDevice to the same
690 memory.
692 Note that there is no coordinate system translation or offsetting
693 involved.
695 This method creates a second bitmap device instance, which renders
696 to the same memory as the original, with the same pixel coordinate
697 pairs refering to the same pixels in the memory buffer, but with
698 rendering clipped to a rectangular area. Useful to implement
699 rectangular clips (usually faster than setting up a 1bpp clip
700 mask).
703 BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC subsetBitmapDevice( const BitmapDeviceSharedPtr& rProto,
704 const basegfx::B2IBox& rSubset );
706 /** Function to clone a BitmapDevice from a given prototype.
708 All attributes (like scanline format and top-down state) are
709 copied, only the size can be varied. Note that the prototype's
710 bitmap content is <em>not</em> copied, only a palette (if any).
712 BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC cloneBitmapDevice( const basegfx::B2IVector& rSize,
713 const BitmapDeviceSharedPtr& rProto );
717 #endif /* INCLUDED_BASEBMP_BITMAPDEVICE_HXX */
719 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */