desktop/source/lib/init.cxx                                  |    2 
 drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx  |    2 
 drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx |    6 
 include/vcl/alpha.hxx                                        |   83 +++++++++--
 include/vcl/bitmap.hxx                                       |    6 
 slideshow/source/engine/shapes/gdimtftools.cxx               |    8 -
 svx/source/dialog/_contdlg.cxx                               |    2 
 vcl/qa/cppunit/BitmapExTest.cxx                              |    4 
 vcl/qa/cppunit/canvasbitmaptest.cxx                          |    4 
 vcl/qa/cppunit/skia/skia.cxx                                 |   27 +--
 vcl/source/bitmap/BitmapEx.cxx                               |    8 -
 vcl/source/bitmap/alpha.cxx                                  |   63 ++++----
 vcl/source/bitmap/bitmap.cxx                                 |    8 -
 vcl/source/bitmap/bitmappaint.cxx                            |   14 -
 vcl/source/bitmap/dibtools.cxx                               |    2 
 vcl/source/filter/jpeg/JpegReader.cxx                        |    2 
 vcl/source/filter/png/PngImageWriter.cxx                     |    4 
 vcl/source/filter/wmf/emfwr.cxx                              |    6 
 vcl/source/filter/wmf/wmfwr.cxx                              |    4 
 vcl/source/gdi/FileDefinitionWidgetDraw.cxx                  |    2 
 vcl/source/gdi/pdfwriter_impl.cxx                            |    4 
 vcl/source/graphic/UnoGraphic.cxx                            |    2 
 vcl/source/outdev/background.cxx                             |    2 
 vcl/source/outdev/bitmap.cxx                                 |    4 
 vcl/source/outdev/bitmapex.cxx                               |   12 -
 vcl/workben/vcldemo.cxx                                      |    2 
 26 files changed, 168 insertions(+), 115 deletions(-)

New commits:
commit aa7d1c8f1411fe35465f265259cf1082adf05aea
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Dec 1 13:27:52 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Dec 6 09:51:17 2023 +0100

    make AlphaMask separate from Bitmap
    
    Having it subclass Bitmap encourages confusion in passing it around, and
    I need the extra type-safety for my work on merged-alpha
    
    Change-Id: I35819f9b8ee609cbdaf865563c78531e397b529b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160235
    Tested-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 66075e3312d9..fa1c55c09e05 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4222,7 +4222,7 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
     Bitmap aBmp = aBmpEx.GetBitmap();
     AlphaMask aAlpha = aBmpEx.GetAlphaMask();
     Bitmap::ScopedReadAccess sraBmp(aBmp);
-    Bitmap::ScopedReadAccess sraAlpha(aAlpha);
+    AlphaMask::ScopedReadAccess sraAlpha(aAlpha);
 
     assert(sraBmp->Height() == nCanvasHeight);
     assert(sraBmp->Width() == nCanvasWidth);
diff --git a/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx 
b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
index ee4b6d4cb14f..e1dcac421344 100644
--- a/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
+++ b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
@@ -40,7 +40,7 @@ AlphaMask ProcessAndBlurAlphaMask(const AlphaMask& rMask, 
double fErodeDilateRad
 
     // Only completely white pixels on the initial mask must be considered for 
transparency. Any
     // other color must be treated as black. This creates 1-bit B&W bitmap.
-    BitmapEx mask(bConvertTo1Bit ? tmpMask.CreateMask(COL_WHITE) : tmpMask);
+    BitmapEx mask(bConvertTo1Bit ? tmpMask.GetBitmap().CreateMask(COL_WHITE) : 
tmpMask.GetBitmap());
 
     // Scaling down increases performance without noticeable quality loss. 
Additionally,
     // current blur implementation can only handle blur radius between 2 and 
254.
diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx 
b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index e5658f6cf0d3..6a0dd7e070ee 100644
--- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
@@ -283,7 +283,7 @@ namespace drawinglayer::primitive2d
                             }
                             else
                             {
-                                BitmapEx aExpandVisibilityMask(aAlphaMask, 
aAlphaMask);
+                                BitmapEx 
aExpandVisibilityMask(aAlphaMask.GetBitmap(), aAlphaMask);
                                 
maVirtualDeviceMask->DrawBitmapEx(rAnimationFrame.maPositionPixel, 
aExpandVisibilityMask);
                             }
 
@@ -306,7 +306,7 @@ namespace drawinglayer::primitive2d
                             }
                             else
                             {
-                                BitmapEx aExpandVisibilityMask(rMask, rMask);
+                                BitmapEx 
aExpandVisibilityMask(rMask.GetBitmap(), rMask);
                                 
maVirtualDeviceMask->DrawBitmapEx(rAnimationFrame.maPositionPixel, 
aExpandVisibilityMask);
                             }
 
@@ -315,7 +315,7 @@ namespace drawinglayer::primitive2d
                         case Disposal::Previous:
                         {
                             
maVirtualDevice->DrawBitmapEx(rAnimationFrame.maPositionPixel, 
rAnimationFrame.maBitmapEx);
-                            BitmapEx 
aExpandVisibilityMask(rAnimationFrame.maBitmapEx.GetAlphaMask(), 
rAnimationFrame.maBitmapEx.GetAlphaMask());
+                            BitmapEx 
aExpandVisibilityMask(rAnimationFrame.maBitmapEx.GetAlphaMask().GetBitmap(), 
rAnimationFrame.maBitmapEx.GetAlphaMask());
                             
maVirtualDeviceMask->DrawBitmapEx(rAnimationFrame.maPositionPixel, 
aExpandVisibilityMask);
                             break;
                         }
diff --git a/include/vcl/alpha.hxx b/include/vcl/alpha.hxx
index 8de4ea113d01..65ad50cfb4ea 100644
--- a/include/vcl/alpha.hxx
+++ b/include/vcl/alpha.hxx
@@ -29,24 +29,23 @@
 
 class BitmapEx;
 
