% Read/Write On-The-Air Image Format %
% %
% Software Design %
-% John Cristy %
+% Cristy %
% January 2000 %
% %
% %
-% Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2017 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 %
% obtain a copy of the License at %
% %
-% http://www.imagemagick.org/script/license.php %
+% https://www.imagemagick.org/script/license.php %
% %
% Unless required by applicable law or agreed to in writing, software %
% distributed under the License is distributed on an "AS IS" BASIS, %
Include declarations.
*/
#include "MagickCore/studio.h"
+#include "MagickCore/attribute.h"
#include "MagickCore/blob.h"
#include "MagickCore/blob-private.h"
#include "MagickCore/cache.h"
Forward declarations.
*/
static MagickBooleanType
- WriteOTBImage(const ImageInfo *,Image *);
+ WriteOTBImage(const ImageInfo *,Image *,ExceptionInfo *);
\f
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Open image file.
*/
assert(image_info != (const ImageInfo *) NULL);
- assert(image_info->signature == MagickSignature);
+ assert(image_info->signature == MagickCoreSignature);
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);
+ assert(exception->signature == MagickCoreSignature);
+ image=AcquireImage(image_info,exception);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
depth=(unsigned char) ReadBlobByte(image);
if (depth != 1)
ThrowReaderException(CoderError,"OnlyLevelZerofilesSupported");
- if (AcquireImageColormap(image,2) == MagickFalse)
+ if (AcquireImageColormap(image,2,exception) == MagickFalse)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
if (image_info->ping != MagickFalse)
{
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Convert bi-level image to pixel packets.
*/
for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (const Quantum *) NULL)
+ if (q == (Quantum *) NULL)
break;
bit=0;
byte=0;
break;
}
}
- (void) SyncImage(image);
+ (void) SyncImage(image,exception);
if (EOFBlob(image) != MagickFalse)
ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
image->filename);
MagickInfo
*entry;
- entry=SetMagickInfo("OTB");
+ entry=AcquireMagickInfo("OTB","OTB","On-the-air bitmap");
entry->decoder=(DecodeImageHandler *) ReadOTBImage;
entry->encoder=(EncodeImageHandler *) WriteOTBImage;
- entry->adjoin=MagickFalse;
- entry->description=ConstantString("On-the-air bitmap");
- entry->module=ConstantString("OTB");
+ entry->flags^=CoderAdjoinFlag;
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
}
%
% The format of the WriteOTBImage method is:
%
-% MagickBooleanType WriteOTBImage(const ImageInfo *image_info,Image *image)
+% MagickBooleanType WriteOTBImage(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 MagickBooleanType WriteOTBImage(const ImageInfo *image_info,Image *image)
+static MagickBooleanType WriteOTBImage(const ImageInfo *image_info,Image *image,
+ ExceptionInfo *exception)
{
#define SetBit(a,i,set) \
a=(unsigned char) ((set) ? (a) | (1L << (i)) : (a) & ~(1L << (i)))
Open output image file.
*/
assert(image_info != (const ImageInfo *) NULL);
- assert(image_info->signature == MagickSignature);
+ assert(image_info->signature == MagickCoreSignature);
assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
+ assert(image->signature == MagickCoreSignature);
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 == MagickCoreSignature);
+ status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
- if (IsRGBColorspace(image->colorspace) == MagickFalse)
- (void) TransformImageColorspace(image,RGBColorspace);
+ (void) TransformImageColorspace(image,sRGBColorspace,exception);
/*
Convert image to a bi-level image.
*/
- (void) SetImageType(image,BilevelType);
+ (void) SetImageType(image,BilevelType,exception);
info=0;
if ((image->columns >= 256) || (image->rows >= 256))
SetBit(info,4,1);
(void) WriteBlobByte(image,1); /* depth */
for (y=0; y < (ssize_t) image->rows; y++)
{
- p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
bit=0;
byte=0;
for (x=0; x < (ssize_t) image->columns; x++)
{
- if (GetPixelIntensity(image,p) < ((Quantum) QuantumRange/2.0))
+ if (GetPixelLuma(image,p) < (QuantumRange/2.0))
byte|=0x1 << (7-bit);
bit++;
if (bit == 8)