forked from amazingfate/loongoffice
use BitmapEx in ImpCreateShadowObjectClone
Change-Id: I7737c8b19dca787eab70b733d07a34a5e5f01c9c Reviewed-on: https://gerrit.libreoffice.org/75208 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@ -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,
|
||||
|
||||
@ -1468,7 +1468,9 @@ public:
|
||||
const basegfx::B2DHomMatrix& rTransformation,
|
||||
const BitmapEx& rBitmapEx);
|
||||
|
||||
|
||||
void DrawShadowBitmapEx(
|
||||
const BitmapEx& rBitmapEx,
|
||||
::Color aShadowColor);
|
||||
protected:
|
||||
|
||||
virtual void DrawDeviceBitmap(
|
||||
|
||||
@ -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));
|
||||
|
||||
@ -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());
|
||||
|
||||
Reference in New Issue
Block a user