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 > 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) const
 Create on-off mask from bitmap. More...
 
Bitmap CreateMask (const Color &rTransColor, sal_uInt8 nTol) const
 Create on-off mask from bitmap. More...
 
AlphaMask CreateAlphaMask (const Color &rTransColor) const
 Create on-off alpha mask from bitmap. More...
 
AlphaMask CreateAlphaMask (const Color &rTransColor, sal_uInt8 nTol) const
 Create on-off alpha 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 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...
 
void RemoveBlendedStartColor (const Color &rColor, const AlphaMask &rAlphaMask)
 Remove existing blending against COL_WHITE based on given AlphaMask. More...
 
const basegfx::SystemDependentDataHolderaccessSystemDependentDataHolder () const
 
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 105 of file include/vcl/bitmap.hxx.

Member Typedef Documentation

◆ ScopedInfoAccess

Definition at line 583 of file include/vcl/bitmap.hxx.

◆ ScopedReadAccess

Definition at line 582 of file include/vcl/bitmap.hxx.

Constructor & Destructor Documentation

◆ Bitmap() [1/4]

Bitmap::Bitmap ( )

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

Referenced by CreateMask().

◆ Bitmap() [2/4]

Bitmap::Bitmap ( const Bitmap rBitmap)

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

◆ Bitmap() [3/4]

Bitmap::Bitmap ( const Size rSizePixel,
vcl::PixelFormat  ePixelFormat,
const BitmapPalette pPal = nullptr 
)

◆ Bitmap() [4/4]

Bitmap::Bitmap ( std::shared_ptr< SalBitmap xSalBitmap)
explicit

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

References MapPixel.

◆ ~Bitmap()

Bitmap::~Bitmap ( )
virtual

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

Member Function Documentation

◆ accessSystemDependentDataHolder()

const basegfx::SystemDependentDataHolder * Bitmap::accessSystemDependentDataHolder ( ) const

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

References mxSalBmp.

◆ AcquireInfoAccess()

BitmapInfoAccess * Bitmap::AcquireInfoAccess ( )

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

◆ AcquireReadAccess()

BitmapReadAccess * Bitmap::AcquireReadAccess ( )

◆ AcquireWriteAccess()

BitmapWriteAccess * Bitmap::AcquireWriteAccess ( )

◆ AdaptBitCount()

void Bitmap::AdaptBitCount ( Bitmap rNew) const

◆ Adjust()

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 1496 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().

◆ Blend()

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

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

Attention: \n 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 1128 of file bitmappaint.cxx.

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

Referenced by Printer::DrawDeviceBitmapEx().

◆ CombineOr()

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

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

Referenced by BitmapEx::CombineMaskOr().

◆ Convert()

bool Bitmap::Convert ( BmpConversion  eConversion)

◆ CopyPixel()

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 445 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(), vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset(), and tools::Rectangle::Top().

Referenced by BitmapEx::CopyPixel().

◆ CopyPixel_AlphaOptimized()

bool Bitmap::CopyPixel_AlphaOptimized ( const tools::Rectangle rRectDst,
const tools::Rectangle rRectSrc,
const Bitmap pBmpSrc 
)

◆ CreateAlphaMask() [1/2]

AlphaMask Bitmap::CreateAlphaMask ( const Color rTransColor) const

Create on-off alpha 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
Returns
the resulting bitmask.

Definition at line 626 of file bitmappaint.cxx.

References COL_ALPHA_OPAQUE(), COL_ALPHA_TRANSPARENT(), BitmapInfoAccess::GetBestMatchingColor(), BitmapColor::GetIndex(), BitmapReadAccess::GetPixelFromData(), BitmapReadAccess::GetScanline(), BitmapInfoAccess::GetScanlineFormat(), GetSizePixel(), BitmapInfoAccess::Height(), maPrefMapMode, maPrefSize, N1BitMsbPal, N8BitPal, vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset(), and BitmapInfoAccess::Width().

Referenced by BitmapEx::BitmapEx(), unographic::Graphic::colorChange(), and CreateAlphaMask().

◆ CreateAlphaMask() [2/2]

AlphaMask Bitmap::CreateAlphaMask ( const Color rTransColor,
sal_uInt8  nTol 
) const

Create on-off alpha 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 701 of file bitmappaint.cxx.

