LibreOffice Module vcl (master)  1
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
Bitmap Class Reference

#include <bitmap.hxx>

Inheritance diagram for Bitmap:
[legend]
Collaboration diagram for Bitmap:
[legend]

Public Types

typedef vcl::ScopedBitmapAccess< BitmapReadAccess, Bitmap,&Bitmap::AcquireReadAccessScopedReadAccess
 
typedef vcl::ScopedBitmapAccess< BitmapInfoAccess, Bitmap,&Bitmap::AcquireInfoAccessScopedInfoAccess
 

Public Member Functions

 Bitmap ()
 
 Bitmap (const Bitmap &rBitmap)
 
 Bitmap (const Size &rSizePixel, sal_uInt16 nBitCount, const BitmapPalette *pPal=nullptr)
 
 Bitmap (std::shared_ptr< SalBitmap > const &xSalBitmap)
 
virtual ~Bitmap ()
 
Bitmapoperator= (const Bitmap &rBitmap)
 
Bitmapoperator= (Bitmap &&rBitmap) noexcept
 
bool operator! () const
 
bool operator== (const Bitmap &rBitmap) const
 
bool operator!= (const Bitmap &rBitmap) const
 
bool IsEmpty () const
 
void SetEmpty ()
 
const MapModeGetPrefMapMode () const
 
void SetPrefMapMode (const MapMode &rMapMode)
 
const SizeGetPrefSize () const
 
void SetPrefSize (const Size &rSize)
 
Size GetSizePixel () const
 
sal_uInt16 GetBitCount () const
 
sal_Int64 GetColorCount () const
 
sal_uLong GetSizeBytes () const
 
bool HasGreyPalette () const
 
bool GetSystemData (BitmapSystemData &rData) const
 get system dependent bitmap data More...
 
BitmapChecksum GetChecksum () const
 
Bitmap CreateDisplayBitmap (OutputDevice *pDisplay)
 
bool Convert (BmpConversion eConversion)
 Convert bitmap format. More...
 
bool Dither ()
 Apply a Floyd dither algorithm to the bitmap. More...
 
bool Crop (const tools::Rectangle &rRectPixel)
 Crop the bitmap. More...
 
bool Expand (sal_uLong nDX, sal_uLong nDY, const Color *pInitColor=nullptr)
 Expand the bitmap by pixel padding. More...
 
bool CopyPixel (const tools::Rectangle &rRectDst, const tools::Rectangle &rRectSrc, const Bitmap *pBmpSrc=nullptr)
 Copy a rectangular area from another bitmap. More...
 
bool CopyPixel_AlphaOptimized (const tools::Rectangle &rRectDst, const tools::Rectangle &rRectSrc, const Bitmap *pBmpSrc)
 
bool CombineSimple (const Bitmap &rMask, BmpCombine eCombine)
 Perform boolean operations with another bitmap. More...
 
bool Blend (const AlphaMask &rAlpha, const Color &rBackgroundColor)
 Alpha-blend the given bitmap against a specified uniform background color. More...
 
bool Erase (const Color &rFillColor)
 Fill the entire bitmap with the given color. More...
 
bool Invert ()
 Perform the Invert operation on every pixel. More...
 
bool Mirror (BmpMirrorFlags nMirrorFlags)
 Mirror the bitmap. More...
 
bool Scale (const Size &rNewSize, BmpScaleFlag nScaleFlag=BmpScaleFlag::Default)
 Scale the bitmap. More...
 
bool Scale (const double &rScaleX, const double &rScaleY, BmpScaleFlag nScaleFlag=BmpScaleFlag::Default)
 Scale the bitmap. More...
 
void AdaptBitCount (Bitmap &rNew) const
 
bool Rotate (long nAngle10, const Color &rFillColor)
 Rotate bitmap by the specified angle. More...
 
Bitmap CreateMask (const Color &rTransColor, sal_uInt8 nTol=0) const
 Create on-off mask from bitmap. More...
 
