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