BitmapEx Class Reference

#include <bitmapex.hxx>

Collaboration diagram for BitmapEx:

Collaboration graph
[legend]

List of all members.

Public Member Functions

SAL_DLLPRIVATE ImpBitmapImplGetBitmapImpBitmap () const
SAL_DLLPRIVATE ImpBitmapImplGetMaskImpBitmap () const
 BitmapEx ()
 BitmapEx (const ResId &rResId)
 BitmapEx (const BitmapEx &rBitmapEx)
 BitmapEx (const BitmapEx &rBitmapEx, Point aSrc, Size aSize)
 BitmapEx (const Bitmap &rBmp)
 BitmapEx (const Bitmap &rBmp, const Bitmap &rMask)
 BitmapEx (const Bitmap &rBmp, const AlphaMask &rAlphaMask)
 BitmapEx (const Bitmap &rBmp, const Color &rTransparentColor)
 ~BitmapEx ()
BitmapExoperator= (const BitmapEx &rBitmapEx)
BOOL operator== (const BitmapEx &rBitmapEx) const
BOOL operator!= (const BitmapEx &rBitmapEx) const
BOOL operator! () const
BOOL IsEqual (const BitmapEx &rBmpEx) const
BOOL IsEmpty () const
void SetEmpty ()
void Clear ()
void Draw (OutputDevice *pOutDev, const Point &rDestPt) const
void Draw (OutputDevice *pOutDev, const Point &rDestPt, const Size &rDestSize) const
void Draw (OutputDevice *pOutDev, const Point &rDestPt, const Size &rDestSize, const Point &rSrcPtPixel, const Size &rSrcSizePixel) const
BOOL IsTransparent () const
TransparentType GetTransparentType () const
Bitmap GetBitmap (const Color *pTransReplaceColor=NULL) const
Bitmap GetMask () const
BitmapEx GetColorTransformedBitmapEx (BmpColorMode eColorMode) const
BOOL IsAlpha () const
AlphaMask GetAlpha () const
const Size & GetSizePixel () const
void SetSizePixel (const Size &rNewSize)
const Size & GetPrefSize () const
void SetPrefSize (const Size &rPrefSize)
const MapModeGetPrefMapMode () const
void SetPrefMapMode (const MapMode &rPrefMapMode)
const Color & GetTransparentColor () const
void SetTransparentColor (const Color &rColor)
USHORT GetBitCount () const
ULONG GetSizeBytes () const
ULONG GetChecksum () const
BOOL Convert (BmpConversion eConversion)
 Convert bitmap format.
BOOL ReduceColors (USHORT nNewColorCount, BmpReduce eReduce=BMP_REDUCE_SIMPLE)
 Reduce number of colors for the bitmap.
BOOL Dither (ULONG nDitherFlags=BMP_DITHER_MATRIX)
 Apply a dither algorithm to the bitmap.
BOOL Crop (const Rectangle &rRectPixel)
 Crop the bitmap.
BOOL Expand (ULONG nDX, ULONG nDY, const Color *pInitColor=NULL, BOOL bExpandTransparent=FALSE)
 Expand the bitmap by pixel padding.
BOOL CopyPixel (const Rectangle &rRectDst, const Rectangle &rRectSrc, const BitmapEx *pBmpExSrc=NULL)
 Copy a rectangular area from another bitmap.
BOOL Erase (const Color &rFillColor)
 Fill the entire bitmap with the given color.
BOOL Invert ()
 Perform the Invert operation on every pixel.
BOOL Mirror (ULONG nMirrorFlags)
 Mirror the bitmap.
BOOL Scale (const Size &rNewSize, ULONG nScaleFlag=BMP_SCALE_FAST)
 Scale the bitmap.
BOOL Scale (const double &rScaleX, const double &rScaleY, ULONG nScaleFlag=BMP_SCALE_FAST)
 Scale the bitmap.
BOOL Rotate (long nAngle10, const Color &rFillColor)
 Rotate bitmap by the specified angle.