References COL_ALPHA_OPAQUE(), COL_ALPHA_TRANSPARENT(), CreateAlphaMask(), Color::GetBlue(), Color::GetGreen(), BitmapReadAccess::GetIndexFromData(), BitmapInfoAccess::GetPaletteColor(), BitmapReadAccess::GetPixelFromData(), Color::GetRed(), BitmapReadAccess::GetScanline(), GetSizePixel(), BitmapInfoAccess::HasPalette(), BitmapInfoAccess::Height(), maPrefMapMode, maPrefSize, vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset(), and BitmapInfoAccess::Width().

◆ CreateDisplayBitmap()

Bitmap Bitmap::CreateDisplayBitmap ( OutputDevice pDisplay) const

◆ CreateMask() [1/2]

Bitmap Bitmap::CreateMask ( const Color rTransColor) 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
Returns
the resulting bitmask.

Definition at line 443 of file bitmappaint.cxx.

References Bitmap(), COL_BLACK(), COL_WHITE(), BitmapInfoAccess::GetBestMatchingColor(), GetGreyPalette(), BitmapColor::GetIndex(), BitmapReadAccess::GetPixelFromData(), BitmapReadAccess::GetScanline(), BitmapInfoAccess::GetScanlineFormat(), BitmapInfoAccess::GetScanlineSize(), GetSizePixel(), BitmapInfoAccess::Height(), maPrefMapMode, maPrefSize, N1BitMsbPal, vcl::N8_BPP, N8BitPal, vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset(), and BitmapInfoAccess::Width().

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

◆ CreateMask() [2/2]

Bitmap Bitmap::CreateMask ( const Color rTransColor,
sal_uInt8  nTol 
) 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 532 of file bitmappaint.cxx.

References Bitmap(), COL_BLACK(), COL_WHITE(), CreateMask(), Color::GetBlue(), Color::GetGreen(), GetGreyPalette(), BitmapReadAccess::GetIndexFromData(), BitmapInfoAccess::GetPaletteColor(), BitmapReadAccess::GetPixelFromData(), Color::GetRed(), BitmapReadAccess::GetScanline(), GetSizePixel(), BitmapInfoAccess::HasPalette(), BitmapInfoAccess::Height(), maPrefMapMode, maPrefSize, vcl::N8_BPP, vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset(), and BitmapInfoAccess::Width().

◆ CreateRegion()

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

References a, tools::Rectangle::Bottom(), BitmapInfoAccess::GetBestMatchingColor(), BitmapReadAccess::GetPixelFromData(), BitmapReadAccess::GetScanline(), GetSizePixel(), tools::Rectangle::Intersection(), tools::Rectangle::Left(), tools::Rectangle::Normalize(), 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(), and ImplWheelWindow::ImplSetRegion().

◆ Crop()

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

References tools::Rectangle::GetHeight(), BitmapInfoAccess::GetPalette(), getPixelFormat(), BitmapReadAccess::GetPixelFromData(), BitmapReadAccess::GetScanline(), tools::Rectangle::GetSize(), GetSizePixel(), tools::Rectangle::GetWidth(), 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(), BitmapScaleSuperFilter::execute(), vcl::bitmap::GetDownsampledBitmap(), Printer::ImplPrintTransparent(), EMFWriter::ImplWrite(), and WMFWriter::WriteRecords().

◆ Dither()

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 1412 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().

◆ Erase()

bool Bitmap::Erase ( const Color rFillColor)

Fill the entire bitmap with the given color.

Parameters
rFillColorColor value to use for filling
Returns
true, if the operation was completed successfully.

Definition at line 34 of file bitmappaint.cxx.

References ImplGetSVData(), ImplSetSalBitmap(), IsEmpty(), maPrefMapMode, maPrefSize, and mxSalBmp.

Referenced by AlphaMask::AlphaMask(), createBlendFrame(), OutputDevice::DrawTransformBitmapExDirect(), OutputDevice::DrawWaveLine(), BitmapEx::Erase(), AlphaMask::Erase(), vcl::drawmode::GetBitmapEx(), GDIMetaFile::ImplBmpMonoFnc(), and BitmapEx::ModifyBitmapEx().

◆ Expand()

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 777 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().

◆ GetChecksum()

BitmapChecksum Bitmap::GetChecksum ( ) const

◆ GetGreyPalette()

const BitmapPalette & Bitmap::GetGreyPalette ( int  nEntries)
static

◆ getPixelFormat()