vcl::Region CreateRegion (const Color &rColor, const tools::Rectangle &rRect) const
 Create region of similar colors in a given rectangle. More...
 
bool Replace (const Bitmap &rMask, const Color &rReplaceColor)
 Replace all pixel where the given mask is on with the specified color. More...
 
bool Replace (const AlphaMask &rAlpha, const Color &rMergeColor)
 Merge bitmap with given background color according to specified alpha mask. More...
 
bool Replace (const Color &rSearchColor, const Color &rReplaceColor, sal_uInt8 nTol=0)
 Replace all pixel having the search color with the specified color. More...
 
bool Replace (const Color *pSearchColors, const Color *rReplaceColors, sal_uLong nColorCount, sal_uInt8 const *pTols)
 Replace all pixel having one the search colors with the corresponding replace color. More...
 
void Vectorize (GDIMetaFile &rMtf, sal_uInt8 cReduce, const Link< long, void > *pProgress)
 Convert the bitmap to a meta file. More...
 
bool Adjust (short nLuminancePercent, short nContrastPercent=0, short nChannelRPercent=0, short nChannelGPercent=0, short nChannelBPercent=0, double fGamma=1.0, bool bInvert=false, bool msoBrightness=false)
 Change various global color characteristics. More...
 
SAL_DLLPRIVATE void ReassignWithSize (const Bitmap &rBitmap)
 ReassignWithSize and recalculate bitmap. More...
 
SAL_DLLPRIVATE void ImplMakeUnique ()
 
const std::shared_ptr< SalBitmap > & ImplGetSalBitmap () const
 
SAL_DLLPRIVATE void ImplSetSalBitmap (const std::shared_ptr< SalBitmap > &xImpBmp)
 
SAL_DLLPRIVATE bool ImplMakeGreyscales (sal_uInt16 nGreyscales)
 
BitmapInfoAccessAcquireInfoAccess ()
 
BitmapReadAccessAcquireReadAccess ()
 
BitmapWriteAccessAcquireWriteAccess ()
 

Static Public Member Functions

static const BitmapPaletteGetGreyPalette (int nEntries)
 
static bool HasFastScale ()
 Returns true if bitmap scaling is considered to be fast. More...
 
static void ReleaseAccess (BitmapInfoAccess *pAccess)
 

Private Member Functions

SAL_DLLPRIVATE bool ImplConvertUp (sal_uInt16 nBitCount, Color const *pExtColor=nullptr)
 
SAL_DLLPRIVATE bool ImplConvertDown (sal_uInt16 nBitCount, Color const *pExtColor=nullptr)
 
SAL_DLLPRIVATE bool ImplConvertGhosted ()
 

Private Attributes

std::shared_ptr< SalBitmapmxSalBmp
 
MapMode maPrefMapMode
 
Size maPrefSize
 

Detailed Description

Definition at line 105 of file bitmap.hxx.

Member Typedef Documentation

Definition at line 531 of file bitmap.hxx.

Definition at line 530 of file bitmap.hxx.

Constructor & Destructor Documentation

Bitmap::Bitmap ( )

Definition at line 34 of file bitmap/bitmap.cxx.

Referenced by CreateMask(), and ImplConvertGhosted().

Bitmap::Bitmap ( const Bitmap rBitmap)

Definition at line 38 of file bitmap/bitmap.cxx.

Bitmap::Bitmap ( const Size rSizePixel,
sal_uInt16  nBitCount,
const BitmapPalette pPal = nullptr 
)
Bitmap::Bitmap ( std::shared_ptr< SalBitmap > const &  xSalBitmap)
explicit

Definition at line 45 of file bitmap/bitmap.cxx.

References MapPixel.

Bitmap::~Bitmap ( )
virtual

Definition at line 113 of file bitmap/bitmap.cxx.

Member Function Documentation

