include/vcl/bitmap.hxx                            |    6 ++-
 reportdesign/qa/unit/data/roundTrip.odb           |binary
 svx/source/customshapes/EnhancedCustomShape2d.cxx |    2 -
 svx/source/customshapes/EnhancedCustomShape3d.cxx |    6 +--
 svx/source/dialog/_bmpmask.cxx                    |   24 ++++++-------
 svx/source/dialog/_contdlg.cxx                    |   19 ++++++-----
 svx/source/dialog/compressgraphicdialog.cxx       |    4 +-
 svx/source/dialog/grfflt.cxx                      |   30 ++++++++---------
 svx/source/gallery2/galmisc.cxx                   |    2 -
 svx/source/gallery2/galobj.cxx                    |    6 +--
 svx/source/sidebar/nbdtmg.cxx                     |    2 -
 svx/source/svdraw/svdetc.cxx                      |    2 -
 svx/source/svdraw/svdoashp.cxx                    |   12 +++---
 svx/source/svdraw/svdograf.cxx                    |    6 +--
 svx/source/svdraw/svdomedia.cxx                   |    6 +--
 svx/source/svdraw/svdpdf.cxx                      |   14 ++++----
 svx/source/svdraw/svdxcgv.cxx                     |    2 -
 svx/source/tbxctrls/itemwin.cxx                   |   30 ++++++++---------
 svx/source/unodraw/UnoGraphicExporter.cxx         |    6 +--
 svx/source/xoutdev/_xoutbmp.cxx                   |    6 +--
 svx/source/xoutdev/xattrbmp.cxx                   |    4 +-
 svx/source/xoutdev/xtabbtmp.cxx                   |    2 -
 svx/source/xoutdev/xtabptrn.cxx                   |    2 -
 vcl/source/bitmap/bitmap.cxx                      |   38 ++++++++++++++++++++++
 vcl/source/filter/graphicfilter.cxx               |    6 +--
 vcl/source/graphic/UnoGraphicProvider.cxx         |   14 ++++----
 vcl/source/image/Image.cxx                        |    2 -
 27 files changed, 150 insertions(+), 103 deletions(-)

New commits:
commit d6896690593602a5da57075a3dd0d526bdda37b5
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Aug 25 14:40:02 2025 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Aug 25 18:11:52 2025 +0200

    BitmapEx->Bitmap in vcl
    
    now that Bitmap supports transparency
    
    Change-Id: I46e62b289aaf9dd3ce6a195e9aaa06838285bbfc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190171
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/vcl/source/filter/graphicfilter.cxx 
b/vcl/source/filter/graphicfilter.cxx
index 2a410899485a..cf35cc9db430 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -246,9 +246,9 @@ static Graphic ImpGetScaledGraphic( const Graphic& 
rGraphic, FilterConfigItem& r
         sal_Int32 nColors = rConfigItem.ReadInt32( u"Color"_ustr, 0 );
         if ( nColors )  // graphic conversion necessary ?
         {
-            BitmapEx aBmpEx( aGraphic.GetBitmapEx() );
-            aBmpEx.Convert( static_cast<BmpConversion>(nColors) );   // the 
entries in the xml section have the same meaning as
-            aGraphic = aBmpEx;                          // they have in the 
BmpConversion enum, so it should be
+            Bitmap aBmp( aGraphic.GetBitmap() );
+            aBmp.Convert( static_cast<BmpConversion>(nColors) );   // the 
entries in the xml section have the same meaning as
+            aGraphic = aBmp;                          // they have in the 
BmpConversion enum, so it should be
         }                                               // allowed to cast them
     }
     else
diff --git a/vcl/source/graphic/UnoGraphicProvider.cxx 
b/vcl/source/graphic/UnoGraphicProvider.cxx
index daf4da518193..77ea10c5f625 100644
--- a/vcl/source/graphic/UnoGraphicProvider.cxx
+++ b/vcl/source/graphic/UnoGraphicProvider.cxx
@@ -502,13 +502,13 @@ void ImplApplyBitmapScaling( ::Graphic& rGraphic, 
sal_Int32 nPixelWidth, sal_Int
 {
     if ( nPixelWidth && nPixelHeight )
     {
-        BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
-        MapMode aPrefMapMode( aBmpEx.GetPrefMapMode() );
-        Size    aPrefSize( aBmpEx.GetPrefSize() );
-        aBmpEx.Scale( Size( nPixelWidth, nPixelHeight ) );
-        aBmpEx.SetPrefMapMode( aPrefMapMode );
-        aBmpEx.SetPrefSize( aPrefSize );
-        rGraphic = aBmpEx;
+        Bitmap aBmp( rGraphic.GetBitmap() );
+        MapMode aPrefMapMode( aBmp.GetPrefMapMode() );
+        Size    aPrefSize( aBmp.GetPrefSize() );
+        aBmp.Scale( Size( nPixelWidth, nPixelHeight ) );
+        aBmp.SetPrefMapMode( aPrefMapMode );
+        aBmp.SetPrefSize( aPrefSize );
+        rGraphic = aBmp;
     }
 }
 
diff --git a/vcl/source/image/Image.cxx b/vcl/source/image/Image.cxx
index 62571e56ce8c..126e28d35739 100644
--- a/vcl/source/image/Image.cxx
+++ b/vcl/source/image/Image.cxx
@@ -55,7 +55,7 @@ Image::Image(uno::Reference<graphic::XGraphic> const & 
rxGraphic)
         else if (aGraphic.GetType() == GraphicType::GdiMetafile)
             mpImplData = 
std::make_shared<ImplImage>(aGraphic.GetGDIMetaFile());
         else
-            ImplInit(Bitmap(aGraphic.GetBitmapEx()));
+            ImplInit(aGraphic.GetBitmap());
     }
 }
 