BOOL Replace (const Color &rSearchColor, const Color &rReplaceColor, ULONG nTol=0)
 Replace all pixel having the search color with the specified color.
BOOL Replace (const Color *pSearchColors, const Color *pReplaceColors, ULONG nColorCount, const ULONG *pTols=NULL)
 Replace all pixel having one the search colors with the corresponding replace color.
BOOL Adjust (short nLuminancePercent=0, short nContrastPercent=0, short nChannelRPercent=0, short nChannelGPercent=0, short nChannelBPercent=0, double fGamma=1.0, BOOL bInvert=FALSE)
 Change various global color characteristics.
BOOL Filter (BmpFilter eFilter, const BmpFilterParam *pFilterParam=NULL, const Link *pProgress=NULL)
 Apply specified filter to the bitmap.
sal_uInt8 GetTransparency (sal_Int32 nX, sal_Int32 nY) const
 Get transparency at given position.

Static Public Member Functions

static BitmapEx AutoScaleBitmap (BitmapEx &aBitmap, const long aStandardSize)

Private Attributes

Bitmap aBitmap
Bitmap aMask
Size aBitmapSize
Color aTransparentColor
TransparentType eTransparent
BOOL bAlpha

Friends

class ImpGraphic
VCL_DLLPUBLIC SvStream & operator<< (SvStream &rOStm, const BitmapEx &rBitmapEx)
VCL_DLLPUBLIC SvStream & operator>> (SvStream &rIStm, BitmapEx &rBitmapEx)


Detailed Description

Definition at line 51 of file bitmapex.hxx.


Constructor & Destructor Documentation

BitmapEx::BitmapEx (  ) 

Definition at line 54 of file bitmapex.cxx.

Referenced by operator>>().

BitmapEx::BitmapEx ( const ResId &  rResId  ) 

BitmapEx::BitmapEx ( const BitmapEx rBitmapEx  ) 

Definition at line 62 of file bitmapex.cxx.

BitmapEx::BitmapEx ( const BitmapEx rBitmapEx,
Point  aSrc,
Size  aSize 
)

BitmapEx::BitmapEx ( const Bitmap rBmp  ) 

Definition at line 121 of file bitmapex.cxx.

BitmapEx::BitmapEx ( const Bitmap rBmp,
const Bitmap rMask 
)

BitmapEx::BitmapEx ( const Bitmap rBmp,
const AlphaMask rAlphaMask 
)

BitmapEx::BitmapEx ( const Bitmap rBmp,
const Color &  rTransparentColor 
)

BitmapEx::~BitmapEx (  ) 

Definition at line 185 of file bitmapex.cxx.


Member Function Documentation

SAL_DLLPRIVATE ImpBitmap* BitmapEx::ImplGetBitmapImpBitmap (  )  const [inline]

SAL_DLLPRIVATE ImpBitmap* BitmapEx::ImplGetMaskImpBitmap (  )  const [inline]

Definition at line 69 of file bitmapex.hxx.

Referenced by OutputDevice::ImplDrawBitmapEx().

BitmapEx & BitmapEx::operator= ( const BitmapEx rBitmapEx  ) 

Definition at line 193 of file bitmapex.cxx.

References aBitmap, aBitmapSize, aMask, aTransparentColor, bAlpha, and eTransparent.

BOOL BitmapEx::operator== ( const BitmapEx rBitmapEx  )  const

BOOL BitmapEx::operator!= ( const BitmapEx rBitmapEx  )  const [inline]

Definition at line 87 of file bitmapex.hxx.

BOOL BitmapEx::operator! (  )  const [inline]

Definition at line 88 of file bitmapex.hxx.

BOOL BitmapEx::IsEqual ( const BitmapEx rBmpEx  )  const

BOOL BitmapEx::IsEmpty (  )  const

void BitmapEx::SetEmpty (  ) 

void BitmapEx::Clear (  ) 

Definition at line 259 of file bitmapex.cxx.

References SetEmpty().