-class VCL_DLLPUBLIC AlphaMask final : public Bitmap
+class VCL_DLLPUBLIC AlphaMask final
 {
 public:
-
                 AlphaMask();
     explicit    AlphaMask( const Bitmap& rBitmap );
                 AlphaMask( const AlphaMask& rAlphaMask );
                 AlphaMask( AlphaMask&& rAlphaMask );
     explicit    AlphaMask( const Size& rSizePixel, const sal_uInt8* 
pEraseTransparency = nullptr );
-    virtual     ~AlphaMask() override;
+                ~AlphaMask();
 
     AlphaMask&  operator=( const Bitmap& rBitmap );
-    AlphaMask&  operator=( const AlphaMask& rAlphaMask ) { return 
static_cast<AlphaMask&>( Bitmap::operator=( rAlphaMask ) ); }
-    AlphaMask&  operator=( AlphaMask&& rAlphaMask ) noexcept { return 
static_cast<AlphaMask&>( Bitmap::operator=( std::move(rAlphaMask) ) ); }
-    bool        operator==( const AlphaMask& rAlphaMask ) const { return 
Bitmap::operator==(rAlphaMask); }
-    bool        operator!=( const AlphaMask& rAlphaMask ) const { return 
Bitmap::operator!=(rAlphaMask); }
+    AlphaMask&  operator=( const AlphaMask& rAlphaMask ) { maBitmap = 
rAlphaMask.maBitmap; return *this; }
+    AlphaMask&  operator=( AlphaMask&& rAlphaMask ) noexcept { maBitmap = 
std::move(rAlphaMask.maBitmap); return *this; }
+    bool        operator==( const AlphaMask& rAlphaMask ) const { return 
maBitmap == rAlphaMask.maBitmap; }
+    bool        operator!=( const AlphaMask& rAlphaMask ) const { return 
maBitmap != rAlphaMask.maBitmap; }
 
-    Bitmap const & GetBitmap() const;
+    Bitmap const & GetBitmap() const { return maBitmap; }
 
     void        Erase( sal_uInt8 cTransparency );
     void        BlendWith(const AlphaMask& rOther);
@@ -63,22 +62,76 @@ public:
     // check if alpha is used, returns true if at least one pixel has 
transparence
     bool        hasAlpha() const;
 
-    BitmapReadAccess*  AcquireAlphaReadAccess() { return 
Bitmap::AcquireReadAccess(); }
-    BitmapWriteAccess* AcquireAlphaWriteAccess() { return 
Bitmap::AcquireWriteAccess(); }
-
-    using Bitmap::ReleaseAccess;
+    BitmapReadAccess*  AcquireAlphaReadAccess() { return 
maBitmap.AcquireReadAccess(); }
+    BitmapWriteAccess* AcquireAlphaWriteAccess() { return 
maBitmap.AcquireWriteAccess(); }    
+    static void ReleaseAccess( BitmapInfoAccess* pBitmapAccess ) { 
Bitmap::ReleaseAccess(pBitmapAccess); }
 
     typedef vcl::ScopedBitmapAccess<BitmapReadAccess, AlphaMask, 
&AlphaMask::AcquireAlphaReadAccess> ScopedReadAccess;
+    typedef vcl::ScopedBitmapAccess<BitmapWriteAccess, AlphaMask, 
&AlphaMask::AcquireAlphaWriteAccess> ScopedWriteAccess;
+
+    bool IsEmpty() const { return maBitmap.IsEmpty(); }
+
+    void SetEmpty() { maBitmap.SetEmpty(); }
+
+    vcl::PixelFormat getPixelFormat() const { return 
maBitmap.getPixelFormat(); }
+
+    sal_Int64 GetSizeBytes() const { return maBitmap.GetSizeBytes(); }
+
+    Size GetSizePixel() const { return maBitmap.GetSizePixel(); }
+
+    void SetPrefSize( const Size& rSize ) { maBitmap.SetPrefSize(rSize); }
+
+    void SetPrefMapMode( const MapMode& rMapMode ) { 
maBitmap.SetPrefMapMode(rMapMode); }
+
+    BitmapReadAccess* AcquireReadAccess() { return 
maBitmap.AcquireReadAccess(); }
+
+    BitmapChecksum GetChecksum() const { return maBitmap.GetChecksum(); }
+
+    bool Invert();
 
-    using Bitmap::IsEmpty;
+    bool Mirror( BmpMirrorFlags nMirrorFlags ) { return 
maBitmap.Mirror(nMirrorFlags); }
+
+    bool Scale( const Size& rNewSize, BmpScaleFlag nScaleFlag = 
BmpScaleFlag::Default ) { return maBitmap.Scale(rNewSize, nScaleFlag); }
+
+    bool Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag 
nScaleFlag = BmpScaleFlag::Default )
+    { return maBitmap.Scale(rScaleX, rScaleY, nScaleFlag); }
+
+    bool Convert( BmpConversion eConversion ) { return 
maBitmap.Convert(eConversion); }
+
+    vcl::Region CreateRegion( const Color& rColor, const tools::Rectangle& 
rRect ) const { return maBitmap.CreateRegion(rColor, rRect); }
+
+    bool Rotate( Degree10 nAngle10, const Color& rFillColor ) { return 
maBitmap.Rotate(nAngle10, rFillColor); }
+
+    bool Crop( const tools::Rectangle& rRectPixel ) { return 
maBitmap.Crop(rRectPixel); }
+
+    bool Expand( sal_Int32 nDX, sal_Int32 nDY, const Color* pInitColor = 
nullptr ) { return maBitmap.Expand(nDX, nDY, pInitColor); }
+
+    bool CopyPixel( const tools::Rectangle& rRectDst,
+                    const tools::Rectangle& rRectSrc )
+    { return maBitmap.CopyPixel(rRectDst, rRectSrc); }
+
+    bool CopyPixel( const tools::Rectangle& rRectDst,
+                    const tools::Rectangle& rRectSrc,
+                    const AlphaMask& rBmpSrc )
+    { return maBitmap.CopyPixel(rRectDst, rRectSrc, rBmpSrc.maBitmap); }
+
+    bool CopyPixel_AlphaOptimized(
+                    const tools::Rectangle& rRectDst,
+                    const tools::Rectangle& rRectSrc )
+    { return maBitmap.CopyPixel_AlphaOptimized(rRectDst, rRectSrc); }
+
+    bool CopyPixel_AlphaOptimized(
+                    const tools::Rectangle& rRectDst,
+                    const tools::Rectangle& rRectSrc,
+                    const AlphaMask& rBmpSrc )
+    { return maBitmap.CopyPixel_AlphaOptimized(rRectDst, rRectSrc, rBmpSrc); }
 
 private:
     friend class BitmapEx;
     friend class ::OutputDevice;
     friend bool VCL_DLLPUBLIC ReadDIBBitmapEx(BitmapEx& rTarget, SvStream& 
rIStm, bool bFileHeader, bool bMSOFormat);
 
-    SAL_DLLPRIVATE const Bitmap&    ImplGetBitmap() const;
-
+    Bitmap maBitmap;
 };
 
 #endif // INCLUDED_VCL_ALPHA_HXX
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index 3b7f39480027..514eefea8f1b 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -107,7 +107,7 @@ struct BitmapSystemData
     int mnHeight;
 };
 
