This source file includes following definitions.
- ReadXCImage
- RegisterXCImage
- UnregisterXCImage
#include "magick/studio.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-private.h"
#include "magick/exception.h"
#include "magick/exception-private.h"
#include "magick/image.h"
#include "magick/image-private.h"
#include "magick/list.h"
#include "magick/magick.h"
#include "magick/memory_.h"
#include "magick/pixel.h"
#include "magick/pixel-accessor.h"
#include "magick/pixel-private.h"
#include "magick/quantum-private.h"
#include "magick/static.h"
#include "magick/string_.h"
#include "magick/module.h"
static Image *ReadXCImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
Image
*image;
IndexPacket
index,
*indexes;
MagickBooleanType
status;
MagickPixelPacket
color;
PixelPacket
pixel;
register ssize_t
x;
register PixelPacket
*q;
ssize_t
y;
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
image=AcquireImage(image_info);
if (image->columns == 0)
image->columns=1;
if (image->rows == 0)
image->rows=1;
status=SetImageExtent(image,image->columns,image->rows);
if (status == MagickFalse)
{
InheritException(exception,&image->exception);
return(DestroyImageList(image));
}
(void) CopyMagickString(image->filename,image_info->filename,MaxTextExtent);
status=QueryMagickColor((char *) image_info->filename,&color,exception);
if (status == MagickFalse)
{
image=DestroyImage(image);
return((Image *) NULL);
}
(void) SetImageColorspace(image,color.colorspace);
image->matte=color.matte;
(void) ResetMagickMemory(&pixel,0,sizeof(pixel));
index=0;
SetPixelPacket(image,&color,&pixel,&index);
for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
*q++=pixel;
if (image->colorspace == CMYKColorspace)
{
indexes=GetAuthenticIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
SetPixelIndex(indexes+x,index);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
return(GetFirstImageInList(image));
}
ModuleExport size_t RegisterXCImage(void)
{
MagickInfo
*entry;
entry=SetMagickInfo("XC");
entry->decoder=(DecodeImageHandler *) ReadXCImage;
entry->adjoin=MagickFalse;
entry->format_type=ImplicitFormatType;
entry->raw=MagickTrue;
entry->endian_support=MagickTrue;
entry->description=ConstantString("Constant image uniform color");
entry->module=ConstantString("XC");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("CANVAS");
entry->decoder=(DecodeImageHandler *) ReadXCImage;
entry->adjoin=MagickFalse;
entry->format_type=ImplicitFormatType;
entry->raw=MagickTrue;
entry->endian_support=MagickTrue;
entry->description=ConstantString("Constant image uniform color");
entry->module=ConstantString("XC");
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
}
ModuleExport void UnregisterXCImage(void)
{
(void) UnregisterMagickInfo("CANVAS");
(void) UnregisterMagickInfo("XC");
}