Referenced by vcl::PNGReaderImpl::GetBitmapEx(), and ImpGraphic::ImplClearGraphics().

void BitmapEx::Draw ( OutputDevice pOutDev,
const Point &  rDestPt 
) const

void BitmapEx::Draw ( OutputDevice pOutDev,
const Point &  rDestPt,
const Size &  rDestSize 
) const

Definition at line 746 of file bitmapex.cxx.

References OutputDevice::DrawBitmapEx().

void BitmapEx::Draw ( OutputDevice pOutDev,
const Point &  rDestPt,
const Size &  rDestSize,
const Point &  rSrcPtPixel,
const Size &  rSrcSizePixel 
) const

Definition at line 754 of file bitmapex.cxx.

References OutputDevice::DrawBitmapEx().

BOOL BitmapEx::IsTransparent (  )  const

TransparentType BitmapEx::GetTransparentType (  )  const [inline]

Bitmap BitmapEx::GetBitmap ( const Color *  pTransReplaceColor = NULL  )  const

Bitmap BitmapEx::GetMask (  )  const

BitmapEx BitmapEx::GetColorTransformedBitmapEx ( BmpColorMode  eColorMode  )  const

BOOL BitmapEx::IsAlpha (  )  const

AlphaMask BitmapEx::GetAlpha (  )  const

const Size& BitmapEx::GetSizePixel (  )  const [inline]

void BitmapEx::SetSizePixel ( const Size &  rNewSize  ) 

Definition at line 394 of file bitmapex.cxx.

References Scale().

const Size& BitmapEx::GetPrefSize (  )  const [inline]

void BitmapEx::SetPrefSize ( const Size &  rPrefSize  )  [inline]

const MapMode& BitmapEx::GetPrefMapMode (  )  const [inline]

void BitmapEx::SetPrefMapMode ( const MapMode rPrefMapMode  )  [inline]

const Color& BitmapEx::GetTransparentColor (  )  const [inline]

Definition at line 124 of file bitmapex.hxx.

Referenced by vcl::PDFWriterImpl::writeBitmapObject().

void BitmapEx::SetTransparentColor ( const Color &  rColor  )  [inline]

Definition at line 125 of file bitmapex.hxx.

USHORT BitmapEx::GetBitCount (  )  const [inline]

Definition at line 127 of file bitmapex.hxx.

Referenced by vcl::PDFWriterImpl::createBitmapEmit().

ULONG BitmapEx::GetSizeBytes (  )  const

ULONG BitmapEx::GetChecksum (  )  const

BOOL BitmapEx::Convert ( BmpConversion  eConversion  ) 

Convert bitmap format.

Parameters:
eConversion The format this bitmap should be converted to.
Returns:
TRUE, if the conversion was completed successfully.

Definition at line 543 of file bitmapex.cxx.

References aBitmap, and Bitmap::Convert().

Referenced by Animation::Convert(), GDIMetaFile::ImplBmpConvertFnc(), and OutputDevice::ImplDrawBitmapEx().

BOOL BitmapEx::ReduceColors ( USHORT  nNewColorCount,
BmpReduce  eReduce = BMP_REDUCE_SIMPLE 
)

Reduce number of colors for the bitmap.

Parameters:
nNewColorCount Maximal number of bitmap colors after the reduce operation
eReduce Algorithm to use for color reduction
Returns:
TRUE, if the color reduction operation was completed successfully.

Definition at line 550 of file bitmapex.cxx.

References aBitmap, and Bitmap::ReduceColors().

Referenced by Animation::ReduceColors().

BOOL BitmapEx::Dither ( ULONG  nDitherFlags = BMP_DITHER_MATRIX  ) 

Apply a dither algorithm to the bitmap.

This method dithers the bitmap inplace, i.e. a true color bitmap is converted to a paletted bitmap, reducing the color deviation by error diffusion.

Parameters:
nDitherFlags The algorithm to be used for dithering

Definition at line 700 of file bitmapex.cxx.

References aBitmap, and Bitmap::Dither().

