% Read/Write Brother PES Image Format %
% %
% Software Design %
-% John Cristy %
+% Cristy %
% July 2009 %
% %
% %
-% Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2015 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 declarations.
*/
-#include "magick/studio.h"
-#include "magick/property.h"
-#include "magick/blob.h"
-#include "magick/blob-private.h"
-#include "magick/cache.h"
-#include "magick/client.h"
-#include "magick/colorspace.h"
-#include "magick/constitute.h"
-#include "magick/decorate.h"
-#include "magick/exception.h"
-#include "magick/exception-private.h"
-#include "magick/gem.h"
-#include "magick/geometry.h"
-#include "magick/image.h"
-#include "magick/image-private.h"
-#include "magick/list.h"
-#include "magick/magick.h"
-#include "magick/memory_.h"
-#include "magick/monitor.h"
-#include "magick/monitor-private.h"
-#include "magick/montage.h"
-#include "magick/resize.h"
-#include "magick/shear.h"
-#include "magick/quantum-private.h"
-#include "magick/static.h"
-#include "magick/string_.h"
-#include "magick/module.h"
-#include "magick/resource_.h"
-#include "magick/transform.h"
-#include "magick/utility.h"
+#include "MagickCore/studio.h"
+#include "MagickCore/property.h"
+#include "MagickCore/blob.h"
+#include "MagickCore/blob-private.h"
+#include "MagickCore/cache.h"
+#include "MagickCore/client.h"
+#include "MagickCore/colorspace.h"
+#include "MagickCore/constitute.h"
+#include "MagickCore/decorate.h"
+#include "MagickCore/exception.h"
+#include "MagickCore/exception-private.h"
+#include "MagickCore/gem.h"
+#include "MagickCore/geometry.h"
+#include "MagickCore/image.h"
+#include "MagickCore/image-private.h"
+#include "MagickCore/list.h"
+#include "MagickCore/magick.h"
+#include "MagickCore/memory_.h"
+#include "MagickCore/monitor.h"
+#include "MagickCore/monitor-private.h"
+#include "MagickCore/montage.h"
+#include "MagickCore/resize.h"
+#include "MagickCore/shear.h"
+#include "MagickCore/quantum-private.h"
+#include "MagickCore/static.h"
+#include "MagickCore/string_.h"
+#include "MagickCore/module.h"
+#include "MagickCore/resource_.h"
+#include "MagickCore/transform.h"
+#include "MagickCore/utility.h"
\f
/*
Typedef declarations.
register ssize_t
i;
+ size_t
+ number_blocks,
+ number_colors,
+ number_stitches;
+
ssize_t
count,
offset;
magick[4],
version[4];
- size_t
- number_blocks,
- number_colors,
- number_stitches;
-
/*
Open image file.
*/
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
- image=AcquireImage(image_info);
+ image=AcquireImage(image_info,exception);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
for (i=0; i < (ssize_t) number_colors; i++)
{
j=(int) ReadBlobByte(image);
- blocks[i].color=PESColor+j;
+ blocks[i].color=PESColor+(j < 0 ? 0 : j);
blocks[i].offset=0;
}
for ( ; i < 256L; i++)
file=fdopen(unique_file,"wb");
if ((unique_file == -1) || (file == (FILE *) NULL))
ThrowImageException(FileOpenError,"UnableToCreateTemporaryFile");
- (void) fprintf(file,"<?xml version=\"1.0\"?>\n");
- (void) fprintf(file,"<svg xmlns=\"http://www.w3.org/2000/svg\" "
+ (void) FormatLocaleFile(file,"<?xml version=\"1.0\"?>\n");
+ (void) FormatLocaleFile(file,"<svg xmlns=\"http://www.w3.org/2000/svg\" "
"xlink=\"http://www.w3.org/1999/xlink\" "
"ev=\"http://www.w3.org/2001/xml-events\" version=\"1.1\" "
"baseProfile=\"full\" width=\"%g\" height=\"%g\">\n",bounds.x2-bounds.x1,
for (i=0; i < (ssize_t) number_blocks; i++)
{
offset=blocks[i].offset;
- (void) fprintf(file," <path stroke=\"#%02x%02x%02x\" fill=\"none\" "
- "d=\"M %g %g",blocks[i].color->red,blocks[i].color->green,
+ (void) FormatLocaleFile(file," <path stroke=\"#%02x%02x%02x\" "
+ "fill=\"none\" d=\"M %g %g",blocks[i].color->red,blocks[i].color->green,
blocks[i].color->blue,stitches[offset].x-bounds.x1,
stitches[offset].y-bounds.y1);
for (j=1; j < (ssize_t) (blocks[i+1].offset-offset); j++)
- (void) fprintf(file," L %g %g",stitches[offset+j].x-bounds.x1,
+ (void) FormatLocaleFile(file," L %g %g",stitches[offset+j].x-bounds.x1,
stitches[offset+j].y-bounds.y1);
- (void) fprintf(file,"\"/>\n");
+ (void) FormatLocaleFile(file,"\"/>\n");
}
- (void) fprintf(file,"</svg>\n");
+ (void) FormatLocaleFile(file,"</svg>\n");
(void) fclose(file);
(void) CloseBlob(image);
image=DestroyImage(image);
*/
read_info=CloneImageInfo(image_info);
SetImageInfoBlob(read_info,(void *) NULL,0);
- (void) FormatMagickString(read_info->filename,MaxTextExtent,"svg:%.1024s",
+ (void) FormatLocaleString(read_info->filename,MaxTextExtent,"svg:%s",
filename);
image=ReadImage(read_info,exception);
if (image != (Image *) NULL)