This source file includes following definitions.
- ReadHALDImage
- RegisterHALDImage
- UnregisterHALDImage
#include "magick/studio.h"
#include "magick/blob.h"
#include "magick/blob-private.h"
#include "magick/cache.h"
#include "magick/colorspace.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/module.h"
#include "magick/monitor.h"
#include "magick/monitor-private.h"
#include "magick/pixel-accessor.h"
#include "magick/quantum-private.h"
#include "magick/resource_.h"
#include "magick/static.h"
#include "magick/string_.h"
#include "magick/string-private.h"
#include "magick/thread-private.h"
static Image *ReadHALDImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
Image
*image;
MagickBooleanType
status;
size_t
cube_size,
level;
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);
level=0;
if (*image_info->filename != '\0')
level=StringToUnsignedLong(image_info->filename);
if (level < 2)
level=8;
status=MagickTrue;
cube_size=level*level;
image->columns=(size_t) (level*cube_size);
image->rows=(size_t) (level*cube_size);
status=SetImageExtent(image,image->columns,image->rows);
if (status == MagickFalse)
{
InheritException(exception,&image->exception);
return(DestroyImageList(image));
}
for (y=0; y < (ssize_t) image->rows; y+=(ssize_t) level)
{
ssize_t
blue,
green,
red;
register PixelPacket
*magick_restrict q;
if (status == MagickFalse)
continue;
q=QueueAuthenticPixels(image,0,y,image->columns,(size_t) level,exception);
if (q == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
blue=y/(ssize_t) level;
for (green=0; green < (ssize_t) cube_size; green++)
{
for (red=0; red < (ssize_t) cube_size; red++)
{
SetPixelRed(q,ClampToQuantum((MagickRealType)
(QuantumRange*red/(cube_size-1.0))));
SetPixelGreen(q,ClampToQuantum((MagickRealType)
(QuantumRange*green/(cube_size-1.0))));
SetPixelBlue(q,ClampToQuantum((MagickRealType)
(QuantumRange*blue/(cube_size-1.0))));
SetPixelOpacity(q,OpaqueOpacity);
q++;
}
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
status=MagickFalse;
}
return(GetFirstImageInList(image));
}
ModuleExport size_t RegisterHALDImage(void)
{
MagickInfo
*entry;
entry=SetMagickInfo("HALD");
entry->decoder=(DecodeImageHandler *) ReadHALDImage;
entry->adjoin=MagickFalse;
entry->format_type=ImplicitFormatType;
entry->raw=MagickTrue;
entry->endian_support=MagickTrue;
entry->description=ConstantString("Identity Hald color lookup table image");
entry->module=ConstantString("HALD");
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
}
ModuleExport void UnregisterHALDImage(void)
{
(void) UnregisterMagickInfo("HALD");
}