Referenced by Animation::Dither().

BOOL BitmapEx::Crop ( const Rectangle &  rRectPixel  ) 

Crop the bitmap.

Parameters:
rRectPixel A rectangle specifying the crop amounts on all four sides of the bitmap. If the upper left corner of the bitmap is assigned (0,0), then this method cuts out the given rectangle from the bitmap. Note that the rectangle is clipped to the bitmap's dimension, i.e. negative left,top rectangle coordinates or exceeding width or height is ignored.
Returns:
TRUE, if cropping was performed successfully. If nothing had to be cropped, because e.g. the crop rectangle included the bitmap, FALSE is returned, too!

Definition at line 521 of file bitmapex.cxx.

References aBitmap, aBitmapSize, aMask, Bitmap::Crop(), eTransparent, Bitmap::GetSizePixel(), and TRANSPARENT_BITMAP.

Referenced by ImplImageBmp::Draw(), vcl::PDFWriter::DrawBitmapEx(), and OutputDevice::GetDownsampledBitmapEx().

BOOL BitmapEx::Expand ( ULONG  nDX,
ULONG  nDY,
const Color *  pInitColor = NULL,
BOOL  bExpandTransparent = FALSE 
)

Expand the bitmap by pixel padding.

Parameters:
nDX Number of pixel to pad at the right border of the bitmap
nDY Number of scanlines to pad at the bottom border of the bitmap
pInitColor Color to use for padded pixel
Returns:
TRUE, if padding was performed successfully. FALSE is not only returned when the operation failed, but also if nothing had to be done, e.g. because nDX and nDY were zero.

Definition at line 557 of file bitmapex.cxx.

References aBitmap, aBitmapSize, aMask, eTransparent, Bitmap::Expand(), Bitmap::GetSizePixel(), and TRANSPARENT_BITMAP.

Referenced by ImplImageBmp::Expand().

BOOL BitmapEx::CopyPixel ( const Rectangle &  rRectDst,
const Rectangle &  rRectSrc,
const BitmapEx pBmpExSrc = NULL 
)

Copy a rectangular area from another bitmap.

Parameters:
rRectDst Destination rectangle in this bitmap. This is clipped to the bitmap dimensions.
rRectSrc Source rectangle in pBmpSrc. This is clipped to the source bitmap dimensions. Note further that no scaling takes place during this copy operation, i.e. only the minimum of source and destination rectangle's width and height are used.
pBmpSrc The source bitmap to copy from. If this argument is NULL, or equal to the object this method is called on, copying takes place within the same bitmap.
Returns:
TRUE, if the operation completed successfully. FALSE is not only returned when the operation failed, but also if nothing had to be done, e.g. because one of the rectangles are empty.

Definition at line 582 of file bitmapex.cxx.

References aBitmap, aMask, bAlpha, Bitmap::CopyPixel(), Bitmap::Erase(), eTransparent, GetSizePixel(), AlphaMask::ImplGetBitmap(), IsAlpha(), Bitmap::IsEmpty(), IsEmpty(), IsTransparent(), and TRANSPARENT_BITMAP.

Referenced by BitmapEx(), ImageList::GetAsHorizontalStrip(), and ImplImageBmp::Replace().

BOOL BitmapEx::Erase ( const Color &  rFillColor  ) 

Fill the entire bitmap with the given color.

Parameters:
rFillColor Color value to use for filling. Set the transparency part of the color to fill the mask.
Returns:
TRUE, if the operation was completed successfully.

Definition at line 671 of file bitmapex.cxx.

References aBitmap, aMask, Bitmap::Erase(), eTransparent, and TRANSPARENT_BITMAP.

BOOL BitmapEx::Invert (  ) 

Perform the Invert operation on every pixel.

Returns:
TRUE, if the operation was completed successfully.

Definition at line 401 of file bitmapex.cxx.

References aBitmap, aTransparentColor, eTransparent, Bitmap::Invert(), and TRANSPARENT_COLOR.

Referenced by ImplImageBmp::Invert(), Image::Invert(), and Animation::Invert().

