[Libreoffice-commits] core.git: drawinglayer/source svtools/source svx/source

Armin Le Grand alg at apache.org
Fri Mar 15 18:58:11 PDT 2013


 drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx |    2 
 svtools/source/filter/exportdialog.cxx                       |   13 ++
 svx/source/unodraw/UnoGraphicExporter.cxx                    |   52 ++++++-----
 3 files changed, 45 insertions(+), 22 deletions(-)

New commits:
commit a1a0830d1ac3ffabbe35bd8a0264b64f1f7a9d67
Author: Armin Le Grand <alg at apache.org>
Date:   Wed May 30 13:44:19 2012 +0000

    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

diff --git a/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx b/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx
index 30540ce..92e21d6 100644
--- a/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx
+++ b/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx
@@ -145,7 +145,7 @@ namespace drawinglayer
                     }
 
                     const geometry::ViewInformation2D aViewInformation2D(aViewInformationSequence);
-                    const double fFactor100th_mmToInch(2.54/1000.0);
+                    const double fFactor100th_mmToInch(1.0 / (2.54 * 1000.0));
                     const sal_uInt32 nDiscreteWidth(basegfx::fround((fWidth * fFactor100th_mmToInch) * DPI_X));
                     const sal_uInt32 nDiscreteHeight(basegfx::fround((fHeight * fFactor100th_mmToInch) * DPI_Y));
 
diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx
index fdf73d6..b8942d5 100644
--- a/svtools/source/filter/exportdialog.cxx
+++ b/svtools/source/filter/exportdialog.cxx
@@ -263,6 +263,10 @@ uno::Sequence< beans::PropertyValue > ExportDialog::GetFilterData( sal_Bool bUpd
             if ( mpCbInterlaced->IsChecked() )
                 nInterlace++;
             pFilterOptions->WriteInt32(OUString("Interlaced"), nInterlace);
+            sal_Int32 nValue = 0;
+            if ( mpCbSaveTransparency->IsChecked() )
+                nValue++;
+            pFilterOptions->WriteInt32(OUString("Translucent"), nValue);
         }
         break;
 
@@ -782,6 +786,7 @@ void ExportDialog::createFilterOptions()
             sal_Int32 nCompression = mpFilterOptionsItem->ReadInt32(OUString("Compression"), 6);
             if ( ( nCompression < 1 ) || ( nCompression > 9 ) )
                 nCompression = 6;
+
             get(mpSbCompression, "compressionpngsb");
             get(mpNfCompression, "compressionpngnf-nospin");
             mpSbCompression->SetRangeMin( 1 );
@@ -793,7 +798,11 @@ void ExportDialog::createFilterOptions()
 
             // Interlaced
             mpMode->Show();
-            mpCbInterlaced->Check( mpFilterOptionsItem->ReadInt32(OUString("Interlaced"), 0) != 0);
+            mpCbInterlaced->Check(mpFilterOptionsItem->ReadInt32(OUString("Interlaced"), 0) != 0);
+
+            // Transparency
+            mpDrawingObjects->Show();
+            mpCbSaveTransparency->Check(mpFilterOptionsItem->ReadInt32(OUString("Translucent"), 1) != 0);
         }
         break;
         case FORMAT_BMP :
@@ -820,9 +829,11 @@ void ExportDialog::createFilterOptions()
         break;
         case FORMAT_GIF :
         {
+            // Interlaced
             mpMode->Show();
             mpCbInterlaced->Check(mpFilterOptionsItem->ReadInt32(OUString("Interlaced"), 1) != 0);
 
+            // Transparency
             mpDrawingObjects->Show();
             mpCbSaveTransparency->Check(mpFilterOptionsItem->ReadInt32(OUString("Translucent"), 1) != 0);
         }
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index 6efefc7..150094d 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;
     }
 


More information about the Libreoffice-commits mailing list