% July 1992 %
% %
% %
-% Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2012 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/color.h"
-#include "magick/color-private.h"
-#include "magick/colorspace.h"
-#include "magick/constitute.h"
-#include "magick/exception.h"
-#include "magick/exception-private.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/pixel.h"
-#include "magick/quantum-private.h"
-#include "magick/static.h"
-#include "magick/string_.h"
-#include "magick/module.h"
+#include "MagickCore/studio.h"
+#include "MagickCore/attribute.h"
+#include "MagickCore/property.h"
+#include "MagickCore/blob.h"
+#include "MagickCore/blob-private.h"
+#include "MagickCore/cache.h"
+#include "MagickCore/color.h"
+#include "MagickCore/color-private.h"
+#include "MagickCore/colormap.h"
+#include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
+#include "MagickCore/constitute.h"
+#include "MagickCore/exception.h"
+#include "MagickCore/exception-private.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/pixel.h"
+#include "MagickCore/pixel-accessor.h"
+#include "MagickCore/property.h"
+#include "MagickCore/quantum-private.h"
+#include "MagickCore/static.h"
+#include "MagickCore/string_.h"
+#include "MagickCore/module.h"
#if defined(MAGICKCORE_FPX_DELEGATE)
#if !defined(vms) && !defined(macintosh) && !defined(MAGICKCORE_WINDOWS_SUPPORT)
#include <fpxlib.h>
Forward declarations.
*/
static MagickBooleanType
- WriteFPXImage(const ImageInfo *,Image *);
+ WriteFPXImage(const ImageInfo *,Image *,ExceptionInfo *);
#endif
\f
/*
Image
*image;
- IndexPacket
- index;
-
MagickBooleanType
status;
- register IndexPacket
- *indexes;
+ Quantum
+ index;
register ssize_t
i,
x;
- register PixelPacket
+ register Quantum
*q;
register unsigned char
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)
{
Note image label.
*/
label=(char *) NULL;
- if (~summary_info.title.length >= MaxTextExtent)
+ if (~summary_info.title.length >= (MaxTextExtent-1))
label=(char *) AcquireQuantumMemory(summary_info.title.length+
MaxTextExtent,sizeof(*label));
if (label == (char *) NULL)
}
(void) CopyMagickString(label,(char *) summary_info.title.ptr,
summary_info.title.length+1);
- (void) SetImageProperty(image,"label",label);
+ (void) SetImageProperty(image,"label",label,exception);
label=DestroyString(label);
}
if (summary_info.comments_valid)
Note image comment.
*/
comments=(char *) NULL;
- if (~summary_info.comments.length >= MaxTextExtent)
+ if (~summary_info.comments.length >= (MaxTextExtent-1))
comments=(char *) AcquireQuantumMemory(summary_info.comments.length+
MaxTextExtent,sizeof(*comments));
if (comments == (char *) NULL)
}
(void) CopyMagickString(comments,(char *) summary_info.comments.ptr,
summary_info.comments.length+1);
- (void) SetImageProperty(image,"comment",comments);
+ (void) SetImageProperty(image,"comment",comments,exception);
comments=DestroyString(comments);
}
/*
/*
Create linear colormap.
*/
- if (AcquireImageColormap(image,MaxColormapSize) == MagickFalse)
+ if (AcquireImageColormap(image,MaxColormapSize,exception) == MagickFalse)
{
FPX_ClearSystem();
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (PixelPacket *) NULL)
+ if (q == (Quantum *) NULL)
break;
- indexes=GetAuthenticIndexQueue(image);
if ((y % tile_height) == 0)
{
/*
{
if (fpx_info.numberOfComponents > 2)
{
- SetRedPixelComponent(q,ScaleCharToQuantum(*r));
- SetGreenPixelComponent(q,ScaleCharToQuantum(*g));
- SetBluePixelComponent(q,ScaleCharToQuantum(*b));
+ SetPixelRed(image,ScaleCharToQuantum(*r),q);
+ SetPixelGreen(image,ScaleCharToQuantum(*g),q);
+ SetPixelBlue(image,ScaleCharToQuantum(*b),q);
}
else
{
index=ScaleCharToQuantum(*r);
- SetIndexPixelComponent(indexes+x,index);
- SetRedPixelComponent(q,index);
- SetGreenPixelComponent(q,index);
- SetBluePixelComponent(q,index);
+ SetPixelBlack(image,index,q);
+ SetPixelRed(image,index,q);
+ SetPixelGreen(image,index,q);
+ SetPixelBlue(image,index,q);
}
- SetOpacityPixelComponent(q,OpaqueOpacity);
+ SetPixelAlpha(image,OpaqueAlpha,q);
if (image->matte != MagickFalse)
- SetAlphaPixelComponent(q,ScaleCharToQuantum(*a));
- q++;
+ SetPixelAlpha(image,ScaleCharToQuantum(*a),q);
+ q+=GetPixelChannels(image);
r+=red_component->columnStride;
g+=green_component->columnStride;
b+=blue_component->columnStride;
%
% The format of the WriteFPXImage method is:
%
-% MagickBooleanType WriteFPXImage(const ImageInfo *image_info,Image *image)
+% MagickBooleanType WriteFPXImage(const ImageInfo *image_info,
+% Image *image,ExceptionInfo *exception)
%
% A description of each parameter follows.
%
%
% o image: The image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static void ColorTwistMultiply(FPXColorTwistMatrix first,
*color_twist=result;
}
-static MagickBooleanType WriteFPXImage(const ImageInfo *image_info,Image *image)
+static MagickBooleanType WriteFPXImage(const ImageInfo *image_info,Image *image,
+ ExceptionInfo *exception)
{
FPXBackground
background_color;
QuantumType
quantum_type;
- register const PixelPacket
+ register const Quantum
*p;
register ssize_t
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
+ assert(exception != (ExceptionInfo *) NULL);
+ assert(exception->signature == MagickSignature);
+ status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
(void) CloseBlob(image);
Initialize FPX toolkit.
*/
image->depth=8;
- if (image->colorspace != RGBColorspace)
- (void) TransformImageColorspace(image,RGBColorspace);
+ if (IsRGBColorspace(image->colorspace) == MagickFalse)
+ (void) TransformImageColorspace(image,sRGBColorspace,exception);
memory_limit=20000000;
fpx_status=FPX_SetToolkitMemoryLimit(&memory_limit);
if (fpx_status != FPX_OK)
if (image->matte != MagickFalse)
colorspace.numberOfComponents=4;
if ((image_info->type != TrueColorType) &&
- IsGrayImage(image,&image->exception))
+ (IsImageGray(image,exception) != MagickFalse))
{
colorspace.numberOfComponents=1;
colorspace.theComponents[0].myColor=MONOCHROME;
summary_info.thumbnail_valid=MagickFalse;
summary_info.appname_valid=MagickFalse;
summary_info.security_valid=MagickFalse;
- label=GetImageProperty(image,"label");
+ label=GetImageProperty(image,"label",exception);
if (label != (const char *) NULL)
{
- size_t
- length;
-
/*
Note image label.
*/
summary_info.title_valid=MagickTrue;
length=strlen(label);
summary_info.title.length=length;
- if (~length >= MaxTextExtent)
+ if (~length >= (MaxTextExtent-1))
summary_info.title.ptr=(unsigned char *) AcquireQuantumMemory(
length+MaxTextExtent,sizeof(*summary_info.title.ptr));
if (summary_info.title.ptr == (unsigned char *) NULL)
(void) CopyMagickString((char *) summary_info.title.ptr,label,
MaxTextExtent);
}
- comment=GetImageProperty(image,"comment");
+ comment=GetImageProperty(image,"comment",exception);
if (comment != (const char *) NULL)
{
/*
quantum_type=GrayQuantum;
for (y=0; y < (ssize_t) image->rows; y++)
{
- p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
- if (p == (const PixelPacket *) NULL)
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
+ if (p == (const Quantum *) NULL)
break;
- length=ExportQuantumPixels(image,(const CacheView *) NULL,quantum_info,
- quantum_type,pixels,&image->exception);
+ length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
+ quantum_type,pixels,exception);
fpx_status=FPX_WriteImageLine(flashpix,&fpx_info);
if (fpx_status != FPX_OK)
break;