-class SAL_WARN_UNUSED VCL_DLLPUBLIC Bitmap
+class SAL_WARN_UNUSED VCL_DLLPUBLIC Bitmap final
 {
 public:
 
@@ -115,7 +115,7 @@ public:
                             Bitmap( const Bitmap& rBitmap );
                             Bitmap( const Size& rSizePixel, vcl::PixelFormat 
ePixelFormat, const BitmapPalette* pPal = nullptr );
     explicit                Bitmap( std::shared_ptr<SalBitmap> xSalBitmap );
-    virtual                 ~Bitmap();
+                            ~Bitmap();
 
     Bitmap&                 operator=( const Bitmap& rBitmap );
     Bitmap&                 operator=( Bitmap&& rBitmap ) noexcept;
@@ -259,7 +259,7 @@ public:
     bool                    CopyPixel_AlphaOptimized(
                                 const tools::Rectangle& rRectDst,
                                 const tools::Rectangle& rRectSrc,
-                                const Bitmap& rBmpSrc );
+                                const AlphaMask& rBmpSrc );
 
     bool                    CopyPixel_AlphaOptimized(
                                 const tools::Rectangle& rRectDst,
diff --git a/slideshow/source/engine/shapes/gdimtftools.cxx 
b/slideshow/source/engine/shapes/gdimtftools.cxx
index 2fc3c86ffa97..0ca2673daa5f 100644
--- a/slideshow/source/engine/shapes/gdimtftools.cxx
+++ b/slideshow/source/engine/shapes/gdimtftools.cxx
@@ -300,7 +300,7 @@ bool getAnimationFromGraphic( VectorOfMtfAnimationFrames&   
o_rFrames,
                 }
                 else
                 {
-                    BitmapEx aTmpMask(aMask, aMask);
+                    BitmapEx aTmpMask(aMask.GetBitmap(), aMask);
                     pVDevMask->DrawBitmapEx(rAnimationFrame.maPositionPixel,
                                             aTmpMask );
                 }
@@ -310,7 +310,7 @@ bool getAnimationFromGraphic( VectorOfMtfAnimationFrames&   
o_rFrames,
             case Disposal::Back:
             {
                 // #i70772# react on no mask
-                const Bitmap aMask(rAnimationFrame.maBitmapEx.GetAlphaMask());
+                const AlphaMask 
aMask(rAnimationFrame.maBitmapEx.GetAlphaMask());
                 const Bitmap & 
rContent(rAnimationFrame.maBitmapEx.GetBitmap());
 
                 pVDevMask->Erase();
@@ -325,7 +325,7 @@ bool getAnimationFromGraphic( VectorOfMtfAnimationFrames&   
o_rFrames,
                 }
                 else
                 {
-                    pVDevMask->DrawBitmap(rAnimationFrame.maPositionPixel, 
aMask);
+                    pVDevMask->DrawBitmap(rAnimationFrame.maPositionPixel, 
aMask.GetBitmap());
                 }
                 break;
             }
@@ -335,7 +335,7 @@ bool getAnimationFromGraphic( VectorOfMtfAnimationFrames&   
o_rFrames,
                 pVDev->DrawBitmapEx(rAnimationFrame.maPositionPixel,
                                     rAnimationFrame.maBitmapEx);
                 pVDevMask->DrawBitmap(rAnimationFrame.maPositionPixel,
-                                      
rAnimationFrame.maBitmapEx.GetAlphaMask());
+                                      
rAnimationFrame.maBitmapEx.GetAlphaMask().GetBitmap());
                 break;
             }
         }
diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx
index 725ce095c9ed..da7077956917 100644
--- a/svx/source/dialog/_contdlg.cxx
+++ b/svx/source/dialog/_contdlg.cxx
@@ -115,7 +115,7 @@ tools::PolyPolygon SvxContourDlg::CreateAutoContour( const 
Graphic& rGraphic,
             }
         }
         else if( rGraphic.IsTransparent() )