BitmapInfoAccess * Bitmap::AcquireInfoAccess ( )

Definition at line 362 of file bitmap/bitmap.cxx.

BitmapReadAccess * Bitmap::AcquireReadAccess ( )
BitmapWriteAccess * Bitmap::AcquireWriteAccess ( )
void Bitmap::AdaptBitCount ( Bitmap rNew) const
bool Bitmap::Adjust ( short  nLuminancePercent,
short  nContrastPercent = 0,
short  nChannelRPercent = 0,
short  nChannelGPercent = 0,
short  nChannelBPercent = 0,
double  fGamma = 1.0,
bool  bInvert = false,
bool  msoBrightness = false 
)

Change various global color characteristics.

Parameters
nLuminancePercentPercent of luminance change, valid range [-100,100]. Values outside this range are clipped to the valid range.
nContrastPercentPercent of contrast change, valid range [-100,100]. Values outside this range are clipped to the valid range.
nChannelRPercentPercent of red channel change, valid range [-100,100]. Values outside this range are clipped to the valid range.
nChannelGPercentPercent of green channel change, valid range [-100,100]. Values outside this range are clipped to the valid range.
nChannelBPercentPercent of blue channel change, valid range [-100,100]. Values outside this range are clipped to the valid range.
fGammaExponent 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.
bInvertIf true, invert the channel values with the logical 'not' operator
msoBrightnessUse the same formula for brightness as used by MSOffice.
Returns
true, if the operation was completed successfully.

Definition at line 1044 of file bitmap3.cxx.

References FRound(), GAMMA, Color::GetBlue(), Color::GetGreen(), BitmapInfoAccess::GetPaletteColor(), BitmapInfoAccess::GetPaletteEntryCount(), BitmapReadAccess::GetPixelFromData(), Color::GetRed(), BitmapReadAccess::GetScanline(), BitmapInfoAccess::GetScanlineFormat(), BitmapInfoAccess::HasPalette(), BitmapInfoAccess::Height(), i, MinMax(), N24BitTcBgr, N24BitTcRgb, vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset(), Color::SetBlue(), Color::SetGreen(), BitmapWriteAccess::SetPaletteColor(), BitmapReadAccess::SetPixelOnData(), Color::SetRed(), and BitmapInfoAccess::Width().

Referenced by BitmapEx::Adjust(), and Image::Draw().

bool Bitmap::Blend ( const AlphaMask rAlpha,
const Color rBackgroundColor 
)

Alpha-blend the given bitmap against a specified uniform background color.

Attention:
This method might convert paletted bitmaps to truecolor, to be able to represent every necessary color. Note that during alpha blending, lots of colors not originally included in the bitmap can be generated.
Parameters
rAlphaAlpha mask to blend with
rBackgroundColorBackground color to use for every pixel during alpha blending
Returns
true, if blending was successful, false otherwise

Definition at line 1112 of file bitmappaint.cxx.

References Convert(), GetBitCount(), BitmapReadAccess::GetPixelFromData(), BitmapReadAccess::GetScanline(), BitmapInfoAccess::Height(), Color::Merge(), N24Bit, BitmapReadAccess::SetPixelOnData(), and BitmapInfoAccess::Width().

Referenced by Printer::DrawDeviceBitmap().

bool Bitmap::CombineSimple ( const Bitmap rMask,
BmpCombine  eCombine 
)

Perform boolean operations with another bitmap.

Parameters
rMaskThe mask bitmap in the selected combine operation
eCombineThe combine operation to perform on the bitmap
Returns
true, if the operation was completed successfully.

Definition at line 1040 of file bitmappaint.cxx.

References And, COL_BLACK(), COL_WHITE(), BitmapInfoAccess::GetBestMatchingColor(), BitmapReadAccess::GetPixelFromData(), BitmapReadAccess::GetScanline(), BitmapInfoAccess::Height(), Or, BitmapReadAccess::SetPixelOnData(), and BitmapInfoAccess::Width().

