% Read DjVu Images. %
% %
% Software Design %
-% John Cristy %
+% Cristy %
% July 1992 %
% %
% %
-% Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2018 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://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 "MagickCore/constitute.h"
#include "MagickCore/exception.h"
#include "MagickCore/exception-private.h"
+#include "MagickCore/image-private.h"
#include "MagickCore/list.h"
#include "MagickCore/magick.h"
#include "MagickCore/memory_.h"
r+=GetPixelChannels(image);
}
- SyncAuthenticPixels(image,exception);
+ (void) SyncAuthenticPixels(image,exception);
}
}
q=(unsigned char *) RelinquishMagickMemory(q);
%
*/
-static inline double MagickMax(const double x,const double y)
-{
- if (x > y)
- return(x);
- return(y);
-}
-
static Image *ReadOneDJVUImage(LoadContext* lc,const int pagenum,
const ImageInfo *image_info,ExceptionInfo *exception)
{
Image *image;
int logging;
int tag;
+ MagickBooleanType status;
/* so, we know that the page is there! Get its dimension, and */
if (tag == 0) break;
ddjvu_message_pop(lc->context);
} while ((message = ddjvu_message_peek(lc->context)));
+ if (tag == 0) break;
} while (!ddjvu_page_decoding_done(lc->page));
ddjvu_document_get_pageinfo(lc->document, pagenum, &info);
image->alpha_trait = BlendPixelTrait;
/* is this useful? */
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
#if DEBUG
printf("now filling %.20g x %.20g\n",(double) image->columns,(double)
image->rows);
* 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);
+ assert(exception->signature == MagickCoreSignature);
logging = LogMagickEvent(CoderEvent,GetMagickModule(),"enter ReadDJVUImage()");
/*
* Initialize members of the MngInfo structure.
*/
- (void) ResetMagickMemory(lc,0,sizeof(LoadContext));
+ (void) memset(lc,0,sizeof(LoadContext));
lc->image = image;
lc->pages = 0;
break;
}
djvu_close_lc(lc);
- (void) CloseBlob(images);
+ if (images != (Image *) NULL)
+ (void) CloseBlob(images);
if (image != (Image *) NULL)
image=DestroyImageList(image);
ModuleExport size_t RegisterDJVUImage(void)
{
char
- version[MaxTextExtent];
+ version[MagickPathExtent];
MagickInfo
*entry;
*version='\0';
#if defined(DJVU_LIBDJVU_VER_STRING)
- (void) ConcatenateMagickString(version,"libdjvu ",MaxTextExtent);
- (void) ConcatenateMagickString(version,DJVU_LIBDJVU_VER_STRING,MaxTextExtent);
+ (void) ConcatenateMagickString(version,"libdjvu ",MagickPathExtent);
+ (void) ConcatenateMagickString(version,DJVU_LIBDJVU_VER_STRING,MagickPathExtent);
#endif
- entry=SetMagickInfo("DJVU");
+ entry=AcquireMagickInfo("DJVU","DJVU","Deja vu");
#if defined(MAGICKCORE_DJVU_DELEGATE)
entry->decoder=(DecodeImageHandler *) ReadDJVUImage;
#endif
- entry->raw=MagickTrue;
entry->magick=(IsImageFormatHandler *) IsDJVU;
- entry->adjoin=MagickFalse;
- entry->thread_support=MagickTrue;
- entry->description=AcquireString("Déjà vu");
- entry->module=AcquireString("DJVU");
+ entry->flags|=CoderRawSupportFlag;
+ entry->flags^=CoderAdjoinFlag;
if (*version != '\0')
entry->version=AcquireString(version);
entry->note=AcquireString(DJVUNote);