-            aBmp = rGraphic.GetBitmapEx().GetAlphaMask();
+            aBmp = rGraphic.GetBitmapEx().GetAlphaMask().GetBitmap();
         else
         {
             aBmp = rGraphic.GetBitmapEx().GetBitmap();
diff --git a/vcl/qa/cppunit/BitmapExTest.cxx b/vcl/qa/cppunit/BitmapExTest.cxx
index 757cc8999538..8313de37fc60 100644
--- a/vcl/qa/cppunit/BitmapExTest.cxx
+++ b/vcl/qa/cppunit/BitmapExTest.cxx
@@ -205,7 +205,7 @@ void BitmapExTest::testCombineMaskOr()
     }
     AlphaMask aAlphaBitmap(Size(3, 3));
     {
-        BitmapScopedWriteAccess pWriteAccess(aAlphaBitmap);
+        AlphaMask::ScopedWriteAccess pWriteAccess(aAlphaBitmap);
         pWriteAccess->Erase(Color(0xff, 0xff, 0xff));
         for (int i = 1; i < 3; ++i)
         {
@@ -217,7 +217,7 @@ void BitmapExTest::testCombineMaskOr()
 
     {
         AlphaMask aMask = aBitmap.CreateAlphaMask(COL_RED, 1);
-        Bitmap::ScopedReadAccess pAccess(aMask);
+        AlphaMask::ScopedReadAccess pAccess(aMask);
         // the output is a greyscale palette bitmap
         CPPUNIT_ASSERT_EQUAL(sal_uInt8(0xff), pAccess->GetPixelIndex(0, 0));
         CPPUNIT_ASSERT_EQUAL(sal_uInt8(0xff), pAccess->GetPixelIndex(0, 1));
diff --git a/vcl/qa/cppunit/canvasbitmaptest.cxx 
b/vcl/qa/cppunit/canvasbitmaptest.cxx
index 5aba5982427e..d2a62ad8bfce 100644
--- a/vcl/qa/cppunit/canvasbitmaptest.cxx
+++ b/vcl/qa/cppunit/canvasbitmaptest.cxx
@@ -675,7 +675,7 @@ void CanvasBitmapTest::runTest()
         AlphaMask aMask(Size(200,200));
         aMask.Erase(255);
         {
-            BitmapScopedWriteAccess pAcc(aMask);
+            AlphaMask::ScopedWriteAccess pAcc(aMask);
             if( pAcc.get() )
             {
                 pAcc->SetFillColor(COL_ALPHA_OPAQUE);
@@ -693,7 +693,7 @@ void CanvasBitmapTest::runTest()
         AlphaMask aAlpha(Size(200,200));
         aAlpha.Erase(0);
         {
-            BitmapWriteAccess* pAcc = aAlpha.AcquireWriteAccess();
+            BitmapWriteAccess* pAcc = aAlpha.AcquireAlphaWriteAccess();
             if( pAcc )
             {
                 pAcc->SetFillColor(COL_ALPHA_OPAQUE);
diff --git a/vcl/qa/cppunit/skia/skia.cxx b/vcl/qa/cppunit/skia/skia.cxx
index b90b915e17ea..0caa1922280e 100644
--- a/vcl/qa/cppunit/skia/skia.cxx
+++ b/vcl/qa/cppunit/skia/skia.cxx
@@ -126,7 +126,8 @@ void SkiaTest::testDrawShaders()
     CPPUNIT_ASSERT(skiaBitmap->PreferSkShader());
     AlphaMask alpha(Size(10, 10));
     alpha.Erase(64);
-    SkiaSalBitmap* skiaAlpha = 
dynamic_cast<SkiaSalBitmap*>(alpha.ImplGetSalBitmap().get());
+    SkiaSalBitmap* skiaAlpha
+        = 
dynamic_cast<SkiaSalBitmap*>(alpha.GetBitmap().ImplGetSalBitmap().get());
     CPPUNIT_ASSERT(skiaAlpha->PreferSkShader());
 
     device->DrawBitmap(Point(5, 5), bitmap);
@@ -235,13 +236,15 @@ void SkiaTest::testAlphaBlendWith()
     AlphaMask bitmap(Size(10, 10));
     // Test with erase colors set.
     alpha.Erase(64);
-    SkiaSalBitmap* skiaAlpha = 
dynamic_cast<SkiaSalBitmap*>(alpha.ImplGetSalBitmap().get());
+    SkiaSalBitmap* skiaAlpha
+        = 
dynamic_cast<SkiaSalBitmap*>(alpha.GetBitmap().ImplGetSalBitmap().get());
     CPPUNIT_ASSERT(skiaAlpha->unittestHasEraseColor());
     bitmap.Erase(64);
-    SkiaSalBitmap* skiaBitmap = 
dynamic_cast<SkiaSalBitmap*>(bitmap.ImplGetSalBitmap().get());
+    SkiaSalBitmap* skiaBitmap
+        = 
dynamic_cast<SkiaSalBitmap*>(bitmap.GetBitmap().ImplGetSalBitmap().get());
     CPPUNIT_ASSERT(skiaBitmap->unittestHasEraseColor());
     alpha.BlendWith(bitmap);
-    skiaAlpha = dynamic_cast<SkiaSalBitmap*>(alpha.ImplGetSalBitmap().get());
+    skiaAlpha = 
dynamic_cast<SkiaSalBitmap*>(alpha.GetBitmap().ImplGetSalBitmap().get());
     CPPUNIT_ASSERT(skiaAlpha->unittestHasEraseColor());
     CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N8_BPP, alpha.getPixelFormat());
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(208),
@@ -250,18 +253,18 @@ void SkiaTest::testAlphaBlendWith()
     // Test with images set.
     alpha.Erase(64);
     AlphaMask::ScopedReadAccess(alpha)->GetColor(0, 0); // Reading a pixel 
will create pixel data.
-    skiaAlpha = dynamic_cast<SkiaSalBitmap*>(alpha.ImplGetSalBitmap().get());
+    skiaAlpha = 
dynamic_cast<SkiaSalBitmap*>(alpha.GetBitmap().ImplGetSalBitmap().get());
     skiaAlpha->GetSkImage();
     CPPUNIT_ASSERT(!skiaAlpha->unittestHasEraseColor());
     CPPUNIT_ASSERT(skiaAlpha->unittestHasImage());
     bitmap.Erase(64);
-    Bitmap::ScopedReadAccess(bitmap)->GetColor(0, 0); // Reading a pixel will 
create pixel data.
-    skiaBitmap = dynamic_cast<SkiaSalBitmap*>(bitmap.ImplGetSalBitmap().get());
+    AlphaMask::ScopedReadAccess(bitmap)->GetColor(0, 0); // Reading a pixel 
will create pixel data.
+    skiaBitmap = 
dynamic_cast<SkiaSalBitmap*>(bitmap.GetBitmap().ImplGetSalBitmap().get());
     skiaBitmap->GetSkImage();
     CPPUNIT_ASSERT(!skiaBitmap->unittestHasEraseColor());
     CPPUNIT_ASSERT(skiaBitmap->unittestHasImage());
     alpha.BlendWith(bitmap);
-    skiaAlpha = dynamic_cast<SkiaSalBitmap*>(alpha.ImplGetSalBitmap().get());
+    skiaAlpha = 
dynamic_cast<SkiaSalBitmap*>(alpha.GetBitmap().ImplGetSalBitmap().get());
     CPPUNIT_ASSERT(skiaAlpha->unittestHasImage());
     CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N8_BPP, alpha.getPixelFormat());
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(207),
@@ -269,16 +272,16 @@ void SkiaTest::testAlphaBlendWith()
 
     // Test with erase color for alpha and image for other bitmap.
     alpha.Erase(64);
-    skiaAlpha = dynamic_cast<SkiaSalBitmap*>(alpha.ImplGetSalBitmap().get());
+    skiaAlpha = 
dynamic_cast<SkiaSalBitmap*>(alpha.GetBitmap().ImplGetSalBitmap().get());
     CPPUNIT_ASSERT(skiaAlpha->unittestHasEraseColor());
     bitmap.Erase(64);
-    Bitmap::ScopedReadAccess(bitmap)->GetColor(0, 0); // Reading a pixel will 
create pixel data.
-    skiaBitmap = dynamic_cast<SkiaSalBitmap*>(bitmap.ImplGetSalBitmap().get());
+    AlphaMask::ScopedReadAccess(bitmap)->GetColor(0, 0); // Reading a pixel 
will create pixel data.
+    skiaBitmap = 
dynamic_cast<SkiaSalBitmap*>(bitmap.GetBitmap().ImplGetSalBitmap().get());
     skiaBitmap->GetSkImage();
     CPPUNIT_ASSERT(!skiaBitmap->unittestHasEraseColor());
     CPPUNIT_ASSERT(skiaBitmap->unittestHasImage());
     alpha.BlendWith(bitmap);
-    skiaAlpha = dynamic_cast<SkiaSalBitmap*>(alpha.ImplGetSalBitmap().get());
+    skiaAlpha = 
dynamic_cast<SkiaSalBitmap*>(alpha.GetBitmap().ImplGetSalBitmap().get());
     CPPUNIT_ASSERT(skiaAlpha->unittestHasImage());
     CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N8_BPP, alpha.getPixelFormat());
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(207),
diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index 11f35c219ddb..b4d48b0dfc0d 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -578,9 +578,7 @@ sal_uInt8 BitmapEx::GetAlpha(sal_Int32 nX, sal_Int32 nY) 
const
     }
     else
     {
-        Bitmap aTestBitmap(maAlphaMask);
-        Bitmap::ScopedReadAccess pRead(aTestBitmap);
-
+        AlphaMask::ScopedReadAccess pRead(const_cast<AlphaMask&>(maAlphaMask));
         if(pRead)
         {
             const BitmapColor aBitmapColor(pRead->GetPixel(nY, nX));
@@ -1363,7 +1361,7 @@ tools::Polygon  BitmapEx::GetContour( bool 
bContourEdgeDetect,
 void BitmapEx::ChangeColorAlpha( sal_uInt8 cIndexFrom, sal_Int8 nAlphaTo )
 {
     AlphaMask aAlphaMask(GetAlphaMask());
-    BitmapScopedWriteAccess pAlphaWriteAccess(aAlphaMask);
+    AlphaMask::ScopedWriteAccess pAlphaWriteAccess(aAlphaMask);
     Bitmap::ScopedReadAccess pReadAccess(maBitmap);
     assert( pReadAccess.get() && pAlphaWriteAccess.get() );
     if ( !(pReadAccess.get() && pAlphaWriteAccess.get()) )
@@ -1394,7 +1392,7 @@ void BitmapEx::AdjustTransparency(sal_uInt8 cTrans)
     else
     {
         aAlpha = GetAlphaMask();
-        BitmapScopedWriteAccess pA(aAlpha);
+        AlphaMask::ScopedWriteAccess pA(aAlpha);
         assert(pA);
 
         if( !pA )
diff --git a/vcl/source/bitmap/alpha.cxx b/vcl/source/bitmap/alpha.cxx
index 65b63dd1ffd0..2b0d544624b5 100644
--- a/vcl/source/bitmap/alpha.cxx
+++ b/vcl/source/bitmap/alpha.cxx
@@ -33,11 +33,10 @@
 AlphaMask::AlphaMask() = default;
 
 AlphaMask::AlphaMask( const Bitmap& rBitmap ) :
-    Bitmap( rBitmap )
+    maBitmap( rBitmap )
 {
-    // no need to do any conversion if it is already an AlphaMask
-    if ( typeid(rBitmap) != typeid(AlphaMask) && !rBitmap.IsEmpty() )
-        Convert( BmpConversion::N8BitNoConversion );
+    if ( !rBitmap.IsEmpty() )
+        maBitmap.Convert( BmpConversion::N8BitNoConversion );
 #if HAVE_FEATURE_SKIA
     // Related tdf#156866 force snapshot of alpha mask when using Skia
     // In release builds, tdf#156629 and tdf#156630 reappear in many
@@ -46,10 +45,10 @@ AlphaMask::AlphaMask( const Bitmap& rBitmap ) :
     // create one here to force the alpha mask to handle any pending
     // scaling and make the alpha mask immutable.
     else if ( SkiaHelper::isVCLSkiaEnabled() )
-        BitmapInfoAccess aInfoAccess( *this );
+        BitmapInfoAccess aInfoAccess( maBitmap );
 #endif
-    assert( (IsEmpty() || getPixelFormat() == vcl::PixelFormat::N8_BPP) && 
"alpha bitmap should be 8bpp" );
-    assert( (IsEmpty() || HasGreyPalette8Bit()) && "alpha bitmap should have 
greyscale palette" );
+    assert( (IsEmpty() || maBitmap.getPixelFormat() == 
vcl::PixelFormat::N8_BPP) && "alpha bitmap should be 8bpp" );
+    assert( (IsEmpty() || maBitmap.HasGreyPalette8Bit()) && "alpha bitmap 
should have greyscale palette" );
 }
 
 AlphaMask::AlphaMask( const AlphaMask& ) = default;
@@ -57,59 +56,49 @@ AlphaMask::AlphaMask( const AlphaMask& ) = default;
 AlphaMask::AlphaMask( AlphaMask&& ) = default;
 
 AlphaMask::AlphaMask( const Size& rSizePixel, const sal_uInt8* 
pEraseTransparency )
-    : Bitmap(rSizePixel, vcl::PixelFormat::N8_BPP, 
&Bitmap::GetGreyPalette(256))
+    : maBitmap(rSizePixel, vcl::PixelFormat::N8_BPP, 
&Bitmap::GetGreyPalette(256))
 {
     if( pEraseTransparency )
     {
         sal_uInt8 nAlpha = 255 - *pEraseTransparency;
-        Bitmap::Erase( Color( nAlpha, nAlpha, nAlpha ) );
+        maBitmap.Erase( Color( nAlpha, nAlpha, nAlpha ) );
     }
     else
-        Bitmap::Erase( COL_ALPHA_OPAQUE );
+        maBitmap.Erase( COL_ALPHA_OPAQUE );
 }
 
 AlphaMask::~AlphaMask() = default;
 
 AlphaMask& AlphaMask::operator=( const Bitmap& rBitmap )
 {
-    *static_cast<Bitmap*>(this) = rBitmap;
+    maBitmap = rBitmap;
 
     if( !rBitmap.IsEmpty() )
-        Convert( BmpConversion::N8BitNoConversion );
+        maBitmap.Convert( BmpConversion::N8BitNoConversion );
 
-    assert( getPixelFormat() == vcl::PixelFormat::N8_BPP && "alpha bitmap 
should be 8bpp" );
-    assert( HasGreyPalette8Bit() && "alpha bitmap should have greyscale 
palette" );
+    assert( maBitmap.getPixelFormat() == vcl::PixelFormat::N8_BPP && "alpha 
bitmap should be 8bpp" );
+    assert( maBitmap.HasGreyPalette8Bit() && "alpha bitmap should have 
greyscale palette" );
 
     return *this;
 }
 
-const Bitmap& AlphaMask::ImplGetBitmap() const
-{
-    return *this;
-}
-
-Bitmap const & AlphaMask::GetBitmap() const
-{
-    return ImplGetBitmap();
-}
-
 void AlphaMask::Erase( sal_uInt8 cTransparency )
 {
     sal_uInt8 nAlpha = 255 - cTransparency;
-    Bitmap::Erase( Color( nAlpha, nAlpha, nAlpha ) );
+    maBitmap.Erase( Color( nAlpha, nAlpha, nAlpha ) );
 }
 
 void AlphaMask::BlendWith(const AlphaMask& rOther)
 {
     std::shared_ptr<SalBitmap> 
xImpBmp(ImplGetSVData()->mpDefInst->CreateSalBitmap());
-    if (xImpBmp->Create(*ImplGetSalBitmap()) && 
xImpBmp->AlphaBlendWith(*rOther.ImplGetSalBitmap()))
+    if (xImpBmp->Create(*maBitmap.ImplGetSalBitmap()) && 
xImpBmp->AlphaBlendWith(*rOther.maBitmap.ImplGetSalBitmap()))
     {
-        ImplSetSalBitmap(xImpBmp);
-        assert( getPixelFormat() == vcl::PixelFormat::N8_BPP && "alpha bitmap 
should be 8bpp" );
-        assert( HasGreyPalette8Bit() && "alpha bitmap should have greyscale 
palette" );
+        maBitmap.ImplSetSalBitmap(xImpBmp);
+        assert( maBitmap.getPixelFormat() == vcl::PixelFormat::N8_BPP && 
"alpha bitmap should be 8bpp" );
+        assert( maBitmap.HasGreyPalette8Bit() && "alpha bitmap should have 
greyscale palette" );
         return;
     }
-    Bitmap::ScopedReadAccess pOtherAcc(const_cast<AlphaMask&>(rOther));
+    AlphaMask::ScopedReadAccess pOtherAcc(const_cast<AlphaMask&>(rOther));
     AlphaScopedWriteAccess pAcc(*this);
     assert (pOtherAcc && pAcc && pOtherAcc->GetBitCount() == 8 && 
pAcc->GetBitCount() == 8 && "cannot BlendWith this combination");
     if (!(pOtherAcc && pAcc && pOtherAcc->GetBitCount() == 8 && 
pAcc->GetBitCount() == 8))
@@ -144,8 +133,8 @@ void AlphaMask::BlendWith(const AlphaMask& rOther)
         }
     }
     pAcc.reset();
-    assert( getPixelFormat() == vcl::PixelFormat::N8_BPP && "alpha bitmap 
should be 8bpp" );
-    assert( HasGreyPalette8Bit() && "alpha bitmap should have greyscale 
palette" );
+    assert( maBitmap.getPixelFormat() == vcl::PixelFormat::N8_BPP && "alpha 
bitmap should be 8bpp" );
+    assert( maBitmap.HasGreyPalette8Bit() && "alpha bitmap should have 
greyscale palette" );
 }
 
 bool AlphaMask::hasAlpha() const
@@ -207,4 +196,14 @@ bool AlphaMask::AlphaCombineOr(const AlphaMask& rMask)
     return true;
 }
 
+bool AlphaMask::Invert()
+{
+    if (IsEmpty())
+        return false;
+    bool b = maBitmap.Invert();
+    assert( maBitmap.getPixelFormat() == vcl::PixelFormat::N8_BPP && "alpha 
bitmap should be 8bpp" );
+    assert( maBitmap.HasGreyPalette8Bit() && "alpha bitmap should have 
greyscale palette" );
+    return b;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx
index 1167789b7986..0bcd581f62d8 100644
--- a/vcl/source/bitmap/bitmap.cxx
+++ b/vcl/source/bitmap/bitmap.cxx
@@ -726,10 +726,10 @@ bool Bitmap::CopyPixel_AlphaOptimized( const 
tools::Rectangle& rRectDst, const t
 }
 
 bool Bitmap::CopyPixel_AlphaOptimized( const tools::Rectangle& rRectDst, const 
tools::Rectangle& rRectSrc,
-                           const Bitmap& rBmpSrc )
+                           const AlphaMask& rBmpSrc )
 {
     assert(HasGreyPalette8Bit());
-    assert(rBmpSrc.HasGreyPalette8Bit());
+    assert(rBmpSrc.GetBitmap().HasGreyPalette8Bit());
     // Note: this code is copied from Bitmap::CopyPixel but avoids any palette 
lookups
     // This optimization is possible because the palettes of AlphaMasks are 
always identical (8bit GreyPalette, see ctor)
     const Size  aSizePix( GetSizePixel() );
@@ -740,10 +740,10 @@ bool Bitmap::CopyPixel_AlphaOptimized( const 
tools::Rectangle& rRectDst, const t
     if( aRectDst.IsEmpty() )
         return false;
 
-    if( rBmpSrc.mxSalBmp == mxSalBmp ) // self-copy
+    if( rBmpSrc.GetBitmap().mxSalBmp == mxSalBmp ) // self-copy
         return CopyPixel_AlphaOptimized(rRectDst, rRectSrc);
 
-    Bitmap*         pSrc = &const_cast<Bitmap&>(rBmpSrc);
+    Bitmap*         pSrc = &const_cast<Bitmap&>(rBmpSrc.GetBitmap());
     const Size      aCopySizePix( pSrc->GetSizePixel() );
     tools::Rectangle       aRectSrc( rRectSrc );
 
diff --git a/vcl/source/bitmap/bitmappaint.cxx 
b/vcl/source/bitmap/bitmappaint.cxx
index 758f36bc1e93..64c42bec3b44 100644
--- a/vcl/source/bitmap/bitmappaint.cxx
+++ b/vcl/source/bitmap/bitmappaint.cxx
@@ -660,7 +660,7 @@ AlphaMask Bitmap::CreateAlphaMask(const Color& rTransColor) 
const
     }
 
     AlphaMask aNewBmp(GetSizePixel());
-    BitmapScopedWriteAccess pWriteAcc(aNewBmp);
+    AlphaMask::ScopedWriteAccess pWriteAcc(aNewBmp);
     if (!pWriteAcc)
         return AlphaMask();
 
@@ -709,8 +709,8 @@ AlphaMask Bitmap::CreateAlphaMask(const Color& rTransColor) 
const
     pWriteAcc.reset();
     pReadAcc.reset();
 
-    aNewBmp.maPrefSize = maPrefSize;
-    aNewBmp.maPrefMapMode = maPrefMapMode;
+    aNewBmp.SetPrefSize(maPrefSize);
+    aNewBmp.SetPrefMapMode(maPrefMapMode);
 
     return aNewBmp;
 }
@@ -730,7 +730,7 @@ AlphaMask Bitmap::CreateAlphaMask(const Color& rTransColor, 
sal_uInt8 nTol) cons
     // TODO: Possibly remove the 1bpp code later.
 
     AlphaMask aNewBmp(GetSizePixel());
-    BitmapScopedWriteAccess pWriteAcc(aNewBmp);
+    AlphaMask::ScopedWriteAccess pWriteAcc(aNewBmp);
     if (!pWriteAcc)
         return AlphaMask();
 
@@ -802,8 +802,8 @@ AlphaMask Bitmap::CreateAlphaMask(const Color& rTransColor, 
sal_uInt8 nTol) cons
     pWriteAcc.reset();
     pReadAcc.reset();
 
-    aNewBmp.maPrefSize = maPrefSize;
-    aNewBmp.maPrefMapMode = maPrefMapMode;
+    aNewBmp.SetPrefSize(maPrefSize);
+    aNewBmp.SetPrefMapMode(maPrefMapMode);
 
     return aNewBmp;
 }
@@ -903,7 +903,7 @@ vcl::Region Bitmap::CreateRegion(const Color& rColor, const 
tools::Rectangle& rR
 
 bool Bitmap::ReplaceMask(const AlphaMask& rMask, const Color& rReplaceColor)
 {
-    ScopedReadAccess pMaskAcc(const_cast<AlphaMask&>(rMask));
+    AlphaMask::ScopedReadAccess pMaskAcc(const_cast<AlphaMask&>(rMask));
     BitmapScopedWriteAccess pAcc(*this);
 
     if (!pMaskAcc || !pAcc)
diff --git a/vcl/source/bitmap/dibtools.cxx b/vcl/source/bitmap/dibtools.cxx
index f5c393848b25..6e62191ead0e 100644
--- a/vcl/source/bitmap/dibtools.cxx
+++ b/vcl/source/bitmap/dibtools.cxx
@@ -1754,7 +1754,7 @@ bool WriteDIBBitmapEx(
             // invert the alpha because the other routines actually want 
transparency
             AlphaMask tmpAlpha = rSource.maAlphaMask;
             tmpAlpha.Invert();
-            return ImplWriteDIB(tmpAlpha, rOStm, true, true);
+            return ImplWriteDIB(tmpAlpha.GetBitmap(), rOStm, true, true);
         }
     }
 
diff --git a/vcl/source/filter/jpeg/JpegReader.cxx 
b/vcl/source/filter/jpeg/JpegReader.cxx
index 186105603904..d985bbf215e7 100644
--- a/vcl/source/filter/jpeg/JpegReader.cxx
+++ b/vcl/source/filter/jpeg/JpegReader.cxx
@@ -260,7 +260,7 @@ Graphic JPEGReader::CreateIntermediateGraphic(tools::Long 
nLines)
         if (nNewLines > 0)
         {
             {
-                BitmapScopedWriteAccess pAccess(*mpIncompleteAlpha);
+                AlphaMask::ScopedWriteAccess pAccess(*mpIncompleteAlpha);
                 pAccess->SetFillColor(COL_ALPHA_OPAQUE);
                 pAccess->FillRect(tools::Rectangle(Point(0, mnLastLines), 
Size(pAccess->Width(), nNewLines)));
             }
diff --git a/vcl/source/filter/png/PngImageWriter.cxx 
b/vcl/source/filter/png/PngImageWriter.cxx
index 5d8f2c7372a8..6a4bf6340a83 100644
--- a/vcl/source/filter/png/PngImageWriter.cxx
+++ b/vcl/source/filter/png/PngImageWriter.cxx
@@ -162,7 +162,7 @@ static bool pngWrite(SvStream& rStream, const Graphic& 
rGraphic, int nCompressio
     Bitmap aBitmap;
     AlphaMask aAlphaMask;
     Bitmap::ScopedReadAccess pAccess;
-    Bitmap::ScopedReadAccess pAlphaAccess;
+    AlphaMask::ScopedReadAccess pAlphaAccess;
 
     if (setjmp(png_jmpbuf(pPng)))
     {
@@ -183,7 +183,7 @@ static bool pngWrite(SvStream& rStream, const Graphic& 
rGraphic, int nCompressio
         bool bCombineChannels = false;
         pAccess = Bitmap::ScopedReadAccess(aBitmap);
         if (bTranslucent)
-            pAlphaAccess = Bitmap::ScopedReadAccess(aAlphaMask);
+            pAlphaAccess = AlphaMask::ScopedReadAccess(aAlphaMask);
         Size aSize = aBitmapEx.GetSizePixel();
 
         int bitDepth = -1;
diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx
index 6fcd294cdaad..0277affb829f 100644
--- a/vcl/source/filter/wmf/emfwr.cxx
+++ b/vcl/source/filter/wmf/emfwr.cxx
@@ -1301,7 +1301,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
                 if( !aMsk.IsEmpty() )
                 {
                     aBmp.Replace( aMsk, COL_WHITE );
-                    ImplWriteBmpRecord( aMsk, pA->GetPoint(), 
maVDev->PixelToLogic( aMsk.GetSizePixel() ), WIN_SRCPAINT );
+                    ImplWriteBmpRecord( aMsk.GetBitmap(), pA->GetPoint(), 
maVDev->PixelToLogic( aMsk.GetSizePixel() ), WIN_SRCPAINT );
                     ImplWriteBmpRecord( aBmp, pA->GetPoint(), 
maVDev->PixelToLogic( aBmp.GetSizePixel() ), WIN_SRCAND );
                 }
                 else
@@ -1318,7 +1318,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
                 if( !aMsk.IsEmpty() )
                 {
                     aBmp.Replace( aMsk, COL_WHITE );
-                    ImplWriteBmpRecord( aMsk, pA->GetPoint(), pA->GetSize(), 
WIN_SRCPAINT );
+                    ImplWriteBmpRecord( aMsk.GetBitmap(), pA->GetPoint(), 
pA->GetSize(), WIN_SRCPAINT );
                     ImplWriteBmpRecord( aBmp, pA->GetPoint(), pA->GetSize(), 
WIN_SRCAND );
                 }
                 else
@@ -1337,7 +1337,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
                 if( !aMsk.IsEmpty() )
                 {
                     aBmp.Replace( aMsk, COL_WHITE );
-                    ImplWriteBmpRecord( aMsk, pA->GetDestPoint(), 
pA->GetDestSize(), WIN_SRCPAINT );
+                    ImplWriteBmpRecord( aMsk.GetBitmap(), pA->GetDestPoint(), 
pA->GetDestSize(), WIN_SRCPAINT );
                     ImplWriteBmpRecord( aBmp, pA->GetDestPoint(), 
pA->GetDestSize(), WIN_SRCAND );
                 }
                 else
diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx
index c6612a9bbf25..5f1089c77759 100644
--- a/vcl/source/filter/wmf/wmfwr.cxx
+++ b/vcl/source/filter/wmf/wmfwr.cxx
@@ -1267,7 +1267,7 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
                 if( !aMsk.IsEmpty() )
                 {
                     aBmp.Replace( aMsk, COL_WHITE );
-                    WMFRecord_StretchDIB( pA->GetPoint(), pA->GetSize(), aMsk, 
W_SRCPAINT );
+                    WMFRecord_StretchDIB( pA->GetPoint(), pA->GetSize(), 
aMsk.GetBitmap(), W_SRCPAINT );
                     WMFRecord_StretchDIB( pA->GetPoint(), pA->GetSize(), aBmp, 
W_SRCAND );
                 }
                 else
@@ -1286,7 +1286,7 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
                 if( !aMsk.IsEmpty() )
                 {
                     aBmp.Replace( aMsk, COL_WHITE );
-                    WMFRecord_StretchDIB( pA->GetDestPoint(), 
pA->GetDestSize(), aMsk, W_SRCPAINT );
+                    WMFRecord_StretchDIB( pA->GetDestPoint(), 
pA->GetDestSize(), aMsk.GetBitmap(), W_SRCPAINT );
                     WMFRecord_StretchDIB( pA->GetDestPoint(), 
pA->GetDestSize(), aBmp, W_SRCAND );
                 }
                 else
diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx 
b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
index 6426491f25d7..0be4c829ddf4 100644
--- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
+++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
@@ -498,7 +498,7 @@ void 
munchDrawCommands(std::vector<std::shared_ptr<WidgetDrawAction>> const& rDr
                     if (aBitmap.IsAlpha())
                     {
                         const std::shared_ptr<SalBitmap> pSalBitmapAlpha
-                            = aBitmap.GetAlphaMask().ImplGetSalBitmap();
+                            = 
aBitmap.GetAlphaMask().GetBitmap().ImplGetSalBitmap();
                         FileDefinitionWidgetDraw::drawBitmap(rGraphics, aTR, 
*pSalBitmap,
                                                              *pSalBitmapAlpha);
                     }
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index d23a97c4e204..cdf10ab30585 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -9056,7 +9056,7 @@ void PDFWriterImpl::writeJPG( const JPGEmit& rObject )
     {
         BitmapEmit aEmit;
         aEmit.m_nObject = nMaskObject;
-        aEmit.m_aBitmap = BitmapEx( rObject.m_aAlphaMask, rObject.m_aAlphaMask 
);
+        aEmit.m_aBitmap = BitmapEx( rObject.m_aAlphaMask.GetBitmap(), 
rObject.m_aAlphaMask );
         writeBitmapObject( aEmit, true );
     }
 
@@ -9441,7 +9441,7 @@ bool PDFWriterImpl::writeBitmapObject( const BitmapEmit& 
rObject, bool bMask )
         {
             if( rObject.m_aBitmap.IsAlpha() )
             {
-                aBitmap = rObject.m_aBitmap.GetAlphaMask();
+                aBitmap = rObject.m_aBitmap.GetAlphaMask().GetBitmap();
                 aBitmap.Convert( BmpConversion::N1BitThreshold );
                 SAL_WARN_IF(aBitmap.getPixelFormat() != 
vcl::PixelFormat::N8_BPP, "vcl.pdfwriter", "mask conversion failed" );
             }
diff --git a/vcl/source/graphic/UnoGraphic.cxx 
b/vcl/source/graphic/UnoGraphic.cxx
index 6448765a9056..9036f54452ba 100644
--- a/vcl/source/graphic/UnoGraphic.cxx
+++ b/vcl/source/graphic/UnoGraphic.cxx
@@ -165,7 +165,7 @@ uno::Sequence<sal_Int8> SAL_CALL Graphic::getMaskDIB()
     {
         SvMemoryStream aMemoryStream;
 
-        WriteDIB(maGraphic.GetBitmapEx().GetAlphaMask(), aMemoryStream, false, 
true);
+        WriteDIB(maGraphic.GetBitmapEx().GetAlphaMask().GetBitmap(), 
aMemoryStream, false, true);
         return css::uno::Sequence<sal_Int8>( static_cast<sal_Int8 const 
*>(aMemoryStream.GetData()), aMemoryStream.Tell() );
     }
     else
diff --git a/vcl/source/outdev/background.cxx b/vcl/source/outdev/background.cxx
index 118b4d4c4be4..7c07367a82b4 100644
--- a/vcl/source/outdev/background.cxx
+++ b/vcl/source/outdev/background.cxx
@@ -57,7 +57,7 @@ void OutputDevice::SetBackground( const Wallpaper& 
rBackground )
     {
         BitmapEx bitmap = rBackground.GetBitmap();
         if( bitmap.IsAlpha())
-            mpAlphaVDev->SetBackground( Wallpaper( BitmapEx( Bitmap( 
bitmap.GetAlphaMask()))));
+            mpAlphaVDev->SetBackground( Wallpaper( BitmapEx( 
bitmap.GetAlphaMask().GetBitmap() ) ) );
         else
             mpAlphaVDev->SetBackground( Wallpaper( COL_ALPHA_OPAQUE ));
     }
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 1806635593d2..9df1ba41ae8c 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -331,7 +331,7 @@ void OutputDevice::DrawDeviceAlphaBitmap( const Bitmap& 
rBmp, const AlphaMask& r
             alpha.Mirror(mirrorFlags);
         }
         SalBitmap* pSalSrcBmp = bitmap.ImplGetSalBitmap().get();
-        SalBitmap* pSalAlphaBmp = alpha.ImplGetSalBitmap().get();
+        SalBitmap* pSalAlphaBmp = alpha.GetBitmap().ImplGetSalBitmap().get();
 
         // #i83087# Naturally, system alpha blending 
(SalGraphics::DrawAlphaBitmap) cannot work
         // with separate alpha VDev
@@ -346,7 +346,7 @@ void OutputDevice::DrawDeviceAlphaBitmap( const Bitmap& 
rBmp, const AlphaMask& r
             {
                 if (mpGraphics->BlendAlphaBitmap(aTR, *pSalSrcBmp, 
*pSalAlphaBmp, *pSalAlphaBmp2, *this))
                 {
-                    mpAlphaVDev->BlendBitmap(aTR, rAlpha);
+                    mpAlphaVDev->BlendBitmap(aTR, rAlpha.GetBitmap());
                     return;
                 }
             }
diff --git a/vcl/source/outdev/bitmapex.cxx b/vcl/source/outdev/bitmapex.cxx
index b4fa9641a1e5..04a50d554570 100644
--- a/vcl/source/outdev/bitmapex.cxx
+++ b/vcl/source/outdev/bitmapex.cxx
@@ -190,7 +190,7 @@ void OutputDevice::DrawDeviceBitmapEx( const Point& 
rDestPt, const Size& rDestSi
                 rBitmapEx.Mirror(nMirrFlags);
 
             const SalBitmap* pSalSrcBmp = 
rBitmapEx.ImplGetBitmapSalBitmap().get();
-            std::shared_ptr<SalBitmap> xMaskBmp = 
rBitmapEx.maAlphaMask.ImplGetSalBitmap();
+            std::shared_ptr<SalBitmap> xMaskBmp = 
rBitmapEx.maAlphaMask.GetBitmap().ImplGetSalBitmap();
 
             if (xMaskBmp)
             {
@@ -274,7 +274,7 @@ void OutputDevice::DrawDeviceBitmapEx( const Point& 
rDestPt, const Size& rDestSi
                 if (mpAlphaVDev)
                     mpAlphaVDev->DrawBitmapEx(rDestPt,
                                               rDestSize,
-                                              
BitmapEx(rBitmapEx.GetAlphaMask(),
+                                              
BitmapEx(rBitmapEx.GetAlphaMask().GetBitmap(),
                                                        
rBitmapEx.GetAlphaMask()));
             }
             else
@@ -305,7 +305,7 @@ bool OutputDevice::DrawTransformBitmapExDirect(
     const basegfx::B2DPoint aTopX(aFullTransform * basegfx::B2DPoint(1.0, 
0.0));
     const basegfx::B2DPoint aTopY(aFullTransform * basegfx::B2DPoint(0.0, 
1.0));
     SalBitmap* pSalSrcBmp = rBitmapEx.GetBitmap().ImplGetSalBitmap().get();
-    Bitmap aAlphaBitmap;
+    AlphaMask aAlphaBitmap;
 
     if(rBitmapEx.IsAlpha())
     {
@@ -314,10 +314,10 @@ bool OutputDevice::DrawTransformBitmapExDirect(
     else if (mpAlphaVDev)
     {
         aAlphaBitmap = AlphaMask(rBitmapEx.GetSizePixel());
-        aAlphaBitmap.Erase(COL_ALPHA_OPAQUE);
+        aAlphaBitmap.Erase(0); // opaque
     }
 
-    SalBitmap* pSalAlphaBmp = aAlphaBitmap.ImplGetSalBitmap().get();
+    SalBitmap* pSalAlphaBmp = 
aAlphaBitmap.GetBitmap().ImplGetSalBitmap().get();
 
     bDone = mpGraphics->DrawTransformedBitmap(
         aNull,
@@ -333,7 +333,7 @@ bool OutputDevice::DrawTransformBitmapExDirect(
         // Merge bitmap alpha to alpha device
         AlphaMask aAlpha(rBitmapEx.GetSizePixel());
         aAlpha.Erase( ( 1 - fAlpha ) * 255 );
-        mpAlphaVDev->DrawTransformBitmapExDirect(aFullTransform, 
BitmapEx(aAlpha, aAlphaBitmap));
+        mpAlphaVDev->DrawTransformBitmapExDirect(aFullTransform, 
BitmapEx(aAlpha.GetBitmap(), aAlphaBitmap));
     }
 
     return bDone;
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index 1214a61a9406..2a8a5800bbde 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -1387,7 +1387,7 @@ public:
                     aAbove.Move(aSrc.GetSizePixel().Width(),0);
                     rDev.DrawBitmap(aAbove, aSrc.GetBitmap());
                     aAbove.Move(aSrc.GetSizePixel().Width(),0);
-                    rDev.DrawBitmap(aAbove, aSrc.GetAlphaMask());
+                    rDev.DrawBitmap(aAbove, aSrc.GetAlphaMask().GetBitmap());
 
                     // intermediates middle
                     BitmapEx aResult = AlphaRecovery(rDev, aLocation, aSrc);

Reply via email to