Referenced by unographic::GraphicTransformer::colorChange(), BitmapEx::CombineMaskOr(), and vcl::bitmap::DrawAndClipBitmap().

bool Bitmap::Convert ( BmpConversion  eConversion)
bool Bitmap::CopyPixel ( const tools::Rectangle rRectDst,
const tools::Rectangle rRectSrc,
const Bitmap pBmpSrc = nullptr 
)

Copy a rectangular area from another bitmap.

Parameters
rRectDstDestination rectangle in this bitmap. This is clipped to the bitmap dimensions.
rRectSrcSource 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.
pBmpSrcThe 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 450 of file bitmap/bitmap.cxx.

References Convert(), BitmapInfoAccess::GetBestPaletteIndex(), GetBitCount(), tools::Rectangle::GetHeight(), BitmapReadAccess::GetIndexFromData(), BitmapInfoAccess::GetPaletteColor(), BitmapInfoAccess::GetPaletteEntryCount(), BitmapReadAccess::GetPixelFromData(), BitmapReadAccess::GetScanline(), GetSizePixel(), tools::Rectangle::GetWidth(), BitmapInfoAccess::HasPalette(), i, tools::Rectangle::Intersection(), tools::Rectangle::IsEmpty(), tools::Rectangle::Left(), mxSalBmp, N24Bit, N4BitColors, N8BitColors, vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset(), BitmapWriteAccess::SetPaletteColor(), BitmapReadAccess::SetPixelOnData(), and tools::Rectangle::Top().

Referenced by BitmapEx::CopyPixel().

bool Bitmap::CopyPixel_AlphaOptimized ( const tools::Rectangle rRectDst,
const tools::Rectangle rRectSrc,
const Bitmap pBmpSrc 
)
Bitmap Bitmap::CreateDisplayBitmap ( OutputDevice pDisplay)
Bitmap Bitmap::CreateMask ( const Color rTransColor,
sal_uInt8  nTol = 0 
) const

Create on-off mask from bitmap.

This method creates a bitmask from the bitmap, where every pixel that equals rTransColor is set transparent, the rest opaque.

Parameters
rTransColorColor value where the bitmask should be transparent
nTolTolerance value. Specifies the maximal difference between rTransColor and the individual pixel values, such that the corresponding pixel is still regarded as transparent.
Returns
the resulting bitmask.

Definition at line 416 of file bitmappaint.cxx.

References Bitmap(), COL_BLACK(), COL_WHITE(), BitmapInfoAccess::GetBestMatchingColor(), Color::GetBlue(), Color::GetGreen(), BitmapColor::GetIndex(), BitmapReadAccess::GetIndexFromData(), BitmapInfoAccess::GetPaletteColor(), BitmapReadAccess::GetPixelFromData(), Color::GetRed(), BitmapReadAccess::GetScanline(), BitmapInfoAccess::GetScanlineFormat(), BitmapInfoAccess::GetScanlineSize(), GetSizePixel(), BitmapInfoAccess::HasPalette(), BitmapInfoAccess::Height(), maPrefMapMode, maPrefSize, N1BitLsbPal, N1BitMsbPal, N4BitLsnPal, N4BitMsnPal, N8BitPal, vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset(), BitmapReadAccess::SetPixelOnData(), and BitmapInfoAccess::Width().

Referenced by BitmapEx::BitmapEx(), BitmapEx::CombineMaskOr(), vcl::bitmap::DrawAlphaBitmapAndAlphaGradient(), OutputDevice::DrawDeviceMask(), and BitmapEx::GetBitmap().

vcl::Region Bitmap::CreateRegion ( const Color rColor,
const tools::Rectangle rRect 
) const

Create region of similar colors in a given rectangle.

Parameters
rColorAll pixel which have this color are included in the calculated region
rRectThe rectangle within which matching pixel are looked for. This rectangle is always clipped to the bitmap dimensions.
Returns
the generated region.

