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, vcl::PixelFormat ePixelFormat, const BitmapPalette *pPal=nullptr)
 
 Bitmap (std::shared_ptr< SalBitmap > const &xSalBitmap)
 
virtual ~Bitmap ()
 
Bitmapoperator= (const Bitmap &rBitmap)
 
Bitmapoperator= (Bitmap &&rBitmap) noexcept
 
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
 
vcl::PixelFormat getPixelFormat () const
 
sal_Int64 GetSizeBytes () const
 
bool HasGreyPalette8Bit () const
 
bool HasGreyPaletteAny () const
 
bool GetSystemData (BitmapSystemData &rData) const
 get system dependent bitmap data More...
 
BitmapChecksum GetChecksum () const
 
Bitmap CreateDisplayBitmap (OutputDevice *pDisplay) const
 
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_Int32 nDX, sal_Int32 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 CombineOr (const Bitmap &rMask)
 Perform boolean OR operation 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 (Degree10 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, size_t 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< tools::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 ()
 
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 (vcl::PixelFormat ePixelFormat, Color const *pExtColor=nullptr)
 
SAL_DLLPRIVATE bool ImplConvertDown8BPP (Color const *pExtColor=nullptr)
 

Private Attributes

std::shared_ptr< SalBitmapmxSalBmp
 
MapMode maPrefMapMode
 
Size maPrefSize
 

Detailed Description

Definition at line 103 of file bitmap.hxx.

Member Typedef Documentation

Definition at line 523 of file bitmap.hxx.

Definition at line 522 of file bitmap.hxx.

Constructor & Destructor Documentation

Bitmap::Bitmap ( )

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

Referenced by CreateMask().

Bitmap::Bitmap ( const Bitmap rBitmap)

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

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

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

References MapPixel.

Bitmap::~Bitmap ( )
virtual

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

Member Function Documentation

BitmapInfoAccess * Bitmap::AcquireInfoAccess ( )

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

BitmapReadAccess * Bitmap::AcquireReadAccess ( )
BitmapWriteAccess * Bitmap::AcquireWriteAccess ( )

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

Referenced by AlphaMask::AcquireAlphaWriteAccess(), and ReadRawDIB().

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 1633 of file bitmap/bitmap.cxx.

References FRound(), GAMMA, Color::GetBlue(), Color::GetGreen(), Color::GetRed(), i, MinMax(), N24BitTcBgr, N24BitTcRgb, nCount, vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset(), Color::SetBlue(), Color::SetGreen(), and Color::SetRed().

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 1091 of file bitmappaint.cxx.

References Convert(), getPixelFormat(), vcl::isPalettePixelFormat(), Color::Merge(), and N24Bit.

Referenced by Printer::DrawDeviceBitmap().

bool Bitmap::CombineOr ( const Bitmap rMask)

Perform boolean OR operation with another bitmap.

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

Definition at line 1050 of file bitmappaint.cxx.

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

Referenced by BitmapEx::CombineMaskOr().

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 521 of file bitmap/bitmap.cxx.

References Convert(), tools::Rectangle::GetHeight(), BitmapReadAccess::GetIndexFromData(), BitmapInfoAccess::GetPaletteColor(), BitmapInfoAccess::GetPaletteEntryCount(), getPixelFormat(), BitmapReadAccess::GetPixelFromData(), BitmapReadAccess::GetScanline(), GetSizePixel(), tools::Rectangle::GetWidth(), BitmapInfoAccess::HasPalette(), i, tools::Rectangle::Intersection(), tools::Rectangle::IsEmpty(), tools::Rectangle::Left(), mxSalBmp, N24Bit, N8BitColors, nCount, vcl::pixelFormatBitCount(), Point, vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset(), 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) const
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 440 of file bitmappaint.cxx.

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

Referenced by BitmapEx::BitmapEx(), BitmapEx::CombineMaskOr(), and OutputDevice::DrawDeviceMask().

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 648 of file bitmappaint.cxx.

