filter/source/graphicfilter/icgm/bitmap.cxx |    2 +-
 include/svx/sdr/overlay/overlaybitmapex.hxx |    4 ++--
 include/vcl/bitmap.hxx                      |   13 +++++++++++++
 sd/source/ui/view/viewoverlaymanager.cxx    |   22 +++++++++++-----------
 svx/source/sdr/overlay/overlaybitmapex.cxx  |    6 +++---
 svx/source/svdraw/svdhdl.cxx                |   28 ++++++++++++++--------------
 vcl/source/bitmap/BitmapEx.cxx              |    2 +-
 vcl/source/bitmap/bitmap.cxx                |    8 ++++++++
 8 files changed, 53 insertions(+), 32 deletions(-)

New commits:
commit 7c626d2fb358095c43207f25c813cddb7b699210
Author:     Noel Grandin <[email protected]>
AuthorDate: Tue Aug 5 20:28:08 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Wed Aug 6 08:51:00 2025 +0200

    BitmapEx->Bitmap in OverlayBitmapEx
    
    now that Bitmap can support transparency
    
    Change-Id: I75b2bab5c134c2ff7a29728fa0986ea5d2b7fbcc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188971
    Reviewed-by: Noel Grandin <[email protected]>
    Tested-by: Jenkins

diff --git a/filter/source/graphicfilter/icgm/bitmap.cxx 
b/filter/source/graphicfilter/icgm/bitmap.cxx
index 537ebcfe5e35..d30fb932e4fd 100644
--- a/filter/source/graphicfilter/icgm/bitmap.cxx
+++ b/filter/source/graphicfilter/icgm/bitmap.cxx
@@ -394,7 +394,7 @@ void CGMBitmap::ImplInsert( CGMBitmapDescriptor const & 
rSource, CGMBitmapDescri
             return;
         }
     }
-    rDest.mxBitmap.Expand( 0, rSource.mnY );
+    rDest.mxBitmap.Expand( 0, rSource.mnY, nullptr );
     rDest.mxBitmap.CopyPixel( tools::Rectangle( Point( 0, rDest.mnY ), Size( 
rSource.mnX, rSource.mnY ) ),
         tools::Rectangle( Point( 0, 0 ), Size( rSource.mnX, rSource.mnY ) ), 
rSource.mxBitmap );
 
diff --git a/include/svx/sdr/overlay/overlaybitmapex.hxx 
b/include/svx/sdr/overlay/overlaybitmapex.hxx
index 42de7d65314f..88ad15d8122d 100644
--- a/include/svx/sdr/overlay/overlaybitmapex.hxx
+++ b/include/svx/sdr/overlay/overlaybitmapex.hxx
@@ -29,7 +29,7 @@ namespace sdr::overlay
         class SVXCORE_DLLPUBLIC OverlayBitmapEx final : public 