commit c4e3658169d08180f74d56788c6b53d13a90ba07
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Aug 25 13:09:50 2025 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Aug 25 18:11:41 2025 +0200

    BitmapEx->Bitmap in svx
    
    now that Bitmap supports transparency
    
    In SvxContourDlg::CreateAutoContour I had to adjust the logic
    a bit because Graphic will return true for IsTransparent()
    if it contains vector data, but then we call GetBitmap()
    and we don't get a alpha layer.
    
    Change-Id: I902436c757a1e11455f543ae7ee02d765b6dee0b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190169
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index 1f2c43113c6a..b44005dbaa7a 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -535,6 +535,10 @@ public:
                                 size_t nColorCount,
                                 sal_uInt8 const * pTols );
 
+    /** Replace transparency with given color.
+     */
+    void ReplaceTransparency( const Color& rColor );
+
     /** Change various global color characteristics
 
         @param nLuminancePercent
@@ -565,7 +569,7 @@ public:
 
         @return true, if the operation was completed successfully.
      */
-    SAL_DLLPRIVATE bool Adjust(
+    bool Adjust(
                                 short nLuminancePercent,
                                 short nContrastPercent = 0,
                                 short nChannelRPercent = 0,
diff --git a/reportdesign/qa/unit/data/roundTrip.odb 
b/reportdesign/qa/unit/data/roundTrip.odb
index f36e443b4422..f4914f44c984 100644
Binary files a/reportdesign/qa/unit/data/roundTrip.odb and 
b/reportdesign/qa/unit/data/roundTrip.odb differ
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx 
b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 9d7db116863c..ac16404301ad 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -2855,7 +2855,7 @@ void EnhancedCustomShape2d::AdaptObjColor(
         {
             if ( nColorCount || 0.0 != dBrightness )
             {
-                BitmapEx 
aBitmap(rObj.GetMergedItem(XATTR_FILLBITMAP).GetGraphicObject().GetGraphic().GetBitmapEx());
+                Bitmap 
aBitmap(rObj.GetMergedItem(XATTR_FILLBITMAP).GetGraphicObject().GetGraphic().GetBitmap());
 
                 short nLuminancePercent = static_cast< short > ( 
GetLuminanceChange(
                         nColorCount ? std::min(nColorIndex, nColorCount-1) : 
nColorIndex));
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx 
b/svx/source/customshapes/EnhancedCustomShape3d.cxx
index cd2d1c751eba..230184f17b83 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx
@@ -528,12 +528,12 @@ rtl::Reference<SdrObject> 
EnhancedCustomShape3d::Create3DObject(
                     aPlaceholderObjectList.push_back( p3DObj.get() );
                 else if ( bUseTwoFillStyles )
                 {
-                    BitmapEx aFillBmp;
+                    Bitmap aFillBmp;
                     bool bFillBmpTile = p3DObj->GetMergedItem( 
XATTR_FILLBMP_TILE ).GetValue();
                     if ( bFillBmpTile )
                     {
                         const XFillBitmapItem& rBmpItm = 
p3DObj->GetMergedItem(XATTR_FILLBITMAP);
-                        aFillBmp = 
rBmpItm.GetGraphicObject().GetGraphic().GetBitmapEx();
+                        aFillBmp = 
rBmpItm.GetGraphicObject().GetGraphic().GetBitmap();
 
                         // #i122777# old adaptation of FillStyle bitmap size 
to 5-times the original size; this is not needed
                         // anymore and was used in old times to male the fill 
look better when converting to 3D. Removed
@@ -555,7 +555,7 @@ rtl::Reference<SdrObject> 
EnhancedCustomShape3d::Create3DObject(
                         if ( aSnapRect != aBoundRect && aSnapRect.GetWidth() > 
0 && aSnapRect.GetHeight() > 0)
                         {
                             const XFillBitmapItem& rBmpItm = 
p3DObj->GetMergedItem(XATTR_FILLBITMAP);
-                            aFillBmp = 
rBmpItm.GetGraphicObject().GetGraphic().GetBitmapEx();
+                            aFillBmp = 
rBmpItm.GetGraphicObject().GetGraphic().GetBitmap();
                             Size aBmpSize( aFillBmp.GetSizePixel() );
                             double fXScale = 
static_cast<double>(aBoundRect.GetWidth()) / 
static_cast<double>(aSnapRect.GetWidth());
                             double fYScale = 
static_cast<double>(aBoundRect.GetHeight()) / 
static_cast<double>(aSnapRect.GetHeight());
diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx
index 794f2c419ced..ce33363d6879 100644
--- a/svx/source/dialog/_bmpmask.cxx
+++ b/svx/source/dialog/_bmpmask.cxx
@@ -635,7 +635,7 @@ Animation SvxBmpMask::ImpMask( const Animation& rAnimation )
     for( sal_uInt16 i = 0; i < nAnimationCount; i++ )
     {
         AnimationFrame aAnimationFrame( aAnimation.Get( i ) );
-        aAnimationFrame.maBitmapEx = 
Mask(aAnimationFrame.maBitmapEx).GetBitmapEx();
+        aAnimationFrame.maBitmapEx = 
BitmapEx(Mask(aAnimationFrame.maBitmapEx).GetBitmap());
         aAnimation.Replace(aAnimationFrame, i);
     }
 
@@ -810,7 +810,7 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
                 case MetaActionType::BMP:
                 {
                     MetaBmpAction*  pAct = 
static_cast<MetaBmpAction*>(pAction);
-                    const Bitmap    aBmp( 
Mask(BitmapEx(pAct->GetBitmap())).GetBitmapEx().GetBitmap() );
+                    const Bitmap    aBmp( 
Mask(BitmapEx(pAct->GetBitmap())).GetBitmap().CreateColorBitmap() );
 
                     pAct = new MetaBmpAction( pAct->GetPoint(), aBmp );
                     aMtf.AddAction( pAct );
@@ -820,7 +820,7 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
                 case MetaActionType::BMPSCALE:
                 {
                     MetaBmpScaleAction* pAct = 
static_cast<MetaBmpScaleAction*>(pAction);
-                    const Bitmap        aBmp( 
Mask(BitmapEx(pAct->GetBitmap())).GetBitmapEx().GetBitmap() );
+                    const Bitmap        aBmp( 
Mask(BitmapEx(pAct->GetBitmap())).GetBitmap().CreateColorBitmap() );
 
                     pAct = new MetaBmpScaleAction( pAct->GetPoint(), 
pAct->GetSize(), aBmp );
                     aMtf.AddAction( pAct );
@@ -830,7 +830,7 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
                 case MetaActionType::BMPSCALEPART:
                 {
                     MetaBmpScalePartAction* pAct = 
static_cast<MetaBmpScalePartAction*>(pAction);
-                    const Bitmap            aBmp( 
Mask(BitmapEx(pAct->GetBitmap())).GetBitmapEx().GetBitmap() );
+                    const Bitmap            aBmp( 
Mask(BitmapEx(pAct->GetBitmap())).GetBitmap().CreateColorBitmap() );
 
                     pAct = new MetaBmpScalePartAction( pAct->GetDestPoint(), 
pAct->GetDestSize(),
                                                        pAct->GetSrcPoint(), 
pAct->GetSrcSize(), aBmp );
@@ -841,7 +841,7 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
                 case MetaActionType::BMPEX:
                 {
                     MetaBmpExAction*    pAct = 
static_cast<MetaBmpExAction*>(pAction);
-                    const BitmapEx      aBmpEx( Mask( pAct->GetBitmapEx() 
).GetBitmapEx() );
+                    const BitmapEx      aBmpEx( Mask( pAct->GetBitmapEx() 
).GetBitmap() );
 
                     pAct = new MetaBmpExAction( pAct->GetPoint(), aBmpEx );
                     aMtf.AddAction( pAct );
@@ -851,7 +851,7 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
                 case MetaActionType::BMPEXSCALE:
                 {
                     MetaBmpExScaleAction*   pAct = 
static_cast<MetaBmpExScaleAction*>(pAction);
-                    const BitmapEx          aBmpEx( Mask( pAct->GetBitmapEx() 
).GetBitmapEx() );
+                    const BitmapEx          aBmpEx( Mask( pAct->GetBitmapEx() 
).GetBitmap() );
 
                     pAct = new MetaBmpExScaleAction( pAct->GetPoint(), 
pAct->GetSize(), aBmpEx );
                     aMtf.AddAction( pAct );
@@ -861,7 +861,7 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
                 case MetaActionType::BMPEXSCALEPART:
                 {
                     MetaBmpExScalePartAction*   pAct = 
static_cast<MetaBmpExScalePartAction*>(pAction);
-                    const BitmapEx              aBmpEx( Mask( 
pAct->GetBitmapEx() ).GetBitmapEx() );
+                    const BitmapEx              aBmpEx( Mask( 
pAct->GetBitmapEx() ).GetBitmap() );
 
                     pAct = new MetaBmpExScalePartAction( pAct->GetDestPoint(), 
pAct->GetDestSize(),
                                                          pAct->GetSrcPoint(), 
pAct->GetSrcSize(), aBmpEx );
@@ -960,9 +960,9 @@ Graphic SvxBmpMask::Mask( const Graphic& rGraphic )
                 // Replace transparency?
                 if( m_xCbxTrans->get_active() )
                 {
-                    BitmapEx aBmpEx = aGraphic.GetBitmapEx();
-                    aBmpEx.ReplaceTransparency(aReplColor);
-                    aGraphic = aBmpEx;
+                    Bitmap aBmp = aGraphic.GetBitmap();
+                    aBmp.ReplaceTransparency(aReplColor);
+                    aGraphic = aBmp;
                 }
                 else
                 {
@@ -979,7 +979,7 @@ Graphic SvxBmpMask::Mask( const Graphic& rGraphic )
                             // Do we have a transparent color?
                             if (pDstCols[i] == COL_TRANSPARENT)
                             {
-                                Bitmap    aBmp( ImpMaskTransparent( 
Bitmap(aGraphic.GetBitmapEx()),
+                                Bitmap    aBmp( ImpMaskTransparent( 
aGraphic.GetBitmap(),
                                                                         
pSrcCols[ i ], pTols[ i ] ) );
                                 const Size  aSize( aBmp.GetSizePixel() );
 
@@ -989,7 +989,7 @@ Graphic SvxBmpMask::Mask( const Graphic& rGraphic )
                         }
 
                         // now replace it again with the normal colors
-                        Bitmap  aBitmap( aGraphic.GetBitmapEx() );
+                        Bitmap  aBitmap( aGraphic.GetBitmap() );
                         if ( aBitmap.GetSizePixel().Width() && 
aBitmap.GetSizePixel().Height() )
                         {
                             ImpMask( aBitmap );
diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx
index 71ba72b032f0..5354176c6e36 100644
--- a/svx/source/dialog/_contdlg.cxx
+++ b/svx/source/dialog/_contdlg.cxx
@@ -114,12 +114,17 @@ tools::PolyPolygon SvxContourDlg::CreateAutoContour( 
const Graphic& rGraphic,
                 aBmp.Convert( BmpConversion::N1BitThreshold );
             }
         }
-        else if( rGraphic.IsTransparent() )
-            aBmp = rGraphic.GetBitmapEx().GetAlphaMask().GetBitmap();
         else
         {
-            aBmp = rGraphic.GetBitmapEx().GetBitmap();
-            bContourEdgeDetect = true;
+            Bitmap aTmpBmp = rGraphic.GetBitmap();
+            if (aTmpBmp.HasAlpha())
+                aBmp = aTmpBmp.CreateAlphaMask().GetBitmap();
+            else
+            {
+
+                aBmp = aTmpBmp;
+                bContourEdgeDetect = true;
+            }
         }
     }
     else if( rGraphic.GetType() != GraphicType::NONE )
@@ -631,10 +636,10 @@ IMPL_LINK( SvxSuperContourDlg, PipetteClickHdl, 
ContourWindow&, rWnd, void )
         {
             const tools::Long  nTol = 
static_cast<tools::Long>(m_xMtfTolerance->get_value(FieldUnit::PERCENT) * 255 / 
100);
 
-            AlphaMask aMask = 
aGraphic.GetBitmapEx().GetBitmap().CreateAlphaMask( rColor, nTol );
+            AlphaMask aMask = 
aGraphic.GetBitmap().CreateColorBitmap().CreateAlphaMask( rColor, nTol );
 
             if( aGraphic.IsTransparent() )
-                aMask.AlphaCombineOr( aGraphic.GetBitmapEx().GetAlphaMask() );
+                aMask.AlphaCombineOr( aGraphic.GetBitmap().CreateAlphaMask() );
 
             if( !aMask.IsEmpty() )
             {
@@ -645,7 +650,7 @@ IMPL_LINK( SvxSuperContourDlg, PipetteClickHdl, 
ContourWindow&, rWnd, void )
 
                 aRedoGraphic = Graphic();
                 aUndoGraphic = aGraphic;
-                Bitmap aBmp = aGraphic.GetBitmapEx().GetBitmap();
+                Bitmap aBmp = aGraphic.GetBitmap().CreateColorBitmap();
                 aGraphic = Graphic( BitmapEx( aBmp, aMask ) );
                 mnGrfChanged++;
 
diff --git a/svx/source/dialog/compressgraphicdialog.cxx 
b/svx/source/dialog/compressgraphicdialog.cxx
index bf427e5a99c5..52b35ca5920e 100644
--- a/svx/source/dialog/compressgraphicdialog.cxx
+++ b/svx/source/dialog/compressgraphicdialog.cxx
@@ -258,7 +258,7 @@ BmpScaleFlag 
CompressGraphicsDialog::GetSelectedInterpolationType() const
 
 void CompressGraphicsDialog::Compress(SvStream& aStream)
 {
-    BitmapEx aBitmap = m_aGraphic.GetBitmapEx();
+    Bitmap aBitmap = m_aGraphic.GetBitmap();
     if ( m_xReduceResolutionCB->get_active() )
     {
         tools::Long nPixelX = static_cast<tools::Long>( GetViewWidthInch() * 
m_dResolution );
@@ -394,7 +394,7 @@ tools::Rectangle 
CompressGraphicsDialog::GetScaledCropRectangle() const
     {
         tools::Long nPixelX = static_cast<tools::Long>( GetViewWidthInch()  * 
m_dResolution );
         tools::Long nPixelY = static_cast<tools::Long>( GetViewHeightInch() * 
m_dResolution );
-        Size aSize = m_aGraphic.GetBitmapEx().GetSizePixel();
+        Size aSize = m_aGraphic.GetBitmap().GetSizePixel();
         double aScaleX = nPixelX / static_cast<double>(aSize.Width());
         double aScaleY = nPixelY / static_cast<double>(aSize.Height());
 
diff --git a/svx/source/dialog/grfflt.cxx b/svx/source/dialog/grfflt.cxx
index d460840fa94e..329cafdbb65d 100644
--- a/svx/source/dialog/grfflt.cxx
+++ b/svx/source/dialog/grfflt.cxx
@@ -68,10 +68,10 @@ void SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest 
const & rReq,
             }
             else
             {
-                BitmapEx aBmpEx( aInputGraphic.GetBitmapEx() );
+                Bitmap aBmp( aInputGraphic.GetBitmap() );
 
-                if( aBmpEx.Invert() )
-                    aOutputGraphic = aBmpEx;
+                if( aBmp.Invert() )
+                    aOutputGraphic = aBmp;
             }
 
             if( pShell )
@@ -105,10 +105,10 @@ void SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest 
const & rReq,
             }
             else
             {
-                BitmapEx aBmpEx( aInputGraphic.GetBitmapEx() );
+                Bitmap aBmp( aInputGraphic.GetBitmap() );
 
-                if (BitmapFilter::Filter(aBmpEx, BitmapSharpenFilter()))
-                    aOutputGraphic = aBmpEx;
+                if (BitmapFilter::Filter(aBmp, BitmapSharpenFilter()))
+                    aOutputGraphic = aBmp;
             }
 
             if( pShell )
@@ -135,10 +135,10 @@ void SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest 
const & rReq,
             }
             else
             {
-                BitmapEx aBmpEx( aInputGraphic.GetBitmapEx() );
+                Bitmap aBmp( aInputGraphic.GetBitmap() );
 
-                if (BitmapFilter::Filter(aBmpEx, BitmapMedianFilter()))
-                    aOutputGraphic = aBmpEx;
+                if (BitmapFilter::Filter(aBmp, BitmapMedianFilter()))
+                    aOutputGraphic = aBmp;
             }
 
             if( pShell )
@@ -165,10 +165,10 @@ void SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest 
const & rReq,
             }
             else
             {
-                BitmapEx aBmpEx( aInputGraphic.GetBitmapEx() );
+                Bitmap aBmp( aInputGraphic.GetBitmap() );
 
-                if (BitmapFilter::Filter(aBmpEx, BitmapSobelGreyFilter()))
-                    aOutputGraphic = aBmpEx;
+                if (BitmapFilter::Filter(aBmp, BitmapSobelGreyFilter()))
+                    aOutputGraphic = aBmp;
             }
 
             if( pShell )
@@ -216,10 +216,10 @@ void SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest 
const & rReq,
             }
             else
             {
-                BitmapEx aBmpEx( aInputGraphic.GetBitmapEx() );
+                Bitmap aBmp( aInputGraphic.GetBitmap() );
 
-                if (BitmapFilter::Filter(aBmpEx, BitmapPopArtFilter()))
-                    aOutputGraphic = aBmpEx;
+                if (BitmapFilter::Filter(aBmp, BitmapPopArtFilter()))
+                    aOutputGraphic = aBmp;
             }
 
             if( pShell )
diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx
index 4cf8d235806a..b3e7f51f5989 100644
--- a/svx/source/gallery2/galmisc.cxx
+++ b/svx/source/gallery2/galmisc.cxx
@@ -492,7 +492,7 @@ bool GalleryTransferable::GetData( const 
datatransfer::DataFlavor& rFlavor, cons
     else if( ( SotClipboardFormatId::BITMAP == nFormat || 
SotClipboardFormatId::PNG == nFormat)
         && mpGraphicObject )
     {
-        bRet = SetBitmapEx( 
Bitmap(mpGraphicObject->GetGraphic().GetBitmapEx()), rFlavor );
+        bRet = SetBitmapEx( mpGraphicObject->GetGraphic().GetBitmap(), rFlavor 
);
     }
 
     return bRet;
diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx
index abea217cbbf7..418b04c6fbe7 100644
--- a/svx/source/gallery2/galobj.cxx
+++ b/svx/source/gallery2/galobj.cxx
@@ -73,7 +73,7 @@ BitmapEx SgaObject::createPreviewBitmapEx(const Size& 
rSizePixel) const
         {
             const Graphic aGraphic(GetThumbMtf());
 
-            aRetval = aGraphic.GetBitmapEx();
+            aRetval = aGraphic.GetBitmap();
         }
 
         if(!aRetval.IsEmpty())
@@ -101,7 +101,7 @@ bool SgaObject::CreateThumb( const Graphic& rGraphic )
 
     if( rGraphic.GetType() == GraphicType::Bitmap )
     {
-        Bitmap      aBmp( rGraphic.GetBitmapEx() );
+        Bitmap      aBmp( rGraphic.GetBitmap() );
         Size        aBmpSize( aBmp.GetSizePixel() );
 
         if( aBmpSize.Width() && aBmpSize.Height() )
@@ -161,7 +161,7 @@ bool SgaObject::CreateThumb( const Graphic& rGraphic )
             aSize.setHeight( static_cast<sal_Int32>( S_THUMB / fFactor ) );
 
         const GraphicConversionParameters aParameters(aSize, false, true, true 
/*TODO: extra ", true" post-#i121194#*/);
-        aThumbBmp = Bitmap(rGraphic.GetBitmapEx(aParameters));
+        aThumbBmp = rGraphic.GetBitmap(aParameters);
 
         if( !aThumbBmp.IsEmpty() )
         {
diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx
index ec3d307067b9..ca64c8f1ad68 100644
--- a/svx/source/sidebar/nbdtmg.cxx
+++ b/svx/source/sidebar/nbdtmg.cxx
@@ -685,7 +685,7 @@ sal_uInt16 
OutlineTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 /*m
                     const Graphic* pGrf2 = pBrsh2->GetGraphic();
                     if (pGrf1==pGrf2) bIsMatch = true;
                     if (pGrf1 && pGrf2) {
-                        if ( pGrf1->GetBitmapEx() == pGrf2->GetBitmapEx() &&
+                        if ( pGrf1->GetBitmap() == pGrf2->GetBitmap() &&
                                 _pSet->aSize == aFmt.GetGraphicSize())
                             bIsMatch = true;
                     }
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index 69a5a5bca4ab..31fea66f0965 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -277,7 +277,7 @@ std::optional<Color> GetDraftFillColor(const SfxItemSet& 
rSet)
         }
         case drawing::FillStyle_BITMAP:
         {
-            Bitmap 
aBitmap(rSet.Get(XATTR_FILLBITMAP).GetGraphicObject().GetGraphic().GetBitmapEx().GetBitmap());
+            Bitmap 
aBitmap(rSet.Get(XATTR_FILLBITMAP).GetGraphicObject().GetGraphic().GetBitmap().CreateColorBitmap());
             const Size aSize(aBitmap.GetSizePixel());
             const sal_uInt32 nWidth = aSize.Width();
             const sal_uInt32 nHeight = aSize.Height();
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 8421a70f3a89..ef5d6eeca657 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -347,15 +347,15 @@ static rtl::Reference<SdrObject> 
ImpCreateShadowObjectClone(const SdrObject& rOr
         if(bBitmapFillUsed)
         {
             GraphicObject 
aGraphicObject(rOriginalSet.Get(XATTR_FILLBITMAP).GetGraphicObject());
-            BitmapEx aBitmapEx(aGraphicObject.GetGraphic().GetBitmapEx());
+            Bitmap aBitmap(aGraphicObject.GetGraphic().GetBitmap());
 
-            if(!aBitmapEx.IsEmpty())
+            if(!aBitmap.IsEmpty())
             {
                 ScopedVclPtr<VirtualDevice> 
pVirDev(VclPtr<VirtualDevice>::Create());
-                pVirDev->SetOutputSizePixel(aBitmapEx.GetSizePixel());
-                BitmapFilter::Filter(aBitmapEx, 
BitmapShadowFilter(aShadowColor));
-                pVirDev->DrawBitmapEx(Point(), aBitmapEx);
-                
aGraphicObject.SetGraphic(Graphic(pVirDev->GetBitmap(Point(0,0), 
aBitmapEx.GetSizePixel())));
+                pVirDev->SetOutputSizePixel(aBitmap.GetSizePixel());
+                BitmapFilter::Filter(aBitmap, 
BitmapShadowFilter(aShadowColor));
+                pVirDev->DrawBitmapEx(Point(), aBitmap);
+                
aGraphicObject.SetGraphic(Graphic(pVirDev->GetBitmap(Point(0,0), 
aBitmap.GetSizePixel())));
             }
 
             aTempSet.Put(XFillBitmapItem(aGraphicObject));
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 24340c40aa36..519476107a71 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -342,7 +342,7 @@ const GraphicObject* 
SdrGrafObj::GetReplacementGraphicObject() const
         else if (mpGraphicObject->GetGraphic().GetType() == 
GraphicType::GdiMetafile)
         {
             // Replacement graphic for PDF and metafiles is just the bitmap.
-            
const_cast<SdrGrafObj*>(this)->mpReplacementGraphicObject.reset(new 
GraphicObject(mpGraphicObject->GetGraphic().GetBitmapEx()));
+            
const_cast<SdrGrafObj*>(this)->mpReplacementGraphicObject.reset(new 
GraphicObject(mpGraphicObject->GetGraphic().GetBitmap()));
         }
     }
 
@@ -1005,8 +1005,8 @@ rtl::Reference<SdrObject> 
SdrGrafObj::DoConvertToPolyObj(bool bBezier, bool bAdd
                 SfxItemSet aSet(GetObjectItemSet());
 
                 aSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP));
-                const BitmapEx 
aBitmapEx(GetTransformedGraphic().GetBitmapEx());
-                aSet.Put(XFillBitmapItem(OUString(), Graphic(aBitmapEx)));
+                const Bitmap aBitmap(GetTransformedGraphic().GetBitmap());
+                aSet.Put(XFillBitmapItem(OUString(), Graphic(aBitmap)));
                 aSet.Put(XFillBmpTileItem(false));
 
                 pRetval->SetMergedItemSet(aSet);
diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx
index 3e731bacbc1f..48b8f0c7bb28 100644
--- a/svx/source/svdraw/svdomedia.cxx
+++ b/svx/source/svdraw/svdomedia.cxx
@@ -169,9 +169,9 @@ uno::Reference< graphic::XGraphic > const & 
SdrMediaObj::getSnapshot() const
                 tools::Long nTop = aPixel.getHeight() * rCrop.Top / 
aPref.getHeight();
                 tools::Long nRight = aPixel.getWidth() * rCrop.Right / 
aPref.getWidth();
                 tools::Long nBottom = aPixel.getHeight() * rCrop.Bottom / 
aPref.getHeight();
-                BitmapEx aBitmapEx = aGraphic.GetBitmapEx();
-                aBitmapEx.Crop({nLeft, nTop, aPixel.getWidth() - nRight, 
aPixel.getHeight() - nBottom});
-                aGraphic = aBitmapEx;
+                Bitmap aBitmap = aGraphic.GetBitmap();
+                aBitmap.Crop({nLeft, nTop, aPixel.getWidth() - nRight, 
aPixel.getHeight() - nBottom});
+                aGraphic = aBitmap;
             }
 
             // We have an explicit graphic for this media object, then go with 
that instead of
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index a519ebd45cca..fe5e0d917258 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -483,11 +483,11 @@ void ImpSdrPdfImport::InsertObj(SdrObject* pObj1, bool 
bScale)
         }
         else
         {
-            BitmapEx aBitmapEx;
+            Bitmap aBitmap;
 
             if (pSdrGrafObj)
             {
-                aBitmapEx = pSdrGrafObj->GetGraphic().GetBitmapEx();
+                aBitmap = pSdrGrafObj->GetGraphic().GetBitmap();
             }
 
             pObj.clear();
@@ -508,13 +508,13 @@ void ImpSdrPdfImport::InsertObj(SdrObject* pObj1, bool 
bScale)
                     pObj->SetLayer(aOldLayer);
                     pObj->SetMergedItemSet(aOldItemSet);
 
-                    if (!aBitmapEx.IsEmpty())
+                    if (!aBitmap.IsEmpty())
                     {
                         // aNewRange is inside of aOldRange and defines which 
part of aBitmapEx is used
-                        const double fScaleX(aBitmapEx.GetSizePixel().Width()
+                        const double fScaleX(aBitmap.GetSizePixel().Width()
                                              / (aOldRange.getWidth() ? 
aOldRange.getWidth() : 1.0));
                         const double fScaleY(
-                            aBitmapEx.GetSizePixel().Height()
+                            aBitmap.GetSizePixel().Height()
                             / (aOldRange.getHeight() ? aOldRange.getHeight() : 
1.0));
                         basegfx::B2DRange aPixel(aNewRange);
                         basegfx::B2DHomMatrix aTrans;
@@ -523,7 +523,7 @@ void ImpSdrPdfImport::InsertObj(SdrObject* pObj1, bool 
bScale)
                         aTrans.scale(fScaleX, fScaleY);
                         aPixel.transform(aTrans);
 
-                        const Size aOrigSizePixel(aBitmapEx.GetSizePixel());
+                        const Size aOrigSizePixel(aBitmap.GetSizePixel());
                         const Point aClipTopLeft(
                             basegfx::fround<tools::Long>(floor(std::max(0.0, 
aPixel.getMinX()))),
                             basegfx::fround<tools::Long>(floor(std::max(0.0, 
aPixel.getMinY()))));
@@ -533,7 +533,7 @@ void ImpSdrPdfImport::InsertObj(SdrObject* pObj1, bool 
bScale)
                             basegfx::fround<tools::Long>(
                                 
ceil(std::min(static_cast<double>(aOrigSizePixel.Height()),
                                               aPixel.getHeight()))));
-                        const BitmapEx aClippedBitmap(aBitmapEx, aClipTopLeft, 
aClipSize);
+                        const BitmapEx aClippedBitmap(BitmapEx(aBitmap), 
aClipTopLeft, aClipSize);
 
                         
pObj->SetMergedItem(XFillStyleItem(drawing::FillStyle_BITMAP));
                         pObj->SetMergedItem(XFillBitmapItem(OUString(), 
Graphic(aClippedBitmap)));
diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx
index 84cfc5833f60..f57c23762c4d 100644
--- a/svx/source/svdraw/svdxcgv.cxx
+++ b/svx/source/svdraw/svdxcgv.cxx
@@ -435,7 +435,7 @@ Bitmap SdrExchangeView::GetMarkedObjBitmap(bool 
bNoVDevIfOneBmpMarked, const sal
             if(bNoVDevIfOneBmpMarked)
             {
                 if (pGrafObj->GetGraphicType() == GraphicType::Bitmap)
-                    aBmp = 
Bitmap(pGrafObj->GetTransformedGraphic().GetBitmapEx());
+                    aBmp = pGrafObj->GetTransformedGraphic().GetBitmap();
             }
             else
             {
diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx
index bfc5b14ea0e9..337ee5cbb6f3 100644
--- a/svx/source/tbxctrls/itemwin.cxx
+++ b/svx/source/tbxctrls/itemwin.cxx
@@ -188,15 +188,15 @@ void SvxFillTypeBox::Fill(weld::ComboBox& rListBox)
 
 namespace
 {
-    void formatBitmapExToSize(BitmapEx& rBitmapEx, const Size& rSize)
+    void formatBitmapToSize(Bitmap& rBitmap, const Size& rSize)
     {
-        if(rBitmapEx.IsEmpty() || rSize.IsEmpty())
+        if(rBitmap.IsEmpty() || rSize.IsEmpty())
             return;
 
         ScopedVclPtrInstance< VirtualDevice > pVirtualDevice;
         pVirtualDevice->SetOutputSizePixel(rSize);
 
-        if(rBitmapEx.IsAlpha())
+        if(rBitmap.HasAlpha())
         {
             const StyleSettings& rStyleSettings = 
Application::GetSettings().GetStyleSettings();
 
@@ -216,14 +216,14 @@ namespace
             }
         }
 
-        if(rBitmapEx.GetSizePixel().Width() >= rSize.Width() && 
rBitmapEx.GetSizePixel().Height() >= rSize.Height())
+        if(rBitmap.GetSizePixel().Width() >= rSize.Width() && 
rBitmap.GetSizePixel().Height() >= rSize.Height())
         {
-            rBitmapEx.Scale(rSize);
-            pVirtualDevice->DrawBitmapEx(Point(0, 0), rBitmapEx);
+            rBitmap.Scale(rSize);
+            pVirtualDevice->DrawBitmapEx(Point(0, 0), rBitmap);
         }
         else
         {
-            const Size aBitmapSize(rBitmapEx.GetSizePixel());
+            const Size aBitmapSize(rBitmap.GetSizePixel());
 
             for(tools::Long y(0); y < rSize.Height(); y += 
aBitmapSize.Height())
             {
@@ -231,12 +231,12 @@ namespace
                 {
                     pVirtualDevice->DrawBitmapEx(
                         Point(x, y),
-                        rBitmapEx);
+                        rBitmap);
                 }
             }
         }
 
-        rBitmapEx = pVirtualDevice->GetBitmap(Point(0, 0), rSize);
+        rBitmap = pVirtualDevice->GetBitmap(Point(0, 0), rSize);
     }
 } // end of anonymous namespace
 
@@ -309,9 +309,9 @@ void SvxFillAttrBox::Fill(weld::ComboBox& rBox, const 
XBitmapListRef &pList)
     for( tools::Long i = 0; i < nCount; i++ )
     {
         const XBitmapEntry* pEntry = pList->GetBitmap( i );
-        BitmapEx aBitmapEx = 
pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
-        formatBitmapExToSize(aBitmapEx, aSize);
-        pVD->DrawBitmapEx(Point(), aBitmapEx);
+        Bitmap aBitmap = pEntry->GetGraphicObject().GetGraphic().GetBitmap();
+        formatBitmapToSize(aBitmap, aSize);
+        pVD->DrawBitmapEx(Point(), aBitmap);
         rBox.append(u""_ustr, pEntry->GetName(), *pVD);
     }
 
@@ -333,9 +333,9 @@ void SvxFillAttrBox::Fill(weld::ComboBox& rBox, const 
XPatternListRef &pList)
     for( tools::Long i = 0; i < nCount; i++ )
     {
         const XBitmapEntry* pEntry = pList->GetBitmap( i );
-        BitmapEx aBitmapEx = 
pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
-        formatBitmapExToSize(aBitmapEx, aSize);
-        pVD->DrawBitmapEx(Point(), aBitmapEx);
+        Bitmap aBitmap = pEntry->GetGraphicObject().GetGraphic().GetBitmap();
+        formatBitmapToSize(aBitmap, aSize);
+        pVD->DrawBitmapEx(Point(), aBitmap);
         rBox.append(u""_ustr, pEntry->GetName(), *pVD);
     }
 
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx 
b/svx/source/unodraw/UnoGraphicExporter.cxx
index aff08a85e2c6..799fe3af9bb3 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -793,10 +793,10 @@ bool GraphicExporter::GetGraphic( ExportSettings const & 
rSettings, Graphic& aGr
                                 ( ( rSettings.mnWidth != aSizePixel.Width() ) 
||
                                   ( rSettings.mnHeight != aSizePixel.Height() 
) ) )
                             {
-                                BitmapEx aBmpEx( aGraphic.GetBitmapEx() );
+                                Bitmap aBmp( aGraphic.GetBitmap() );
                                 // export: use highest quality
-                                aBmpEx.Scale( Size( rSettings.mnWidth, 
rSettings.mnHeight ), BmpScaleFlag::Lanczos );
-                                aGraphic = aBmpEx;
+                                aBmp.Scale( Size( rSettings.mnWidth, 
rSettings.mnHeight ), BmpScaleFlag::Lanczos );
+                                aGraphic = aBmp;
                             }
 
                             // #118804# only accept for bitmap graphics, else 
the
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index 1c7ecadb34cf..7c6dc7441568 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -104,7 +104,7 @@ Graphic XOutBitmap::MirrorGraphic( const Graphic& rGraphic, 
const BmpMirrorFlags
         }
         else
         {
-            BitmapEx aBmp( rGraphic.GetBitmapEx() );
+            Bitmap aBmp( rGraphic.GetBitmap() );
             aBmp.Mirror( nMirrorFlags );
             aRetGraphic = aBmp;
         }
@@ -325,10 +325,10 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& 
rGraphic, OUString& rFileName,
                 }
             }
             else
-                aGraphic = rGraphic.GetBitmapEx();
+                aGraphic = rGraphic.GetBitmap();
         }
         else
-            aGraphic = rGraphic.GetBitmapEx();
+            aGraphic = rGraphic.GetBitmap();
 
         // mirror?
         if( ( nFlags & XOutFlags::MirrorHorz ) || ( nFlags & 
XOutFlags::MirrorVert ) )
diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx
index 2b4dcf90c3d5..be5f4e34cbd5 100644
--- a/svx/source/xoutdev/xattrbmp.cxx
+++ b/svx/source/xoutdev/xattrbmp.cxx
@@ -54,7 +54,7 @@ XOBitmap::~XOBitmap()
 
 Bitmap XOBitmap::GetBitmap() const
 {
-    return Bitmap(GetGraphicObject().GetGraphic().GetBitmapEx());
+    return GetGraphicObject().GetGraphic().GetBitmap();
 }
 
 const GraphicObject& XOBitmap::GetGraphicObject() const
@@ -162,7 +162,7 @@ bool XFillBitmapItem::operator==(const SfxPoolItem& rItem) 
const
 bool XFillBitmapItem::isPattern() const
 {
     Color aBack, aFront;
-    return 
vcl::bitmap::isHistorical8x8(Bitmap(GetGraphicObject().GetGraphic().GetBitmapEx()),
 aBack, aFront);
+    return 
vcl::bitmap::isHistorical8x8(GetGraphicObject().GetGraphic().GetBitmap(), 
aBack, aFront);
 }
 
 bool XFillBitmapItem::GetPresentation(
diff --git a/svx/source/xoutdev/xtabbtmp.cxx b/svx/source/xoutdev/xtabbtmp.cxx
index 7b6a5e61dafe..1ef12fafde5f 100644
--- a/svx/source/xoutdev/xtabbtmp.cxx
+++ b/svx/source/xoutdev/xtabbtmp.cxx
@@ -49,7 +49,7 @@ Bitmap XBitmapList::CreateBitmap( tools::Long nIndex, const 
Size& rSize ) const
 
     if(nIndex < Count())
     {
-        Bitmap rBitmap( GetBitmap( nIndex 
)->GetGraphicObject().GetGraphic().GetBitmapEx());
+        Bitmap rBitmap( GetBitmap( nIndex 
)->GetGraphicObject().GetGraphic().GetBitmap());
         ScopedVclPtrInstance< VirtualDevice > pVirtualDevice;
         pVirtualDevice->SetOutputSizePixel(rSize);
 
diff --git a/svx/source/xoutdev/xtabptrn.cxx b/svx/source/xoutdev/xtabptrn.cxx
index 150741a47a56..c17a0e67f5bc 100644
--- a/svx/source/xoutdev/xtabptrn.cxx
+++ b/svx/source/xoutdev/xtabptrn.cxx
@@ -84,7 +84,7 @@ Bitmap XPatternList::CreateBitmap( tools::Long nIndex, const 
Size& rSize ) const
 
     if(nIndex < Count())
     {
-        Bitmap rBitmap(GetBitmap( nIndex 
)->GetGraphicObject().GetGraphic().GetBitmapEx());
+        Bitmap rBitmap(GetBitmap( nIndex 
)->GetGraphicObject().GetGraphic().GetBitmap());
         ScopedVclPtrInstance< VirtualDevice > pVirtualDevice;
         pVirtualDevice->SetOutputSizePixel(rSize);
 
diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx
index 44e39909a80d..4d093757aea2 100644
--- a/vcl/source/bitmap/bitmap.cxx
+++ b/vcl/source/bitmap/bitmap.cxx
@@ -2272,4 +2272,42 @@ void Bitmap::BlendAlpha(sal_uInt8 nAlpha)
     }
 }
 
+void Bitmap::ReplaceTransparency(const Color& rReplaceColor)
+{
+    if( !HasAlpha() )
+        return;
+
+    Bitmap aNewBmp(GetSizePixel(), vcl::PixelFormat::N24_BPP);
+    aNewBmp.SetPrefSize(GetPrefSize());
+    aNewBmp.SetPrefMapMode(GetPrefMapMode());
+
+    {
+        BitmapScopedReadAccess pReadAccess(*this);
+        assert(pReadAccess);
+        if( !pReadAccess )
+            return;
+
+        BitmapScopedWriteAccess pWriteAccess(*this);
+        assert(pWriteAccess);
+        if( !pWriteAccess )
+            return;
+
+        const tools::Long  nWidth = pReadAccess->Width(), nHeight = 
pReadAccess->Height();
+        for( tools::Long nY = 0; nY < nHeight; nY++ )
+        {
+            Scanline pReadScanline = pReadAccess->GetScanline( nY );
+            Scanline pWriteScanline = pWriteAccess->GetScanline( nY );
+            for( tools::Long nX = 0; nX < nWidth; nX++ )
+            {
+                BitmapColor aCol = pReadAccess->GetPixelFromData( 
pReadScanline, nX );
+                aCol.Merge(rReplaceColor, aCol.GetAlpha());
+                aCol.SetAlpha(255);
+                pWriteAccess->SetPixelOnData( pWriteScanline, nX, aCol );
+            }
+        }
+    }
+
+    *this = std::move(aNewBmp);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to