1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_VCL_BITMAP_HXX
21 #define INCLUDED_VCL_BITMAP_HXX
23 #include <boost/math/special_functions/sinc.hpp>
24 #include <tools/color.hxx>
25 #include <tools/link.hxx>
26 #include <tools/solar.h>
27 #include <vcl/checksum.hxx>
28 #include <vcl/dllapi.h>
29 #include <vcl/mapmod.hxx>
30 #include <vcl/region.hxx>
31 #include <vcl/scopedbitmapaccess.hxx>
32 #include <o3tl/typed_flags_set.hxx>
34 enum class BmpMirrorFlags
42 template<> struct typed_flags
<BmpMirrorFlags
> : is_typed_flags
<BmpMirrorFlags
, 0x03> {};
46 enum class BmpScaleFlag
49 // Try to preferably use these.
53 // Specific algorithms, use only if you really need to.
63 enum class BmpDitherFlags
72 template<> struct typed_flags
<BmpDitherFlags
> : is_typed_flags
<BmpDitherFlags
, 0x07> {};
75 enum class BmpVectorizeFlags
84 template<> struct typed_flags
<BmpVectorizeFlags
> : is_typed_flags
<BmpVectorizeFlags
, 0x0f> {};
87 #define BMP_COL_TRANS Color( 252, 3, 251 )
91 BMP_CONVERSION_NONE
= 0,
92 BMP_CONVERSION_1BIT_THRESHOLD
= 1,
93 BMP_CONVERSION_1BIT_MATRIX
= 2,
94 BMP_CONVERSION_4BIT_GREYS
= 3,
95 BMP_CONVERSION_4BIT_COLORS
= 4,
96 BMP_CONVERSION_8BIT_GREYS
= 5,
97 BMP_CONVERSION_8BIT_COLORS
= 6,
98 BMP_CONVERSION_24BIT
= 7,
99 BMP_CONVERSION_4BIT_TRANS
= 8,
100 BMP_CONVERSION_8BIT_TRANS
= 9,
101 BMP_CONVERSION_GHOSTED
= 10
106 BMP_COMBINE_COPY
= 0,
107 BMP_COMBINE_INVERT
= 1,
109 BMP_COMBINE_NAND
= 3,
118 BMP_REDUCE_SIMPLE
= 0,
119 BMP_REDUCE_POPULAR
= 1,
120 BMP_REDUCE_MEDIAN
= 2
125 BMP_EMBOSS_TOPLEFT
= 0,
127 BMP_EMBOSS_TOPRIGHT
= 2,
129 BMP_EMBOSS_MIDDLE
= 4,
130 BMP_EMBOSS_RIGHT
= 5,
131 BMP_EMBOSS_BOTTOMLEFT
= 6,
132 BMP_EMBOSS_BOTTOM
= 7,
133 BMP_EMBOSS_BOTTOMRIGHT
= 8
138 BMP_FILTER_SMOOTH
= 0,
139 BMP_FILTER_SHARPEN
= 1,
140 BMP_FILTER_REMOVENOISE
= 2,
141 BMP_FILTER_SOBEL_GREY
= 3,
142 BMP_FILTER_EMBOSS_GREY
= 4,
143 BMP_FILTER_SOLARIZE
= 5,
144 BMP_FILTER_SEPIA
= 6,
145 BMP_FILTER_MOSAIC
= 7,
146 BMP_FILTER_POPART
= 8,
147 BMP_FILTER_DUOTONE
= 9,
149 BMP_FILTER_UNKNOWN
= 65535
152 class VCL_DLLPUBLIC BmpFilterParam
156 BmpFilterParam( sal_uLong nProgressStart
= 0, sal_uLong nProgressEnd
= 0 ) :
157 meFilter( BMP_FILTER_UNKNOWN
), mnProgressStart( nProgressStart
), mnProgressEnd( nProgressEnd
) {}
159 BmpFilterParam( sal_uInt8 cSolarGreyThreshold
, sal_uLong nProgressStart
= 0, sal_uLong nProgressEnd
= 0 ) :
160 meFilter( BMP_FILTER_SOLARIZE
), mnProgressStart( nProgressStart
), mnProgressEnd( nProgressEnd
),
161 mcSolarGreyThreshold( cSolarGreyThreshold
) {}
163 BmpFilterParam( double nRadius
, sal_uLong nProgressStart
= 0, sal_uLong nProgressEnd
= 0 ) :
164 meFilter( BMP_FILTER_SMOOTH
), mnProgressStart( nProgressStart
), mnProgressEnd( nProgressEnd
),
165 mnRadius( nRadius
) {}
167 BmpFilterParam( sal_uInt16 nSepiaPercent
, sal_uLong nProgressStart
= 0, sal_uLong nProgressEnd
= 0 ) :
168 meFilter( BMP_FILTER_SEPIA
), mnProgressStart( nProgressStart
), mnProgressEnd( nProgressEnd
),
169 mnSepiaPercent( nSepiaPercent
) {}
171 BmpFilterParam( const Size
& rMosaicTileSize
, sal_uLong nProgressStart
= 0, sal_uLong nProgressEnd
= 0 ) :
172 meFilter( BMP_FILTER_MOSAIC
), mnProgressStart( nProgressStart
), mnProgressEnd( nProgressEnd
)
174 maMosaicTileSize
.mnTileWidth
= rMosaicTileSize
.Width();
175 maMosaicTileSize
.mnTileHeight
= rMosaicTileSize
.Height();
177 BmpFilterParam( sal_uInt16 nEmbossAzimuthAngle100
, sal_uInt16 nEmbossElevationAngle100
,
178 sal_uLong nProgressStart
= 0, sal_uLong nProgressEnd
= 0 ) :
179 meFilter( BMP_FILTER_EMBOSS_GREY
), mnProgressStart( nProgressStart
), mnProgressEnd( nProgressEnd
)
181 maEmbossAngles
.mnAzimuthAngle100
= nEmbossAzimuthAngle100
;
182 maEmbossAngles
.mnElevationAngle100
= nEmbossElevationAngle100
;
186 friend class ::Bitmap
;
187 friend class BitmapEx
;
188 friend class Animation
;
192 sal_uLong mnProgressStart
;
193 sal_uLong mnProgressEnd
;
196 struct MosaicTileSize
198 sal_uLong mnTileWidth
;
199 sal_uLong mnTileHeight
;
204 sal_uInt16 mnAzimuthAngle100
;
205 sal_uInt16 mnElevationAngle100
;
211 sal_uInt16 mnSepiaPercent
;
212 sal_uInt8 mcSolarGreyThreshold
;
215 MosaicTileSize maMosaicTileSize
;
216 EmbossAngles maEmbossAngles
;
230 virtual double GetWidth() const = 0;
231 virtual double Calculate( double x
) const = 0;
234 class Lanczos3Kernel
: public Kernel
237 Lanczos3Kernel() : Kernel () {}
239 virtual double GetWidth() const SAL_OVERRIDE
{ return 3.0; }
240 virtual double Calculate (double x
) const SAL_OVERRIDE
242 return (-3.0 <= x
&& x
< 3.0) ? SincFilter(x
) * SincFilter( x
/ 3.0 ) : 0.0;
245 static inline double SincFilter(double x
)
252 return boost::math::sinc_pi(x
, SincPolicy());
256 typedef boost::math::policies::policy
<
257 boost::math::policies::promote_double
<false> > SincPolicy
;
260 class BicubicKernel
: public Kernel
263 BicubicKernel() : Kernel () {}
266 virtual double GetWidth() const SAL_OVERRIDE
{ return 2.0; }
267 virtual double Calculate (double x
) const SAL_OVERRIDE
276 return (1.5 * x
- 2.5) * x
* x
+ 1.0;
280 return ((-0.5 * x
+ 2.5) * x
- 4) * x
+ 2;
286 class BilinearKernel
: public Kernel
289 BilinearKernel() : Kernel () {}
291 virtual double GetWidth() const SAL_OVERRIDE
{ return 1.0; }
292 virtual double Calculate (double x
) const SAL_OVERRIDE
306 class BoxKernel
: public Kernel
309 BoxKernel() : Kernel () {}
312 virtual double GetWidth() const SAL_OVERRIDE
{ return 0.5; }
313 virtual double Calculate (double x
) const SAL_OVERRIDE
315 if (-0.5 <= x
&& x
< 0.5)
321 class BitmapInfoAccess
;
322 class BitmapReadAccess
;
323 class BitmapWriteAccess
;
333 struct BitmapSystemData
336 void* pDIB
; // device independent byte buffer
337 void* pDDB
; // if not NULL then this is actually an HBITMAP
338 #elif defined( MACOSX ) || defined( IOS )
339 void* rImageContext
; //Image context (CGContextRef)
347 class VCL_DLLPUBLIC Bitmap
352 Bitmap( const Bitmap
& rBitmap
);
353 Bitmap( const Size
& rSizePixel
, sal_uInt16 nBitCount
, const BitmapPalette
* pPal
= NULL
);
354 Bitmap( const ResId
& rResId
);
355 Bitmap( SalBitmap
* pSalBitmap
);
358 Bitmap
& operator=( const Bitmap
& rBitmap
);
359 inline bool operator!() const;
360 inline bool operator==( const Bitmap
& rBitmap
) const;
361 inline bool operator!=( const Bitmap
& rBitmap
) const;
363 inline bool IsSameInstance( const Bitmap
& rBmp
) const;
364 bool IsEqual( const Bitmap
& rBmp
) const;
366 inline bool IsEmpty() const;
369 inline const MapMode
& GetPrefMapMode() const;
370 inline void SetPrefMapMode( const MapMode
& rMapMode
);
372 inline const Size
& GetPrefSize() const;
373 inline void SetPrefSize( const Size
& rSize
);
375 Size
GetSizePixel() const;
377 sal_uInt16
GetBitCount() const;
378 inline sal_uLong
GetColorCount() const;
379 inline sal_uLong
GetSizeBytes() const;
380 bool HasGreyPalette() const;
381 /** get system dependent bitmap data
384 The system dependent BitmapSystemData structure to be filled
386 @return true if the bitmap has a valid system object (e.g. not empty)
388 bool GetSystemData( BitmapSystemData
& rData
) const;
390 BitmapChecksum
GetChecksum() const;
392 Bitmap
CreateDisplayBitmap( OutputDevice
* pDisplay
);
393 Bitmap
GetColorTransformedBitmap() const;
395 static const BitmapPalette
&
396 GetGreyPalette( int nEntries
);
400 bool MakeMono( sal_uInt8 cThreshold
);
403 /** Convert bitmap format
406 The format this bitmap should be converted to.
408 @return true, if the conversion was completed successfully.
410 bool Convert( BmpConversion eConversion
);
412 /** Reduce number of colors for the bitmap
414 @param nNewColorCount
415 Maximal number of bitmap colors after the reduce operation
418 Algorithm to use for color reduction
420 @return true, if the color reduction operation was completed successfully.
423 sal_uInt16 nNewColorCount
,
424 BmpReduce eReduce
= BMP_REDUCE_SIMPLE
);
426 /** Apply a dither algorithm to the bitmap
428 This method dithers the bitmap inplace, i.e. a true color
429 bitmap is converted to a paletted bitmap, reducing the color
430 deviation by error diffusion.
433 The algorithm to be used for dithering
435 bool Dither( BmpDitherFlags nDitherFlags
= BmpDitherFlags::Matrix
);
440 A rectangle specifying the crop amounts on all four sides of
441 the bitmap. If the upper left corner of the bitmap is assigned
442 (0,0), then this method cuts out the given rectangle from the
443 bitmap. Note that the rectangle is clipped to the bitmap's
444 dimension, i.e. negative left,top rectangle coordinates or
445 exceeding width or height is ignored.
447 @return true, if cropping was performed successfully. If
448 nothing had to be cropped, because e.g. the crop rectangle
449 included the bitmap, false is returned, too!
451 bool Crop( const Rectangle
& rRectPixel
);
453 /** Expand the bitmap by pixel padding
456 Number of pixel to pad at the right border of the bitmap
459 Number of scanlines to pad at the bottom border of the bitmap
462 Color to use for padded pixel
464 @return true, if padding was performed successfully. false is
465 not only returned when the operation failed, but also if
466 nothing had to be done, e.g. because nDX and nDY were zero.
469 sal_uLong nDX
, sal_uLong nDY
,
470 const Color
* pInitColor
= NULL
);
472 /** Copy a rectangular area from another bitmap
475 Destination rectangle in this bitmap. This is clipped to the
479 Source rectangle in pBmpSrc. This is clipped to the source
480 bitmap dimensions. Note further that no scaling takes place
481 during this copy operation, i.e. only the minimum of source
482 and destination rectangle's width and height are used.
485 The source bitmap to copy from. If this argument is NULL, or
486 equal to the object this method is called on, copying takes
487 place within the same bitmap.
489 @return true, if the operation completed successfully. false
490 is not only returned when the operation failed, but also if
491 nothing had to be done, e.g. because one of the rectangles are
495 const Rectangle
& rRectDst
,
496 const Rectangle
& rRectSrc
,
497 const Bitmap
* pBmpSrc
= NULL
);
499 bool CopyPixel_AlphaOptimized(
500 const Rectangle
& rRectDst
,
501 const Rectangle
& rRectSrc
,
502 const Bitmap
* pBmpSrc
= NULL
);
504 /** Perform boolean operations with another bitmap
507 The mask bitmap in the selected combine operation
510 The combine operation to perform on the bitmap
512 @return true, if the operation was completed successfully.
516 BmpCombine eCombine
);
518 /** Alpha-blend the given bitmap against a specified uniform
521 @attention This method might convert paletted bitmaps to
522 truecolor, to be able to represent every necessary color. Note
523 that during alpha blending, lots of colors not originally
524 included in the bitmap can be generated.
527 Alpha mask to blend with
529 @param rBackgroundColor
530 Background color to use for every pixel during alpha blending
532 @return true, if blending was successful, false otherwise
535 const AlphaMask
& rAlpha
,
536 const Color
& rBackgroundColor
);
538 /** Fill the entire bitmap with the given color
541 Color value to use for filling
543 @return true, if the operation was completed successfully.
545 bool Erase( const Color
& rFillColor
);
547 /** Perform the Invert operation on every pixel
549 @return true, if the operation was completed successfully.
553 /** Mirror the bitmap
556 About which axis (horizontal, vertical, or both) to mirror
558 @return true, if the operation was completed successfully.
560 bool Mirror( BmpMirrorFlags nMirrorFlags
);
565 The resulting size of the scaled bitmap
568 The algorithm to be used for scaling
570 @return true, if the operation was completed successfully.
572 bool Scale( const Size
& rNewSize
, BmpScaleFlag nScaleFlag
= BmpScaleFlag::Default
);
577 The scale factor in x direction.
580 The scale factor in y direction.
583 Method of scaling - it is recommended that either BmpScaleFlag::Default or BmpScaleFlag::BestQuality be used.
585 @return true, if the operation was completed successfully.
587 bool Scale( const double& rScaleX
, const double& rScaleY
, BmpScaleFlag nScaleFlag
= BmpScaleFlag::Default
);
590 Returns true if bitmap scaling is considered to be fast.
592 Currently this returns true if OpenGL is used for scaling, otherwise false (CPU scaling is slower).
596 static bool HasFastScale();
598 // Adapt the BitCount of rNew to BitCount of lolal, including grey or color paltette
599 // Can be used to create alpha/mask bitmaps after their processing in 24bit
600 void AdaptBitCount(Bitmap
& rNew
) const;
602 /** Rotate bitmap by the specified angle
605 The rotation angle in tenth of a degree. The bitmap is always rotated around its center.
608 The color to use for filling blank areas. During rotation, the
609 bitmap is enlarged such that the whole rotation result fits
610 in. The empty spaces around that rotated original bitmap are
611 then filled with this color.
613 @return true, if the operation was completed successfully.
615 bool Rotate( long nAngle10
, const Color
& rFillColor
);
617 /** Create on-off mask from bitmap
619 This method creates a bitmask from the bitmap, where every
620 pixel that equals rTransColor is set transparent, the rest
624 Color value where the bitmask should be transparent
627 Tolerance value. Specifies the maximal difference between
628 rTransColor and the individual pixel values, such that the
629 corresponding pixel is still regarded transparent.
631 @return the resulting bitmask.
633 Bitmap
CreateMask( const Color
& rTransColor
, sal_uLong nTol
= 0UL ) const;
635 /** Create region of similar colors in a given rectangle
638 All pixel which have this color are included in the calculated region
641 The rectangle within which matching pixel are looked for. This
642 rectangle is always clipped to the bitmap dimensions.
644 @return the generated region.
646 vcl::Region
CreateRegion( const Color
& rColor
, const Rectangle
& rRect
) const;
648 /** Replace all pixel where the given mask is on with the specified color
651 Mask specifying which pixel should be replaced
654 Color to be placed in all changed pixel
656 @return true, if the operation was completed successfully.
658 bool Replace( const Bitmap
& rMask
, const Color
& rReplaceColor
);
660 /** Merge bitmap with given background color according to specified alpha mask
663 Alpha mask specifying the amount of background color to merge in
666 Background color to be used for merging
668 @return true, if the operation was completed successfully.
670 bool Replace( const AlphaMask
& rAlpha
, const Color
& rMergeColor
);
672 /** Replace all pixel having the search color with the specified color
675 Color specifying which pixel should be replaced
678 Color to be placed in all changed pixel
681 Tolerance value. Specifies the maximal difference between
682 rSearchColor and the individual pixel values, such that the
683 corresponding pixel is still regarded a match.
685 @return true, if the operation was completed successfully.
687 bool Replace( const Color
& rSearchColor
, const Color
& rReplaceColor
, sal_uLong nTol
= 0 );
689 /** Replace all pixel having one the search colors with the corresponding replace color
692 Array of colors specifying which pixel should be replaced
694 @param rReplaceColors
695 Array of colors to be placed in all changed pixel
698 Size of the aforementioned color arrays
701 Tolerance value. Specifies the maximal difference between
702 pSearchColor colors and the individual pixel values, such that
703 the corresponding pixel is still regarded a match.
705 @return true, if the operation was completed successfully.
708 const Color
* pSearchColors
,
709 const Color
* rReplaceColors
,
710 sal_uLong nColorCount
,
711 sal_uLong
* pTols
= NULL
);
713 /** Convert the bitmap to a PolyPolygon
715 This works by putting continuous areas of the same color into
716 a polygon, by tracing its bounding line.
719 The resulting PolyPolygon
722 Whether the inline or the outline of the color areas should be
723 represented by the polygon
726 A callback for showing the progress of the vectorization
728 @return true, if the operation was completed successfully.
731 tools::PolyPolygon
& rPolyPoly
,
732 BmpVectorizeFlags nFlags
= BmpVectorizeFlags::Outer
,
733 const Link
<>* pProgress
= NULL
);
735 /** Convert the bitmap to a meta file
737 This works by putting continuous areas of the same color into
738 polygons painted in this color, by tracing the area's bounding
742 The resulting meta file
745 If non-null, minimal size of bound rects for individual polygons. Smaller ones are ignored.
748 Whether the inline or the outline of the color areas should be
749 represented by the polygon
752 A callback for showing the progress of the vectorization
754 @return true, if the operation was completed successfully.
758 sal_uInt8 cReduce
= 0,
759 BmpVectorizeFlags nFlags
= BmpVectorizeFlags::Inner
,
760 const Link
<>* pProgress
= NULL
);
762 /** Change various global color characteristics
764 @param nLuminancePercent
765 Percent of luminance change, valid range [-100,100]. Values outside this range are clipped to the valid range.
767 @param nContrastPercent
768 Percent of contrast change, valid range [-100,100]. Values outside this range are clipped to the valid range.
770 @param nChannelRPercent
771 Percent of red channel change, valid range [-100,100]. Values outside this range are clipped to the valid range.
773 @param nChannelGPercent
774 Percent of green channel change, valid range [-100,100]. Values outside this range are clipped to the valid range.
776 @param nChannelBPercent
777 Percent of blue channel change, valid range [-100,100]. Values outside this range are clipped to the valid range.
780 Exponent of the gamma function applied to the bitmap. The
781 value 1.0 results in no change, the valid range is
782 (0.0,10.0]. Values outside this range are regarded as 1.0.
785 If true, invert the channel values with the logical 'not' operator
788 Use the same formula for brightness as used by MSOffice.
790 @return true, if the operation was completed successfully.
793 short nLuminancePercent
= 0,
794 short nContrastPercent
= 0,
795 short nChannelRPercent
= 0,
796 short nChannelGPercent
= 0,
797 short nChannelBPercent
= 0,
799 bool bInvert
= false,
800 bool msoBrightness
= false );
802 /** Apply specified filter to the bitmap
805 The filter algorithm to apply
808 Various parameter for the different bitmap filter algorithms
811 A callback for showing the progress of the vectorization
813 @return true, if the operation was completed successfully.
817 const BmpFilterParam
* pFilterParam
= NULL
,
818 const Link
<>* pProgress
= NULL
);
822 SAL_DLLPRIVATE
void ImplReleaseRef();
823 SAL_DLLPRIVATE
void ImplMakeUnique();
824 ImpBitmap
* ImplGetImpBitmap() const { return mpImpBmp
;}
825 SAL_DLLPRIVATE
void ImplSetImpBitmap( ImpBitmap
* pImpBmp
);
826 SAL_DLLPRIVATE
void ImplAssignWithSize( const Bitmap
& rBitmap
);
828 SAL_DLLPRIVATE
void ImplAdaptBitCount(Bitmap
& rNew
) const;
829 SAL_DLLPRIVATE
bool ImplScaleFast( const double& rScaleX
, const double& rScaleY
);
830 SAL_DLLPRIVATE
bool ImplScaleInterpolate( const double& rScaleX
, const double& rScaleY
);
831 SAL_DLLPRIVATE
bool ImplScaleSuper( const double& rScaleX
, const double& rScaleY
);
832 SAL_DLLPRIVATE
bool ImplScaleConvolution( const double& rScaleX
, const double& rScaleY
, const Kernel
& aKernel
);
834 SAL_DLLPRIVATE
bool ImplConvolutionPass(
836 BitmapReadAccess
* pReadAcc
,
837 int aNumberOfContributions
,
842 SAL_DLLPRIVATE
bool ImplMakeMono( sal_uInt8 cThreshold
);
843 SAL_DLLPRIVATE
bool ImplMakeMonoDither();
844 SAL_DLLPRIVATE
bool ImplMakeGreyscales( sal_uInt16 nGreyscales
);
845 SAL_DLLPRIVATE
bool ImplConvertUp( sal_uInt16 nBitCount
, Color
* pExtColor
= NULL
);
846 SAL_DLLPRIVATE
bool ImplConvertDown( sal_uInt16 nBitCount
, Color
* pExtColor
= NULL
);
847 SAL_DLLPRIVATE
bool ImplConvertGhosted();
848 SAL_DLLPRIVATE
bool ImplDitherMatrix();
849 SAL_DLLPRIVATE
bool ImplDitherFloyd();
850 SAL_DLLPRIVATE
bool ImplDitherFloyd16();
851 SAL_DLLPRIVATE
bool ImplReduceSimple( sal_uInt16 nColorCount
);
852 SAL_DLLPRIVATE
bool ImplReducePopular( sal_uInt16 nColorCount
);
853 SAL_DLLPRIVATE
bool ImplReduceMedian( sal_uInt16 nColorCount
);
854 SAL_DLLPRIVATE
void ImplMedianCut(
857 long nR1
, long nR2
, long nG1
, long nG2
, long nB1
, long nB2
,
858 long nColors
, long nPixels
, long& rIndex
);
860 SAL_DLLPRIVATE
bool ImplConvolute3(
861 const long* pMatrix
, long nDivisor
,
862 const BmpFilterParam
* pFilterParam
,
863 const Link
<>* pProgress
);
865 SAL_DLLPRIVATE
bool ImplMedianFilter( const BmpFilterParam
* pFilterParam
, const Link
<>* pProgress
);
866 SAL_DLLPRIVATE
bool ImplSobelGrey( const BmpFilterParam
* pFilterParam
, const Link
<>* pProgress
);
867 SAL_DLLPRIVATE
bool ImplEmbossGrey( const BmpFilterParam
* pFilterParam
, const Link
<>* pProgress
);
868 SAL_DLLPRIVATE
bool ImplSolarize( const BmpFilterParam
* pFilterParam
, const Link
<>* pProgress
);
869 SAL_DLLPRIVATE
bool ImplSepia( const BmpFilterParam
* pFilterParam
, const Link
<>* pProgress
);
870 SAL_DLLPRIVATE
bool ImplMosaic( const BmpFilterParam
* pFilterParam
, const Link
<>* pProgress
);
871 SAL_DLLPRIVATE
bool ImplPopArt( const BmpFilterParam
* pFilterParam
, const Link
<>* pProgress
);
873 SAL_DLLPRIVATE
bool ImplSeparableBlurFilter( const double aRadius
= 0.7 );
874 SAL_DLLPRIVATE
bool ImplSeparableUnsharpenFilter( const double aRadius
= 0.7 );
875 SAL_DLLPRIVATE
bool ImplDuotoneFilter( const sal_uLong nColorOne
, sal_uLong nColorTwo
);
876 SAL_DLLPRIVATE
void ImplBlurContributions(
878 const int aNumberOfContributions
,
886 BitmapInfoAccess
* AcquireInfoAccess();
887 BitmapReadAccess
* AcquireReadAccess();
888 BitmapWriteAccess
* AcquireWriteAccess();
889 static void ReleaseAccess( BitmapInfoAccess
* pAccess
);
891 typedef vcl::ScopedBitmapAccess
<BitmapReadAccess
, Bitmap
, &Bitmap::AcquireReadAccess
> ScopedReadAccess
;
892 typedef vcl::ScopedBitmapAccess
<BitmapWriteAccess
, Bitmap
, &Bitmap::AcquireWriteAccess
> ScopedWriteAccess
;
893 typedef vcl::ScopedBitmapAccess
<BitmapInfoAccess
, Bitmap
, &Bitmap::AcquireInfoAccess
> ScopedInfoAccess
;
898 MapMode maPrefMapMode
;
903 inline bool Bitmap::operator!() const
905 return( mpImpBmp
== NULL
);
908 inline bool Bitmap::operator==( const Bitmap
& rBitmap
) const
910 return( rBitmap
.mpImpBmp
== mpImpBmp
);
913 inline bool Bitmap::operator!=( const Bitmap
& rBitmap
) const
915 return( rBitmap
.mpImpBmp
!= mpImpBmp
);
918 inline bool Bitmap::IsSameInstance( const Bitmap
& rBitmap
) const
920 return( rBitmap
.mpImpBmp
== mpImpBmp
);
923 inline bool Bitmap::IsEmpty() const
925 return( mpImpBmp
== NULL
);
928 inline const MapMode
& Bitmap::GetPrefMapMode() const
930 return maPrefMapMode
;
933 inline void Bitmap::SetPrefMapMode( const MapMode
& rMapMode
)
935 maPrefMapMode
= rMapMode
;
938 inline const Size
& Bitmap::GetPrefSize() const
943 inline void Bitmap::SetPrefSize( const Size
& rSize
)
948 inline sal_uLong
Bitmap::GetColorCount() const
950 return( (sal_uLong
)1 << (sal_uLong
) GetBitCount() );
953 inline sal_uLong
Bitmap::GetSizeBytes() const
955 const Size
aSizePix( GetSizePixel() );
956 return( ( (sal_uLong
) aSizePix
.Width() * aSizePix
.Height() * GetBitCount() ) >> 3UL );
959 #endif // INCLUDED_VCL_BITMAP_HXX
961 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */