diff options
-rw-r--r-- | include/vcl/bitmapex.hxx | 1 | ||||
-rw-r--r-- | include/vcl/outdev.hxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdoashp.cxx | 32 | ||||
-rw-r--r-- | vcl/source/outdev/bitmap.cxx | 24 |
4 files changed, 33 insertions, 28 deletions
diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx index 478b9fdefea9..1067c0c45b52 100644 --- a/include/vcl/bitmapex.hxx +++ b/include/vcl/bitmapex.hxx @@ -468,6 +468,7 @@ public: private: friend class ImpGraphic; + friend class OutputDevice; friend bool VCL_DLLPUBLIC WriteDIBBitmapEx(const BitmapEx& rSource, SvStream& rOStm); friend void ReadRawDIB(); friend bool VCL_DLLPUBLIC ReadRawDIB(BitmapEx& rTarget, const unsigned char* pBuf, diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index b3159396f9a4..0b92e735914f 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -1468,7 +1468,9 @@ public: const basegfx::B2DHomMatrix& rTransformation, const BitmapEx& rBitmapEx); - + void DrawShadowBitmapEx( + const BitmapEx& rBitmapEx, + ::Color aShadowColor); protected: virtual void DrawDeviceBitmap( diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 45d8db33a2b3..603bedcf9924 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -354,35 +354,13 @@ static SdrObject* ImpCreateShadowObjectClone(const SdrObject& rOriginal, const S { GraphicObject aGraphicObject(rOriginalSet.Get(XATTR_FILLBITMAP).GetGraphicObject()); const BitmapEx aBitmapEx(aGraphicObject.GetGraphic().GetBitmapEx()); - Bitmap aBitmap(aBitmapEx.GetBitmap()); - if(!aBitmap.IsEmpty()) + if(!aBitmapEx.IsEmpty()) { - Bitmap::ScopedReadAccess pReadAccess(aBitmap); - - if(pReadAccess) - { - ScopedVclPtr<VirtualDevice> pVirDev(VclPtr<VirtualDevice>::Create()); - pVirDev->SetOutputSizePixel(aBitmap.GetSizePixel()); - - for(long y(0); y < pReadAccess->Height(); y++) - { - for(long x(0); x < pReadAccess->Width(); x++) - { - const BitmapColor aColor = pReadAccess->GetColor(y, x); - sal_uInt16 nLuminance(static_cast<sal_uInt16>(aColor.GetLuminance()) + 1); - const Color aDestColor( - static_cast<sal_uInt8>((nLuminance * static_cast<sal_uInt16>(aShadowColor.GetRed())) >> 8), - static_cast<sal_uInt8>((nLuminance * static_cast<sal_uInt16>(aShadowColor.GetGreen())) >> 8), - static_cast<sal_uInt8>((nLuminance * static_cast<sal_uInt16>(aShadowColor.GetBlue())) >> 8)); - pVirDev->DrawPixel(Point(x,y), aDestColor); - } - } - - pReadAccess.reset(); - - aGraphicObject.SetGraphic(Graphic(pVirDev->GetBitmapEx(Point(0,0), aBitmap.GetSizePixel()))); - } + ScopedVclPtr<VirtualDevice> pVirDev(VclPtr<VirtualDevice>::Create()); + pVirDev->SetOutputSizePixel(aBitmapEx.GetSizePixel()); + pVirDev->DrawShadowBitmapEx(aBitmapEx, aShadowColor); + aGraphicObject.SetGraphic(Graphic(pVirDev->GetBitmapEx(Point(0,0), aBitmapEx.GetSizePixel()))); } aTempSet.Put(XFillBitmapItem(aGraphicObject)); diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index 5322a0a29cea..b33a5dfcefa6 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -1299,6 +1299,30 @@ void OutputDevice::DrawTransformedBitmapEx( } } +void OutputDevice::DrawShadowBitmapEx( + const BitmapEx& rBitmapEx, + ::Color aShadowColor) +{ + Bitmap::ScopedReadAccess pReadAccess(const_cast<Bitmap&>(rBitmapEx.maBitmap)); + + if(!pReadAccess) + return; + + for(long y(0); y < pReadAccess->Height(); y++) + { + for(long x(0); x < pReadAccess->Width(); x++) + { + const BitmapColor aColor = pReadAccess->GetColor(y, x); + sal_uInt16 nLuminance(static_cast<sal_uInt16>(aColor.GetLuminance()) + 1); + const Color aDestColor( + static_cast<sal_uInt8>((nLuminance * static_cast<sal_uInt16>(aShadowColor.GetRed())) >> 8), + static_cast<sal_uInt8>((nLuminance * static_cast<sal_uInt16>(aShadowColor.GetGreen())) >> 8), + static_cast<sal_uInt8>((nLuminance * static_cast<sal_uInt16>(aShadowColor.GetBlue())) >> 8)); + DrawPixel(Point(x,y), aDestColor); + } + } +} + void OutputDevice::DrawImage( const Point& rPos, const Image& rImage, DrawImageFlags nStyle ) { assert(!is_double_buffered_window()); |