summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2012-05-30 13:44:19 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-03-16 01:57:53 +0000
commita1a0830d1ac3ffabbe35bd8a0264b64f1f7a9d67 (patch)
tree7425273b6d0195397dfe635810bd48063c0d9054 /svx
parente8620b247dcba55f67ad7eaf63cfe5ac3831b187 (diff)
Resolves: #i119601# support for transparency in PNG export dialog
Added support for transparency in PNG export dialog and support for alpha channnel Conflicts: svtools/source/filter/exportdialog.cxx Change-Id: I324bfd6a34803478bf17f113e015620056c90567
Diffstat (limited to 'svx')
-rw-r--r--svx/source/unodraw/UnoGraphicExporter.cxx52
1 files changed, 32 insertions, 20 deletions
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index 6efefc7f84f4..150094dd4650 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -207,34 +207,46 @@ namespace svx
*/
BitmapEx GetBitmapFromMetaFile( const GDIMetaFile& rMtf, sal_Bool bTransparent, const Size* pSize )
{
- Graphic aGraphic( rMtf );
- BitmapEx aBmpEx;
-
- // #i102089# support user's settings of AA and LineSnap when the MetaFile gets
- // rasterconverted to a bitmap
- const SvtOptionsDrawinglayer aDrawinglayerOpt;
- const GraphicConversionParameters aParameters(
- pSize ? *pSize : Size(0, 0),
- true, // allow unlimited size
- aDrawinglayerOpt.IsAntiAliasing(),
- aDrawinglayerOpt.IsSnapHorVerLinesToDiscrete());
-
- if( bTransparent )
+ BitmapEx aBmpEx;
+
+ if(bTransparent)
{
- Graphic aMaskGraphic(rMtf.GetMonochromeMtf(COL_BLACK));
- Bitmap aMaskBmp(aMaskGraphic.GetBitmap(aParameters));
+ // use new primitive conversion tooling
+ basegfx::B2DRange aRange(basegfx::B2DPoint(0.0, 0.0));
+
+ if(pSize)
+ {
+ // use 100th mm for primitive bitmap converter tool, input is pixel
+ // use a real OutDev to get the correct DPI, the static LogicToLogic assumes 72dpi which is wrong (!)
+ const Size aSize100th(Application::GetDefaultDevice()->PixelToLogic(*pSize, MapMode(MAP_100TH_MM)));
- aMaskBmp.Convert(BMP_CONVERSION_1BIT_THRESHOLD);
- aBmpEx = BitmapEx(aGraphic.GetBitmap(aParameters), aMaskBmp);
+ aRange.expand(basegfx::B2DPoint(aSize100th.Width(), aSize100th.Height()));
+ }
+ else
+ {
+ // use 100th mm for primitive bitmap converter tool
+ const Size aSize100th(Application::GetDefaultDevice()->LogicToLogic(rMtf.GetPrefSize(), rMtf.GetPrefMapMode(), MapMode(MAP_100TH_MM)));
+
+ aRange.expand(basegfx::B2DPoint(aSize100th.Width(), aSize100th.Height()));
+ }
+
+ aBmpEx = convertMetafileToBitmapEx(rMtf, aRange);
}
else
{
+ const SvtOptionsDrawinglayer aDrawinglayerOpt;
+ const GraphicConversionParameters aParameters(
+ pSize ? *pSize : Size(0, 0),
+ true, // allow unlimited size
+ aDrawinglayerOpt.IsAntiAliasing(),
+ aDrawinglayerOpt.IsSnapHorVerLinesToDiscrete());
+ const Graphic aGraphic(rMtf);
+
aBmpEx = BitmapEx(aGraphic.GetBitmap(aParameters));
+ aBmpEx.SetPrefMapMode( rMtf.GetPrefMapMode() );
+ aBmpEx.SetPrefSize( rMtf.GetPrefSize() );
}
- aBmpEx.SetPrefMapMode( rMtf.GetPrefMapMode() );
- aBmpEx.SetPrefSize( rMtf.GetPrefSize() );
-
return aBmpEx;
}