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