Definition at line 637 of file bitmappaint.cxx.

References tools::Rectangle::Bottom(), BitmapInfoAccess::GetBestMatchingColor(), BitmapReadAccess::GetPixelFromData(), BitmapReadAccess::GetScanline(), GetSizePixel(), tools::Rectangle::Intersection(), tools::Rectangle::Justify(), tools::Rectangle::Left(), vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset(), tools::Rectangle::Right(), tools::Rectangle::SetBottom(), tools::Rectangle::SetLeft(), tools::Rectangle::SetRight(), tools::Rectangle::SetTop(), tools::Rectangle::Top(), and vcl::Region::Union().

Referenced by Printer::DrawDeviceMask(), OutputDevice::ImplPrintTransparent(), and ImplWheelWindow::ImplSetRegion().

bool Bitmap::Crop ( const tools::Rectangle rRectPixel)

Crop the bitmap.

Parameters
rRectPixelA 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 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 403 of file bitmap/bitmap.cxx.

References GetBitCount(), BitmapInfoAccess::GetPalette(), BitmapReadAccess::GetPixelFromData(), BitmapReadAccess::GetScanline(), tools::Rectangle::GetSize(), GetSizePixel(), tools::Rectangle::Intersection(), tools::Rectangle::IsEmpty(), tools::Rectangle::Left(), ReassignWithSize(), vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset(), and tools::Rectangle::Top().

Referenced by clipMetafileContentAgainstOwnRegions(), BitmapEx::Crop(), Printer::DrawDeviceMask(), OutputDevice::GetDownsampledBitmap(), and OutputDevice::ImplPrintTransparent().

bool Bitmap::Dither ( )
bool Bitmap::Erase ( const Color rFillColor)
bool Bitmap::Expand ( sal_uLong  nDX,
sal_uLong  nDY,
const Color pInitColor = nullptr 
)

Expand the bitmap by pixel padding.

Parameters
nDXNumber of pixel to pad at the right border of the bitmap
nDYNumber of scanlines to pad at the bottom border of the bitmap
pInitColorColor 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 783 of file bitmap/bitmap.cxx.

References BitmapWriteAccess::CopyScanline(), BitmapInfoAccess::GetBestMatchingColor(), GetBitCount(), BitmapInfoAccess::GetPalette(), BitmapReadAccess::GetScanline(), GetSizePixel(), Size::Height(), BitmapInfoAccess::Height(), ReassignWithSize(), vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset(), BitmapReadAccess::SetPixelOnData(), Size::Width(), and BitmapInfoAccess::Width().

Referenced by BitmapEx::Expand().

sal_uInt16 Bitmap::GetBitCount ( ) const
BitmapChecksum Bitmap::GetChecksum ( ) const
sal_Int64 Bitmap::GetColorCount ( ) const
inline
const BitmapPalette & Bitmap::GetGreyPalette ( int  nEntries)
static
const MapMode & Bitmap::GetPrefMapMode ( ) const
inline
const Size & Bitmap::GetPrefSize ( ) const
inline
sal_uLong Bitmap::GetSizeBytes ( ) const
inline

Definition at line 581 of file bitmap.hxx.

References GetBitCount(), GetSizePixel(), Size::Height(), and Size::Width().

Referenced by BitmapEx::GetSizeBytes().

Size Bitmap::GetSizePixel ( ) const

Definition at line 257 of file bitmap/bitmap.cxx.

References mxSalBmp.

