]> granicus.if.org Git - imagemagick/blobdiff - coders/wmf.c
(no commit message)
[imagemagick] / coders / wmf.c
index b57651cca207793098891fe2b6f3cc0d83bc0252..7071f22d00d39d15ae4531490596b851d0f45751 100644 (file)
@@ -17,7 +17,7 @@
 %                               December 2000                                 %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2013 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  %
 #include "MagickCore/module.h"
 #include "MagickWand/MagickWand.h"
 
+#if defined(__CYGWIN__)
+#undef MAGICKCORE_WMF_DELEGATE 
+#endif
+
 #if defined(MAGICKCORE_WMF_DELEGATE)
 #include "libwmf/api.h"
 #include "libwmf/eps.h"
@@ -644,7 +648,7 @@ static void ipa_bmp_draw(wmfAPI *API, wmfBMP_Draw_t *bmp_draw)
   MagickWand
     *magick_wand;
 
-  MagickRealType
+  double
     height,
     width;
 
@@ -821,7 +825,7 @@ static void ipa_device_begin(wmfAPI * API)
   DrawSetViewbox(WmfDrawingWand, 0, 0, ddata->image->columns, ddata->image->rows );
 
   (void) FormatLocaleString(comment,MaxTextExtent,"Created by ImageMagick %s",
-    GetMagickVersion((unsigned long *) NULL));
+    GetMagickVersion((size_t *) NULL));
   DrawComment(WmfDrawingWand,comment);
 
   /* Scale width and height to image */
@@ -890,10 +894,9 @@ static void ipa_device_begin(wmfAPI * API)
             ddata->pattern_id);
           (void) DrawSetFillPatternURL(WmfDrawingWand,pattern_id);
           ++ddata->pattern_id;
-
           DrawRectangle(WmfDrawingWand,
-                         XC(ddata->bbox.TL.x),YC(ddata->bbox.TL.y),
-                         XC(ddata->bbox.BR.x),YC(ddata->bbox.BR.y));
+            XC(ddata->bbox.TL.x),YC(ddata->bbox.TL.y),
+            XC(ddata->bbox.BR.x),YC(ddata->bbox.BR.y));
           image=DestroyImageList(image);
         }
       else
@@ -1941,7 +1944,6 @@ static void util_set_brush(wmfAPI * API, wmfDC * dc, const BrushApply brush_appl
 
               (void) FormatLocaleString(pattern_id,MaxTextExtent,"#brush_%lu",
                 ddata->pattern_id);
-
               if ( brush_apply == BrushApplyStroke )
                 (void) DrawSetStrokePatternURL(WmfDrawingWand,pattern_id);
               else
@@ -2249,6 +2251,7 @@ static int util_font_weight( const char* font )
  */
 static float lite_font_stringwidth( wmfAPI* API, wmfFont* font, char* str)
 {
+#if 0
   wmf_magick_t
     *ddata = WMF_MAGICK_GetData(API);
 
@@ -2313,6 +2316,13 @@ static float lite_font_stringwidth( wmfAPI* API, wmfFont* font, char* str)
   image->units = orig_resolution_units;
 
   return stringwidth;
+#else
+  (void) API;
+  (void) font;
+  (void) str;
+
+  return 0;
+#endif
 }
 
 /* Map font (similar to wmf_ipa_font_map) */
@@ -2538,16 +2548,8 @@ static long ipa_blob_tell(void* wand)
   return (long)TellBlob((Image*)wand);
 }
 
