BitmapEx->Bitmap in MetaBmpExAction
now that Bitmap supports transparency Note that the SVM unit test changed because we no longer store some bitmaps as an 8-bit palette color layer and an 8-bit alpha layer. When those pass through Bitmap, they get converted to a 32-bit bitmap. Change-Id: Icbb30e291a7ed5c53319876637ae25e88a97d90d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190330 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
This commit is contained in:
@@ -2188,7 +2188,7 @@ namespace cppcanvas::internal
|
||||
|
||||
std::shared_ptr<Action> pBmpAction(
|
||||
internal::BitmapActionFactory::createBitmapAction(
|
||||
Bitmap(pAct->GetBitmapEx()),
|
||||
pAct->GetBitmap(),
|
||||
rStates.getState().mapModeTransform *
|
||||
vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ),
|
||||
rCanvas,
|
||||
|
||||
@@ -1952,9 +1952,9 @@ namespace wmfemfhelper
|
||||
{
|
||||
/** CHECKED, WORKS WELL: Simply same as MetaActionType::BMP */
|
||||
const MetaBmpExAction* pA = static_cast<const MetaBmpExAction*>(pAction);
|
||||
const BitmapEx& rBitmapEx = pA->GetBitmapEx();
|
||||
const Bitmap& rBitmap = pA->GetBitmap();
|
||||
|
||||
createBitmapPrimitive(Bitmap(rBitmapEx), pA->GetPoint(), rTargetHolders.Current(), rPropertyHolders.Current());
|
||||
createBitmapPrimitive(rBitmap, pA->GetPoint(), rTargetHolders.Current(), rPropertyHolders.Current());
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3909,9 +3909,9 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
|
||||
{
|
||||
const MetaBmpExAction* pA = static_cast<const MetaBmpExAction*>(pAction);
|
||||
|
||||
ImplWriteBmp( pA->GetBitmapEx(),
|
||||
pA->GetPoint(), mpVDev->PixelToLogic( pA->GetBitmapEx().GetSizePixel() ),
|
||||
Point(), pA->GetBitmapEx().GetSizePixel(), pxShape );
|
||||
ImplWriteBmp( BitmapEx(pA->GetBitmap()),
|
||||
pA->GetPoint(), mpVDev->PixelToLogic( pA->GetBitmap().GetSizePixel() ),
|
||||
Point(), pA->GetBitmap().GetSizePixel(), pxShape );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -787,7 +787,7 @@ class VCL_DLLPUBLIC MetaBmpExAction final : public MetaAction
|
||||
{
|
||||
private:
|
||||
|
||||
BitmapEx maBmpEx;
|
||||
Bitmap maBmp;
|
||||
Point maPt;
|
||||
|
||||
public:
|
||||
@@ -802,16 +802,16 @@ public:
|
||||
SAL_DLLPRIVATE virtual void Execute( OutputDevice* pOut ) override;
|
||||
SAL_DLLPRIVATE virtual rtl::Reference<MetaAction> Clone() const override;
|
||||
|
||||
MetaBmpExAction( const Point& rPt, const BitmapEx& rBmpEx );
|
||||
MetaBmpExAction( const Point& rPt, const Bitmap& rBmp );
|
||||
|
||||
SAL_DLLPRIVATE virtual void Move( tools::Long nHorzMove, tools::Long nVertMove ) override;
|
||||
SAL_DLLPRIVATE virtual void Scale( double fScaleX, double fScaleY ) override;
|
||||
|
||||
const BitmapEx& GetBitmapEx() const { return maBmpEx; }
|
||||
const Bitmap& GetBitmap() const { return maBmp; }
|
||||
const Point& GetPoint() const { return maPt; }
|
||||
void SetBitmapEx(const BitmapEx& rBmpEx) { maBmpEx = rBmpEx; }
|
||||
void SetBitmap(const Bitmap& rBmp) { maBmp = rBmp; }
|
||||
void SetPoint(const Point& rPt) { maPt = rPt; }
|
||||
bool IsTransparent() const override { return GetBitmapEx().IsAlpha(); }
|
||||
bool IsTransparent() const override { return GetBitmap().HasAlpha(); }
|
||||
};
|
||||
|
||||
class VCL_DLLPUBLIC MetaBmpExScaleAction final : public MetaAction
|
||||
|
||||
@@ -214,7 +214,7 @@ bool View::InsertMetaFile( const TransferableDataHelper& rDataHelper, const Poin
|
||||
{
|
||||
MetaBmpExAction* pBmpExAction = dynamic_cast< MetaBmpExAction* >( pAction );
|
||||
if( pBmpExAction )
|
||||
aGraphic = Graphic(Bitmap(pBmpExAction->GetBitmapEx()) );
|
||||
aGraphic = Graphic(pBmpExAction->GetBitmap());
|
||||
}
|
||||
break;
|
||||
case MetaActionType::BMPEXSCALE:
|
||||
|
||||
@@ -530,7 +530,7 @@ void SfxRedactionHelper::searchImagesInMetaFile(
|
||||
{
|
||||
MetaBmpExAction* pAction = static_cast<MetaBmpExAction*>(pCurrAct);
|
||||
aDestPt = pAction->GetPoint();
|
||||
aDestSz = pAction->GetBitmapEx().GetSizePixel();
|
||||
aDestSz = pAction->GetBitmap().GetSizePixel();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ public:
|
||||
|
||||
::Bitmap aBmp( aGraphic.GetBitmap() );
|
||||
|
||||
xMtf->AddAction( new MetaBmpExAction( Point(), BitmapEx(aBmp) ) );
|
||||
xMtf->AddAction( new MetaBmpExAction( Point(), aBmp ) );
|
||||
xMtf->SetPrefSize( aBmp.GetPrefSize() );
|
||||
xMtf->SetPrefMapMode( aBmp.GetPrefMapMode() );
|
||||
|
||||
@@ -375,11 +375,11 @@ bool getAnimationFromGraphic( VectorOfMtfAnimationFrames& o_rFrames,
|
||||
AlphaMask aAlphaMask(pVDevMask->GetBitmap(aEmptyPoint, aAnimSize));
|
||||
pMtf->AddAction(
|
||||
new MetaBmpExAction( aEmptyPoint,
|
||||
BitmapEx(
|
||||
Bitmap(BitmapEx(
|
||||
pVDev->GetBitmap(
|
||||
aEmptyPoint,
|
||||
aAnimSize ),
|
||||
aAlphaMask)));
|
||||
aAlphaMask))));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -387,11 +387,11 @@ bool getAnimationFromGraphic( VectorOfMtfAnimationFrames& o_rFrames,
|
||||
aAlphaMask.Invert(); // convert from transparency to alpha
|
||||
pMtf->AddAction(
|
||||
new MetaBmpExAction( aEmptyPoint,
|
||||
BitmapEx(
|
||||
Bitmap(BitmapEx(
|
||||
pVDev->GetBitmap(
|
||||
aEmptyPoint,
|
||||
aAnimSize ),
|
||||
aAlphaMask)));
|
||||
aAlphaMask))));
|
||||
}
|
||||
mnLoadedFrames = i+1;
|
||||
}
|
||||
|
||||
@@ -841,9 +841,9 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
|
||||
case MetaActionType::BMPEX:
|
||||
{
|
||||
MetaBmpExAction* pAct = static_cast<MetaBmpExAction*>(pAction);
|
||||
const BitmapEx aBmpEx( Mask( Bitmap(pAct->GetBitmapEx()) ).GetBitmap() );
|
||||
const Bitmap aBmp( Mask( pAct->GetBitmap() ).GetBitmap() );
|
||||
|
||||
pAct = new MetaBmpExAction( pAct->GetPoint(), aBmpEx );
|
||||
pAct = new MetaBmpExAction( pAct->GetPoint(), aBmp );
|
||||
aMtf.AddAction( pAct );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1129,11 +1129,11 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaBmpScaleAction const & rAct)
|
||||
|
||||
void ImpSdrGDIMetaFileImport::DoAction(MetaBmpExAction const & rAct)
|
||||
{
|
||||
tools::Rectangle aRect(rAct.GetPoint(),rAct.GetBitmapEx().GetSizePixel());
|
||||
tools::Rectangle aRect(rAct.GetPoint(),rAct.GetBitmap().GetSizePixel());
|
||||
aRect.AdjustRight( 1 ); aRect.AdjustBottom( 1 );
|
||||
rtl::Reference<SdrGrafObj> pGraf = new SdrGrafObj(
|
||||
*mpModel,
|
||||
Bitmap(rAct.GetBitmapEx()),
|
||||
rAct.GetBitmap(),
|
||||
aRect);
|
||||
|
||||
// This action is not creating line and fill, set directly, do not use SetAttributes(..)
|
||||
|
||||
@@ -1067,11 +1067,11 @@ void SvmTest::checkBitmapExs(const GDIMetaFile& rMetaFile, bool bIsSvmFile)
|
||||
#else
|
||||
u"469f0820", // atypical RGBA little-endian config
|
||||
#endif
|
||||
u"839e8cce",
|
||||
u"236aaf55", // 1-bit
|
||||
u"2949ccc7", // 4-bit color bitmap - same as 8-bit color bitmap
|
||||
u"2949ccc7",
|
||||
u"e5df8aad",
|
||||
u"a17eb609",
|
||||
u"7bd5c66f", // 1-bit
|
||||
u"ec307070", // 4-bit color bitmap - same as 8-bit color bitmap
|
||||
u"ec307070",
|
||||
u"b6d8e2d5",
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -1080,7 +1080,7 @@ void SvmTest::checkBitmapExs(const GDIMetaFile& rMetaFile, bool bIsSvmFile)
|
||||
u"26bdebd04e5b18d685cea04982179e273ee3b659",
|
||||
u"f4f52df6ef965a2f0fbccbe6aca35ba3457cf9d5",
|
||||
u"7c953a06d34bbd38897f950d595df2880dbb0f75",
|
||||
u"ca3e5cdde1c395e1ee76d339a5bf6e46fbac3249",
|
||||
u"7b51ea0cc5da3bbaf9b9d3dc1cde8e5fa69dbdf2",
|
||||
u"8a1ebc46f890eb0879464c6e293bffd4ce7fadc0", // 1-bit
|
||||
u"23611fc9f484c23e45bbd457730adb8ab5355509", // 4-bit color bitmap - same as 8-bit color bitmap
|
||||
u"23611fc9f484c23e45bbd457730adb8ab5355509",
|
||||
@@ -1105,7 +1105,7 @@ void SvmTest::checkBitmapExs(const GDIMetaFile& rMetaFile, bool bIsSvmFile)
|
||||
{"x", u"6"}, {"y", u"6"}, {"crc", aExpectedCRC[3]}, {"transparenttype", u"bitmap"}, {"contentchecksum", aExpectedContentChecksum[3]}
|
||||
});
|
||||
assertXPathAttrs(pDoc, "/metafile/bmpex[3]", {
|
||||
{"x", u"0"}, {"y", u"6"}, {"transparenttype", u"bitmap"}, {"contentchecksum", aExpectedContentChecksum[4]}, {"pixelformat", u"8BPP"}
|
||||
{"x", u"0"}, {"y", u"6"}, {"transparenttype", u"bitmap"}, {"contentchecksum", aExpectedContentChecksum[4]}, {"pixelformat", u"24BPP"}
|
||||
});
|
||||
if (!bIsSvmFile)
|
||||
{
|
||||
@@ -1114,13 +1114,13 @@ void SvmTest::checkBitmapExs(const GDIMetaFile& rMetaFile, bool bIsSvmFile)
|
||||
});
|
||||
}
|
||||
assertXPathAttrs(pDoc, "/metafile/bmpex[4]", {
|
||||
{"x", u"2"}, {"y", u"6"}, {"crc", aExpectedCRC[5]}, {"transparenttype", u"bitmap"}, {"contentchecksum", aExpectedContentChecksum[5]}, {"pixelformat", u"8BPP"}
|
||||
{"x", u"2"}, {"y", u"6"}, {"crc", aExpectedCRC[5]}, {"transparenttype", u"bitmap"}, {"contentchecksum", aExpectedContentChecksum[5]}, {"pixelformat", u"24BPP"}
|
||||
});
|
||||
assertXPathAttrs(pDoc, "/metafile/bmpex[5]", {
|
||||
{"x", u"0"}, {"y", u"8"}, {"crc", aExpectedCRC[6]}, {"transparenttype", u"bitmap"}, {"contentchecksum", aExpectedContentChecksum[6]}, {"pixelformat", u"8BPP"}
|
||||
{"x", u"0"}, {"y", u"8"}, {"crc", aExpectedCRC[6]}, {"transparenttype", u"bitmap"}, {"contentchecksum", aExpectedContentChecksum[6]}, {"pixelformat", u"24BPP"}
|
||||
});
|
||||
assertXPathAttrs(pDoc, "/metafile/bmpex[6]", {
|
||||
{"x", u"2"}, {"y", u"8"}, {"crc", aExpectedCRC[7]}, {"transparenttype", u"bitmap"}, {"contentchecksum", aExpectedContentChecksum[7]}, {"pixelformat", u"8BPP"}
|
||||
{"x", u"2"}, {"y", u"8"}, {"crc", aExpectedCRC[7]}, {"transparenttype", u"bitmap"}, {"contentchecksum", aExpectedContentChecksum[7]}, {"pixelformat", u"24BPP"}
|
||||
});
|
||||
#else
|
||||
(void)bIsSvmFile;
|
||||
|
||||
@@ -815,11 +815,11 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
|
||||
|
||||
case MetaActionType::BMPEX :
|
||||
{
|
||||
BitmapEx aBitmapEx( static_cast<MetaBmpExAction*>(pMA)->GetBitmapEx() );
|
||||
Bitmap aBitmap( aBitmapEx.GetBitmap() );
|
||||
Bitmap aBitmapEx( static_cast<MetaBmpExAction*>(pMA)->GetBitmap() );
|
||||
Bitmap aBitmap( aBitmapEx.CreateColorBitmap() );
|
||||
if ( mbGrayScale )
|
||||
aBitmap.Convert( BmpConversion::N8BitGreys );
|
||||
const AlphaMask& aMask( aBitmapEx.GetAlphaMask() );
|
||||
const AlphaMask aMask( aBitmapEx.CreateAlphaMask() );
|
||||
Point aPoint( static_cast<const MetaBmpExAction*>(pMA)->GetPoint() );
|
||||
Size aSize( rVDev.PixelToLogic( aBitmap.GetSizePixel() ) );
|
||||
ImplBmp( &aBitmap, &aMask, aPoint, aSize.Width(), aSize.Height() );
|
||||
|
||||
@@ -937,14 +937,14 @@ rtl::Reference<MetaAction> SvmReader::BmpExHandler()
|
||||
rtl::Reference<MetaBmpExAction> pAction(new MetaBmpExAction);
|
||||
|
||||
VersionCompatRead aCompat(mrStream);
|
||||
BitmapEx aBmpEx;
|
||||
ReadDIBBitmapEx(aBmpEx, mrStream);
|
||||
Bitmap aBmp;
|
||||
ReadDIBBitmapEx(aBmp, mrStream);
|
||||
TypeSerializer aSerializer(mrStream);
|
||||
Point aPoint;
|
||||
aSerializer.readPoint(aPoint);
|
||||
|
||||
pAction->SetPoint(aPoint);
|
||||
pAction->SetBitmapEx(aBmpEx);
|
||||
pAction->SetBitmap(aBmp);
|
||||
|
||||
return pAction;
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ BitmapChecksum SvmWriter::GetChecksum(const GDIMetaFile& rMetaFile)
|
||||
ShortToSVBT16(static_cast<sal_uInt16>(pAct->GetType()), aBT16);
|
||||
nCrc = rtl_crc32(nCrc, aBT16, 2);
|
||||
|
||||
BCToBCOA(pAct->GetBitmapEx().GetChecksum(), aBCOA);
|
||||
BCToBCOA(pAct->GetBitmap().GetChecksum(), aBCOA);
|
||||
nCrc = rtl_crc32(nCrc, aBCOA, BITMAP_CHECKSUM_SIZE);
|
||||
|
||||
Int32ToSVBT32(pAct->GetPoint().X(), aBT32);
|
||||
@@ -1103,11 +1103,11 @@ void SvmWriter::BmpScalePartHandler(const MetaBmpScalePartAction* pAction)
|
||||
|
||||
void SvmWriter::BmpExHandler(const MetaBmpExAction* pAction)
|
||||
{
|
||||
if (!pAction->GetBitmapEx().GetBitmap().IsEmpty())
|
||||
if (!pAction->GetBitmap().CreateColorBitmap().IsEmpty())
|
||||
{
|
||||
mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
|
||||
VersionCompatWrite aCompat(mrStream, 1);
|
||||
WriteDIBBitmapEx(pAction->GetBitmapEx(), mrStream);
|
||||
WriteDIBBitmapEx(pAction->GetBitmap(), mrStream);
|
||||
TypeSerializer aSerializer(mrStream);
|
||||
aSerializer.writePoint(pAction->GetPoint());
|
||||
}
|
||||
|
||||
@@ -1288,8 +1288,8 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
|
||||
case MetaActionType::BMPEX:
|
||||
{
|
||||
const MetaBmpExAction* pA = static_cast<const MetaBmpExAction *>(pAction);
|
||||
Bitmap aBmp( pA->GetBitmapEx().GetBitmap() );
|
||||
AlphaMask aMsk( pA->GetBitmapEx().GetAlphaMask() );
|
||||
Bitmap aBmp( pA->GetBitmap().CreateColorBitmap() );
|
||||
AlphaMask aMsk( pA->GetBitmap().CreateAlphaMask() );
|
||||
|
||||
if( !aMsk.IsEmpty() )
|
||||
{
|
||||
|
||||
@@ -1244,8 +1244,8 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
|
||||
case MetaActionType::BMPEX:
|
||||
{
|
||||
const MetaBmpExAction* pA = static_cast<const MetaBmpExAction *>(pMA);
|
||||
Bitmap aBmp( pA->GetBitmapEx().GetBitmap() );
|
||||
AlphaMask aMsk( pA->GetBitmapEx().GetAlphaMask() );
|
||||
Bitmap aBmp( pA->GetBitmap().CreateColorBitmap() );
|
||||
AlphaMask aMsk( pA->GetBitmap().CreateAlphaMask() );
|
||||
|
||||
if( !aMsk.IsEmpty() )
|
||||
{
|
||||
|
||||
@@ -231,6 +231,120 @@ namespace
|
||||
return true;
|
||||
}
|
||||
|
||||
bool handleBitmapContent(
|
||||
const basegfx::B2DPolyPolygon& rClip,
|
||||
const Point& rPoint,
|
||||
const Size& rSize,
|
||||
const Bitmap& rBitmap,
|
||||
GDIMetaFile& rTarget)
|
||||
{
|
||||
if(!rSize.Width() || !rSize.Height() || rBitmap.IsEmpty())
|
||||
{
|
||||
// bitmap or size is empty
|
||||
return true;
|
||||
}
|
||||
|
||||
const basegfx::B2DRange aLogicBitmapRange(
|
||||
rPoint.X(), rPoint.Y(),
|
||||
rPoint.X() + rSize.Width(), rPoint.Y() + rSize.Height());
|
||||
const basegfx::B2DPolyPolygon aClipOfBitmap(
|
||||
basegfx::utils::clipPolyPolygonOnRange(
|
||||
rClip,
|
||||
aLogicBitmapRange,
|
||||
true,
|
||||
false)); // stroke
|
||||
|
||||
if(!aClipOfBitmap.count())
|
||||
{
|
||||
// outside clip region
|
||||
return true;
|
||||
}
|
||||
|
||||
// inside or overlapping. Use area to find out if it is completely
|
||||
// covering (inside) or overlapping
|
||||
const double fClipArea(basegfx::utils::getArea(aClipOfBitmap));
|
||||
const double fBitmapArea(
|
||||
aLogicBitmapRange.getWidth() * aLogicBitmapRange.getWidth() +
|
||||
aLogicBitmapRange.getHeight() * aLogicBitmapRange.getHeight());
|
||||
const double fFactor(fClipArea / fBitmapArea);
|
||||
|
||||
if(basegfx::fTools::more(fFactor, 1.0 - 0.001))
|
||||
{
|
||||
// completely covering (with 0.1% tolerance)
|
||||
return false;
|
||||
}
|
||||
|
||||
// needs clipping (with 0.1% tolerance). Prepare VirtualDevice
|
||||
// in pixel mode for alpha channel painting (black is transparent,
|
||||
// white to paint 100% opacity)
|
||||
const Size aSizePixel(rBitmap.GetSizePixel());
|
||||
ScopedVclPtrInstance< VirtualDevice > aVDev;
|
||||
|
||||
aVDev->SetOutputSizePixel(aSizePixel);
|
||||
aVDev->EnableMapMode(false);
|
||||
aVDev->SetFillColor( COL_WHITE);
|
||||
aVDev->SetLineColor();
|
||||
|
||||
if(rBitmap.HasAlpha())
|
||||
{
|
||||
// use given alpha channel
|
||||
aVDev->DrawBitmap(Point(0, 0), rBitmap.CreateAlphaMask().GetBitmap());
|
||||
}
|
||||
else
|
||||
{
|
||||
// reset alpha channel
|
||||
aVDev->SetBackground(Wallpaper(COL_BLACK));
|
||||
aVDev->Erase();
|
||||
}
|
||||
|
||||
// transform polygon from clipping to pixel coordinates
|
||||
basegfx::B2DPolyPolygon aPixelPoly(aClipOfBitmap);
|
||||
basegfx::B2DHomMatrix aTransform;
|
||||
|
||||
aTransform.translate(-aLogicBitmapRange.getMinX(), -aLogicBitmapRange.getMinY());
|
||||
aTransform.scale(
|
||||
static_cast< double >(aSizePixel.Width()) / aLogicBitmapRange.getWidth(),
|
||||
static_cast< double >(aSizePixel.Height()) / aLogicBitmapRange.getHeight());
|
||||
aPixelPoly.transform(aTransform);
|
||||
|
||||
// to fill the non-covered parts, use the Xor fill rule of
|
||||
// tools::PolyPolygon painting. Start with an all-covering polygon and
|
||||
// add the clip polygon one
|
||||
basegfx::B2DPolyPolygon aInvertPixelPoly;
|
||||
|
||||
aInvertPixelPoly.append(
|
||||
basegfx::utils::createPolygonFromRect(
|
||||
basegfx::B2DRange(
|
||||
0.0, 0.0,
|
||||
aSizePixel.Width(), aSizePixel.Height())));
|
||||
aInvertPixelPoly.append(aPixelPoly);
|
||||
|
||||
// paint as alpha
|
||||
aVDev->DrawPolyPolygon(aInvertPixelPoly);
|
||||
|
||||
// get created alpha mask and set defaults
|
||||
AlphaMask aAlpha(
|
||||
aVDev->GetBitmap(
|
||||
Point(0, 0),
|
||||
aSizePixel));
|
||||
|
||||
aAlpha.SetPrefSize(rBitmap.GetPrefSize());
|
||||
aAlpha.SetPrefMapMode(rBitmap.GetPrefMapMode());
|
||||
|
||||
// add new action replacing the old one
|
||||
rTarget.AddAction(
|
||||
new MetaBmpExScaleAction(
|
||||
Point(
|
||||
basegfx::fround<tools::Long>(aLogicBitmapRange.getMinX()),
|
||||
basegfx::fround<tools::Long>(aLogicBitmapRange.getMinY())),
|
||||
Size(
|
||||
basegfx::fround<tools::Long>(aLogicBitmapRange.getWidth()),
|
||||
basegfx::fround<tools::Long>(aLogicBitmapRange.getHeight())),
|
||||
BitmapEx(rBitmap.CreateColorBitmap(), aAlpha)));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void addSvtGraphicStroke(const SvtGraphicStroke& rStroke, GDIMetaFile& rTarget)
|
||||
{
|
||||
// write SvtGraphicFill
|
||||
@@ -705,26 +819,26 @@ void clipMetafileContentAgainstOwnRegions(GDIMetaFile& rSource)
|
||||
case MetaActionType::BMPEX :
|
||||
{
|
||||
const MetaBmpExAction* pA = static_cast< const MetaBmpExAction* >(pAction);
|
||||
const BitmapEx& rBitmapEx = pA->GetBitmapEx();
|
||||
const Bitmap& rBitmap = pA->GetBitmap();
|
||||
|
||||
// the logical size depends on the PrefSize of the given bitmap in
|
||||
// combination with the current MapMode
|
||||
Size aLogicalSize(rBitmapEx.GetPrefSize());
|
||||
Size aLogicalSize(rBitmap.GetPrefSize());
|
||||
|
||||
if(MapUnit::MapPixel == rBitmapEx.GetPrefMapMode().GetMapUnit())
|
||||
if(MapUnit::MapPixel == rBitmap.GetPrefMapMode().GetMapUnit())
|
||||
{
|
||||
aLogicalSize = Application::GetDefaultDevice()->PixelToLogic(aLogicalSize, aMapModes.back());
|
||||
}
|
||||
else
|
||||
{
|
||||
aLogicalSize = OutputDevice::LogicToLogic(aLogicalSize, rBitmapEx.GetPrefMapMode(), aMapModes.back());
|
||||
aLogicalSize = OutputDevice::LogicToLogic(aLogicalSize, rBitmap.GetPrefMapMode(), aMapModes.back());
|
||||
}
|
||||
|
||||
bDone = handleBitmapContent(
|
||||
aClips.back(),
|
||||
pA->GetPoint(),
|
||||
aLogicalSize,
|
||||
rBitmapEx,
|
||||
rBitmap,
|
||||
aTarget);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1625,7 +1625,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference ) const
|
||||
case MetaActionType::BMPEX:
|
||||
{
|
||||
MetaBmpExAction* pAct = static_cast<MetaBmpExAction*>(pAction);
|
||||
tools::Rectangle aRect( pAct->GetPoint(), aMapVDev->PixelToLogic( pAct->GetBitmapEx().GetSizePixel() ) );
|
||||
tools::Rectangle aRect( pAct->GetPoint(), aMapVDev->PixelToLogic( pAct->GetBitmap().GetSizePixel() ) );
|
||||
ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
|
||||
}
|
||||
break;
|
||||
@@ -2225,7 +2225,7 @@ sal_uLong GDIMetaFile::GetSizeBytes() const
|
||||
case MetaActionType::BMPSCALE: nSizeBytes += static_cast<MetaBmpScaleAction*>( pAction )->GetBitmap().GetSizeBytes(); break;
|
||||
case MetaActionType::BMPSCALEPART: nSizeBytes += static_cast<MetaBmpScalePartAction*>( pAction )->GetBitmap().GetSizeBytes(); break;
|
||||
|
||||
case MetaActionType::BMPEX: nSizeBytes += static_cast<MetaBmpExAction*>( pAction )->GetBitmapEx().GetSizeBytes(); break;
|
||||
case MetaActionType::BMPEX: nSizeBytes += static_cast<MetaBmpExAction*>( pAction )->GetBitmap().GetSizeBytes(); break;
|
||||
case MetaActionType::BMPEXSCALE: nSizeBytes += static_cast<MetaBmpExScaleAction*>( pAction )->GetBitmapEx().GetSizeBytes(); break;
|
||||
case MetaActionType::BMPEXSCALEPART: nSizeBytes += static_cast<MetaBmpExScalePartAction*>( pAction )->GetBitmapEx().GetSizeBytes(); break;
|
||||
|
||||
|
||||
@@ -1067,15 +1067,15 @@ MetaBmpExAction::MetaBmpExAction() :
|
||||
MetaBmpExAction::~MetaBmpExAction()
|
||||
{}
|
||||
|
||||
MetaBmpExAction::MetaBmpExAction( const Point& rPt, const BitmapEx& rBmpEx ) :
|
||||
MetaBmpExAction::MetaBmpExAction( const Point& rPt, const Bitmap& rBmp ) :
|
||||
MetaAction ( MetaActionType::BMPEX ),
|
||||
maBmpEx ( rBmpEx ),
|
||||
maBmp ( rBmp ),
|
||||
maPt ( rPt )
|
||||
{}
|
||||
|
||||
void MetaBmpExAction::Execute( OutputDevice* pOut )
|
||||
{
|
||||
pOut->DrawBitmapEx( maPt, maBmpEx );
|
||||
pOut->DrawBitmapEx( maPt, maBmp );
|
||||
}
|
||||
|
||||
rtl::Reference<MetaAction> MetaBmpExAction::Clone() const
|
||||
|
||||
@@ -1004,8 +1004,8 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& r
|
||||
auto pMeta = static_cast<MetaBmpExAction*>(pAction);
|
||||
rWriter.startElement(sCurrentElementTag);
|
||||
writePoint(rWriter, pMeta->GetPoint());
|
||||
Bitmap aBitmap = pMeta->GetBitmapEx().GetBitmap();
|
||||
rWriter.attribute("transparenttype", convertBitmapExTransparentType(pMeta->GetBitmapEx()));
|
||||
Bitmap aBitmap = pMeta->GetBitmap().CreateColorBitmap();
|
||||
rWriter.attribute("transparenttype", convertBitmapTransparentType(pMeta->GetBitmap()));
|
||||
writeBitmap(rWriter, aBitmap);
|
||||
rWriter.endElement();
|
||||
}
|
||||
|
||||
@@ -764,11 +764,11 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
|
||||
case MetaActionType::BMPEX:
|
||||
{
|
||||
const MetaBmpExAction* pA = static_cast<const MetaBmpExAction*>(pAction);
|
||||
BitmapEx aBitmapEx( pA->GetBitmapEx() );
|
||||
Size aSize( OutputDevice::LogicToLogic( aBitmapEx.GetPrefSize(),
|
||||
aBitmapEx.GetPrefMapMode(), pDummyVDev->GetMapMode() ) );
|
||||
Bitmap aBitmap( pA->GetBitmap() );
|
||||
Size aSize( OutputDevice::LogicToLogic( aBitmap.GetPrefSize(),
|
||||
aBitmap.GetPrefMapMode(), pDummyVDev->GetMapMode() ) );
|
||||
Graphic aGraphic = i_pOutDevData ? i_pOutDevData->GetCurrentGraphic() : Graphic();
|
||||
implWriteBitmapEx( pA->GetPoint(), aSize, Bitmap(aBitmapEx), aGraphic, pDummyVDev, i_rContext );
|
||||
implWriteBitmapEx( pA->GetPoint(), aSize, aBitmap, aGraphic, pDummyVDev, i_rContext );
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
|
||||
switch(nAction)
|
||||
{
|
||||
case MetaActionType::BMPEX:
|
||||
mpMetaFile->AddAction(new MetaBmpExAction(rDestPt, aBmpEx));
|
||||
mpMetaFile->AddAction(new MetaBmpExAction(rDestPt, Bitmap(aBmpEx)));
|
||||
break;
|
||||
|
||||
case MetaActionType::BMPEXSCALE:
|
||||
@@ -232,7 +232,7 @@ void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
|
||||
switch(nAction)
|
||||
{
|
||||
case MetaActionType::BMPEX:
|
||||
mpMetaFile->AddAction(new MetaBmpExAction(rDestPt, aBmpEx));
|
||||
mpMetaFile->AddAction(new MetaBmpExAction(rDestPt, Bitmap(aBmpEx)));
|
||||
break;
|
||||
|
||||
case MetaActionType::BMPEXSCALE:
|
||||
|
||||
@@ -820,7 +820,7 @@ void ImplConvertTransparentAction( GDIMetaFile& o_rMtf,
|
||||
switch (rAct.GetType())
|
||||
{
|
||||
case MetaActionType::BMPEX:
|
||||
aBmpEx = static_cast<const MetaBmpExAction&>(rAct).GetBitmapEx();
|
||||
aBmpEx = static_cast<const MetaBmpExAction&>(rAct).GetBitmap();
|
||||
break;
|
||||
|
||||
case MetaActionType::BMPEXSCALE:
|
||||
@@ -1088,7 +1088,7 @@ tools::Rectangle ImplCalcActionBounds( const MetaAction& rAct, const OutputDevic
|
||||
|
||||
case MetaActionType::BMPEX:
|
||||
aActionBounds = tools::Rectangle( static_cast<const MetaBmpExAction&>(rAct).GetPoint(),
|
||||
rOut.PixelToLogic( static_cast<const MetaBmpExAction&>(rAct).GetBitmapEx().GetSizePixel() ) );
|
||||
rOut.PixelToLogic( static_cast<const MetaBmpExAction&>(rAct).GetBitmap().GetSizePixel() ) );
|
||||
break;
|
||||
|
||||
case MetaActionType::BMPEXSCALE:
|
||||
|
||||
Reference in New Issue
Block a user