vcl::PixelFormat Bitmap::getPixelFormat ( ) const

◆ GetPrefMapMode()

const MapMode & Bitmap::GetPrefMapMode ( ) const
inline

◆ GetPrefSize()

const Size & Bitmap::GetPrefSize ( ) const
inline

◆ GetSizeBytes()

sal_Int64 Bitmap::GetSizeBytes ( ) const
inline

◆ GetSizePixel()

Size Bitmap::GetSizePixel ( ) const

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

References mxSalBmp.

Referenced by BitmapEx::BitmapEx(), OutputDevice::BlendBitmap(), OutputDevice::BlendBitmapWithAlpha(), vcl::bitmap::CanvasExtractBitmapData(), vcl::bitmap::convertBitmap32To24Plus8(), BitmapGaussianSeparableBlurFilter::convolutionPass(), CopyPixel(), CopyPixel_AlphaOptimized(), CreateAlphaMask(), CreateMask(), CreateRegion(), Crop(), BitmapEx::Crop(), DetectEdges(), Dither(), OutputDevice::DrawBitmap(), OutputDevice::DrawDeviceAlphaBitmap(), OutputDevice::DrawDeviceAlphaBitmapSlowPath(), Printer::DrawDeviceMask(), vcl::PDFWriterImpl::drawJPGBitmap(), OutputDevice::DrawMask(), OutputDevice::DrawTransformedBitmapEx(), BitmapWriteAccess::Erase(), BitmapScaleSuperFilter::execute(), BitmapColorQuantizationFilter::execute(), BitmapConvolutionMatrixFilter::execute(), BitmapDuoToneFilter::execute(), BitmapEmbossGreyFilter::execute(), BitmapGaussianSeparableBlurFilter::execute(), BitmapMedianFilter::execute(), BitmapMonochromeFilter::execute(), BitmapMosaicFilter::execute(), BitmapSeparableUnsharpenFilter::execute(), BitmapSepiaFilter::execute(), BitmapSimpleColorQuantizationFilter::execute(), BitmapSobelGreyFilter::execute(), BitmapFastScaleFilter::execute(), BitmapInterpolateScaleFilter::execute(), MetaBmpScaleAction::Execute(), BitmapEx::Expand(), Expand(), BitmapWriteAccess::FillRect(), GDIMetaFile::GetBoundRect(), BitmapEx::GetContour(), vcl::bitmap::GetDownsampledBitmap(), vcl::unotools::VclCanvasBitmap::getSize(), GetSizeBytes(), ImplConvertDown8BPP(), ImplConvertUp(), ImplMakeGreyscales(), Printer::ImplPrintTransparent(), ImplWheelWindow::ImplSetRegion(), EMFWriter::ImplWrite(), EMFWriter::ImplWriteBmpRecord(), vcl::bitmap::isHistorical8x8(), BitmapEx::ModifyBitmapEx(), ReassignWithSize(), OutputDevice::RemoveTransparenciesFromMetaFile(), Replace(), BitmapEx::ReplaceTransparency(), Rotate(), BitmapEx::Rotate(), Scale(), BitmapEx::Scale(), vcl::unotools::VclCanvasBitmap::VclCanvasBitmap(), WMFWriter::WMFRecord_StretchDIB(), vcl::PDFWriterImpl::writeBitmapObject(), vcl::PDFWriterImpl::writeGradientFunction(), and WMFWriter::WriteRecords().

◆ GetSystemData()

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

References mxSalBmp.

◆ HasFastScale()

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: \n 4.5

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

References SkiaHelper::isVCLSkiaEnabled().

◆ HasGreyPalette8Bit()

bool Bitmap::HasGreyPalette8Bit ( ) const

◆ HasGreyPaletteAny()

bool Bitmap::HasGreyPaletteAny ( ) const

◆ ImplConvertDown8BPP()

bool Bitmap::ImplConvertDown8BPP ( Color const *  pExtColor = nullptr)
private

◆ ImplConvertUp()

bool Bitmap::ImplConvertUp ( vcl::PixelFormat  ePixelFormat,
Color const *  pExtColor = nullptr 
)
private

◆ ImplGetSalBitmap()

const std::shared_ptr< SalBitmap > & Bitmap::ImplGetSalBitmap ( ) const
inline

◆ ImplMakeGreyscales()

bool Bitmap::ImplMakeGreyscales ( )

◆ ImplMakeUnique()