BOOL BitmapEx::Mirror ( ULONG  nMirrorFlags  ) 

Mirror the bitmap.

Parameters:
nMirrorFlags About which axis (horizontal, vertical, or both) to mirror
Returns:
TRUE, if the operation was completed successfully.

Definition at line 418 of file bitmapex.cxx.

References aBitmap, aMask, eTransparent, Bitmap::Mirror(), and TRANSPARENT_BITMAP.

Referenced by OutputDevice::ImplDrawBitmapEx(), and Animation::Mirror().

BOOL BitmapEx::Scale ( const Size &  rNewSize,
ULONG  nScaleFlag = BMP_SCALE_FAST 
)

Scale the bitmap.

Parameters:
rNewSize The resulting size of the scaled bitmap
nScaleFlag The algorithm to be used for scaling
Returns:
TRUE, if the operation was completed successfully.

Definition at line 457 of file bitmapex.cxx.

References aBitmapSize.

Referenced by AutoScaleBitmap(), OutputDevice::GetDownsampledBitmapEx(), OutputDevice::ImplDrawBitmapWallpaper(), ImpGraphic::ImplGetBitmapEx(), and SetSizePixel().

BOOL BitmapEx::Scale ( const double &  rScaleX,
const double &  rScaleY,
ULONG  nScaleFlag = BMP_SCALE_FAST 
)

Scale the bitmap.

Parameters:
rScaleX The scale factor in x direction.
rScaleY The scale factor in y direction.
Returns:
TRUE, if the operation was completed successfully.

Definition at line 435 of file bitmapex.cxx.

References aBitmap, aBitmapSize, aMask, BMP_SCALE_FAST, eTransparent, Bitmap::GetSizePixel(), Bitmap::Scale(), and TRANSPARENT_BITMAP.

BOOL BitmapEx::Rotate ( long  nAngle10,
const Color &  rFillColor 
)

Rotate bitmap by the specified angle.

Parameters:
nAngle10 The rotation angle in tenth of a degree. The bitmap is always rotated around its center.
rFillColor The color to use for filling blank areas. During rotation, the bitmap is enlarged such that the whole rotation result fits in. The empty spaces around that rotated original bitmap are then filled with this color.
Returns:
TRUE, if the operation was completed successfully.

Definition at line 475 of file bitmapex.cxx.

References aBitmap, aBitmapSize, aMask, aTransparentColor, Bitmap::Erase(), eTransparent, Bitmap::GetSizePixel(), Bitmap::Rotate(), TRANSPARENT_BITMAP, TRANSPARENT_COLOR, and TRANSPARENT_NONE.

BOOL BitmapEx::Replace ( const Color &  rSearchColor,
const Color &  rReplaceColor,
ULONG  nTol = 0 
)

Replace all pixel having the search color with the specified color.

Parameters:
rSearchColor Color specifying which pixel should be replaced
rReplaceColor Color to be placed in all changed pixel
nTol Tolerance value. Specifies the maximal difference between rSearchColor and the individual pixel values, such that the corresponding pixel is still regarded a match.
Returns:
TRUE, if the operation was completed successfully.

Definition at line 707 of file bitmapex.cxx.

References aBitmap, and Bitmap::Replace().

Referenced by Image::GetColorTransformedImage(), GDIMetaFile::ImplBmpReplaceFnc(), ImageList::InsertFromHorizontalBitmap(), and ImplImageBmp::ReplaceColors().

BOOL BitmapEx::Replace ( const Color *  pSearchColors,
const Color *  pReplaceColors,
ULONG  nColorCount,
const ULONG *  pTols = NULL 
)

Replace all pixel having one the search colors with the corresponding replace color.

Parameters:
pSearchColor Array of colors specifying which pixel should be replaced
pReplaceColor Array of colors to be placed in all changed pixel
nColorCount Size of the aforementioned color arrays
nTol Tolerance value. Specifies the maximal difference between pSearchColor colors and the individual pixel values, such that the corresponding pixel is still regarded a match.
Returns:
TRUE, if the operation was completed successfully.

