Hi,

Currently "Save as Picture" feature in Writer, Impress, or Draw
produces a broken EPS file when I save an image as EPS format.
# Export feature produces a correct file.

Here is a patch to fix this issue.
The patch is under the LGPLv3+ / MPL.

Cheers,
--
KUROSAWA Takeshi <taken....@gmail.com>
From d9b1a6593bc34cd074ae469f648c6926d30e52e4 Mon Sep 17 00:00:00 2001
From: Takeshi Kurosawa <taken....@gmail.com>
Date: Tue, 1 Feb 2011 13:30:33 +0900
Subject: [PATCH] [EPS Export] Fix "Save as Picture"

Currently "Save as Picture" produces a broken eps file.
---
 filter/source/graphicfilter/eps/eps.cxx |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
index dd127e0..88c2b86 100644
--- a/filter/source/graphicfilter/eps/eps.cxx
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -374,7 +374,16 @@ BOOL PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter
     if ( rGraphic.GetType() == GRAPHIC_GDIMETAFILE )
         pMTF = &rGraphic.GetGDIMetaFile();
     else
-        pMTF = pAMTF = new GDIMetaFile( rGraphic.GetGDIMetaFile() );
+    {
+        Bitmap aBmp( rGraphic.GetBitmap() );
+        pAMTF = new GDIMetaFile();
+        VirtualDevice aTmpVDev;
+        pAMTF->Record( &aTmpVDev );
+        aTmpVDev.DrawBitmap( Point(), aBmp );
+        pAMTF->Stop();
+        pAMTF->SetPrefSize( aBmp.GetSizePixel() );
+        pMTF = pAMTF;
+    }
     aVDev.SetMapMode( pMTF->GetPrefMapMode() );
     nBoundingX1 = nBoundingY1 = 0;
     nBoundingX2 = pMTF->GetPrefSize().Width();
-- 
1.7.1

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to