% July 1992 %
% %
% %
-% Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2013 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/blob.h"
-#include "magick/blob-private.h"
-#include "magick/cache.h"
-#include "magick/constitute.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/monitor.h"
-#include "magick/monitor-private.h"
-#include "magick/quantum-private.h"
-#include "magick/static.h"
-#include "magick/string_.h"
-#include "magick/module.h"
+#include "MagickCore/studio.h"
+#include "MagickCore/blob.h"
+#include "MagickCore/blob-private.h"
+#include "MagickCore/cache.h"
+#include "MagickCore/colormap.h"
+#include "MagickCore/constitute.h"
+#include "MagickCore/exception.h"
+#include "MagickCore/exception-private.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-accessor.h"
+#include "MagickCore/quantum-private.h"
+#include "MagickCore/static.h"
+#include "MagickCore/string_.h"
+#include "MagickCore/module.h"
\f
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
*/
-static inline unsigned long MagickMin(const unsigned long x,
- const unsigned long y)
+static inline size_t MagickMin(const size_t x,
+ const size_t y)
{
if (x < y)
return(x);
static Image *ReadSTEGANOImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
-#define GetBit(alpha,i) MagickMin((((unsigned long) (alpha) >> (unsigned long) \
+#define GetBit(alpha,i) MagickMin((((size_t) (alpha) >> (size_t) \
(i)) & 0x01),16)
-#define SetBit(alpha,i,set) (alpha)=(IndexPacket) ((set) != 0 ? \
- (unsigned long) (alpha) | (1UL << (unsigned long) (i)) : (unsigned long) \
- (alpha) & ~(1UL << (unsigned long) (i)))
+#define SetBit(i,set) SetPixelIndex(image,((set) != 0 ? \
+ (size_t) GetPixelIndex(image,q) | (one << (size_t) (i)) : \
+ (size_t) GetPixelIndex(image,q) & ~(one << (size_t) (i))),q)
Image
*image,
ImageInfo
*read_info;
- long
- c,
- i,
- j,
- k,
- y;
+ int
+ c;
MagickBooleanType
status;
- PixelPacket
+ PixelInfo
pixel;
- register IndexPacket
- *indexes;
+ register Quantum
+ *q;
- register long
+ register ssize_t
x;
- register PixelPacket
- *q;
+ size_t
+ depth,
+ one;
- unsigned long
- depth;
+ ssize_t
+ i,
+ j,
+ k,
+ y;
/*
Initialize Image structure.
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
- image=AcquireImage(image_info);
+ one=1;
+ image=AcquireImage(image_info,exception);
if ((image->columns == 0) || (image->rows == 0))
ThrowReaderException(OptionError,"MustSpecifyImageSize");
read_info=CloneImageInfo(image_info);
if (watermark == (Image *) NULL)
return((Image *) NULL);
watermark->depth=MAGICKCORE_QUANTUM_DEPTH;
- if (AcquireImageColormap(image,MaxColormapSize) == MagickFalse)
+ if (AcquireImageColormap(image,MaxColormapSize,exception) == MagickFalse)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
if (image_info->ping != MagickFalse)
{
c=0;
i=0;
j=0;
- i=MAGICKCORE_QUANTUM_DEPTH-1;
- depth=MAGICKCORE_QUANTUM_DEPTH;
- for (k=image->offset; (i >= 0) && (j < (long) depth); i--)
+ i=(ssize_t) (watermark->depth-1);
+ depth=watermark->depth;
+ for (k=image->offset; (i >= 0) && (j < (ssize_t) depth); i--)
{
- for (y=0; (y < (long) image->rows) && (j < (long) depth); y++)
+ for (y=0; (y < (ssize_t) image->rows) && (j < (ssize_t) depth); y++)
{
x=0;
- for (; (x < (long) image->columns) && (j < (long) depth); x++)
+ for ( ; (x < (ssize_t) image->columns) && (j < (ssize_t) depth); x++)
{
- if ((k/(long) watermark->columns) >= (long) watermark->rows)
+ if ((k/(ssize_t) watermark->columns) >= (ssize_t) watermark->rows)
break;
- (void) GetOneVirtualPixel(watermark,k % (long) watermark->columns,
- k/(long) watermark->columns,&pixel,exception);
+ (void) GetOneVirtualPixelInfo(watermark,UndefinedVirtualPixelMethod,
+ k % (ssize_t) watermark->columns,k/(ssize_t) watermark->columns,
+ &pixel,exception);
q=GetAuthenticPixels(image,x,y,1,1,exception);
- if (q == (PixelPacket *) NULL)
+ if (q == (Quantum *) NULL)
break;
- indexes=GetAuthenticIndexQueue(image);
switch (c)
{
case 0:
{
- SetBit(*indexes,i,GetBit(pixel.red,j));
+ SetBit(i,GetBit(pixel.red,j));
break;
}
case 1:
{
- SetBit(*indexes,i,GetBit(pixel.green,j));
+ SetBit(i,GetBit(pixel.green,j));
break;
}
case 2:
{
- SetBit(*indexes,i,GetBit(pixel.blue,j));
+ SetBit(i,GetBit(pixel.blue,j));
break;
}
}
if (c == 3)
c=0;
k++;
- if (k == (long) (watermark->columns*watermark->columns))
+ if (k == (ssize_t) (watermark->columns*watermark->columns))
k=0;
if (k == image->offset)
j++;
}
}
- status=SetImageProgress(image,LoadImagesTag,i,depth);
+ status=SetImageProgress(image,LoadImagesTag,(MagickOffsetType) i,depth);
if (status == MagickFalse)
break;
}
watermark=DestroyImage(watermark);
- (void) SyncImage(image);
+ (void) SyncImage(image,exception);
return(GetFirstImageInList(image));
}
\f
%
% The format of the RegisterSTEGANOImage method is:
%
-% unsigned long RegisterSTEGANOImage(void)
+% size_t RegisterSTEGANOImage(void)
%
*/
-ModuleExport unsigned long RegisterSTEGANOImage(void)
+ModuleExport size_t RegisterSTEGANOImage(void)
{
MagickInfo
*entry;
entry=SetMagickInfo("STEGANO");
entry->decoder=(DecodeImageHandler *) ReadSTEGANOImage;
- entry->format_type=ExplicitFormatType;
+ entry->format_type=ImplicitFormatType;
entry->description=ConstantString("Steganographic image");
entry->module=ConstantString("STEGANO");
(void) RegisterMagickInfo(entry);