References a, tools::Rectangle::Bottom(), BitmapInfoAccess::GetBestMatchingColor(), BitmapReadAccess::GetPixelFromData(), BitmapReadAccess::GetScanline(), GetSizePixel(), tools::Rectangle::Intersection(), tools::Rectangle::Justify(), tools::Rectangle::Left(), Point, 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(), Printer::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 474 of file bitmap/bitmap.cxx.

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

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

bool Bitmap::Dither ( )

Apply a Floyd 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.

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

References aMap, CALC_ERRORS, CALC_TABLES3, CALC_TABLES5, CALC_TABLES7, vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::get(), getColor(), GetSizePixel(), Size::Height(), BitmapInfoAccess::Height(), maPrefMapMode, maPrefSize, vcl::N8_BPP, nVCLBLut, nVCLGLut, nVCLRLut, vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset(), shiftColor(), Size::Width(), and BitmapInfoAccess::Width().

bool Bitmap::Erase ( const Color rFillColor)
bool Bitmap::Expand ( sal_Int32  nDX,
sal_Int32  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 853 of file bitmap/bitmap.cxx.

References BitmapInfoAccess::GetPalette(), getPixelFormat(), GetSizePixel(), Size::Height(), ReassignWithSize(), vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset(), and Size::Width().

Referenced by BitmapEx::Expand().

BitmapChecksum Bitmap::GetChecksum ( ) const
const BitmapPalette & Bitmap::GetGreyPalette ( int  nEntries)
static
vcl::PixelFormat Bitmap::getPixelFormat ( ) const
const MapMode & Bitmap::GetPrefMapMode ( ) const
inline
const Size & Bitmap::GetPrefSize ( ) const
inline
sal_Int64 Bitmap::GetSizeBytes ( ) const
inline

Definition at line 560 of file bitmap.hxx.

References getPixelFormat(), GetSizePixel(), and vcl::pixelFormatBitCount().

Referenced by BitmapEx::GetSizeBytes().

Size Bitmap::GetSizePixel ( ) const

Definition at line 318 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(), BitmapSeparableUnsharpenFilter::execute(), BitmapSimpleColorQuantizationFilter::execute(), BitmapColorQuantizationFilter::execute(), BitmapScaleSuperFilter::execute(), BitmapGaussianSeparableBlurFilter::execute(), BitmapMonochromeFilter::execute(), BitmapEx::Expand(), Expand(), BitmapWriteAccess::FillRect(), GDIMetaFile::GetBoundRect(), BitmapEx::GetContour(), OutputDevice::GetDownsampledBitmap(), vcl::unotools::VclCanvasBitmap::getSize(), GetSizeBytes(), ImplConvertDown8BPP(), ImplConvertUp(), ImplMakeGreyscales(), Printer::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 934 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 1476 of file bitmap/bitmap.cxx.

References SkiaHelper::isVCLSkiaEnabled().

bool Bitmap::HasGreyPalette8Bit ( ) const
bool Bitmap::HasGreyPaletteAny ( ) const

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

References getPixelFormat(), and vcl::N1_BPP.

Referenced by AdaptBitCount(), and vcl::PDFWriterImpl::writeBitmapObject().

bool Bitmap::ImplConvertDown8BPP ( Color const *  pExtColor = nullptr)
private
bool Bitmap::ImplConvertUp ( vcl::PixelFormat  ePixelFormat,
Color const *  pExtColor = nullptr 
)
private
const std::shared_ptr<SalBitmap>& Bitmap::ImplGetSalBitmap ( ) const
inline
bool Bitmap::ImplMakeGreyscales ( )
void Bitmap::ImplMakeUnique ( )
void Bitmap::ImplSetSalBitmap ( const std::shared_ptr< SalBitmap > &  xImpBmp)
bool Bitmap::Invert ( )

Perform the Invert operation on every pixel.

Returns
true, if the operation was completed successfully.

Definition at line 61 of file bitmappaint.cxx.

References i, Color::Invert(), mxSalBmp, nCount, and vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset().

Referenced by BitmapEx::Invert().

bool Bitmap::IsEmpty ( ) const
inline
bool Bitmap::Mirror ( BmpMirrorFlags  nMirrorFlags)

Mirror the bitmap.

Parameters
nMirrorFlagsAbout which axis (horizontal, vertical, or both) to mirror
Returns
true, if the operation was completed successfully.

Definition at line 127 of file bitmappaint.cxx.

References vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::get(), Horizontal, vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset(), and Vertical.

Referenced by OutputDevice::DrawBitmap(), OutputDevice::DrawDeviceAlphaBitmap(), Printer::DrawDeviceMask(), OutputDevice::DrawDeviceMask(), Printer::ImplPrintTransparent(), BitmapEx::Mirror(), and Rotate().

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

Definition at line 116 of file bitmap.hxx.

References operator==().

Referenced by AlphaMask::operator!=().

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

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

References maPrefMapMode, maPrefSize, and mxSalBmp.

Referenced by AlphaMask::operator=().

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

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

References maPrefMapMode, maPrefSize, and mxSalBmp.

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

Definition at line 293 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 405 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 
)