Referenced by BitmapEx::BitmapEx(), OutputDevice::BlendBitmap(), OutputDevice::BlendBitmapWithAlpha(), BitmapGaussianSeparableBlurFilter::convolutionPass(), CopyPixel(), CopyPixel_AlphaOptimized(), CreateMask(), CreateRegion(), BitmapEx::Crop(), Crop(), DetectEdges(), Dither(), OutputDevice::DrawBitmap(), OutputDevice::DrawDeviceAlphaBitmap(), OutputDevice::DrawDeviceAlphaBitmapSlowPath(), Printer::DrawDeviceMask(), vcl::PDFWriterImpl::drawJPGBitmap(), OutputDevice::DrawMask(), BitmapWriteAccess::Erase(), BitmapDuoToneFilter::execute(), BitmapColorQuantizationFilter::execute(), BitmapSeparableUnsharpenFilter::execute(), BitmapSimpleColorQuantizationFilter::execute(), BitmapScaleSuperFilter::execute(), BitmapGaussianSeparableBlurFilter::execute(), BitmapMonochromeFilter::execute(), BitmapEx::Expand(), Expand(), BitmapWriteAccess::FillRect(), GDIMetaFile::GetBoundRect(), BitmapEx::GetContour(), OutputDevice::GetDownsampledBitmap(), vcl::unotools::VclCanvasBitmap::getSize(), GetSizeBytes(), BitmapEx::GetSplitData(), ImplConvertDown(), ImplConvertGhosted(), ImplConvertUp(), ImplMakeGreyscales(), OutputDevice::ImplPrintTransparent(), ImplWheelWindow::ImplSetRegion(), EMFWriter::ImplWrite(), EMFWriter::ImplWriteBmpRecord(), BitmapEx::ModifyBitmapEx(), ReassignWithSize(), Replace(), BitmapEx::ReplaceTransparency(), BitmapEx::Rotate(), Rotate(), BitmapEx::Scale(), Scale(), vcl::unotools::VclCanvasBitmap::VclCanvasBitmap(), WMFWriter::WMFRecord_StretchDIB(), vcl::PDFWriterImpl::writeBitmapObject(), vcl::PDFWriterImpl::writeGradientFunction(), and WMFWriter::WriteRecords().

bool Bitmap::GetSystemData ( BitmapSystemData rData) const

get system dependent bitmap data

Parameters
rDataThe system dependent BitmapSystemData structure to be filled
Returns
true if the bitmap has a valid system object (e.g. not empty)

Definition at line 864 of file bitmap/bitmap.cxx.

References mxSalBmp.

bool Bitmap::HasFastScale ( )
static

Returns true if bitmap scaling is considered to be fast.

Currently this returns true if OpenGL is used for scaling, otherwise false (CPU scaling is slower).

Available since:
4.5

Definition at line 835 of file bitmap3.cxx.

References OpenGLHelper::isVCLOpenGLEnabled().

bool Bitmap::HasGreyPalette ( ) const
bool Bitmap::ImplConvertDown ( sal_uInt16  nBitCount,
Color const *  pExtColor = nullptr 
)
private
bool Bitmap::ImplConvertGhosted ( )
private
bool Bitmap::ImplConvertUp ( sal_uInt16  nBitCount,
Color const *  pExtColor = nullptr 
)
private
const std::shared_ptr<SalBitmap>& Bitmap::ImplGetSalBitmap ( ) const
inline
bool Bitmap::ImplMakeGreyscales ( sal_uInt16  nGreyscales)
void Bitmap::ImplMakeUnique ( )
void Bitmap::ImplSetSalBitmap ( const std::shared_ptr< SalBitmap > &  xImpBmp)
bool Bitmap::Invert ( )
bool Bitmap::IsEmpty ( ) const
inline
bool Bitmap::Mirror ( BmpMirrorFlags  nMirrorFlags)
bool Bitmap::operator! ( ) const
inline

Definition at line 546 of file bitmap.hxx.

References mxSalBmp.

Referenced by AlphaMask::operator!().

bool Bitmap::operator!= ( const Bitmap rBitmap) const
inline

Definition at line 119 of file bitmap.hxx.

References operator==().

Referenced by AlphaMask::operator!=().

Bitmap & Bitmap::operator= ( const Bitmap rBitmap)