-static Image *ReadWMFImage(const ImageInfo *image_info,
-  ExceptionInfo * exception)
+static Image *ReadWMFImage(const ImageInfo *image_info,ExceptionInfo *exception)
 {
-  Image
-    *image;
-
-  float
-    wmf_width,
-    wmf_height;
-
   double
     bounding_height,
     bounding_width,
@@ -2559,6 +2561,13 @@ static Image *ReadWMFImage(const ImageInfo *image_info,
     resolution_x,
     units_per_inch;
 
+  float
+    wmf_width,
+    wmf_height;
+
+  Image
+    *image;
+
   unsigned long
     wmf_options_flags = 0;
 
@@ -2577,7 +2586,7 @@ static Image *ReadWMFImage(const ImageInfo *image_info,
   wmfD_Rect
     bbox;
 
-  image = AcquireImage(image_info,exception);
+  image=AcquireImage(image_info,exception);
   if (OpenBlob(image_info,image,ReadBinaryBlobMode,exception) == MagickFalse)
     {
       if (image->debug != MagickFalse)
@@ -2622,14 +2631,15 @@ static Image *ReadWMFImage(const ImageInfo *image_info,
   /* Register progress monitor */
   wmf_status_function(API,image,magick_progress_callback);
 
-  ddata = WMF_MAGICK_GetData(API);
-  ddata->image = image;
-  ddata->image_info = image_info;
-  ddata->draw_info = CloneDrawInfo((const ImageInfo *) NULL, (const DrawInfo *) NULL);
-  ddata->exception = exception;
-  RelinquishMagickMemory(ddata->draw_info->font);
-  RelinquishMagickMemory(ddata->draw_info->text);
-
+  ddata=WMF_MAGICK_GetData(API);
+  ddata->image=image;
+  ddata->image_info=image_info;
+  ddata->draw_info=CloneDrawInfo(image_info,(const DrawInfo *) NULL);
+  ddata->exception=exception;
+  ddata->draw_info->font=(char *)
+    RelinquishMagickMemory(ddata->draw_info->font);
+  ddata->draw_info->text=(char *)
+    RelinquishMagickMemory(ddata->draw_info->text);
 
 #if defined(MAGICKCORE_WMFLITE_DELEGATE)
   /* Must initialize font subystem for WMFlite interface */
@@ -2643,7 +2653,7 @@ static Image *ReadWMFImage(const ImageInfo *image_info,
    *
    */
   wmf_error = wmf_bbuf_input(API,ipa_blob_read,ipa_blob_seek,
-                             ipa_blob_tell,(void*)image);
+    ipa_blob_tell,(void*)image);
   if (wmf_error != wmf_E_None)
     {
       wmf_api_destroy(API);
@@ -2667,7 +2677,7 @@ static Image *ReadWMFImage(const ImageInfo *image_info,
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(CoderEvent,GetMagickModule(),
       "  Scanning WMF to obtain bounding box");
-  wmf_error = wmf_scan(API, 0, &bbox);
+  wmf_error=wmf_scan(API, 0, &bbox);
   if (wmf_error != wmf_E_None)
     {
       wmf_api_destroy(API);
@@ -2686,19 +2696,18 @@ static Image *ReadWMFImage(const ImageInfo *image_info,
    *
    */
 
-  ddata->bbox = bbox;
+  ddata->bbox=bbox;
 
   /* User specified resolution */
   resolution_y=DefaultResolution;
-  if (image->resolution.y 0)
+  if (image->resolution.y != 0.0)
     {
       resolution_y = image->resolution.y;
       if (image->units == PixelsPerCentimeterResolution)
         resolution_y *= CENTIMETERS_PER_INCH;
     }
-
   resolution_x=DefaultResolution;
-  if (image->resolution.x 0)
+  if (image->resolution.x != 0.0)
     {
       resolution_x = image->resolution.x;
       if (image->units == PixelsPerCentimeterResolution)
@@ -2706,7 +2715,7 @@ static Image *ReadWMFImage(const ImageInfo *image_info,
     }
 
   /* Obtain output size expressed in metafile units */
-  wmf_error = wmf_size(API, &wmf_width, &wmf_height);
+  wmf_error=wmf_size(API,&wmf_width,&wmf_height);
   if (wmf_error != wmf_E_None)
     {
       wmf_api_destroy(API);
@@ -2722,11 +2731,11 @@ static Image *ReadWMFImage(const ImageInfo *image_info,
 
   /* Obtain (or guess) metafile units */
   if ((API)->File->placeable)
-    units_per_inch = (API)->File->pmh->Inch;
+    units_per_inch=(API)->File->pmh->Inch;
   else if ( (wmf_width*wmf_height) < 1024*1024)
-    units_per_inch = POINTS_PER_INCH;  /* MM_TEXT */
+    units_per_inch=POINTS_PER_INCH;  /* MM_TEXT */
   else
-    units_per_inch = TWIPS_PER_INCH;  /* MM_TWIPS */
+    units_per_inch=TWIPS_PER_INCH;  /* MM_TWIPS */
 
   /* Calculate image width and height based on specified DPI
      resolution */
@@ -2853,8 +2862,8 @@ static Image *ReadWMFImage(const ImageInfo *image_info,
     }
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(CoderEvent,GetMagickModule(),
-       "  Creating canvas image with size %ldx%ld",
-       image->rows,image->columns);
+       "  Creating canvas image with size %lux%lu",(unsigned long) image->rows,
+       (unsigned long) image->columns);
 
   /*
    * Set solid background color
@@ -2862,7 +2871,7 @@ static Image *ReadWMFImage(const ImageInfo *image_info,
   {
     image->background_color = image_info->background_color;
     if (image->background_color.alpha != OpaqueAlpha)
-      image->matte = MagickTrue;
+      image->alpha_trait = MagickTrue;
     (void) SetImageBackgroundColor(image,exception);
   }
   /*