Replace all pixel where the given mask is on with the specified color.

Parameters
rMaskMask specifying which pixel should be replaced
rReplaceColorColor to be placed in all changed pixel
Returns
true, if the operation was completed successfully.

Definition at line 746 of file bitmappaint.cxx.

References COL_WHITE, BitmapInfoAccess::GetBestMatchingColor(), BitmapReadAccess::GetPixelFromData(), BitmapReadAccess::GetScanline(), BitmapInfoAccess::Height(), i, and BitmapInfoAccess::Width().

Referenced by unographic::Graphic::colorChange(), BitmapEx::GetBitmap(), EMFWriter::ImplWrite(), BitmapEx::Replace(), BitmapEx::ReplaceTransparency(), and WMFWriter::WriteRecords().

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 824 of file bitmappaint.cxx.

References aMap, BitmapReadAccess::GetColor(), GetSizePixel(), BitmapInfoAccess::Height(), maPrefMapMode, maPrefSize, Color::Merge(), vcl::N24_BPP, vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset(), 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 871 of file bitmappaint.cxx.

References Convert(), Color::GetBlue(), Color::GetGreen(), getPixelFormat(), Color::GetRed(), i, ImplGetSVData(), ImplSetSalBitmap(), maPrefMapMode, maPrefSize, mxSalBmp, vcl::N1_BPP, N8BitColors, and vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset().

bool Bitmap::Replace ( const Color pSearchColors,
const Color rReplaceColors,
size_t  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 946 of file bitmappaint.cxx.

References Convert(), Color::GetBlue(), Color::GetGreen(), getPixelFormat(), Color::GetRed(), i, vcl::N1_BPP, N8BitColors, and vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset().

bool Bitmap::Rotate ( Degree10  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 285 of file bitmappaint.cxx.

References F_PI1800, FRound(), o3tl::strong_int< UNDERLYING_TYPE, PHANTOM_TYPE >::get(), tools::Polygon::GetBoundRect(), BitmapInfoAccess::GetPalette(), BitmapReadAccess::GetPixel(), getPixelFormat(), GetSizePixel(), Size::Height(), Horizontal, IsEmpty(), Mirror(), Point, 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 1459 of file bitmap/bitmap.cxx.

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

Referenced by BitmapEx::BitmapEx(), OutputDevice::DrawBitmap(), BitmapFastScaleFilter::execute(), ImpGraphic::getBitmap(), OutputDevice::GetDownsampledBitmap(), and BitmapEx::Scale().

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 1371 of file bitmap/bitmap.cxx.

References BestQuality, BiCubic, BiLinear, Default, basegfx::fTools::equal(), basegfx::fTools::equalZero(), Fast, BitmapFilter::Filter(), BitmapEx::GetBitmap(), getPixelFormat(), GetSizePixel(), Height, ImplGetSVData(), ImplSetSalBitmap(), Interpolate, Lanczos, maPrefMapMode, maPrefSize, mxSalBmp, vcl::N1_BPP, NearestNeighbor, SAL_INFO, and Width.

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

Definition at line 555 of file bitmap.hxx.

References maPrefSize.

Referenced by ImpGraphic::getBitmap().

void Bitmap::Vectorize ( GDIMetaFile rMtf,
sal_uInt8  cReduce,
const Link< tools::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 1628 of file bitmap/bitmap.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: