~ubuntu-branches/ubuntu/oneiric/imagemagick/oneiric-updates

« back to all changes in this revision

Viewing changes to coders/pdf.c

  • Committer: Bazaar Package Importer
  • Author(s): Nelson A. de Oliveira
  • Date: 2010-06-20 19:59:55 UTC
  • mfrom: (6.2.8 sid)
  • Revision ID: james.westby@ubuntu.com-20100620195955-n3eq0yenhycw888i
Tags: 7:6.6.2.6-1
* New upstream release;
* Change Recommends on ufraw to ufraw-batch (Closes: #579775);
* Fix FTBFS when using dash to run the configure script, by setting
  CONFIG_SHELL=/bin/bash (Closes: #582073, #583024). Thank you, Niko Tyni!

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
%                                 July 1992                                   %
18
18
%                                                                             %
19
19
%                                                                             %
20
 
%  Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization      %
 
20
%  Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization      %
21
21
%  dedicated to making software imaging solutions freely available.           %
22
22
%                                                                             %
23
23
%  You may not use this file except in compliance with the License.  You may  %
124
124
  int
125
125
    status;
126
126
 
127
 
#if defined(MAGICKCORE_GS_DELEGATE) || defined(__WINDOWS__)
 
127
#if defined(MAGICKCORE_GS_DELEGATE) || defined(MAGICKCORE_WINDOWS_SUPPORT)
128
128
  char
129
129
    **argv;
130
130
 
138
138
    argc,
139
139
    code;
140
140
 
141
 
  register long
 
141
  register ssize_t
142
142
    i;
143
143
 
144
 
#if defined(__WINDOWS__)
 
144
#if defined(MAGICKCORE_WINDOWS_SUPPORT)
145
145
  ghost_info=NTGhostscriptDLLVectors();
146
146
#else
147
147
  GhostInfo
161
161
#endif
162
162
  if (ghost_info == (GhostInfo *) NULL)
163
163
    {
164
 
      status=SystemCommand(verbose,command,exception);
 
164
      status=SystemCommand(MagickFalse,verbose,command,exception);
165
165
      return(status == 0 ? MagickTrue : MagickFalse);
166
166
    }
167
167
  if (verbose != MagickFalse)
172
172
  status=(ghost_info->new_instance)(&interpreter,(void *) NULL);
173
173
  if (status < 0)
174
174
    {
175
 
      status=SystemCommand(verbose,command,exception);
 
175
      status=SystemCommand(MagickFalse,verbose,command,exception);
176
176
      return(status == 0 ? MagickTrue : MagickFalse);
177
177
    }
178
178
  argv=StringToArgv(command,&argc);
182
182
      0,&code);
183
183
  (ghost_info->exit)(interpreter);
184
184
  (ghost_info->delete_instance)(interpreter);
185
 
#if defined(__WINDOWS__)
 
185
#if defined(MAGICKCORE_WINDOWS_SUPPORT)
186
186
  NTGhostscriptUnLoadDLL();
187
187
#endif
188
 
  for (i=0; i < (long) argc; i++)
 
188
  for (i=0; i < (ssize_t) argc; i++)
189
189
    argv[i]=DestroyString(argv[i]);
190
190
  argv=(char **) RelinquishMagickMemory(argv);
191
191
  if ((status != 0) && (status != -101))
203
203
    }
204
204
  return(MagickTrue);
205
205
#else
206
 
  status=SystemCommand(verbose,command,exception);
 
206
  status=SystemCommand(MagickFalse,verbose,command,exception);
207
207
  return(status == 0 ? MagickTrue : MagickFalse);
208
208
#endif
209
209
}
315
315
  double
316
316
    angle;
317
317
 
 
318
  GeometryInfo
 
319
    geometry_info;
 
320
 
318
321
  Image
319
322
    *image,
320
323
    *next,
332
335
    trimbox,
333
336
    status;
334
337
 
 
338
  MagickStatusType
 
339
    flags;
 
340
 
335
341
  PointInfo
336
342
    delta;
337
343
 
352
358
  ssize_t
353
359
    count;
354
360
 
355
 
  unsigned long
 
361
  size_t
356
362
    scene,
357
363
    spotcolor;
358
364
 
388
394
  delta.y=DefaultResolution;
389
395
  if ((image->x_resolution == 0.0) || (image->y_resolution == 0.0))
390
396
    {
391
 
      GeometryInfo
392
 
        geometry_info;
393
 
 
394
 
      MagickStatusType
395
 
        flags;
396
 
 
397
397
      flags=ParseGeometry(PSDensityGeometry,&geometry_info);
398
398
      image->x_resolution=geometry_info.rho;
399
399
      image->y_resolution=geometry_info.sigma;
450
450
          property[MaxTextExtent],
451
451
          *value;
452
452
 
453
 
        register long
 
453
        register ssize_t
454
454
          i;
455
455
 
456
456
        /*
457
457
          Note spot names.
458
458
        */
459
 
        (void) FormatMagickString(property,MaxTextExtent,"pdf:SpotColor-%lu",
460
 
          spotcolor++);
 
459
        (void) FormatMagickString(property,MaxTextExtent,"pdf:SpotColor-%.20g",
 
460
          (double) spotcolor++);
461
461
        i=0;
462
462
        for (c=ReadBlobByte(image); c != EOF; c=ReadBlobByte(image))
463
463
        {
524
524
        /*
525
525
          Set PDF render geometry.
526
526
        */
527
 
        (void) FormatMagickString(geometry,MaxTextExtent,"%gx%g%+g%+g",
528
 
          bounds.x2-bounds.x1,bounds.y2-bounds.y1,bounds.x1,bounds.y1);
 
527
        (void) FormatMagickString(geometry,MaxTextExtent,
 
528
          "%gx%g%+.15g%+.15g",bounds.x2-bounds.x1,bounds.y2-bounds.y1,
 
529
           bounds.x1,bounds.y1);
529
530
        (void) SetImageProperty(image,"pdf:HiResBoundingBox",geometry);
530
 
        page.width=(unsigned long) (bounds.x2-bounds.x1+0.5);
531
 
        page.height=(unsigned long) (bounds.y2-bounds.y1+0.5);
 
531
        page.width=(size_t) floor(bounds.x2-bounds.x1+0.5);
 
532
        page.height=(size_t) floor(bounds.y2-bounds.y1+0.5);
532
533
        hires_bounds=bounds;
533
534
      }
534
535
  }
535
536
  (void) CloseBlob(image);
536
537
  if ((fabs(angle) == 90.0) || (fabs(angle) == 270.0))
537
538
    {
538
 
      unsigned long
 
539
      size_t
539
540
        swap;
540
541
 
541
542
      swap=page.width;
578
579
      return((Image *) NULL);
579
580
    }
580
581
  *options='\0';
581
 
  (void) FormatMagickString(density,MaxTextExtent,"%gx%g",image->x_resolution,
582
 
    image->y_resolution);
 
582
  if (image_info->density != (char *) NULL)
 
583
    {
 
584
      flags=ParseGeometry(image_info->density,&geometry_info);
 
585
      image->x_resolution=geometry_info.rho;
 
586
      image->y_resolution=geometry_info.sigma;
 
587
      if ((flags & SigmaValue) == 0)
 
588
        image->y_resolution=image->x_resolution;
 
589
    }
 
590
  (void) FormatMagickString(density,MaxTextExtent,"%gx%g",
 
591
    image->x_resolution,image->y_resolution);
583
592
  if (image_info->page != (char *) NULL)
584
593
    {
585
594
      (void) ParseAbsoluteGeometry(image_info->page,&page);
586
 
      page.width=(unsigned long) (page.width*image->x_resolution/delta.x+0.5);
587
 
      page.height=(unsigned long) (page.height*image->y_resolution/delta.y+0.5);
588
 
      (void) FormatMagickString(options,MaxTextExtent,"-g%lux%lu ",page.width,
589
 
        page.height);
 
595
      page.width=(size_t) floor(page.width*image->x_resolution/delta.x+
 
596
        0.5);
 
597
      page.height=(size_t) floor(page.height*image->y_resolution/delta.y+
 
598
        0.5);
 
599
      (void) FormatMagickString(options,MaxTextExtent,"-g%.20gx%.20g ",
 
600
        (double) page.width,(double) page.height);
590
601
    }
591
602
  if (cmyk != MagickFalse)
592
603
    (void) ConcatenateMagickString(options,"-dUseCIEColor ",MaxTextExtent);
601
612
      char
602
613
        pages[MaxTextExtent];
603
614
 
604
 
      (void) FormatMagickString(pages,MaxTextExtent,"-dFirstPage=%lu "
605
 
        "-dLastPage=%lu",read_info->scene+1,read_info->scene+
606
 
        read_info->number_scenes);
 
615
      (void) FormatMagickString(pages,MaxTextExtent,"-dFirstPage=%.20g "
 
616
        "-dLastPage=%.20g",(double) read_info->scene+1,(double)
 
617
        (read_info->scene+read_info->number_scenes));
607
618
      (void) ConcatenateMagickString(options,pages,MaxTextExtent);
608
619
      read_info->number_scenes=0;
609
620
      if (read_info->scenes != (char *) NULL)
651
662
      Image
652
663
        *clone_image;
653
664
 
654
 
      register long
 
665
      register ssize_t
655
666
        i;
656
667
 
657
668
      /*
658
669
        Add place holder images to meet the subimage specification requirement.
659
670
      */
660
 
      for (i=0; i < (long) image_info->scene; i++)
 
671
      for (i=0; i < (ssize_t) image_info->scene; i++)
661
672
      {
662
673
        clone_image=CloneImage(pdf_image,1,1,MagickTrue,exception);
663
674
        if (clone_image != (Image *) NULL)
704
715
%
705
716
%  The format of the RegisterPDFImage method is:
706
717
%
707
 
%      unsigned long RegisterPDFImage(void)
 
718
%      size_t RegisterPDFImage(void)
708
719
%
709
720
*/
710
 
ModuleExport unsigned long RegisterPDFImage(void)
 
721
ModuleExport size_t RegisterPDFImage(void)
711
722
{
712
723
  MagickInfo
713
724
    *entry;
827
838
  register char
828
839
    *p;
829
840
 
830
 
  register long
 
841
  register ssize_t
831
842
    i;
832
843
 
833
844
  static char
834
845
    buffer[MaxTextExtent];
835
846
 
836
 
  unsigned long
 
847
  size_t
837
848
    escapes;
838
849
 
839
850
  escapes=0;
840
851
  p=buffer;
841
 
  for (i=0; i < (long) MagickMin(strlen(text),(MaxTextExtent-escapes-1)); i++)
 
852
  for (i=0; i < (ssize_t) MagickMin(strlen(text),(MaxTextExtent-escapes-1)); i++)
842
853
  {
843
854
    if ((text[i] == '(') || (text[i] == ')'))
844
855
      {
948
959
  GeometryInfo
949
960
    geometry_info;
950
961
 
951
 
  long
 
962
  ssize_t
952
963
    count,
953
964
    y;
954
965
 
989
1000
  register unsigned char
990
1001
    *q;
991
1002
 
992
 
  register long
 
1003
  register ssize_t
993
1004
    i,
994
1005
    x;
995
1006
 
1005
1016
  unsigned char
1006
1017
    *pixels;
1007
1018
 
1008
 
  unsigned long
 
1019
  size_t
1009
1020
    info_id,
1010
1021
    object,
1011
1022
    pages_id,
1038
1049
  object=0;
1039
1050
  version=3;
1040
1051
  if (image_info->compression == JPEG2000Compression)
1041
 
    version=(unsigned long) MagickMax(version,5);
 
1052
    version=(size_t) MagickMax(version,5);
1042
1053
  for (next=image; next != (Image *) NULL; next=GetNextImageInList(next))
1043
1054
    if (next->matte != MagickFalse)
1044
 
      version=(unsigned long) MagickMax(version,4);
 
1055
      version=(size_t) MagickMax(version,4);
1045
1056
  if (LocaleCompare(image_info->magick,"PDFA") == 0)
1046
 
    version=(unsigned long) MagickMax(version,6);
1047
 
  (void) FormatMagickString(buffer,MaxTextExtent,"%%PDF-1.%lu \n",version);
 
1057
    version=(size_t) MagickMax(version,6);
 
1058
  (void) FormatMagickString(buffer,MaxTextExtent,"%%PDF-1.%.20g \n",
 
1059
    (double) version);
1048
1060
  (void) WriteBlobString(image,buffer);
1049
1061
  if (LocaleCompare(image_info->magick,"PDFA") == 0)
1050
1062
    (void) WriteBlobString(image,"%����\n");
1053
1065
  */
1054
1066
  xref[object++]=TellBlob(image);
1055
1067
  root_id=object;
1056
 
  (void) FormatMagickString(buffer,MaxTextExtent,"%lu 0 obj\n",object);
 
1068
  (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
 
1069
    object);
1057
1070
  (void) WriteBlobString(image,buffer);
1058
1071
  (void) WriteBlobString(image,"<<\n");
1059
1072
  if (LocaleCompare(image_info->magick,"PDFA") != 0)
1060
 
    (void) FormatMagickString(buffer,MaxTextExtent,"/Pages %lu 0 R\n",
1061
 
      object+1);
 
1073
    (void) FormatMagickString(buffer,MaxTextExtent,"/Pages %.20g 0 R\n",
 
1074
      (double) object+1);
1062
1075
  else
1063
1076
    {
1064
 
      (void) FormatMagickString(buffer,MaxTextExtent,"/Metadata %lu 0 R\n",
1065
 
        object+1);
 
1077
      (void) FormatMagickString(buffer,MaxTextExtent,"/Metadata %.20g 0 R\n",
 
1078
        (double) object+1);
1066
1079
      (void) WriteBlobString(image,buffer);
1067
 
      (void) FormatMagickString(buffer,MaxTextExtent,"/Pages %lu 0 R\n",
1068
 
        object+2);
 
1080
      (void) FormatMagickString(buffer,MaxTextExtent,"/Pages %.20g 0 R\n",
 
1081
        (double) object+2);
1069
1082
    }
1070
1083
  (void) WriteBlobString(image,buffer);
1071
1084
  (void) WriteBlobString(image,"/Type /Catalog\n");
1079
1092
        timestamp[MaxTextExtent],
1080
1093
        xmp_profile[MaxTextExtent];
1081
1094
 
1082
 
      unsigned long
 
1095
      size_t
1083
1096
        version;
1084
1097
 
1085
1098
      /*
1086
1099
        Write XMP object.
1087
1100
      */
1088
1101
      xref[object++]=TellBlob(image);
1089
 
      (void) FormatMagickString(buffer,MaxTextExtent,"%lu 0 obj\n",object);
 
1102
      (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",
 
1103
        (double) object);
1090
1104
      (void) WriteBlobString(image,buffer);
1091
1105
      (void) WriteBlobString(image,"<<\n");
1092
1106
      (void) WriteBlobString(image,"/Subtype /XML\n");
1102
1116
      i=FormatMagickString(xmp_profile,MaxTextExtent,XMPProfile,
1103
1117
        XMPProfileMagick,modify_date,create_date,timestamp,
1104
1118
        GetMagickVersion(&version),GetMagickVersion(&version));
1105
 
      (void) FormatMagickString(buffer,MaxTextExtent,"/Length %lu\n",1UL*i);
 
1119
      (void) FormatMagickString(buffer,MaxTextExtent,"/Length %.20g\n",
 
1120
        (double) i);
1106
1121
      (void) WriteBlobString(image,buffer);
1107
1122
      (void) WriteBlobString(image,"/Type /Metadata\n");
1108
1123
      (void) WriteBlobString(image,">>\nstream\n");
1115
1130
  */
1116
1131
  xref[object++]=TellBlob(image);
1117
1132
  pages_id=object;
1118
 
  (void) FormatMagickString(buffer,MaxTextExtent,"%lu 0 obj\n",object);
 
1133
  (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
 
1134
    object);
1119
1135
  (void) WriteBlobString(image,buffer);
1120
1136
  (void) WriteBlobString(image,"<<\n");
1121
1137
  (void) WriteBlobString(image,"/Type /Pages\n");
1122
 
  (void) FormatMagickString(buffer,MaxTextExtent,"/Kids [ %lu 0 R ",object+1);
 
1138
  (void) FormatMagickString(buffer,MaxTextExtent,"/Kids [ %.20g 0 R ",
 
1139
    (double) object+1);
1123
1140
  (void) WriteBlobString(image,buffer);
1124
 
  count=(long) (pages_id+ObjectsPerImage+1);
 
1141
  count=(ssize_t) (pages_id+ObjectsPerImage+1);
1125
1142
  if (image_info->adjoin != MagickFalse)
1126
1143
    {
1127
1144
      Image
1133
1150
      kid_image=image;
1134
1151
      for ( ; GetNextImageInList(kid_image) != (Image *) NULL; count+=ObjectsPerImage)
1135
1152
      {
1136
 
        (void) FormatMagickString(buffer,MaxTextExtent,"%ld 0 R ",count);
 
1153
        (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 R ",(double)
 
1154
          count);
1137
1155
        (void) WriteBlobString(image,buffer);
1138
1156
        kid_image=GetNextImageInList(kid_image);
1139
1157
      }
1143
1161
        ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
1144
1162
    }
1145
1163
  (void) WriteBlobString(image,"]\n");
1146
 
  (void) FormatMagickString(buffer,MaxTextExtent,"/Count %lu\n",
1147
 
    (count-pages_id)/ObjectsPerImage);
 
1164
  (void) FormatMagickString(buffer,MaxTextExtent,"/Count %.20g\n",
 
1165
    (double) ((count-pages_id)/ObjectsPerImage));
1148
1166
  (void) WriteBlobString(image,buffer);
1149
1167
  (void) WriteBlobString(image,">>\n");
1150
1168
  (void) WriteBlobString(image,"endobj\n");
1239
1257
      }
1240
1258
    if (image->units == PixelsPerCentimeterResolution)
1241
1259
      {
1242
 
        resolution.x*=2.54;
1243
 
        resolution.y*=2.54;
 
1260
        resolution.x=(size_t) (100.0*2.54*resolution.x+0.5)/100.0;
 
1261
        resolution.y=(size_t) (100.0*2.54*resolution.y+0.5)/100.0;
1244
1262
      }
1245
1263
    SetGeometry(image,&geometry);
1246
 
    (void) FormatMagickString(page_geometry,MaxTextExtent,"%lux%lu",
1247
 
      image->columns,image->rows);
 
1264
    (void) FormatMagickString(page_geometry,MaxTextExtent,"%.20gx%.20g",
 
1265
      (double) image->columns,(double) image->rows);
1248
1266
    if (image_info->page != (char *) NULL)
1249
1267
      (void) CopyMagickString(page_geometry,image_info->page,MaxTextExtent);
1250
1268
    else
1251
1269
      if ((image->page.width != 0) && (image->page.height != 0))
1252
 
        (void) FormatMagickString(page_geometry,MaxTextExtent,"%lux%lu%+ld%+ld",
1253
 
          image->page.width,image->page.height,image->page.x,image->page.y);
 
1270
        (void) FormatMagickString(page_geometry,MaxTextExtent,
 
1271
          "%.20gx%.20g%+.20g%+.20g",(double) image->page.width,
 
1272
          (double) image->page.height,(double) image->page.x,(double)
 
1273
          image->page.y);
1254
1274
      else
1255
1275
        if ((image->gravity != UndefinedGravity) &&
1256
1276
            (LocaleCompare(image_info->magick,"PDF") == 0))
1259
1279
    (void) ParseMetaGeometry(page_geometry,&geometry.x,&geometry.y,
1260
1280
      &geometry.width,&geometry.height);
1261
1281
    scale.x=(double) (geometry.width*delta.x)/resolution.x;
1262
 
    geometry.width=(unsigned long) (scale.x+0.5);
 
1282
    geometry.width=(size_t) floor(scale.x+0.5);
1263
1283
    scale.y=(double) (geometry.height*delta.y)/resolution.y;
1264
 
    geometry.height=(unsigned long) (scale.y+0.5);
 
1284
    geometry.height=(size_t) floor(scale.y+0.5);
1265
1285
    (void) ParseAbsoluteGeometry(page_geometry,&media_info);
1266
1286
    (void) ParseGravityGeometry(image,page_geometry,&page_info,
1267
1287
      &image->exception);
1268
1288
    if (image->gravity != UndefinedGravity)
1269
1289
      {
1270
1290
        geometry.x=(-page_info.x);
1271
 
        geometry.y=(long) (media_info.height+page_info.y-image->rows);
 
1291
        geometry.y=(ssize_t) (media_info.height+page_info.y-image->rows);
1272
1292
      }
1273
1293
    pointsize=12.0;
1274
1294
    if (image_info->pointsize != 0.0)
1276
1296
    text_size=0;
1277
1297
    value=GetImageProperty(image,"Label");
1278
1298
    if (value != (const char *) NULL)
1279
 
      text_size=(unsigned long) (MultilineCensus(value)*pointsize+12);
 
1299
      text_size=(size_t) (MultilineCensus(value)*pointsize+12);
1280
1300
    /*
1281
1301
      Write Page object.
1282
1302
    */
1283
1303
    xref[object++]=TellBlob(image);
1284
 
    (void) FormatMagickString(buffer,MaxTextExtent,"%lu 0 obj\n",object);
 
1304
    (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
 
1305
      object);
1285
1306
    (void) WriteBlobString(image,buffer);
1286
1307
    (void) WriteBlobString(image,"<<\n");
1287
1308
    (void) WriteBlobString(image,"/Type /Page\n");
1288
 
    (void) FormatMagickString(buffer,MaxTextExtent,"/Parent %lu 0 R\n",
1289
 
      pages_id);
 
1309
    (void) FormatMagickString(buffer,MaxTextExtent,"/Parent %.20g 0 R\n",
 
1310
      (double) pages_id);
1290
1311
    (void) WriteBlobString(image,buffer);
1291
1312
    (void) WriteBlobString(image,"/Resources <<\n");
1292
1313
    labels=(char **) NULL;
1296
1317
    if (labels != (char **) NULL)
1297
1318
      {
1298
1319
        (void) FormatMagickString(buffer,MaxTextExtent,
1299
 
          "/Font << /F%lu %lu 0 R >>\n",image->scene,object+4);
 
1320
          "/Font << /F%.20g %.20g 0 R >>\n",(double) image->scene,(double)
 
1321
          object+4);
1300
1322
        (void) WriteBlobString(image,buffer);
1301
1323
      }
1302
1324
    (void) FormatMagickString(buffer,MaxTextExtent,
1303
 
      "/XObject << /Im%lu %lu 0 R >>\n",image->scene,object+5);
1304
 
    (void) WriteBlobString(image,buffer);
1305
 
    (void) FormatMagickString(buffer,MaxTextExtent,"/ProcSet %lu 0 R >>\n",
1306
 
      object+3);
1307
 
    (void) WriteBlobString(image,buffer);
1308
 
    (void) FormatMagickString(buffer,MaxTextExtent,"/MediaBox [0 0 %g %g]\n",
1309
 
      72.0*media_info.width/resolution.x,72.0*media_info.height/resolution.y);
1310
 
    (void) WriteBlobString(image,buffer);
1311
 
    (void) FormatMagickString(buffer,MaxTextExtent,"/CropBox [0 0 %g %g]\n",
1312
 
      72.0*media_info.width/resolution.x,72.0*media_info.height/resolution.y);
1313
 
    (void) WriteBlobString(image,buffer);
1314
 
    (void) FormatMagickString(buffer,MaxTextExtent,"/Contents %lu 0 R\n",
1315
 
      object+1);
1316
 
    (void) WriteBlobString(image,buffer);
1317
 
    (void) FormatMagickString(buffer,MaxTextExtent,"/Thumb %lu 0 R\n",
1318
 
      object+8);
 
1325
      "/XObject << /Im%.20g %.20g 0 R >>\n",(double) image->scene,(double)
 
1326
      object+5);
 
1327
    (void) WriteBlobString(image,buffer);
 
1328
    (void) FormatMagickString(buffer,MaxTextExtent,"/ProcSet %.20g 0 R >>\n",
 
1329
      (double) object+3);
 
1330
    (void) WriteBlobString(image,buffer);
 
1331
    (void) FormatMagickString(buffer,MaxTextExtent,
 
1332
      "/MediaBox [0 0 %g %g]\n",72.0*media_info.width/resolution.x,
 
1333
      72.0*media_info.height/resolution.y);
 
1334
    (void) WriteBlobString(image,buffer);
 
1335
    (void) FormatMagickString(buffer,MaxTextExtent,
 
1336
      "/CropBox [0 0 %g %g]\n",72.0*media_info.width/resolution.x,
 
1337
      72.0*media_info.height/resolution.y);
 
1338
    (void) WriteBlobString(image,buffer);
 
1339
    (void) FormatMagickString(buffer,MaxTextExtent,"/Contents %.20g 0 R\n",
 
1340
      (double) object+1);
 
1341
    (void) WriteBlobString(image,buffer);
 
1342
    (void) FormatMagickString(buffer,MaxTextExtent,"/Thumb %.20g 0 R\n",
 
1343
      (double) object+8);
1319
1344
    (void) WriteBlobString(image,buffer);
1320
1345
    (void) WriteBlobString(image,">>\n");
1321
1346
    (void) WriteBlobString(image,"endobj\n");
1323
1348
      Write Contents object.
1324
1349
    */
1325
1350
    xref[object++]=TellBlob(image);
1326
 
    (void) FormatMagickString(buffer,MaxTextExtent,"%lu 0 obj\n",object);
 
1351
    (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
 
1352
      object);
1327
1353
    (void) WriteBlobString(image,buffer);
1328
1354
    (void) WriteBlobString(image,"<<\n");
1329
 
    (void) FormatMagickString(buffer,MaxTextExtent,"/Length %lu 0 R\n",
1330
 
      object+1);
 
1355
    (void) FormatMagickString(buffer,MaxTextExtent,"/Length %.20g 0 R\n",
 
1356
      (double) object+1);
1331
1357
    (void) WriteBlobString(image,buffer);
1332
1358
    (void) WriteBlobString(image,">>\n");
1333
1359
    (void) WriteBlobString(image,"stream\n");
1337
1363
      for (i=0; labels[i] != (char *) NULL; i++)
1338
1364
      {
1339
1365
        (void) WriteBlobString(image,"BT\n");
1340
 
        (void) FormatMagickString(buffer,MaxTextExtent,"/F%lu %g Tf\n",
1341
 
          image->scene,pointsize);
 
1366
        (void) FormatMagickString(buffer,MaxTextExtent,"/F%.20g %g Tf\n",
 
1367
          (double) image->scene,pointsize);
1342
1368
        (void) WriteBlobString(image,buffer);
1343
 
        (void) FormatMagickString(buffer,MaxTextExtent,"%ld %ld Td\n",
1344
 
          geometry.x,(long) (geometry.y+geometry.height+i*pointsize+12));
 
1369
        (void) FormatMagickString(buffer,MaxTextExtent,"%.20g %.20g Td\n",
 
1370
          (double) geometry.x,(double) (geometry.y+geometry.height+i*pointsize+
 
1371
          12));
1345
1372
        (void) WriteBlobString(image,buffer);
1346
1373
        (void) FormatMagickString(buffer,MaxTextExtent,"(%s) Tj\n",labels[i]);
1347
1374
        (void) WriteBlobString(image,buffer);
1348
1375
        (void) WriteBlobString(image,"ET\n");
1349
1376
        labels[i]=DestroyString(labels[i]);
1350
1377
      }
1351
 
    (void) FormatMagickString(buffer,MaxTextExtent,"%g 0 0 %g %ld %ld cm\n",
1352
 
      scale.x,scale.y,geometry.x,geometry.y);
 
1378
    (void) FormatMagickString(buffer,MaxTextExtent,"%g 0 0 %g %.20g %.20g cm\n",
 
1379
      scale.x,scale.y,(double) geometry.x,(double) geometry.y);
1353
1380
    (void) WriteBlobString(image,buffer);
1354
 
    (void) FormatMagickString(buffer,MaxTextExtent,"/Im%lu Do\n",image->scene);
 
1381
    (void) FormatMagickString(buffer,MaxTextExtent,"/Im%.20g Do\n",
 
1382
      (double) image->scene);
1355
1383
    (void) WriteBlobString(image,buffer);
1356
1384
    (void) WriteBlobString(image,"Q\n");
1357
1385
    offset=TellBlob(image)-offset;
1361
1389
      Write Length object.
1362
1390
    */
1363
1391
    xref[object++]=TellBlob(image);
1364
 
    (void) FormatMagickString(buffer,MaxTextExtent,"%lu 0 obj\n",object);
 
1392
    (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
 
1393
      object);
1365
1394
    (void) WriteBlobString(image,buffer);
1366
 
    (void) FormatMagickString(buffer,MaxTextExtent,"%lu\n",
1367
 
      (unsigned long) offset);
 
1395
    (void) FormatMagickString(buffer,MaxTextExtent,"%.20g\n",(double) offset);
1368
1396
    (void) WriteBlobString(image,buffer);
1369
1397
    (void) WriteBlobString(image,"endobj\n");
1370
1398
    /*
1371
1399
      Write Procset object.
1372
1400
    */
1373
1401
    xref[object++]=TellBlob(image);
1374
 
    (void) FormatMagickString(buffer,MaxTextExtent,"%lu 0 obj\n",object);
 
1402
    (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",
 
1403
      (double) object);
1375
1404
    (void) WriteBlobString(image,buffer);
1376
1405
    if ((image->storage_class == DirectClass) || (image->colors > 256))
1377
1406
      (void) CopyMagickString(buffer,"[ /PDF /Text /ImageC",MaxTextExtent);
1387
1416
      Write Font object.
1388
1417
    */
1389
1418
    xref[object++]=TellBlob(image);
1390
 
    (void) FormatMagickString(buffer,MaxTextExtent,"%lu 0 obj\n",object);
 
1419
    (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",
 
1420
      (double) object);
1391
1421
    (void) WriteBlobString(image,buffer);
1392
1422
    (void) WriteBlobString(image,"<<\n");
1393
1423
    if (labels != (char **) NULL)
1394
1424
      {
1395
1425
        (void) WriteBlobString(image,"/Type /Font\n");
1396
1426
        (void) WriteBlobString(image,"/Subtype /Type1\n");
1397
 
        (void) FormatMagickString(buffer,MaxTextExtent,"/Name /F%lu\n",
1398
 
          image->scene);
 
1427
        (void) FormatMagickString(buffer,MaxTextExtent,"/Name /F%.20g\n",
 
1428
          (double) image->scene);
1399
1429
        (void) WriteBlobString(image,buffer);
1400
1430
        (void) WriteBlobString(image,"/BaseFont /Helvetica\n");
1401
1431
        (void) WriteBlobString(image,"/Encoding /MacRomanEncoding\n");
1407
1437
      Write XObject object.
1408
1438
    */
1409
1439
    xref[object++]=TellBlob(image);
1410
 
    (void) FormatMagickString(buffer,MaxTextExtent,"%lu 0 obj\n",object);
 
1440
    (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
 
1441
      object);
1411
1442
    (void) WriteBlobString(image,buffer);
1412
1443
    (void) WriteBlobString(image,"<<\n");
1413
1444
    (void) WriteBlobString(image,"/Type /XObject\n");
1414
1445
    (void) WriteBlobString(image,"/Subtype /Image\n");
1415
 
    (void) FormatMagickString(buffer,MaxTextExtent,"/Name /Im%lu\n",
1416
 
      image->scene);
 
1446
    (void) FormatMagickString(buffer,MaxTextExtent,"/Name /Im%.20g\n",
 
1447
      (double) image->scene);
1417
1448
    (void) WriteBlobString(image,buffer);
1418
1449
    switch (compression)
1419
1450
    {
1459
1490
          MaxTextExtent);
1460
1491
        (void) WriteBlobString(image,buffer);
1461
1492
        (void) FormatMagickString(buffer,MaxTextExtent,"/DecodeParms [ << "
1462
 
          "/K %s /BlackIs1 false /Columns %ld /Rows %ld >> ]\n",CCITTParam,
1463
 
          image->columns,image->rows);
 
1493
          "/K %s /BlackIs1 false /Columns %.20g /Rows %.20g >> ]\n",CCITTParam,
 
1494
          (double) image->columns,(double) image->rows);
1464
1495
        break;
1465
1496
      }
