incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1344280 - in /incubator/ooo/trunk/main: drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx svtools/source/filter/exportdialog.cxx svx/source/unodraw/UnoGraphicExporter.cxx
Date Wed, 30 May 2012 14:44:20 GMT
Author: alg
Date: Wed May 30 14:44:19 2012
New Revision: 1344280

URL: http://svn.apache.org/viewvc?rev=1344280&view=rev
Log:
#119601# Added support for transparency in PNG export dialog and support for alpha channnel

Modified:
    incubator/ooo/trunk/main/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx
    incubator/ooo/trunk/main/svtools/source/filter/exportdialog.cxx
    incubator/ooo/trunk/main/svx/source/unodraw/UnoGraphicExporter.cxx

Modified: incubator/ooo/trunk/main/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx?rev=1344280&r1=1344279&r2=1344280&view=diff
==============================================================================
--- incubator/ooo/trunk/main/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx
(original)
+++ incubator/ooo/trunk/main/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx
Wed May 30 14:44:19 2012
@@ -150,7 +150,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));
 

Modified: incubator/ooo/trunk/main/svtools/source/filter/exportdialog.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svtools/source/filter/exportdialog.cxx?rev=1344280&r1=1344279&r2=1344280&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svtools/source/filter/exportdialog.cxx (original)
+++ incubator/ooo/trunk/main/svtools/source/filter/exportdialog.cxx Wed May 30 14:44:19 2012
@@ -270,6 +270,10 @@ uno::Sequence< beans::PropertyValue > Ex
 			if ( maCbInterlaced.IsChecked() )
 				nInterlace++;
 			pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ),
nInterlace );
+            sal_Int32 nValue = 0;
+			if ( maCbSaveTransparency.IsChecked() )
+				nValue++;
+			pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Translucent" ) ),
nValue );
 		}
 		break;
 
@@ -930,6 +934,16 @@ void ExportDialog::createFilterOptions( 
 			maNfCompression.SetValue( 9 );
 			maNfCompression.SetStrictFormat( sal_True );
 
+            // transparency
+			xIndenter = boost::shared_ptr< vcl::Indenter >( new vcl::Indenter( &rLayout,
nIndent ) );
+			rLayout.addChild( xIndenter );
+			xRows = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( &rLayout,
true ) );
+			xIndenter->setChild( xRows );
+			xRows->addWindow( &maCbSaveTransparency );
+		    xSpacer.reset( new vcl::Spacer( &rLayout, 2 ) );
+			rLayout.addChild( xSpacer );
+
+			maCbSaveTransparency.Check( mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM(
"Translucent" ) ), 1 ) != 0 );
 			maCbInterlaced.Check( mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM(
"Interlaced" ) ), 0 ) != 0 );
 		}
 		break;

Modified: incubator/ooo/trunk/main/svx/source/unodraw/UnoGraphicExporter.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/unodraw/UnoGraphicExporter.cxx?rev=1344280&r1=1344279&r2=1344280&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/unodraw/UnoGraphicExporter.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/unodraw/UnoGraphicExporter.cxx Wed May 30 14:44:19
2012
@@ -219,34 +219,46 @@ namespace svx
 	*/
 	BitmapEx GetBitmapFromMetaFile( const GDIMetaFile& rMtf, sal_Bool bTransparent, const
Size* pSize )
 	{
-		Graphic     aGraphic( rMtf );
-		BitmapEx	aBmpEx;
+		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 )
+		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)));
+                    
+                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()));
+            }
 
-			aMaskBmp.Convert(BMP_CONVERSION_1BIT_THRESHOLD);
-			aBmpEx = BitmapEx(aGraphic.GetBitmap(aParameters), aMaskBmp);
+            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;
 	}
 



Mime
View raw message