OverlayObjectWithBasePosition
         {
             // the Bitmap itself
-            BitmapEx                                maBitmapEx;
+            Bitmap                                  maBitmap;
 
             // position of the basePosition inside the Bitmap, in pixels
             sal_uInt16                              mnCenterX;
@@ -45,7 +45,7 @@ namespace sdr::overlay
         public:
             OverlayBitmapEx(
                 const basegfx::B2DPoint& rBasePos,
-                const BitmapEx& rBitmapEx,
+                const Bitmap& rBitmap,
                 sal_uInt16 nCenX = 0,
                 sal_uInt16 nCenY = 0,
                 double fAlpha = 0.0,
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index 464103980acf..a92a437f7312 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -201,6 +201,19 @@ public:
      */
     bool                    Crop( const tools::Rectangle& rRectPixel );
 
+    /** Expand the bitmap by pixel padding
+
+        @param nDX
+        Number of pixel to pad at the right border of the bitmap
+
+        @param nDY
+        Number of scanlines to pad at the bottom border of the bitmap
+
+        @param bExpandTransparent
+        Whether to expand the transparency color or not.
+     */
+    void Expand( sal_Int32 nDX, sal_Int32 nDY, bool bExpandTransparent = false 
);
+
     /** Expand the bitmap by pixel padding
 
         @param nDX
diff --git a/sd/source/ui/view/viewoverlaymanager.cxx 
b/sd/source/ui/view/viewoverlaymanager.cxx
index 81fc252c7a6b..c692da31c07c 100644
--- a/sd/source/ui/view/viewoverlaymanager.cxx
+++ b/sd/source/ui/view/viewoverlaymanager.cxx
@@ -86,14 +86,14 @@ constexpr OUString aBigPlaceHolders[] =
     BMP_PLACEHOLDER_MOVIE_LARGE_HOVER
 };
 
-static BitmapEx& getButtonImage( int index, bool large )
+static Bitmap& getButtonImage( int index, bool large )
 {
-    static ::tools::DeleteOnDeinit< BitmapEx > 
gSmallButtonImages[SAL_N_ELEMENTS(aSmallPlaceHolders)] = {
+    static ::tools::DeleteOnDeinit< Bitmap > 
gSmallButtonImages[SAL_N_ELEMENTS(aSmallPlaceHolders)] = {
             ::tools::DeleteOnDeinitFlag::Empty, 
::tools::DeleteOnDeinitFlag::Empty,
             ::tools::DeleteOnDeinitFlag::Empty, 
::tools::DeleteOnDeinitFlag::Empty,
             ::tools::DeleteOnDeinitFlag::Empty, 
::tools::DeleteOnDeinitFlag::Empty,
             ::tools::DeleteOnDeinitFlag::Empty, 
::tools::DeleteOnDeinitFlag::Empty };
-    static ::tools::DeleteOnDeinit< BitmapEx > 
gLargeButtonImages[SAL_N_ELEMENTS(aBigPlaceHolders)] = {
+    static ::tools::DeleteOnDeinit< Bitmap > 
gLargeButtonImages[SAL_N_ELEMENTS(aBigPlaceHolders)] = {
             ::tools::DeleteOnDeinitFlag::Empty, 
::tools::DeleteOnDeinitFlag::Empty,
             ::tools::DeleteOnDeinitFlag::Empty, 
::tools::DeleteOnDeinitFlag::Empty,
             ::tools::DeleteOnDeinitFlag::Empty, 
::tools::DeleteOnDeinitFlag::Empty,
@@ -105,8 +105,8 @@ static BitmapEx& getButtonImage( int index, bool large )
     {
         for (size_t i = 0; i < SAL_N_ELEMENTS(aSmallPlaceHolders); i++ )
         {
-            gSmallButtonImages[i].set(aSmallPlaceHolders[i]);
-            gLargeButtonImages[i].set(aBigPlaceHolders[i]);
+            gSmallButtonImages[i].set(BitmapEx(aSmallPlaceHolders[i]));
+            gLargeButtonImages[i].set(BitmapEx(aBigPlaceHolders[i]));
         }
     }
 
@@ -136,7 +136,7 @@ public:
     /** returns true if the SmartTag consumes this event. */
     virtual bool KeyInput( const KeyEvent& rKEvt ) override;
 
-    BitmapEx createOverlayImage( int nHighlight );
+    Bitmap createOverlayImage( int nHighlight );
 
 protected:
     virtual void addCustomHandles( SdrHdlList& rHandlerList ) override;
@@ -262,8 +262,8 @@ void ImageButtonHdl::CreateB2dIAObject()
     const Point aTagPos( GetPos() );
     basegfx::B2DPoint aPosition( aTagPos.X(), aTagPos.Y() );
 
-    BitmapEx aBitmapEx( mxChangePlaceholderTag->createOverlayImage( 
mnHighlightId ) ); // maImageMO.GetBitmapEx() : maImage.GetBitmapEx() );
-    maImageSize = aBitmapEx.GetSizePixel();
+    Bitmap aBitmap( mxChangePlaceholderTag->createOverlayImage( mnHighlightId 
) ); // maImageMO.GetBitmapEx() : maImage.GetBitmapEx() );
+    maImageSize = aBitmap.GetSizePixel();
     maImageSize.setWidth( maImageSize.Width() >> 1 );
     maImageSize.setHeight( maImageSize.Height() >> 1 );
 
@@ -289,7 +289,7 @@ void ImageButtonHdl::CreateB2dIAObject()
         if(rPaintWindow.OutputToWindow() && xManager.is() )
         {
             std::unique_ptr<sdr::overlay::OverlayObject> pOverlayObject(
-                new sdr::overlay::OverlayBitmapEx( aPosition, aBitmapEx, 0, 0 
));
+                new sdr::overlay::OverlayBitmapEx( aPosition, aBitmap, 0, 0 ));
 
             // OVERLAYMANAGER
             insertNewlyCreatedOverlayObjectForSdrHdl(
@@ -360,9 +360,9 @@ bool ChangePlaceholderTag::KeyInput( const KeyEvent& rKEvt )
     }
 }
 
-BitmapEx ChangePlaceholderTag::createOverlayImage( int nHighlight )
+Bitmap ChangePlaceholderTag::createOverlayImage( int nHighlight )
 {
-    BitmapEx aRet;
+    Bitmap aRet;
     if( auto pPlaceholder = mxPlaceholderObj.get() )
     {
         SmartTagReference xThis( this );
diff --git a/svx/source/sdr/overlay/overlaybitmapex.cxx 
b/svx/source/sdr/overlay/overlaybitmapex.cxx
index 6dc31ff8eb2c..40127afcc053 100644
--- a/svx/source/sdr/overlay/overlaybitmapex.cxx
+++ b/svx/source/sdr/overlay/overlaybitmapex.cxx
@@ -28,7 +28,7 @@ namespace sdr::overlay
         {
             drawinglayer::primitive2d::Primitive2DReference aReference(
                 new drawinglayer::primitive2d::OverlayBitmapExPrimitive(
-                    maBitmapEx,
+                    BitmapEx(maBitmap),
                     getBasePosition(),
                     mnCenterX,
                     mnCenterY,
@@ -46,14 +46,14 @@ namespace sdr::overlay
 
         OverlayBitmapEx::OverlayBitmapEx(
             const basegfx::B2DPoint& rBasePos,
-            const BitmapEx& rBitmapEx,
+            const Bitmap& rBitmap,
             sal_uInt16 nCenX,
             sal_uInt16 nCenY,
             double fAlpha,
             double fShearX,
             double fRotation)
         :   OverlayObjectWithBasePosition(rBasePos, COL_WHITE),
-            maBitmapEx(rBitmapEx),
+            maBitmap(rBitmap),
             mnCenterX(nCenX),
             mnCenterY(nCenY),
             mfAlpha(fAlpha),
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index c61740579ce8..dccb7699cb71 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -883,7 +883,7 @@ std::unique_ptr<sdr::overlay::OverlayObject> 
SdrHdl::CreateOverlayObject(
     else
     {
         // create normal handle: use ImpGetBitmapEx(...) now
-        BitmapEx aBmpEx = ImpGetBitmapEx(eKindOfMarker, eColIndex);
+        Bitmap aBmp(ImpGetBitmapEx(eKindOfMarker, eColIndex));
 
         // When the image with handles is not found, the bitmap returned is
         // empty. This is a problem when we use LibreOffice as a library
@@ -892,27 +892,27 @@ std::unique_ptr<sdr::overlay::OverlayObject> 
SdrHdl::CreateOverlayObject(
         //
         // This HACK replaces the empty bitmap with a black 13x13 bitmap handle
         // so that the hit test works for this case.
-        if (aBmpEx.IsEmpty())
+        if (aBmp.IsEmpty())
         {
-            aBmpEx = BitmapEx(Size(13, 13), vcl::PixelFormat::N24_BPP);
-            aBmpEx.Erase(COL_BLACK);
+            aBmp = Bitmap(Size(13, 13), vcl::PixelFormat::N24_BPP);
+            aBmp.Erase(COL_BLACK);
         }
 
         if(eKindOfMarker == BitmapMarkerKind::Anchor || eKindOfMarker == 
BitmapMarkerKind::AnchorPressed)
         {
             // upper left as reference point inside the handle for 
AnchorPressed, too
-            pRetval.reset(new sdr::overlay::OverlayBitmapEx(rPos, aBmpEx));
+            pRetval.reset(new sdr::overlay::OverlayBitmapEx(rPos, aBmp));
         }
         else if(eKindOfMarker == BitmapMarkerKind::AnchorTR || eKindOfMarker 
== BitmapMarkerKind::AnchorPressedTR)
         {
             // AnchorTR for SW, take top right as (0,0)
-            pRetval.reset(new sdr::overlay::OverlayBitmapEx(rPos, aBmpEx,
-                static_cast<sal_uInt16>(aBmpEx.GetSizePixel().Width() - 1), 
0));
+            pRetval.reset(new sdr::overlay::OverlayBitmapEx(rPos, aBmp,
+                static_cast<sal_uInt16>(aBmp.GetSizePixel().Width() - 1), 0));
         }
         else
         {
-            sal_uInt16 
nCenX(static_cast<sal_uInt16>(aBmpEx.GetSizePixel().Width() - 1) >> 1);
-            sal_uInt16 
nCenY(static_cast<sal_uInt16>(aBmpEx.GetSizePixel().Height() - 1) >> 1);
+            sal_uInt16 
nCenX(static_cast<sal_uInt16>(aBmp.GetSizePixel().Width() - 1) >> 1);
+            sal_uInt16 
nCenY(static_cast<sal_uInt16>(aBmp.GetSizePixel().Height() - 1) >> 1);
 
             if(aMoveOutsideOffset.X() > 0)
             {
@@ -920,7 +920,7 @@ std::unique_ptr<sdr::overlay::OverlayObject> 
SdrHdl::CreateOverlayObject(
             }
             else if(aMoveOutsideOffset.X() < 0)
             {
-                nCenX = static_cast<sal_uInt16>(aBmpEx.GetSizePixel().Width() 
- 1);
+                nCenX = static_cast<sal_uInt16>(aBmp.GetSizePixel().Width() - 
1);
             }
 
             if(aMoveOutsideOffset.Y() > 0)
@@ -929,11 +929,11 @@ std::unique_ptr<sdr::overlay::OverlayObject> 
SdrHdl::CreateOverlayObject(
             }
             else if(aMoveOutsideOffset.Y() < 0)
             {
-                nCenY = static_cast<sal_uInt16>(aBmpEx.GetSizePixel().Height() 
- 1);
+                nCenY = static_cast<sal_uInt16>(aBmp.GetSizePixel().Height() - 
1);
             }
 
             // create centered handle as default
-            pRetval.reset(new sdr::overlay::OverlayBitmapEx(rPos, aBmpEx, 
nCenX, nCenY));
+            pRetval.reset(new sdr::overlay::OverlayBitmapEx(rPos, aBmp, nCenX, 
nCenY));
         }
     }
 
@@ -1149,7 +1149,7 @@ void SdrHdlColor::CreateB2dIAObject()
             const rtl::Reference< sdr::overlay::OverlayManager >& xManager = 
rPageWindow.GetOverlayManager();
             if (xManager.is())
             {
-                BitmapEx aBmpCol(CreateColorDropper(m_aMarkerColor));
+                Bitmap aBmpCol(CreateColorDropper(m_aMarkerColor));
                 basegfx::B2DPoint aPosition(m_aPos.X(), m_aPos.Y());
                 std::unique_ptr<sdr::overlay::OverlayObject> 
pNewOverlayObject(new
                     sdr::overlay::OverlayBitmapEx(
@@ -2440,7 +2440,7 @@ void SdrCropHdl::CreateB2dIAObject()
                     // create centered handle as default
                     pOverlayObject.reset(new sdr::overlay::OverlayBitmapEx(
                         aPosition,
-                        BitmapEx(aBmp1),
+                        aBmp1,
                         static_cast<sal_uInt16>(aBmp1.GetSizePixel().Width() - 
1) >> 1,
                         static_cast<sal_uInt16>(aBmp1.GetSizePixel().Height() 
- 1) >> 1,
                         0.0,
diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index c248db8b9747..7723a05b703c 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -386,7 +386,7 @@ void BitmapEx::Expand(sal_Int32 nDX, sal_Int32 nDY, bool 
bExpandTransparent)
     if (maBitmap.IsEmpty())
         return;
 
-    bool bRet = maBitmap.Expand( nDX, nDY );
+    bool bRet = maBitmap.Expand( nDX, nDY, nullptr );
 
     if ( bRet && !maAlphaMask.IsEmpty() )
     {
diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx
index 2dc4ff0b66e4..e8262657873e 100644
--- a/vcl/source/bitmap/bitmap.cxx
+++ b/vcl/source/bitmap/bitmap.cxx
@@ -1832,4 +1832,12 @@ Color Bitmap::GetPixelColor(sal_Int32 nX, sal_Int32 nY) 
const
     return aColor;
 }
 
+void Bitmap::Expand(sal_Int32 nDX, sal_Int32 nDY, bool bExpandTransparent)
+{
+    BitmapEx aTmpEx(*this);
+    aTmpEx.Expand(nDX, nDY, bExpandTransparent);
+    operator=(Bitmap(aTmpEx));
+}
+
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to