本文整理汇总了C++中SetImageInfoBlob函数的典型用法代码示例。如果您正苦于以下问题:C++ SetImageInfoBlob函数的具体用法?C++ SetImageInfoBlob怎么用?C++ SetImageInfoBlob使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetImageInfoBlob函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadDOTImage
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e a d D O T I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ReadDOTImage() reads a Graphviz image file and returns it. It allocates
% the memory necessary for the new Image structure and returns a pointer to
% the new image.
%
% The format of the ReadDOTImage method is:
%
% Image *ReadDOTImage(const ImageInfo *image_info,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o exception: return any errors or warnings in this structure.
%
*/
static Image *ReadDOTImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
char
command[MaxTextExtent];
const char
*option;
graph_t
*graph;
Image
*image;
ImageInfo
*read_info;
MagickBooleanType
status;
/*
Open image file.
*/
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,exception);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
return((Image *) NULL);
read_info=CloneImageInfo(image_info);
SetImageInfoBlob(read_info,(void *) NULL,0);
(void) CopyMagickString(read_info->magick,"SVG",MaxTextExtent);
(void) AcquireUniqueFilename(read_info->filename);
(void) FormatLocaleString(command,MaxTextExtent,"-Tsvg -o%s %s",
read_info->filename,image_info->filename);
graph=agread(GetBlobFileHandle(image));
if (graph == (graph_t *) NULL)
return ((Image *) NULL);
option=GetImageOption(image_info,"dot:layout-engine");
if (option == (const char *) NULL)
gvLayout(graphic_context,graph,(char *) "dot");
else
gvLayout(graphic_context,graph,(char *) option);
gvRenderFilename(graphic_context,graph,(char *) "svg",read_info->filename);
gvFreeLayout(graphic_context,graph);
/*
Read SVG graph.
*/
image=ReadImage(read_info,exception);
(void) RelinquishUniqueFileResource(read_info->filename);
read_info=DestroyImageInfo(read_info);
if (image == (Image *) NULL)
return((Image *) NULL);
return(GetFirstImageInList(image));
}
示例2: assert
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e a d M A S K I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ReadMASKImage returns the image mask associated with the image.
%
% The format of the ReadMASKImage method is:
%
% Image *ReadMASKImage(const ImageInfo *image_info,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o exception: return any errors or warnings in this structure.
%
*/
static Image *ReadMASKImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
Image
*image;
ImageInfo
*read_info;
/*
Initialize Image structure.
*/
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);
read_info=CloneImageInfo(image_info);
SetImageInfoBlob(read_info,(void *) NULL,0);
*read_info->magick='\0';
image=ReadImage(read_info,exception);
read_info=DestroyImageInfo(read_info);
if (image != (Image *) NULL)
{
MagickBooleanType
status;
status=GrayscaleImage(image,image->intensity,exception);
if (status == MagickFalse)
image=DestroyImage(image);
}
return(GetFirstImageInList(image));
}
示例3: FaxReadG4
static Image* FaxReadG4(Image *image,const ImageInfo *image_info,
ExceptionInfo *exception)
{
char
filename[MagickPathExtent];
ImageInfo
*read_info;
filename[0]='\0';
if (ImageToFile(image,filename,exception) == MagickFalse)
ThrowImageException(FileOpenError,"UnableToCreateTemporaryFile");
(void) CloseBlob(image);
image=DestroyImage(image);
read_info=CloneImageInfo(image_info);
SetImageInfoBlob(read_info,(void *) NULL,0);
(void) FormatLocaleString(read_info->filename,MagickPathExtent,"group4:%s",
filename);
read_info->orientation=TopLeftOrientation;
image=ReadImage(read_info,exception);
if (image != (Image *) NULL)
{
(void) CopyMagickString(image->filename,image_info->filename,
MagickPathExtent);
(void) CopyMagickString(image->magick_filename,image_info->filename,
MagickPathExtent);
(void) CopyMagickString(image->magick,"G4",MagickPathExtent);
}
read_info=DestroyImageInfo(read_info);
(void) RelinquishUniqueFileResource(filename);
return(GetFirstImageInList(image));
}
示例4: assert
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e a d T I L E I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ReadTILEImage tiles a texture on an image. It allocates the
% memory necessary for the new Image structure and returns a pointer to the
% new image.
%
% The format of the ReadTILEImage method is:
%
% Image *ReadTILEImage(const ImageInfo *image_info,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o exception: return any errors or warnings in this structure.
%
*/
static Image *ReadTILEImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
Image
*image,
*tile_image;
ImageInfo
*read_info;
MagickBooleanType
status;
/*
Initialize Image structure.
*/
assert(image_info != (const ImageInfo *) NULL);
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 == MagickCoreSignature);
read_info=CloneImageInfo(image_info);
SetImageInfoBlob(read_info,(void *) NULL,0);
*read_info->magick='\0';
tile_image=ReadImage(read_info,exception);
read_info=DestroyImageInfo(read_info);
if (tile_image == (Image *) NULL)
return((Image *) NULL);
image=AcquireImage(image_info,exception);
if ((image->columns == 0) || (image->rows == 0))
ThrowReaderException(OptionError,"MustSpecifyImageSize");
if (*image_info->filename == '\0')
ThrowReaderException(OptionError,"MustSpecifyAnImageName");
status=SetImageExtent(image,image->columns,image->rows,exception);
if (status == MagickFalse)
return(DestroyImageList(image));
image->colorspace=tile_image->colorspace;
image->alpha_trait=tile_image->alpha_trait;
if (image->alpha_trait != UndefinedPixelTrait)
(void) SetImageBackgroundColor(image,exception);
(void) CopyMagickString(image->filename,image_info->filename,MagickPathExtent);
if (LocaleCompare(tile_image->magick,"PATTERN") == 0)
{
tile_image->tile_offset.x=0;
tile_image->tile_offset.y=0;
}
(void) TextureImage(image,tile_image,exception);
tile_image=DestroyImage(tile_image);
if (image->colorspace == GRAYColorspace)
image->type=GrayscaleType;
return(GetFirstImageInList(image));
}
示例5: assert
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e a d T I L E I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ReadTILEImage tiles a texture on an image. It allocates the
% memory necessary for the new Image structure and returns a pointer to the
% new image.
%
% The format of the ReadTILEImage method is:
%
% Image *ReadTILEImage(const ImageInfo *image_info,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: The image info.
%
% o exception: return any errors or warnings in this structure.
%
*/
static Image *ReadTILEImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
Image
*image,
*tile_image;
ImageInfo
*read_info;
/*
Initialize Image structure.
*/
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);
read_info=CloneImageInfo(image_info);
SetImageInfoBlob(read_info,(void *) NULL,0);
*read_info->magick='\0';
tile_image=ReadImage(read_info,exception);
read_info=DestroyImageInfo(read_info);
if (tile_image == (Image *) NULL)
return((Image *) NULL);
image=AllocateImage(image_info);
if ((image->columns == 0) || (image->rows == 0))
ThrowReaderException(OptionError,"MustSpecifyImageSize");
if (*image_info->filename == '\0')
ThrowReaderException(OptionError,"MustSpecifyAnImageName");
(void) SetImageBackgroundColor(image);
image->matte=tile_image->matte;
(void) CopyMagickString(image->filename,image_info->filename,MaxTextExtent);
if (LocaleCompare(tile_image->magick,"PATTERN") == 0)
{
tile_image->tile_offset.x=0;
tile_image->tile_offset.y=0;
}
(void) TextureImage(image,tile_image);
tile_image=DestroyImage(tile_image);
return(GetFirstImageInList(image));
}
示例6: assert
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e a d C L I P I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ReadCLIPImage returns the rendered clip path associated with the image.
%
% The format of the ReadCLIPImage method is:
%
% Image *ReadCLIPImage(const ImageInfo *image_info,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o exception: return any errors or warnings in this structure.
%
*/
static Image *ReadCLIPImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
Image
*image;
ImageInfo
*read_info;
/*
Initialize Image structure.
*/
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);
read_info=CloneImageInfo(image_info);
SetImageInfoBlob(read_info,(void *) NULL,0);
(void) CopyMagickString(read_info->magick,"MIFF",MaxTextExtent);
image=ReadImage(read_info,exception);
read_info=DestroyImageInfo(read_info);
if (image != (Image *) NULL)
{
Image
*clip_image;
(void) ClipImage(image);
if (image->clip_mask == (Image *) NULL)
ThrowReaderException(CoderError,"ImageDoesNotHaveAClipMask");
clip_image=CloneImage(image->clip_mask,0,0,MagickTrue,exception);
image=DestroyImage(image);
image=clip_image;
}
return(GetFirstImageInList(image));
}
示例7: SetImageInfoBlob
static Image *ReadPlasmaImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
Image
*image;
ImageInfo
*read_info;
ssize_t
y;
MagickBooleanType
status;
register ssize_t
x;
register PixelPacket
*q;
register size_t
i;
SegmentInfo
segment_info;
size_t
depth,
max_depth;
/*
Recursively apply plasma to the image.
*/
read_info=CloneImageInfo(image_info);
SetImageInfoBlob(read_info,(void *) NULL,0);
(void) FormatMagickString(read_info->filename,MaxTextExtent,
"gradient:%s",image_info->filename);
image=ReadImage(read_info,exception);
read_info=DestroyImageInfo(read_info);
if (image == (Image *) NULL)
return((Image *) NULL);
image->storage_class=DirectClass;
for (y=0; y < (ssize_t) image->rows; y++)
{
q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
q->opacity=(Quantum) (QuantumRange/2);
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
segment_info.x1=0;
segment_info.y1=0;
segment_info.x2=(double) image->columns-1;
segment_info.y2=(double) image->rows-1;
if (LocaleCompare(image_info->filename,"fractal") == 0)
{
RandomInfo
*random_info;
/*
Seed pixels before recursion.
*/
random_info=AcquireRandomInfo();
PlasmaPixel(image,random_info,segment_info.x1,segment_info.y1);
PlasmaPixel(image,random_info,segment_info.x1,(segment_info.y1+
segment_info.y2)/2);
PlasmaPixel(image,random_info,segment_info.x1,segment_info.y2);
PlasmaPixel(image,random_info,(segment_info.x1+segment_info.x2)/2,
segment_info.y1);
PlasmaPixel(image,random_info,(segment_info.x1+segment_info.x2)/2,
(segment_info.y1+segment_info.y2)/2);
PlasmaPixel(image,random_info,(segment_info.x1+segment_info.x2)/2,
segment_info.y2);
PlasmaPixel(image,random_info,segment_info.x2,segment_info.y1);
PlasmaPixel(image,random_info,segment_info.x2,(segment_info.y1+
segment_info.y2)/2);
PlasmaPixel(image,random_info,segment_info.x2,segment_info.y2);
random_info=DestroyRandomInfo(random_info);
}
i=(size_t) MagickMax(image->columns,image->rows)/2;
for (max_depth=0; i != 0; max_depth++)
i>>=1;
for (depth=1; ; depth++)
{
if (PlasmaImage(image,&segment_info,0,depth) != MagickFalse)
break;
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) depth,
max_depth);
if (status == MagickFalse)
break;
}
(void) SetImageAlphaChannel(image,DeactivateAlphaChannel);
return(GetFirstImageInList(image));
}
示例8: assert
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e a d V I D I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ReadVIDImage reads one of more images and creates a Visual Image
% Directory file. It allocates the memory necessary for the new Image
% structure and returns a pointer to the new image.
%
% The format of the ReadVIDImage method is:
%
% Image *ReadVIDImage(const ImageInfo *image_info,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o exception: return any errors or warnings in this structure.
%
*/
static Image *ReadVIDImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
#define ClientName "montage"
char
**filelist,
*label;
Image
*image,
*images,
*montage_image,
*next_image,
*thumbnail_image;
ImageInfo
*read_info;
int
number_files;
MagickBooleanType
status;
MontageInfo
*montage_info;
RectangleInfo
geometry;
register ssize_t
i;
/*
Expand the filename.
*/
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);
filelist=(char **) AcquireAlignedMemory(1,sizeof(*filelist));
if (filelist == (char **) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
filelist[0]=ConstantString(image_info->filename);
number_files=1;
status=ExpandFilenames(&number_files,&filelist);
if ((status == MagickFalse) || (number_files == 0))
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
image=DestroyImage(image);
/*
Read each image and convert them to a tile.
*/
images=NewImageList();
read_info=CloneImageInfo(image_info);
SetImageInfoBlob(read_info,(void *) NULL,0);
(void) SetImageInfoProgressMonitor(read_info,(MagickProgressMonitor) NULL,
(void *) NULL);
if (read_info->size == (char *) NULL)
(void) CloneString(&read_info->size,DefaultTileGeometry);
for (i=0; i < (ssize_t) number_files; i++)
{
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),"name: %s",
filelist[i]);
(void) CopyMagickString(read_info->filename,filelist[i],MaxTextExtent);
filelist[i]=DestroyString(filelist[i]);
*read_info->magick='\0';
next_image=ReadImage(read_info,exception);
CatchException(exception);
if (next_image == (Image *) NULL)
//.........这里部分代码省略.........
示例9: GetBit
static Image *ReadSTEGANOImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
#define GetBit(alpha,i) MagickMin((((unsigned long) (alpha) >> (unsigned long) \
(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)))
Image
*image,
*watermark;
ImageInfo
*read_info;
long
c,
i,
j,
k,
y;
MagickBooleanType
status;
PixelPacket
pixel;
register IndexPacket
*indexes;
register long
x;
register PixelPacket
*q;
unsigned long
depth;
/*
Initialize Image structure.
*/
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->rows == 0))
ThrowReaderException(OptionError,"MustSpecifyImageSize");
read_info=CloneImageInfo(image_info);
SetImageInfoBlob(read_info,(void *) NULL,0);
*read_info->magick='\0';
watermark=ReadImage(read_info,exception);
read_info=DestroyImageInfo(read_info);
if (watermark == (Image *) NULL)
return((Image *) NULL);
watermark->depth=MAGICKCORE_QUANTUM_DEPTH;
if (AcquireImageColormap(image,MaxColormapSize) == MagickFalse)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
if (image_info->ping != MagickFalse)
{
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
/*
Get hidden watermark from low-order bits of image.
*/
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--)
{
for (y=0; (y < (long) image->rows) && (j < (long) depth); y++)
{
x=0;
for (; (x < (long) image->columns) && (j < (long) depth); x++)
{
if ((k/(long) watermark->columns) >= (long) watermark->rows)
break;
(void) GetOneVirtualPixel(watermark,k % (long) watermark->columns,
k/(long) watermark->columns,&pixel,exception);
q=GetAuthenticPixels(image,x,y,1,1,exception);
if (q == (PixelPacket *) NULL)
break;
indexes=GetAuthenticIndexQueue(image);
switch (c)
{
case 0:
{
SetBit(*indexes,i,GetBit(pixel.red,j));
break;
}
case 1:
//.........这里部分代码省略.........
示例10: ReadPWPImage
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e a d P W P I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ReadPWPImage() reads a Seattle Film Works multi-image file and returns
% it. It allocates the memory necessary for the new Image structure and
% returns a pointer to the new image.
%
% The format of the ReadPWPImage method is:
%
% Image *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o exception: return any errors or warnings in this structure.
%
*/
static Image *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
FILE
*file;
Image
*image,
*next_image,
*pwp_image;
ImageInfo
*read_info;
int
c,
unique_file;
MagickBooleanType
status;
register Image
*p;
register ssize_t
i;
size_t
filesize,
length;
ssize_t
count;
unsigned char
magick[MaxTextExtent];
/*
Open image file.
*/
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);
pwp_image=AcquireImage(image_info);
image=pwp_image;
status=OpenBlob(image_info,pwp_image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
return((Image *) NULL);
count=ReadBlob(pwp_image,5,magick);
if ((count == 0) || (LocaleNCompare((char *) magick,"SFW95",5) != 0))
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
read_info=CloneImageInfo(image_info);
(void) SetImageInfoProgressMonitor(read_info,(MagickProgressMonitor) NULL,
(void *) NULL);
SetImageInfoBlob(read_info,(void *) NULL,0);
unique_file=AcquireUniqueFileResource(read_info->filename);
for ( ; ; )
{
for (c=ReadBlobByte(pwp_image); c != EOF; c=ReadBlobByte(pwp_image))
{
for (i=0; i < 17; i++)
magick[i]=magick[i+1];
magick[17]=(unsigned char) c;
if (LocaleNCompare((char *) (magick+12),"SFW94A",6) == 0)
break;
}
if (c == EOF)
break;
if (LocaleNCompare((char *) (magick+12),"SFW94A",6) != 0)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
/*
//.........这里部分代码省略.........
示例11: ReadPESImage
//.........这里部分代码省略.........
{
/*
Normal stitch.
*/
if ((y & 0x40) != 0)
y-=0x80;
}
else
{
/*
Jump stitch.
*/
y=((y & 0x0f) << 8)+ReadBlobByte(image);
if ((y & 0x800) != 0)
y-=0x1000;
}
/*
Note stitch (x,y).
*/
x+=delta_x;
y+=delta_y;
delta_x=x;
delta_y=y;
stitches[i].x=(double) x;
stitches[i].y=(double) y;
if ((double) x < bounds.x1)
bounds.x1=(double) x;
if ((double) x > bounds.x2)
bounds.x2=(double) x;
if ((double) y < bounds.y1)
bounds.y1=(double) y;
if ((double) y > bounds.y2)
bounds.y2=(double) y;
i++;
if (i >= (ssize_t) number_stitches)
{
/*
Make room for more stitches.
*/
number_stitches<<=1;
stitches=(PointInfo *) ResizeQuantumMemory(stitches,(size_t)
number_stitches,sizeof(*stitches));
if (stitches == (PointInfo *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
}
j++;
blocks[j].offset=(ssize_t) i;
number_blocks=(size_t) j;
/*
Write stitches as SVG file.
*/
file=(FILE *) NULL;
unique_file=AcquireUniqueFileResource(filename);
if (unique_file != -1)
file=fdopen(unique_file,"wb");
if ((unique_file == -1) || (file == (FILE *) NULL))
ThrowImageException(FileOpenError,"UnableToCreateTemporaryFile");
(void) FormatLocaleFile(file,"<?xml version=\"1.0\"?>\n");
(void) FormatLocaleFile(file,"<svg xmlns=\"http://www.w3.org/2000/svg\" "
"xlink=\"http://www.w3.org/1999/xlink\" "
"ev=\"http://www.w3.org/2001/xml-events\" version=\"1.1\" "
"baseProfile=\"full\" width=\"%g\" height=\"%g\">\n",bounds.x2-bounds.x1,
bounds.y2-bounds.y1);
for (i=0; i < (ssize_t) number_blocks; i++)
{
offset=blocks[i].offset;
(void) FormatLocaleFile(file," <path stroke=\"#%02x%02x%02x\" "
"fill=\"none\" d=\"M %g %g",blocks[i].color->red,blocks[i].color->green,
blocks[i].color->blue,stitches[offset].x-bounds.x1,
stitches[offset].y-bounds.y1);
for (j=1; j < (ssize_t) (blocks[i+1].offset-offset); j++)
(void) FormatLocaleFile(file," L %g %g",stitches[offset+j].x-bounds.x1,
stitches[offset+j].y-bounds.y1);
(void) FormatLocaleFile(file,"\"/>\n");
}
(void) FormatLocaleFile(file,"</svg>\n");
(void) fclose(file);
(void) CloseBlob(image);
image=DestroyImage(image);
/*
Read SVG file.
*/
read_info=CloneImageInfo(image_info);
SetImageInfoBlob(read_info,(void *) NULL,0);
(void) FormatLocaleString(read_info->filename,MaxTextExtent,"svg:%s",
filename);
image=ReadImage(read_info,exception);
if (image != (Image *) NULL)
{
(void) CopyMagickString(image->filename,image_info->filename,
MaxTextExtent);
(void) CopyMagickString(image->magick_filename,image_info->filename,
MaxTextExtent);
(void) CopyMagickString(image->magick,"PES",MaxTextExtent);
}
read_info=DestroyImageInfo(read_info);
(void) RelinquishUniqueFileResource(filename);
return(GetFirstImageInList(image));
}
示例12: ReadDNGImage
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e a d D N G I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ReadDNGImage() reads an binary file in the Digital Negative format and
% returns it. It allocates the memory necessary for the new Image structure
% and returns a pointer to the new image.
%
% The format of the ReadDNGImage method is:
%
% Image *ReadDNGImage(const ImageInfo *image_info,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o exception: return any errors or warnings in this structure.
%
*/
static Image *ReadDNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
ExceptionInfo
*sans_exception;
Image
*image;
ImageInfo
*read_info;
MagickBooleanType
status;
/*
Open image file.
*/
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);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
(void) CloseBlob(image);
(void) DestroyImageList(image);
/*
Convert DNG to PPM with delegate.
*/
image=AcquireImage(image_info);
read_info=CloneImageInfo(image_info);
SetImageInfoBlob(read_info,(void *) NULL,0);
(void) InvokeDelegate(read_info,image,"dng:decode",(char *) NULL,exception);
image=DestroyImage(image);
(void) FormatLocaleString(read_info->filename,MaxTextExtent,"%s.png",
read_info->unique);
sans_exception=AcquireExceptionInfo();
image=ReadImage(read_info,sans_exception);
sans_exception=DestroyExceptionInfo(sans_exception);
if (image == (Image *) NULL)
{
(void) FormatLocaleString(read_info->filename,MaxTextExtent,"%s.ppm",
read_info->unique);
image=ReadImage(read_info,exception);
}
(void) RelinquishUniqueFileResource(read_info->filename);
if (image != (Image *) NULL)
{
char
filename[MaxTextExtent],
*xml;
ExceptionInfo
*sans;
(void) CopyMagickString(image->magick,read_info->magick,MaxTextExtent);
(void) FormatLocaleString(filename,MaxTextExtent,"%s.ufraw",
read_info->unique);
sans=AcquireExceptionInfo();
xml=FileToString(filename,MaxTextExtent,sans);
(void) RelinquishUniqueFileResource(filename);
if (xml != (char *) NULL)
{
XMLTreeInfo
*ufraw;
//.........这里部分代码省略.........
示例13: GetBit
static Image *ReadSTEGANOImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
#define GetBit(alpha,i) MagickMin((((size_t) (alpha) >> (size_t) \
(i)) & 0x01),16)
#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,
*watermark;
ImageInfo
*read_info;
int
c;
MagickBooleanType
status;
PixelInfo
pixel;
register Quantum
*q;
register ssize_t
x;
size_t
depth,
one;
ssize_t
i,
j,
k,
y;
/*
Initialize Image structure.
*/
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);
one=1;
image=AcquireImage(image_info,exception);
if ((image->columns == 0) || (image->rows == 0))
ThrowReaderException(OptionError,"MustSpecifyImageSize");
read_info=CloneImageInfo(image_info);
SetImageInfoBlob(read_info,(void *) NULL,0);
*read_info->magick='\0';
watermark=ReadImage(read_info,exception);
read_info=DestroyImageInfo(read_info);
if (watermark == (Image *) NULL)
return((Image *) NULL);
watermark->depth=MAGICKCORE_QUANTUM_DEPTH;
if (AcquireImageColormap(image,MaxColormapSize,exception) == MagickFalse)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
if (image_info->ping != MagickFalse)
{
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
/*
Get hidden watermark from low-order bits of image.
*/
c=0;
i=0;
j=0;
i=(ssize_t) (watermark->depth-1);
depth=watermark->depth;
for (k=image->offset; (i >= 0) && (j < (ssize_t) depth); i--)
{
for (y=0; (y < (ssize_t) image->rows) && (j < (ssize_t) depth); y++)
{
x=0;
for ( ; (x < (ssize_t) image->columns) && (j < (ssize_t) depth); x++)
{
if ((k/(ssize_t) watermark->columns) >= (ssize_t) watermark->rows)
break;
(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 == (Quantum *) NULL)
break;
switch (c)
{
case 0:
{
SetBit(i,GetBit(pixel.red,j));
break;
}
//.........这里部分代码省略.........
示例14: assert
//.........这里部分代码省略.........
buffer=(unsigned char *) RelinquishMagickMemory(buffer);
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
}
TranslateSFWMarker(header); /* translate soi and app tags */
TranslateSFWMarker(header+2);
(void) CopyMagickMemory(header+6,"JFIF\0\001\0",7); /* JFIF magic */
/*
Translate remaining markers.
*/
offset=header+2;
offset+=(((unsigned int) offset[2]) << 8)+offset[3]+2;
for ( ; ; )
{
if ((offset+4) > (buffer+count-1))
{
buffer=(unsigned char *) RelinquishMagickMemory(buffer);
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
TranslateSFWMarker(offset);
if (offset[1] == 0xda)
break;
offset+=(((unsigned int) offset[2]) << 8)+offset[3]+2;
}
offset--;
data=SFWScan(offset,buffer+count-1,(const unsigned char *) "\377\311",2);
if (data == (unsigned char *) NULL)
{
buffer=(unsigned char *) RelinquishMagickMemory(buffer);
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
}
TranslateSFWMarker(data++); /* translate eoi marker */
/*
Write JFIF file.
*/
read_info=CloneImageInfo(image_info);
SetImageInfoBlob(read_info,(void *) NULL,0);
file=(FILE *) NULL;
unique_file=AcquireUniqueFileResource(read_info->filename);
if (unique_file != -1)
file=fopen_utf8(read_info->filename,"wb");
if ((unique_file == -1) || (file == (FILE *) NULL))
{
buffer=(unsigned char *) RelinquishMagickMemory(buffer);
read_info=DestroyImageInfo(read_info);
(void) CopyMagickString(image->filename,read_info->filename,
MagickPathExtent);
ThrowFileException(exception,FileOpenError,"UnableToCreateTemporaryFile",
image->filename);
image=DestroyImageList(image);
return((Image *) NULL);
}
extent=fwrite(header,(size_t) (offset-header+1),1,file);
(void) extent;
extent=fwrite(HuffmanTable,1,sizeof(HuffmanTable)/sizeof(*HuffmanTable),file);
extent=fwrite(offset+1,(size_t) (data-offset),1,file);
status=ferror(file) == -1 ? MagickFalse : MagickTrue;
(void) fclose(file);
(void) close(unique_file);
buffer=(unsigned char *) RelinquishMagickMemory(buffer);
if (status == MagickFalse)
{
char
*message;
(void) remove_utf8(read_info->filename);
read_info=DestroyImageInfo(read_info);
message=GetExceptionMessage(errno);
(void) ThrowMagickException(exception,GetMagickModule(),FileOpenError,
"UnableToWriteFile","`%s': %s",image->filename,message);
message=DestroyString(message);
image=DestroyImageList(image);
return((Image *) NULL);
}
/*
Read JPEG image.
*/
jpeg_image=ReadImage(read_info,exception);
(void) RelinquishUniqueFileResource(read_info->filename);
read_info=DestroyImageInfo(read_info);
if (jpeg_image == (Image *) NULL)
{
image=DestroyImageList(image);
return(jpeg_image);
}
(void) CopyMagickString(jpeg_image->filename,image->filename,MagickPathExtent);
(void) CopyMagickString(jpeg_image->magick,image->magick,MagickPathExtent);
image=DestroyImageList(image);
image=jpeg_image;
/*
Correct image orientation.
*/
flipped_image=FlipImage(image,exception);
if (flipped_image != (Image *) NULL)
{
DuplicateBlob(flipped_image,image);
image=DestroyImage(image);
image=flipped_image;
}
return(GetFirstImageInList(image));
}
示例15: ReadTEXTImage
//.........这里部分代码省略.........
geometry_info;
MagickStatusType
flags;
flags=ParseGeometry(PSDensityGeometry,&geometry_info);
image->x_resolution=geometry_info.rho;
image->y_resolution=geometry_info.sigma;
if ((flags & SigmaValue) == 0)
image->y_resolution=image->x_resolution;
}
page.width=612;
page.height=792;
page.x=43;
page.y=43;
if (image_info->page != (char *) NULL)
(void) ParseAbsoluteGeometry(image_info->page,&page);
/*
Initialize Image structure.
*/
image->columns=(size_t) floor((((double) page.width*image->x_resolution)/
delta.x)+0.5);
image->rows=(size_t) floor((((double) page.height*image->y_resolution)/
delta.y)+0.5);
image->page.x=0;
image->page.y=0;
texture=(Image *) NULL;
if (image_info->texture != (char *) NULL)
{
ImageInfo
*read_info;
read_info=CloneImageInfo(image_info);
SetImageInfoBlob(read_info,(void *) NULL,0);
(void) CopyMagickString(read_info->filename,image_info->texture,
MaxTextExtent);
texture=ReadImage(read_info,exception);
read_info=DestroyImageInfo(read_info);
}
/*
Annotate the text image.
*/
(void) SetImageBackgroundColor(image);
draw_info=CloneDrawInfo(image_info,(DrawInfo *) NULL);
(void) CloneString(&draw_info->text,image_info->filename);
(void) FormatLocaleString(geometry,MaxTextExtent,"0x0%+ld%+ld",(long) page.x,
(long) page.y);
(void) CloneString(&draw_info->geometry,geometry);
status=GetTypeMetrics(image,draw_info,&metrics);
if (status == MagickFalse)
ThrowReaderException(TypeError,"UnableToGetTypeMetrics");
page.y=(ssize_t) ceil((double) page.y+metrics.ascent-0.5);
(void) FormatLocaleString(geometry,MaxTextExtent,"0x0%+ld%+ld",(long) page.x,
(long) page.y);
(void) CloneString(&draw_info->geometry,geometry);
(void) CopyMagickString(filename,image_info->filename,MaxTextExtent);
if (*draw_info->text != '\0')
*draw_info->text='\0';
p=text;
for (offset=2*page.y; p != (char *) NULL; )
{
/*
Annotate image with text.
*/
(void) ConcatenateString(&draw_info->text,text);
(void) ConcatenateString(&draw_info->text,"\n");