1466
1497
      default:
1471
1502
      }
1472
1503
    }
1473
1504
    (void) WriteBlobString(image,buffer);
1474
 
    (void) FormatMagickString(buffer,MaxTextExtent,"/Width %lu\n",
 
1505
    (void) FormatMagickString(buffer,MaxTextExtent,"/Width %.20g\n",(double)
1475
1506
      image->columns);
1476
1507
    (void) WriteBlobString(image,buffer);
1477
 
    (void) FormatMagickString(buffer,MaxTextExtent,"/Height %lu\n",image->rows);
 
1508
    (void) FormatMagickString(buffer,MaxTextExtent,"/Height %.20g\n",(double)
 
1509
      image->rows);
1478
1510
    (void) WriteBlobString(image,buffer);
1479
 
    (void) FormatMagickString(buffer,MaxTextExtent,"/ColorSpace %lu 0 R\n",
1480
 
      object+2);
 
1511
    (void) FormatMagickString(buffer,MaxTextExtent,"/ColorSpace %.20g 0 R\n",
 
1512
      (double) object+2);
1481
1513
    (void) WriteBlobString(image,buffer);
1482
1514
    (void) FormatMagickString(buffer,MaxTextExtent,"/BitsPerComponent %d\n",
1483
1515
      (compression == FaxCompression) || (compression == Group4Compression) ?
1485
1517
    (void) WriteBlobString(image,buffer);
1486
1518
    if (image->matte != MagickFalse)
1487
1519
      {
1488
 
        (void) FormatMagickString(buffer,MaxTextExtent,"/SMask %lu 0 R\n",
1489
 
          object+7);
 
1520
        (void) FormatMagickString(buffer,MaxTextExtent,"/SMask %.20g 0 R\n",
 
1521
          (double) object+7);
1490
1522
        (void) WriteBlobString(image,buffer);
1491
1523
      }
1492
 
    (void) FormatMagickString(buffer,MaxTextExtent,"/Length %lu 0 R\n",
1493
 
      object+1);
 
1524
    (void) FormatMagickString(buffer,MaxTextExtent,"/Length %.20g 0 R\n",
 
1525
      (double) object+1);
1494
1526
    (void) WriteBlobString(image,buffer);
1495
1527
    (void) WriteBlobString(image,">>\n");
1496
1528
    (void) WriteBlobString(image,"stream\n");
1546
1578
              Dump Runlength encoded pixels.
1547
1579
            */
1548
1580
            q=pixels;
1549
 
            for (y=0; y < (long) image->rows; y++)
 
1581
            for (y=0; y < (ssize_t) image->rows; y++)
1550
1582
            {
1551
1583
              p=GetVirtualPixels(image,0,y,image->columns,1,
1552
1584
                &image->exception);
1553
1585
              if (p == (const PixelPacket *) NULL)
1554
1586
                break;
1555
 
              for (x=0; x < (long) image->columns; x++)
 
1587
              for (x=0; x < (ssize_t) image->columns; x++)
1556
1588
              {
1557
1589
                *q++=ScaleQuantumToChar(PixelIntensityToQuantum(p));
1558
1590
                p++;
1559
1591
              }
1560
1592
              if (image->previous == (Image *) NULL)
1561
1593
                {
1562
 
                  status=SetImageProgress(image,SaveImageTag,y,image->rows);
 
1594
                  status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
 
1595
                image->rows);
1563
1596
                  if (status == MagickFalse)
1564
1597
                    break;
1565
1598
                }
1587
1620
              Dump uncompressed PseudoColor packets.
1588
1621
            */
1589
1622
            Ascii85Initialize(image);
1590
 
            for (y=0; y < (long) image->rows; y++)
 
1623
            for (y=0; y < (ssize_t) image->rows; y++)
1591
1624
            {
1592
1625
              p=GetVirtualPixels(image,0,y,image->columns,1,
1593
1626
                &image->exception);
1594
1627
              if (p == (const PixelPacket *) NULL)
1595
1628
                break;
1596
 
              for (x=0; x < (long) image->columns; x++)
 
1629
              for (x=0; x < (ssize_t) image->columns; x++)
1597
1630
              {
1598
1631
                Ascii85Encode(image,
1599
1632
                  ScaleQuantumToChar(PixelIntensityToQuantum(p)));
1601
1634
              }
1602
1635
              if (image->previous == (Image *) NULL)
1603
1636
                {
1604
 
                  status=SetImageProgress(image,SaveImageTag,y,image->rows);
 
1637
                  status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
 
1638
                image->rows);
1605
1639
                  if (status == MagickFalse)
1606
1640
                    break;
1607
1641
                }
1649
1683
              Dump runoffset encoded pixels.
1650
1684
            */
1651
1685
            q=pixels;
1652
 
            for (y=0; y < (long) image->rows; y++)
 
1686
            for (y=0; y < (ssize_t) image->rows; y++)
1653
1687
            {
1654
1688
              p=GetVirtualPixels(image,0,y,image->columns,1,
1655
1689
                &image->exception);
1656
1690
              if (p == (const PixelPacket *) NULL)
1657
1691
                break;
1658
1692
              indexes=GetVirtualIndexQueue(image);
1659
 
              for (x=0; x < (long) image->columns; x++)
 
1693
              for (x=0; x < (ssize_t) image->columns; x++)
1660
1694
              {
1661
 
                *q++=ScaleQuantumToChar(p->red);
1662
 
                *q++=ScaleQuantumToChar(p->green);
1663
 
                *q++=ScaleQuantumToChar(p->blue);
 
1695
                *q++=ScaleQuantumToChar(GetRedPixelComponent(p));
 
1696
                *q++=ScaleQuantumToChar(GetGreenPixelComponent(p));
 
1697
                *q++=ScaleQuantumToChar(GetBluePixelComponent(p));
1664
1698
                if (image->colorspace == CMYKColorspace)
1665
1699
                  *q++=ScaleQuantumToChar(indexes[x]);
1666
1700
                p++;
1667
1701
              }
1668
1702
              if (image->previous == (Image *) NULL)
1669
1703
                {
1670
 
                  status=SetImageProgress(image,SaveImageTag,y,image->rows);
 
1704
                  status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
 
1705
                image->rows);
1671
1706
                  if (status == MagickFalse)
1672
1707
                    break;
1673
1708
                }
1695
1730
              Dump uncompressed DirectColor packets.
1696
1731
            */
1697
1732
            Ascii85Initialize(image);
1698
 
            for (y=0; y < (long) image->rows; y++)
 
1733
            for (y=0; y < (ssize_t) image->rows; y++)
1699
1734
            {
1700
1735
              p=GetVirtualPixels(image,0,y,image->columns,1,
1701
1736
                &image->exception);
1702
1737
              if (p == (const PixelPacket *) NULL)
1703
1738
                break;
1704
1739
              indexes=GetVirtualIndexQueue(image);
1705
 
              for (x=0; x < (long) image->columns; x++)
 
1740
              for (x=0; x < (ssize_t) image->columns; x++)
1706
1741
              {
1707
 
                Ascii85Encode(image,ScaleQuantumToChar(p->red));
1708
 
                Ascii85Encode(image,ScaleQuantumToChar(p->green));
1709
 
                Ascii85Encode(image,ScaleQuantumToChar(p->blue));
 
1742
                Ascii85Encode(image,ScaleQuantumToChar(GetRedPixelComponent(p)));
 
1743
                Ascii85Encode(image,ScaleQuantumToChar(GetGreenPixelComponent(p)));
 
1744
                Ascii85Encode(image,ScaleQuantumToChar(GetBluePixelComponent(p)));
1710
1745
                if (image->colorspace == CMYKColorspace)
1711
1746
                  Ascii85Encode(image,ScaleQuantumToChar(indexes[x]));
1712
1747
                p++;
1713
1748
              }
1714
1749
              if (image->previous == (Image *) NULL)
1715
1750
                {
1716
 
                  status=SetImageProgress(image,SaveImageTag,y,image->rows);
 
1751
                  status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
 
1752
                image->rows);
1717
1753
                  if (status == MagickFalse)
1718
1754
                    break;
1719
1755
                }
1745
1781
                Dump Runlength encoded pixels.
1746
1782
              */
1747
1783
              q=pixels;
1748
 
              for (y=0; y < (long) image->rows; y++)
 
1784
              for (y=0; y < (ssize_t) image->rows; y++)
1749
1785
              {
1750
1786
                p=GetVirtualPixels(image,0,y,image->columns,1,
1751
1787
                  &image->exception);
1752
1788
                if (p == (const PixelPacket *) NULL)
1753
1789
                  break;
1754
1790
                indexes=GetVirtualIndexQueue(image);
1755
 
                for (x=0; x < (long) image->columns; x++)
 
1791
                for (x=0; x < (ssize_t) image->columns; x++)
1756
1792
                  *q++=(unsigned char) indexes[x];
1757
1793
                if (image->previous == (Image *) NULL)
1758
1794
                  {
1759
 
                    status=SetImageProgress(image,SaveImageTag,y,image->rows);
 
1795
                    status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
 
1796
                image->rows);
1760
1797
                    if (status == MagickFalse)
1761
1798
                      break;
1762
1799
                  }
1784
1821
                Dump uncompressed PseudoColor packets.
1785
1822
              */
1786
1823
              Ascii85Initialize(image);
1787
 
              for (y=0; y < (long) image->rows; y++)
 
1824
              for (y=0; y < (ssize_t) image->rows; y++)
1788
1825
              {
1789
1826
                p=GetVirtualPixels(image,0,y,image->columns,1,
1790
1827
                  &image->exception);
1791
1828
                if (p == (const PixelPacket *) NULL)
1792
1829
                  break;
1793
1830
                indexes=GetVirtualIndexQueue(image);
1794
 
                for (x=0; x < (long) image->columns; x++)
 
1831
                for (x=0; x < (ssize_t) image->columns; x++)
1795
1832
                  Ascii85Encode(image,(unsigned char) indexes[x]);
1796
1833
                if (image->previous == (Image *) NULL)
1797
1834
                  {
1798
 
                    status=SetImageProgress(image,SaveImageTag,y,image->rows);
 
1835
                    status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
 
1836
                image->rows);
1799
1837
                    if (status == MagickFalse)
1800
1838
                      break;
1801
1839
                  }
1812
1850
      Write Length object.
1813
1851
    */
1814
1852
    xref[object++]=TellBlob(image);
1815
 
    (void) FormatMagickString(buffer,MaxTextExtent,"%lu 0 obj\n",object);
 
1853
    (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
 
1854
      object);
1816
1855
    (void) WriteBlobString(image,buffer);
1817
 
    (void) FormatMagickString(buffer,MaxTextExtent,"%lu\n",
1818
 
      (unsigned long) offset);
 
1856
    (void) FormatMagickString(buffer,MaxTextExtent,"%.20g\n",
 
1857
      (double) offset);
1819
1858
    (void) WriteBlobString(image,buffer);
1820
1859
    (void) WriteBlobString(image,"endobj\n");
1821
1860
    /*
1822
1861
      Write Colorspace object.
1823
1862
    */
1824
1863
    xref[object++]=TellBlob(image);
1825
 
    (void) FormatMagickString(buffer,MaxTextExtent,"%lu 0 obj\n",object);
 
1864
    (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
 
1865
      object);
1826
1866
    (void) WriteBlobString(image,buffer);
1827
1867
    if (image->colorspace == CMYKColorspace)
1828
1868
      (void) CopyMagickString(buffer,"/DeviceCMYK\n",MaxTextExtent);
1839
1879
          (void) CopyMagickString(buffer,"/DeviceRGB\n",MaxTextExtent);
1840
1880
        else
1841
1881
          (void) FormatMagickString(buffer,MaxTextExtent,
1842
 
            "[ /Indexed /DeviceRGB %lu %lu 0 R ]\n",
1843
 
            image->colors-1,object+3);
 
1882
            "[ /Indexed /DeviceRGB %.20g %.20g 0 R ]\n",(double) image->colors-
 
1883
            1,(double) object+3);
1844
1884
    (void) WriteBlobString(image,buffer);
1845
1885
    (void) WriteBlobString(image,"endobj\n");
1846
1886
    /*
1854
1894
    if (tile_image == (Image *) NULL)
1855
1895
      ThrowWriterException(ResourceLimitError,image->exception.reason);
1856
1896
    xref[object++]=TellBlob(image);
1857
 
    (void) FormatMagickString(buffer,MaxTextExtent,"%lu 0 obj\n",object);
 
1897
    (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
 
1898
      object);
1858
1899
    (void) WriteBlobString(image,buffer);
1859
1900
    (void) WriteBlobString(image,"<<\n");
1860
1901
    switch (compression)
1901
1942
          MaxTextExtent);
1902
1943
        (void) WriteBlobString(image,buffer);
1903
1944
        (void) FormatMagickString(buffer,MaxTextExtent,"/DecodeParms [ << "
1904
 
          "/K %s /BlackIs1 false /Columns %lu /Rows %lu >> ]\n",CCITTParam,
1905
 
          tile_image->columns,tile_image->rows);
 
1945
          "/K %s /BlackIs1 false /Columns %.20g /Rows %.20g >> ]\n",CCITTParam,
 
1946
          (double) tile_image->columns,(double) tile_image->rows);
1906
1947
        break;
1907
1948
      }
1908
1949
      default:
1913
1954
      }
1914
1955
    }
1915
1956
    (void) WriteBlobString(image,buffer);
1916
 
    (void) FormatMagickString(buffer,MaxTextExtent,"/Width %lu\n",
 
1957
    (void) FormatMagickString(buffer,MaxTextExtent,"/Width %.20g\n",(double)
1917
1958
      tile_image->columns);
1918
1959
    (void) WriteBlobString(image,buffer);
1919
 
    (void) FormatMagickString(buffer,MaxTextExtent,"/Height %lu\n",
 
1960
    (void) FormatMagickString(buffer,MaxTextExtent,"/Height %.20g\n",(double)
1920
1961
      tile_image->rows);
1921
1962
    (void) WriteBlobString(image,buffer);
1922
 
    (void) FormatMagickString(buffer,MaxTextExtent,"/ColorSpace %lu 0 R\n",
1923
 
      object-1);
 
1963
    (void) FormatMagickString(buffer,MaxTextExtent,"/ColorSpace %.20g 0 R\n",
 
1964
      (double) object-1);
1924
1965
    (void) WriteBlobString(image,buffer);
1925
1966
    (void) FormatMagickString(buffer,MaxTextExtent,"/BitsPerComponent %d\n",
1926
1967
      (compression == FaxCompression) || (compression == Group4Compression) ?
1927
1968
      1 : 8);
1928
1969
    (void) WriteBlobString(image,buffer);
1929
 
    (void) FormatMagickString(buffer,MaxTextExtent,"/Length %lu 0 R\n",
1930
 
      object+1);
 
1970
    (void) FormatMagickString(buffer,MaxTextExtent,"/Length %.20g 0 R\n",
 
1971
      (double) object+1);
1931
1972
    (void) WriteBlobString(image,buffer);
1932
1973
    (void) WriteBlobString(image,">>\n");
1933
1974
    (void) WriteBlobString(image,"stream\n");
1986
2027
              Dump Runlength encoded pixels.
1987
2028
            */
1988
2029
            q=pixels;
1989
 
            for (y=0; y < (long) tile_image->rows; y++)
 
2030
            for (y=0; y < (ssize_t) tile_image->rows; y++)
1990
2031
            {
1991
2032
              p=GetVirtualPixels(tile_image,0,y,tile_image->columns,1,
1992
2033
                &tile_image->exception);
1993
2034
              if (p == (const PixelPacket *) NULL)
1994
2035
                break;
1995
 
              for (x=0; x < (long) tile_image->columns; x++)
 
2036
              for (x=0; x < (ssize_t) tile_image->columns; x++)
1996
2037
              {
1997
2038
                *q++=ScaleQuantumToChar(PixelIntensityToQuantum(p));
1998
2039
                p++;
2021
2062
              Dump uncompressed PseudoColor packets.
2022
2063
            */
2023
2064
            Ascii85Initialize(image);
2024
 
            for (y=0; y < (long) tile_image->rows; y++)
 
2065
            for (y=0; y < (ssize_t) tile_image->rows; y++)
2025
2066
            {
2026
2067
              p=GetVirtualPixels(tile_image,0,y,tile_image->columns,1,
2027
2068
                &tile_image->exception);
2028
2069
              if (p == (const PixelPacket *) NULL)
2029
2070
                break;
2030
 
              for (x=0; x < (long) tile_image->columns; x++)
 
2071
              for (x=0; x < (ssize_t) tile_image->columns; x++)
2031
2072
              {
2032
2073
                Ascii85Encode(image,
2033
2074
                  ScaleQuantumToChar(PixelIntensityToQuantum(p)));
2081
2122
              Dump runoffset encoded pixels.
2082
2123
            */
2083
2124
            q=pixels;
2084
 
            for (y=0; y < (long) tile_image->rows; y++)
 
2125
            for (y=0; y < (ssize_t) tile_image->rows; y++)
2085
2126
            {
2086
2127
              p=GetVirtualPixels(tile_image,0,y,tile_image->columns,1,
2087
2128
                &tile_image->exception);
2088
2129
              if (p == (const PixelPacket *) NULL)
2089
2130
                break;
2090
2131
              indexes=GetVirtualIndexQueue(tile_image);
2091
 
              for (x=0; x < (long) tile_image->columns; x++)
 
2132
              for (x=0; x < (ssize_t) tile_image->columns; x++)
2092
2133
              {
2093
 
                *q++=ScaleQuantumToChar(p->red);
2094
 
                *q++=ScaleQuantumToChar(p->green);
2095
 
                *q++=ScaleQuantumToChar(p->blue);
 
2134
                *q++=ScaleQuantumToChar(GetRedPixelComponent(p));
 
2135
                *q++=ScaleQuantumToChar(GetGreenPixelComponent(p));
 
2136
                *q++=ScaleQuantumToChar(GetBluePixelComponent(p));
2096
2137
                if (image->colorspace == CMYKColorspace)
2097
2138
                  *q++=ScaleQuantumToChar(indexes[x]);
2098
2139
                p++;
2121
2162
              Dump uncompressed DirectColor packets.
2122
2163
            */
2123
2164
            Ascii85Initialize(image);
2124
 
            for (y=0; y < (long) tile_image->rows; y++)
 
2165
            for (y=0; y < (ssize_t) tile_image->rows; y++)
2125
2166
            {
2126
2167
              p=GetVirtualPixels(tile_image,0,y,tile_image->columns,1,
2127
2168
                &tile_image->exception);
2128
2169
              if (p == (const PixelPacket *) NULL)
2129
2170
                break;
2130
2171
              indexes=GetVirtualIndexQueue(tile_image);
2131
 
              for (x=0; x < (long) tile_image->columns; x++)
 
2172
              for (x=0; x < (ssize_t) tile_image->columns; x++)
2132
2173
              {
2133
 
                Ascii85Encode(image,ScaleQuantumToChar(p->red));
2134
 
                Ascii85Encode(image,ScaleQuantumToChar(p->green));
2135
 
                Ascii85Encode(image,ScaleQuantumToChar(p->blue));
 
2174
                Ascii85Encode(image,ScaleQuantumToChar(GetRedPixelComponent(p)));
 
2175
                Ascii85Encode(image,ScaleQuantumToChar(GetGreenPixelComponent(p)));
 
2176
                Ascii85Encode(image,ScaleQuantumToChar(GetBluePixelComponent(p)));
2136
2177
                if (image->colorspace == CMYKColorspace)
2137
2178
                  Ascii85Encode(image,ScaleQuantumToChar(indexes[x]));
2138
2179
                p++;
2168
2209
                Dump Runlength encoded pixels.
2169
2210
              */
2170
2211
              q=pixels;
2171
 
              for (y=0; y < (long) tile_image->rows; y++)
 
2212
              for (y=0; y < (ssize_t) tile_image->rows; y++)
2172
2213
              {
2173
2214
                p=GetVirtualPixels(tile_image,0,y,tile_image->columns,1,
2174
2215
                  &tile_image->exception);
2175
2216
                if (p == (const PixelPacket *) NULL)
2176
2217
                  break;
2177
2218
                indexes=GetVirtualIndexQueue(tile_image);
2178
 
                for (x=0; x < (long) tile_image->columns; x++)
 
2219
                for (x=0; x < (ssize_t) tile_image->columns; x++)
2179
2220
                  *q++=(unsigned char) indexes[x];
2180
2221
              }
2181
2222
#if defined(MAGICKCORE_ZLIB_DELEGATE)
2201
2242
                Dump uncompressed PseudoColor packets.
2202
2243
              */
2203
2244
              Ascii85Initialize(image);
2204
 
              for (y=0; y < (long) tile_image->rows; y++)
 
2245
              for (y=0; y < (ssize_t) tile_image->rows; y++)
2205
2246
              {
2206
2247
                p=GetVirtualPixels(tile_image,0,y,tile_image->columns,1,
2207
2248
                  &tile_image->exception);
2208
2249
                if (p == (const PixelPacket *) NULL)
2209
2250
                  break;
2210
2251
                indexes=GetVirtualIndexQueue(tile_image);
2211
 
                for (x=0; x < (long) tile_image->columns; x++)
 
2252
                for (x=0; x < (ssize_t) tile_image->columns; x++)
2212
2253
                  Ascii85Encode(image,(unsigned char) indexes[x]);
2213
2254
              }
2214
2255
              Ascii85Flush(image);
2224
2265
      Write Length object.
2225
2266
    */
2226
2267
    xref[object++]=TellBlob(image);
2227
 
    (void) FormatMagickString(buffer,MaxTextExtent,"%lu 0 obj\n",object);
 
2268
    (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
 
2269
      object);
2228
2270
    (void) WriteBlobString(image,buffer);
2229
 
    (void) FormatMagickString(buffer,MaxTextExtent,"%lu\n",
2230
 
      (unsigned long) offset);
 
2271
    (void) FormatMagickString(buffer,MaxTextExtent,"%.20g\n",(double) offset);
2231
2272
    (void) WriteBlobString(image,buffer);
2232
2273
    (void) WriteBlobString(image,"endobj\n");
2233
2274
    xref[object++]=TellBlob(image);
2234
 
    (void) FormatMagickString(buffer,MaxTextExtent,"%lu 0 obj\n",object);
 
2275
    (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
 
2276
      object);
2235
2277
    (void) WriteBlobString(image,buffer);
2236
2278
    if ((image->storage_class != DirectClass) && (image->colors <= 256) &&
2237
2279
        (compression != FaxCompression) && (compression != Group4Compression))
2242
2284
        (void) WriteBlobString(image,"<<\n");
2243
2285
        if (compression == NoCompression)
2244
2286
          (void) WriteBlobString(image,"/Filter [ /ASCII85Decode ]\n");
2245
 
        (void) FormatMagickString(buffer,MaxTextExtent,"/Length %lu 0 R\n",
2246
 
          object+1);
 
2287
        (void) FormatMagickString(buffer,MaxTextExtent,"/Length %.20g 0 R\n",
 
2288
          (double) object+1);
2247
2289
        (void) WriteBlobString(image,buffer);
2248
2290
        (void) WriteBlobString(image,">>\n");
2249
2291
        (void) WriteBlobString(image,"stream\n");
2250
2292
        offset=TellBlob(image);
2251
2293
        if (compression == NoCompression)
2252
2294
          Ascii85Initialize(image);
2253
 
        for (i=0; i < (long) image->colors; i++)
 
2295
        for (i=0; i < (ssize_t) image->colors; i++)
2254
2296
        {
2255
2297
          if (compression == NoCompression)
2256
2298
            {
2276
2318
      Write Length object.
2277
2319
    */
2278
2320
    xref[object++]=TellBlob(image);
2279
 
    (void) FormatMagickString(buffer,MaxTextExtent,"%lu 0 obj\n",object);
 
2321
    (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
 
2322
      object);
2280
2323
    (void) WriteBlobString(image,buffer);
2281
 
    (void) FormatMagickString(buffer,MaxTextExtent,"%lu\n",
2282
 
      (unsigned long) offset);
 
2324
    (void) FormatMagickString(buffer,MaxTextExtent,"%.20g\n",(double)
 
2325
      offset);
2283
2326
    (void) WriteBlobString(image,buffer);
2284
2327
    (void) WriteBlobString(image,"endobj\n");
2285
2328
    /*
2286
2329
      Write softmask object.
2287
2330
    */
2288
2331
    xref[object++]=TellBlob(image);
2289
 
    (void) FormatMagickString(buffer,MaxTextExtent,"%lu 0 obj\n",object);
 
2332
    (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
 
2333
      object);
2290
2334
    (void) WriteBlobString(image,buffer);
2291
2335
    (void) WriteBlobString(image,"<<\n");
2292
2336
    if (image->matte == MagickFalse)
2295
2339
      {
2296
2340
        (void) WriteBlobString(image,"/Type /XObject\n");
2297
2341
        (void) WriteBlobString(image,"/Subtype /Image\n");
2298
 
        (void) FormatMagickString(buffer,MaxTextExtent,"/Name /Ma%lu\n",
2299
 
          image->scene);
 
2342
        (void) FormatMagickString(buffer,MaxTextExtent,"/Name /Ma%.20g\n",
 
2343
          (double) image->scene);
2300
2344
        (void) WriteBlobString(image,buffer);
2301
2345
        switch (compression)
2302
2346
        {
2325
2369
          }
2326
2370
        }
2327
2371
        (void) WriteBlobString(image,buffer);
2328
 
        (void) FormatMagickString(buffer,MaxTextExtent,"/Width %lu\n",
2329
 
          image->columns);
 
2372
        (void) FormatMagickString(buffer,MaxTextExtent,"/Width %.20g\n",
 
2373
          (double) image->columns);
2330
2374
        (void) WriteBlobString(image,buffer);
2331
 
        (void) FormatMagickString(buffer,MaxTextExtent,"/Height %lu\n",
2332
 
          image->rows);
 
2375
        (void) FormatMagickString(buffer,MaxTextExtent,"/Height %.20g\n",
 
2376
          (double) image->rows);
2333
2377
        (void) WriteBlobString(image,buffer);
2334
2378
        (void) WriteBlobString(image,"/ColorSpace /DeviceGray\n");
2335
2379
        (void) FormatMagickString(buffer,MaxTextExtent,"/BitsPerComponent %d\n",
2336
2380
          (compression == FaxCompression) || (compression == Group4Compression)
2337
2381
          ? 1 : 8);
2338
2382
        (void) WriteBlobString(image,buffer);
2339
 
        (void) FormatMagickString(buffer,MaxTextExtent,"/Length %lu 0 R\n",
2340
 
          object+1);
 
2383
        (void) FormatMagickString(buffer,MaxTextExtent,"/Length %.20g 0 R\n",
 
2384
          (double) object+1);
2341
2385
        (void) WriteBlobString(image,buffer);
2342
2386
        (void) WriteBlobString(image,">>\n");
2343
2387
        (void) WriteBlobString(image,"stream\n");
2364
2408
              Dump Runlength encoded pixels.
2365
2409
            */
2366
2410
            q=pixels;
2367
 
            for (y=0; y < (long) image->rows; y++)
 
2411
            for (y=0; y < (ssize_t) image->rows; y++)
2368
2412
            {
2369
2413
              p=GetVirtualPixels(image,0,y,image->columns,1,
2370
2414
                &image->exception);
2371
2415
              if (p == (const PixelPacket *) NULL)
2372
2416
                break;
2373
 
              for (x=0; x < (long) image->columns; x++)
 
2417
              for (x=0; x < (ssize_t) image->columns; x++)
2374
2418
              {
2375
 
                *q++=ScaleQuantumToChar((Quantum) (QuantumRange-p->opacity));
 
2419
                *q++=ScaleQuantumToChar((Quantum) (GetAlphaPixelComponent(p)));
2376
2420
                p++;
2377
2421
              }
2378
2422
            }
2399
2443
              Dump uncompressed PseudoColor packets.
2400
2444
            */
2401
2445
            Ascii85Initialize(image);
2402
 
            for (y=0; y < (long) image->rows; y++)
 
2446
            for (y=0; y < (ssize_t) image->rows; y++)
2403
2447
            {
2404
2448
              p=GetVirtualPixels(image,0,y,image->columns,1,
2405
2449
                &image->exception);
2406
2450
              if (p == (const PixelPacket *) NULL)
2407
2451
                break;
2408
 
              for (x=0; x < (long) image->columns; x++)
 
2452
              for (x=0; x < (ssize_t) image->columns; x++)
2409
2453
              {
2410
2454
                Ascii85Encode(image,ScaleQuantumToChar((Quantum) (QuantumRange-
2411
 
                  p->opacity)));
 
2455
                  GetOpacityPixelComponent(p))));
2412
2456
                p++;
2413
2457
              }
2414
2458
            }
2424
2468
      Write Length object.
2425
2469
    */
2426
2470
    xref[object++]=TellBlob(image);
2427
 
    (void) FormatMagickString(buffer,MaxTextExtent,"%lu 0 obj\n",object);
 
2471
    (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
 
2472
      object);
2428
2473
    (void) WriteBlobString(image,buffer);
2429
 
    (void) FormatMagickString(buffer,MaxTextExtent,"%lu\n",(unsigned long)
2430
 
      offset);
 
2474
    (void) FormatMagickString(buffer,MaxTextExtent,"%.20g\n",(double) offset);
2431
2475
    (void) WriteBlobString(image,buffer);
2432
2476
    (void) WriteBlobString(image,"endobj\n");
2433
2477
    if (GetNextImageInList(image) == (Image *) NULL)
2443
2487
  */
2444
2488
  xref[object++]=TellBlob(image);
2445
2489
  info_id=object;
2446
 
  (void) FormatMagickString(buffer,MaxTextExtent,"%lu 0 obj\n",object);
 
2490
  (void) FormatMagickString(buffer,MaxTextExtent,"%.20g 0 obj\n",(double)
 
2491
    object);
2447
2492
  (void) WriteBlobString(image,buffer);
2448
2493
  (void) WriteBlobString(image,"<<\n");
2449
2494
  (void) FormatMagickString(buffer,MaxTextExtent,"/Title (%s)\n",
2463
2508
  (void) FormatMagickString(buffer,MaxTextExtent,"/ModDate (%s)\n",date);
2464
2509
  (void) WriteBlobString(image,buffer);
2465
2510
  (void) FormatMagickString(buffer,MaxTextExtent,"/Producer (%s)\n",
2466
 
    EscapeParenthesis(GetMagickVersion((unsigned long *) NULL)));
 
2511
    EscapeParenthesis(GetMagickVersion((size_t *) NULL)));
2467
2512
  (void) WriteBlobString(image,buffer);
2468
2513
  (void) WriteBlobString(image,">>\n");
2469
2514
  (void) WriteBlobString(image,"endobj\n");
2472
2517
  */
2473
2518
  offset=TellBlob(image)-xref[0]+10;
2474
2519
  (void) WriteBlobString(image,"xref\n");
2475
 
  (void) FormatMagickString(buffer,MaxTextExtent,"0 %lu\n",object+1);
 
2520
  (void) FormatMagickString(buffer,MaxTextExtent,"0 %.20g\n",(double)
 
2521
    object+1);
2476
2522
  (void) WriteBlobString(image,buffer);
2477
2523
  (void) WriteBlobString(image,"0000000000 65535 f \n");
2478
 
  for (i=0; i < (long) object; i++)
 
2524
  for (i=0; i < (ssize_t) object; i++)
2479
2525
  {
2480
2526
    (void) FormatMagickString(buffer,MaxTextExtent,"%010lu 00000 n \n",
2481
2527
      (unsigned long) xref[i]);
2483
2529
  }
2484
2530
  (void) WriteBlobString(image,"trailer\n");
2485
2531
  (void) WriteBlobString(image,"<<\n");
2486
 
  (void) FormatMagickString(buffer,MaxTextExtent,"/Size %lu\n",object+1);
2487
 
  (void) WriteBlobString(image,buffer);
2488
 
  (void) FormatMagickString(buffer,MaxTextExtent,"/Info %lu 0 R\n",info_id);
2489
 
  (void) WriteBlobString(image,buffer);
2490
 
  (void) FormatMagickString(buffer,MaxTextExtent,"/Root %lu 0 R\n",root_id);
 
2532
  (void) FormatMagickString(buffer,MaxTextExtent,"/Size %.20g\n",(double)
 
2533
    object+1);
 
2534
  (void) WriteBlobString(image,buffer);
 
2535
  (void) FormatMagickString(buffer,MaxTextExtent,"/Info %.20g 0 R\n",(double)
 
2536
    info_id);
 
2537
  (void) WriteBlobString(image,buffer);
 
2538
  (void) FormatMagickString(buffer,MaxTextExtent,"/Root %.20g 0 R\n",(double)
 
2539
    root_id);
2491
2540
  (void) WriteBlobString(image,buffer);
2492
2541
  (void) WriteBlobString(image,">>\n");
2493
2542
  (void) WriteBlobString(image,"startxref\n");
2494
 
  (void) FormatMagickString(buffer,MaxTextExtent,"%lu\n",
2495
 
    (unsigned long) offset);
 
2543
  (void) FormatMagickString(buffer,MaxTextExtent,"%.20g\n",(double) offset);
2496
2544
  (void) WriteBlobString(image,buffer);
2497
2545
  (void) WriteBlobString(image,"%%EOF\n");
2498
2546
  xref=(MagickOffsetType *) RelinquishMagickMemory(xref);