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