void Bitmap::ImplMakeUnique ( )

◆ ImplSetSalBitmap()

void Bitmap::ImplSetSalBitmap ( const std::shared_ptr< SalBitmap > &  xImpBmp)

◆ Invert()

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 BitmapPalette::GetEntryCount(), BitmapInfoAccess::HasPalette(), i, Color::Invert(), mxSalBmp, and nCount.

Referenced by BitmapEx::BitmapEx(), OutputDevice::DrawTransparent(), BitmapEx::Invert(), vcl::PDFWriterImpl::playMetafile(), and ReadDIBV5().

◆ IsEmpty()

bool Bitmap::IsEmpty ( ) const
inline

◆ Mirror()

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 141 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(), OutputDevice::DrawDeviceMask(), Printer::DrawDeviceMask(), Printer::ImplPrintTransparent(), BitmapEx::Mirror(), and Rotate().

◆ operator!=()

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

Definition at line 118 of file include/vcl/bitmap.hxx.

References operator==().

Referenced by AlphaMask::operator!=().

◆ operator=() [1/2]

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

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

◆ operator=() [2/2]

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

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

References maPrefMapMode, maPrefSize, and mxSalBmp.

Referenced by AlphaMask::operator=().

◆ operator==()

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

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

References mxSalBmp.

Referenced by AlphaMask::operator==().

◆ ReassignWithSize()

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

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

Referenced by Crop(), BitmapDuoToneFilter::execute(), BitmapGaussianSeparableBlurFilter::execute(), BitmapSeparableUnsharpenFilter::execute(), BitmapFastScaleFilter::execute(), Expand(), and Rotate().

◆ ReleaseAccess()

void Bitmap::ReleaseAccess ( BitmapInfoAccess pAccess)
static

◆ RemoveBlendedStartColor()

void Bitmap::RemoveBlendedStartColor ( const Color rColor,
const AlphaMask rAlphaMask 
)

Remove existing blending against COL_WHITE based on given AlphaMask.

Inside convertToBitmapEx the content gets rendered to RGB target (no 'A'), so it gets blended against the start condition of the target device which is blank (usually white background, but others may be used). Usually rendering to RGB is sufficient (e.g. EditViews), but for conversion to BitmapEx the alpha channel is needed to e.g. allow export/conversion to pixel target formats which support Alpha, e.g. PNG. It is possible though to create the fully valid and correct AlphaChannel. If the content, the start condition and the alpha values are known it is possible to calculate back ("remove") the white blending from the result, and this is what this method does.

Parameters
rColorThe Color we know this Bitmap is blended against (usually COL_WHITE)
rAlphaMaskThe AlphaMask which was used to blend white against this

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

References Color::GetBlue(), Color::GetGreen(), Color::GetRed(), IsEmpty(), Color::SetBlue(), Color::SetGreen(), Color::SetRed(), x, and y.

◆ Replace() [1/3]

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 887 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().

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

◆ Replace() [2/3]

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

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

◆ Replace() [3/3]

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

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

◆ Rotate()

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

References tools::Polygon::GetBoundRect(), BitmapInfoAccess::GetPalette(), BitmapReadAccess::GetPixel(), getPixelFormat(), tools::Rectangle::GetSize(), GetSizePixel(), Size::Height(), Horizontal, IsEmpty(), tools::Rectangle::Left(), Mirror(), ReassignWithSize(), vcl::ScopedBitmapAccess< Access, Bitmap, Acquire >::reset(), tools::Polygon::Rotate(), tools::Rectangle::Top(), toRadians(), Vertical, and Size::Width().

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

◆ Scale() [1/2]

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 1260 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, NearestNeighbor, SAL_INFO, and Width.

◆ Scale() [2/2]

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

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

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

◆ SetEmpty()

void Bitmap::SetEmpty ( )

◆ SetPrefMapMode()

void Bitmap::SetPrefMapMode ( const MapMode rMapMode)
inline

◆ SetPrefSize()

void Bitmap::SetPrefSize ( const Size rSize)
inline

◆ Vectorize()

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

References ImplVectorizer::ImplVectorize().

Member Data Documentation

◆ maPrefMapMode

MapMode Bitmap::maPrefMapMode
private

◆ maPrefSize

Size Bitmap::maPrefSize
private

◆ mxSalBmp

std::shared_ptr<SalBitmap> Bitmap::mxSalBmp
private

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