Definition at line 714 of file bitmapex.cxx.

References aBitmap, and Bitmap::Replace().

BOOL BitmapEx::Adjust ( short  nLuminancePercent = 0,
short  nContrastPercent = 0,
short  nChannelRPercent = 0,
short  nChannelGPercent = 0,
short  nChannelBPercent = 0,
double  fGamma = 1.0,
BOOL  bInvert = FALSE 
)

Change various global color characteristics.

Parameters:
nLuminancePercent Percent of luminance change, valid range [-100,100]. Values outside this range are clipped to the valid range.
nContrastPercent Percent of contrast change, valid range [-100,100]. Values outside this range are clipped to the valid range.
nChannelRPercent Percent of red channel change, valid range [-100,100]. Values outside this range are clipped to the valid range.
nChannelGPercent Percent of green channel change, valid range [-100,100]. Values outside this range are clipped to the valid range.
nChannelBPercent Percent of blue channel change, valid range [-100,100]. Values outside this range are clipped to the valid range.
fGamma Exponent of the gamma function applied to the bitmap. The value 1.0 results in no change, the valid range is (0.0,10.0]. Values outside this range are regarded as 1.0.
bInvert If TRUE, invert the channel values with the logical 'not' operator
Returns:
TRUE, if the operation was completed successfully.

Definition at line 721 of file bitmapex.cxx.

References aBitmap, and Bitmap::Adjust().

Referenced by Animation::Adjust(), and GDIMetaFile::ImplBmpAdjustFnc().

BOOL BitmapEx::Filter ( BmpFilter  eFilter,
const BmpFilterParam pFilterParam = NULL,
const Link *  pProgress = NULL 
)

Apply specified filter to the bitmap.

Parameters:
eFilter The filter algorithm to apply
pFilterParam Various parameter for the different bitmap filter algorithms
pProgress A callback for showing the progress of the vectorization
Returns:
TRUE, if the operation was completed successfully.

Definition at line 732 of file bitmapex.cxx.

References aBitmap, and Bitmap::Filter().

Referenced by Animation::Filter().

sal_uInt8 BitmapEx::GetTransparency ( sal_Int32  nX,
sal_Int32  nY 
) const

Get transparency at given position.

Parameters:
nX integer X-Position in Bitmap
nY integer Y-Position in Bitmap
Returns:
transparency value in the range of [0 .. 255] where 0 is not transparent, 255 is fully transparent

Definition at line 818 of file bitmapex.cxx.

References aBitmap, aBitmapSize, Bitmap::AcquireReadAccess(), aMask, aTransparentColor, bAlpha, eTransparent, BitmapReadAccess::GetColor(), BitmapReadAccess::GetPixel(), Bitmap::IsEmpty(), Bitmap::ReleaseAccess(), TRANSPARENT_BITMAP, TRANSPARENT_COLOR, and TRANSPARENT_NONE.

BitmapEx BitmapEx::AutoScaleBitmap ( BitmapEx aBitmap,
const long  aStandardSize 
) [static]


Friends And Related Function Documentation

friend class ImpGraphic [friend]

Definition at line 53 of file bitmapex.hxx.

VCL_DLLPUBLIC SvStream& operator<< ( SvStream &  rOStm,
const BitmapEx rBitmapEx 
) [friend]

Definition at line 890 of file bitmapex.cxx.

VCL_DLLPUBLIC SvStream& operator>> ( SvStream &  rIStm,
BitmapEx rBitmapEx 
) [friend]

Definition at line 908 of file bitmapex.cxx.


Member Data Documentation

Size BitmapEx::aBitmapSize [private]

Color BitmapEx::aTransparentColor [private]

BOOL BitmapEx::bAlpha [private]


The documentation for this class was generated from the following files:

Generated on Thu Apr 29 13:58:57 2010 for ooo-build Module vcl (ooo/OOO320_m15) by  doxygen 1.5.6