]> granicus.if.org Git - imagemagick/blobdiff - coders/wmf.c
(no commit message)
[imagemagick] / coders / wmf.c
index 96bdf3c71e3cfbbdef3fa71cb9b5923d66984ee1..7dd6b437d681436c738c5510d7d75f3aea93ee09 100644 (file)
@@ -17,7 +17,7 @@
 %                               December 2000                                 %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
 %  dedicated to making software imaging solutions freely available.           %
 %                                                                             %
 %  You may not use this file except in compliance with the License.  You may  %
@@ -65,7 +65,7 @@
 
 #if defined(MAGICKCORE_WMF_DELEGATE)
 #include "libwmf/api.h"
-#include "libwmf/gd.h"
+#include "libwmf/eps.h"
 \f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -126,7 +126,10 @@ static Image *ReadWMFImage(const ImageInfo *image_info,ExceptionInfo *exception)
   ImageInfo
     *read_info;
 
-  unsigned long
+  MagickBooleanType
+    status;
+
+  size_t
     flags;
 
   wmfAPI
@@ -138,11 +141,11 @@ static Image *ReadWMFImage(const ImageInfo *image_info,ExceptionInfo *exception)
   wmfD_Rect
     bounding_box;
 
-  wmf_gd_t
-   *gd_info;
+  wmf_eps_t
+    *eps_info;
 
   wmf_error_t
-    status;
+    wmf_status;
 
   /*
     Read WMF image.
@@ -158,17 +161,17 @@ static Image *ReadWMFImage(const ImageInfo *image_info,ExceptionInfo *exception)
   flags=0;
   flags|=WMF_OPT_IGNORE_NONFATAL;
   flags|=WMF_OPT_FUNCTION;
-  options.function=wmf_gd_function;
-  status=wmf_api_create(&wmf_info,flags,&options);
-  if (status != wmf_E_None)
+  options.function=wmf_eps_function;
+  wmf_status=wmf_api_create(&wmf_info,(unsigned long) flags,&options);
+  if (wmf_status != wmf_E_None)
     {
       if (wmf_info != (wmfAPI *) NULL)
         wmf_api_destroy(wmf_info);
       ThrowReaderException(DelegateError,"UnableToInitializeWMFLibrary");
     }
-  status=wmf_bbuf_input(wmf_info,WMFReadBlob,WMFSeekBlob,WMFTellBlob,
+  wmf_status=wmf_bbuf_input(wmf_info,WMFReadBlob,WMFSeekBlob,WMFTellBlob,
     (void *) image);
-  if (status != wmf_E_None)
+  if (wmf_status != wmf_E_None)
     {
       wmf_api_destroy(wmf_info);
       ThrowFileException(exception,FileOpenError,"UnableToOpenFile",
@@ -176,13 +179,13 @@ static Image *ReadWMFImage(const ImageInfo *image_info,ExceptionInfo *exception)
       image=DestroyImageList(image);
       return((Image *) NULL);
     }
-  status=wmf_scan(wmf_info,0,&bounding_box);
-  if (status != wmf_E_None)
+  wmf_status=wmf_scan(wmf_info,0,&bounding_box);
+  if (wmf_status != wmf_E_None)
     {
       wmf_api_destroy(wmf_info);
       ThrowReaderException(DelegateError,"FailedToScanFile");
     }
-  gd_info=WMF_GD_GetData(wmf_info);
+  eps_info=WMF_EPS_GetData(wmf_info);
   file=(FILE *) NULL;
   unique_file=AcquireUniqueFileResource(filename);
   if (unique_file != -1)
@@ -192,13 +195,10 @@ static Image *ReadWMFImage(const ImageInfo *image_info,ExceptionInfo *exception)
       wmf_api_destroy(wmf_info);
       ThrowReaderException(FileOpenError,"UnableToCreateTemporaryFile");
     }
-  gd_info->flags|=WMF_GD_OUTPUT_FILE;
-  gd_info->file=file;
-  gd_info->bbox=bounding_box;
-  wmf_display_size(wmf_info,&gd_info->width,&gd_info->height,
-    ceil(image->x_resolution-0.5),ceil(image->y_resolution-0.5));
-  status=wmf_play(wmf_info,0,&bounding_box);
-  if (status != wmf_E_None)
+  eps_info->out=wmf_stream_create(wmf_info,file);
+  eps_info->bbox=bounding_box;
+  wmf_status=wmf_play(wmf_info,0,&bounding_box);
+  if (wmf_status != wmf_E_None)
     {
       wmf_api_destroy(wmf_info);
       ThrowReaderException(DelegateError,"FailedToRenderFile");
@@ -208,10 +208,11 @@ static Image *ReadWMFImage(const ImageInfo *image_info,ExceptionInfo *exception)
   (void) CloseBlob(image);
   image=DestroyImage(image);
   /*
-    Read GD image.
+    Read EPS image.
   */
   read_info=CloneImageInfo(image_info);
-  (void) FormatMagickString(read_info->filename,MaxTextExtent,"png:%.1024s",
+  SetImageInfoBlob(read_info,(void *) NULL,0);
+  (void) FormatMagickString(read_info->filename,MaxTextExtent,"eps:%s",
     filename);
   image=ReadImage(read_info,exception);
   read_info=DestroyImageInfo(read_info);
@@ -248,10 +249,10 @@ static Image *ReadWMFImage(const ImageInfo *image_info,ExceptionInfo *exception)
 %
 %  The format of the RegisterWMFImage method is:
 %
-%      unsigned long RegisterWMFImage(void)
+%      size_t RegisterWMFImage(void)
 %
 */
-ModuleExport unsigned long RegisterWMFImage(void)
+ModuleExport size_t RegisterWMFImage(void)
 {
   MagickInfo
     *entry;