Definition at line 211 of file bitmap/bitmap.cxx.

References maPrefMapMode, maPrefSize, and mxSalBmp.

Referenced by AlphaMask::operator=().

Bitmap & Bitmap::operator= ( Bitmap &&  rBitmap)
noexcept

Definition at line 223 of file bitmap/bitmap.cxx.

References maPrefMapMode, maPrefSize, and mxSalBmp.

bool Bitmap::operator== ( const Bitmap rBitmap) const

Definition at line 232 of file bitmap/bitmap.cxx.

References mxSalBmp.

Referenced by AlphaMask::operator==().

void Bitmap::ReassignWithSize ( const Bitmap rBitmap)

ReassignWithSize and recalculate bitmap.

ReassignWithSizes the bitmap, and recalculates the bitmap size based on the new bitmap.

Parameters
rBitmapBitmap to reassign and use for size calculation

Definition at line 333 of file bitmap/bitmap.cxx.

References FRound(), GetSizePixel(), Size::Height(), maPrefMapMode, maPrefSize, Size::setHeight(), Size::setWidth(), and Size::Width().

Referenced by Crop(), Expand(), and Rotate().

void Bitmap::ReleaseAccess ( BitmapInfoAccess pAccess)
static
bool Bitmap::Replace ( const Bitmap rMask,
const Color rReplaceColor 
)
bool Bitmap::Replace ( const AlphaMask rAlpha,
const Color rMergeColor 
)

Merge bitmap with given background color according to specified alpha mask.

Parameters
rAlphaAlpha mask specifying the amount of background color to merge in
rMergeColorBackground color to be used for merging
Returns
true, if the operation was completed successfully.

Definition at line 813 of file bitmappaint.cxx.

References BitmapReadAccess::GetColor(), BitmapReadAccess::GetScanline(), GetSizePixel(), BitmapInfoAccess::Height(), maPrefMapMode, maPrefSize, Color::Merge(), vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset(), BitmapReadAccess::SetPixelOnData(), and BitmapInfoAccess::Width().

bool Bitmap::Replace ( const Color rSearchColor,
const Color rReplaceColor,
sal_uInt8  nTol = 0 
)

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

Parameters
rSearchColorColor specifying which pixel should be replaced
rReplaceColorColor to be placed in all changed pixel
nTolTolerance 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 860 of file bitmappaint.cxx.

References Convert(), BitmapInfoAccess::GetBestMatchingColor(), GetBitCount(), Color::GetBlue(), Color::GetGreen(), BitmapInfoAccess::GetPaletteColor(), BitmapInfoAccess::GetPaletteEntryCount(), BitmapReadAccess::GetPixelFromData(), Color::GetRed(), BitmapReadAccess::GetScanline(), BitmapInfoAccess::HasPalette(), BitmapInfoAccess::Height(), i, ImplGetSVData(), ImplSetSalBitmap(), MapMode, maPrefMapMode, maPrefSize, mxSalBmp, N4BitColors, vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset(), BitmapWriteAccess::SetPaletteColor(), BitmapReadAccess::SetPixelOnData(), and BitmapInfoAccess::Width().

bool Bitmap::Replace ( const Color pSearchColors,
const Color rReplaceColors,
sal_uLong  nColorCount,
sal_uInt8 const *  pTols 
)

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

Parameters
pSearchColorsArray of colors specifying which pixel should be replaced
rReplaceColorsArray of colors to be placed in all changed pixel
nColorCountSize of the aforementioned color arrays
pTolsTolerance 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 935 of file bitmappaint.cxx.

References Convert(), BitmapInfoAccess::GetBestMatchingColor(), GetBitCount(), Color::GetBlue(), Color::GetGreen(), BitmapInfoAccess::GetPaletteColor(), BitmapInfoAccess::GetPaletteEntryCount(), BitmapReadAccess::GetPixelFromData(), Color::GetRed(), BitmapReadAccess::GetScanline(), BitmapInfoAccess::HasPalette(), BitmapInfoAccess::Height(), i, N4BitColors, vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset(), BitmapWriteAccess::SetPaletteColor(), BitmapReadAccess::SetPixelOnData(), and BitmapInfoAccess::Width().

bool Bitmap::Rotate ( long  nAngle10,
const Color rFillColor 
)

Rotate bitmap by the specified angle.

Parameters
nAngle10The rotation angle in tenth of a degree. The bitmap is always rotated around its center.
rFillColorThe 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 262 of file bitmappaint.cxx.

References F_PI1800, FRound(), GetBitCount(), tools::Polygon::GetBoundRect(), BitmapInfoAccess::GetPalette(), BitmapReadAccess::GetPixel(), GetSizePixel(), Size::Height(), Horizontal, Mirror(), ReassignWithSize(), vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset(), tools::Polygon::Rotate(), Vertical, and Size::Width().

Referenced by OutputDevice::ImplDrawRotateText(), and BitmapEx::Rotate().

bool Bitmap::Scale ( const Size rNewSize,
BmpScaleFlag  nScaleFlag = BmpScaleFlag::Default 
)

Scale the bitmap.

Parameters
rNewSizeThe resulting size of the scaled bitmap
nScaleFlagThe algorithm to be used for scaling
Returns
true, if the operation was completed successfully.

Definition at line 818 of file bitmap3.cxx.

References GetSizePixel(), Size::Height(), and Size::Width().

Referenced by BitmapEx::BitmapEx(), BitmapFastScaleFilter::execute(), OutputDevice::GetDownsampledBitmap(), ImpGraphic::ImplGetBitmap(), BitmapEx::Scale(), and OutputDevice::ScaleBitmap().

bool Bitmap::Scale ( const double &  rScaleX,
const double &  rScaleY,
BmpScaleFlag  nScaleFlag = BmpScaleFlag::Default 
)

Scale the bitmap.

Parameters
rScaleXThe scale factor in x direction.
rScaleYThe scale factor in y direction.
nScaleFlagMethod of scaling - it is recommended that either BmpScaleFlag::Default or BmpScaleFlag::BestQuality be used.
Returns
true, if the operation was completed successfully.

Definition at line 727 of file bitmap3.cxx.

References BestQuality, BiCubic, BiLinear, Default, basegfx::fTools::equal(), basegfx::fTools::equalZero(), Fast, BitmapFilter::Filter(), GetBitCount(), BitmapEx::GetBitmapRef(), GetSizePixel(), Height, ImplGetSVData(), ImplSetSalBitmap(), Interpolate, Lanczos, MapMode, maPrefMapMode, maPrefSize, mxSalBmp, NearestNeighbor, SAL_INFO, Super, and Width.

void Bitmap::SetEmpty ( )
void Bitmap::SetPrefMapMode ( const MapMode rMapMode)
inline
void Bitmap::SetPrefSize ( const Size rSize)
inline

Definition at line 571 of file bitmap.hxx.

References maPrefSize.

Referenced by ImpGraphic::ImplGetBitmap(), and AlphaMask::SetPrefSize().

void Bitmap::Vectorize ( GDIMetaFile rMtf,
sal_uInt8  cReduce,
const Link< long, void > *  pProgress 
)

Convert the bitmap to a meta file.

This works by putting continuous areas of the same color into polygons painted in this color, by tracing the area's bounding line.

Parameters
rMtfThe resulting meta file
cReduceIf non-null, minimal size of bound rects for individual polygons. Smaller ones are ignored.
pProgressA callback for showing the progress of the vectorization

Definition at line 1039 of file bitmap3.cxx.

References ImplVectorizer::ImplVectorize().

Member Data Documentation

MapMode Bitmap::maPrefMapMode
private
Size Bitmap::maPrefSize
private
std::shared_ptr<SalBitmap> Bitmap::mxSalBmp
private

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