本文整理汇总了C++中DestroyQuantumInfo函数的典型用法代码示例。如果您正苦于以下问题:C++ DestroyQuantumInfo函数的具体用法?C++ DestroyQuantumInfo怎么用?C++ DestroyQuantumInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DestroyQuantumInfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AcquireMagickMemory
MagickExport QuantumInfo *AcquireQuantumInfo(const ImageInfo *image_info,
Image *image)
{
MagickBooleanType
status;
QuantumInfo
*quantum_info;
quantum_info=(QuantumInfo *) AcquireMagickMemory(sizeof(*quantum_info));
if (quantum_info == (QuantumInfo *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
quantum_info->signature=MagickSignature;
GetQuantumInfo(image_info,quantum_info);
if (image == (const Image *) NULL)
return(quantum_info);
status=SetQuantumDepth(image,quantum_info,image->depth);
if (status == MagickFalse)
quantum_info=DestroyQuantumInfo(quantum_info);
return(quantum_info);
}
示例2: ReadRGBImage
//.........这里部分代码省略.........
register long
x;
register PixelPacket
*__restrict q;
if (count != (ssize_t) length)
{
ThrowFileException(exception,CorruptImageError,
"UnexpectedEndOfFile",image->filename);
break;
}
q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
exception);
if (q == (PixelPacket *) NULL)
break;
length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
quantum_info,quantum_types[i],pixels,exception);
if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
break;
if (((y-image->extract_info.y) >= 0) &&
((y-image->extract_info.y) < (long) image->rows))
{
p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
canvas_image->columns,1,exception);
q=GetAuthenticPixels(image,0,y-image->extract_info.y,
image->columns,1,exception);
if ((p == (const PixelPacket *) NULL) ||
(q == (PixelPacket *) NULL))
break;
for (x=0; x < (long) image->columns; x++)
{
switch(quantum_types[i])
{
case RedQuantum: q->red=p->red; break;
case GreenQuantum: q->green=p->green; break;
case BlueQuantum: q->blue=p->blue; break;
case OpacityQuantum:
case AlphaQuantum: q->opacity=p->opacity; break;
default: break;
}
p++;
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
count=ReadBlob(image,length,pixels);
}
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,(i+1),5);
if (status == MagickFalse)
break;
}
if (i != (channels-1))
(void) CloseBlob(image);
}
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,5,5);
if (status == MagickFalse)
break;
}
break;
}
}
SetQuantumImageType(image,quantum_type);
/*
Proceed to next image.
*/
if (image_info->number_scenes != 0)
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
if (count == (ssize_t) length)
{
/*
Allocate next image structure.
*/
AcquireNextImage(image_info,image);
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
image=SyncNextImageInList(image);
status=SetImageProgress(image,LoadImagesTag,TellBlob(image),
GetBlobSize(image));
if (status == MagickFalse)
break;
}
scene++;
} while (count == (ssize_t) length);
quantum_info=DestroyQuantumInfo(quantum_info);
InheritException(&image->exception,&canvas_image->exception);
canvas_image=DestroyImage(canvas_image);
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
示例3: WriteRGBImage
//.........这里部分代码省略.........
}
break;
}
case PlaneInterlace:
{
/*
Plane interlacing: RRRRRR...GGGGGG...BBBBBB...
*/
for (i=0; i < (long) channels; i++)
{
for (y=0; y < (long) image->rows; y++)
{
register const PixelPacket
*__restrict p;
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
length=ExportQuantumPixels(image,(const CacheView *) NULL,
quantum_info,quantum_types[i],pixels,&image->exception);
count=WriteBlob(image,length,pixels);
if (count != (ssize_t) length)
break;
}
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,(i+1),5);
if (status == MagickFalse)
break;
}
}
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,5,5);
if (status == MagickFalse)
break;
}
break;
}
case PartitionInterlace:
{
char
sfx[] = {0, 0};
/*
Partition interlacing: RRRRRR..., GGGGGG..., BBBBBB...
*/
for (i=0; i < (long) channels; i++)
{
sfx[0]=image_info->magick[i];
AppendImageFormat(sfx,image->filename);
status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
AppendBinaryBlobMode,&image->exception);
if (status == MagickFalse)
return(status);
for (y=0; y < (long) image->rows; y++)
{
register const PixelPacket
*__restrict p;
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
length=ExportQuantumPixels(image,(const CacheView *) NULL,
quantum_info,quantum_types[i],pixels,&image->exception);
count=WriteBlob(image,length,pixels);
if (count != (ssize_t) length)
break;
}
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,(i+1),5);
if (status == MagickFalse)
break;
}
(void) CloseBlob(image);
}
(void) CopyMagickString(image->filename,image_info->filename,
MaxTextExtent);
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,5,5);
if (status == MagickFalse)
break;
}
break;
}
}
quantum_info=DestroyQuantumInfo(quantum_info);
if (GetNextImageInList(image) == (Image *) NULL)
break;
image=SyncNextImageInList(image);
status=SetImageProgress(image,SaveImagesTag,scene++,
GetImageListLength(image));
if (status == MagickFalse)
break;
} while (image_info->adjoin != MagickFalse);
(void) CloseBlob(image);
return(MagickTrue);
}
示例4: WriteCINImage
//.........这里部分代码省略.........
offset+=WriteBlobFloat(image,cin.origination.gamma);
offset+=WriteBlob(image,sizeof(cin.origination.reserve),(unsigned char *)
cin.origination.reserve);
/*
Image film information.
*/
cin.film.id=0;
value=GetCINProperty(image_info,image,"dpx:film.id",exception);
if (value != (const char *) NULL)
cin.film.id=(char) StringToLong(value);
offset+=WriteBlobByte(image,(unsigned char) cin.film.id);
cin.film.type=0;
value=GetCINProperty(image_info,image,"dpx:film.type",exception);
if (value != (const char *) NULL)
cin.film.type=(char) StringToLong(value);
offset+=WriteBlobByte(image,(unsigned char) cin.film.type);
cin.film.offset=0;
value=GetCINProperty(image_info,image,"dpx:film.offset",exception);
if (value != (const char *) NULL)
cin.film.offset=(char) StringToLong(value);
offset+=WriteBlobByte(image,(unsigned char) cin.film.offset);
offset+=WriteBlobByte(image,(unsigned char) cin.film.reserve1);
cin.film.prefix=0UL;
value=GetCINProperty(image_info,image,"dpx:film.prefix",exception);
if (value != (const char *) NULL)
cin.film.prefix=StringToUnsignedLong(value);
offset+=WriteBlobLong(image,(unsigned int) cin.film.prefix);
cin.film.count=0UL;
value=GetCINProperty(image_info,image,"dpx:film.count",exception);
if (value != (const char *) NULL)
cin.film.count=StringToUnsignedLong(value);
offset+=WriteBlobLong(image,(unsigned int) cin.film.count);
value=GetCINProperty(image_info,image,"dpx:film.format",exception);
if (value != (const char *) NULL)
(void) CopyMagickString(cin.film.format,value,sizeof(cin.film.format));
offset+=WriteBlob(image,sizeof(cin.film.format),(unsigned char *)
cin.film.format);
cin.film.frame_position=0UL;
value=GetCINProperty(image_info,image,"dpx:film.frame_position",exception);
if (value != (const char *) NULL)
cin.film.frame_position=StringToUnsignedLong(value);
offset+=WriteBlobLong(image,(unsigned int) cin.film.frame_position);
cin.film.frame_rate=0.0f;
value=GetCINProperty(image_info,image,"dpx:film.frame_rate",exception);
if (value != (const char *) NULL)
cin.film.frame_rate=StringToDouble(value,(char **) NULL);
offset+=WriteBlobFloat(image,cin.film.frame_rate);
value=GetCINProperty(image_info,image,"dpx:film.frame_id",exception);
if (value != (const char *) NULL)
(void) CopyMagickString(cin.film.frame_id,value,sizeof(cin.film.frame_id));
offset+=WriteBlob(image,sizeof(cin.film.frame_id),(unsigned char *)
cin.film.frame_id);
value=GetCINProperty(image_info,image,"dpx:film.slate_info",exception);
if (value != (const char *) NULL)
(void) CopyMagickString(cin.film.slate_info,value,
sizeof(cin.film.slate_info));
offset+=WriteBlob(image,sizeof(cin.film.slate_info),(unsigned char *)
cin.film.slate_info);
offset+=WriteBlob(image,sizeof(cin.film.reserve),(unsigned char *)
cin.film.reserve);
if (profile != (StringInfo *) NULL)
offset+=WriteBlob(image,GetStringInfoLength(profile),
GetStringInfoDatum(profile));
while (offset < (MagickOffsetType) cin.file.image_offset)
offset+=WriteBlobByte(image,0x00);
/*
Convert pixel packets to CIN raster image.
*/
quantum_info=AcquireQuantumInfo(image_info,image);
if (quantum_info == (QuantumInfo *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
quantum_info->quantum=32;
quantum_info->pack=MagickFalse;
quantum_type=RGBQuantum;
pixels=GetQuantumPixels(quantum_info);
length=GetBytesPerRow(image->columns,3,image->depth,MagickTrue);
if (0)
{
quantum_type=GrayQuantum;
length=GetBytesPerRow(image->columns,1,image->depth,MagickTrue);
}
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
(void) ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
quantum_type,pixels,exception);
count=WriteBlob(image,length,pixels);
if (count != (ssize_t) length)
break;
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
quantum_info=DestroyQuantumInfo(quantum_info);
(void) CloseBlob(image);
return(status);
}
示例5: assert
//.........这里部分代码省略.........
cin.film.prefix);
cin.film.count=ReadBlobLong(image);
offset+=4;
offset+=ReadBlob(image,sizeof(cin.film.format),(unsigned char *)
cin.film.format);
(void) SetImageProperty(image,"dpx:film.format",cin.film.format,
exception);
cin.film.frame_position=ReadBlobLong(image);
offset+=4;
if (cin.film.frame_position != ~0UL)
(void) FormatImageProperty(image,"dpx:film.frame_position","%.20g",
(double) cin.film.frame_position);
cin.film.frame_rate=ReadBlobFloat(image);
offset+=4;
if (IsFloatDefined(cin.film.frame_rate) != MagickFalse)
(void) FormatImageProperty(image,"dpx:film.frame_rate","%g",
cin.film.frame_rate);
offset+=ReadBlob(image,sizeof(cin.film.frame_id),(unsigned char *)
cin.film.frame_id);
(void) SetImageProperty(image,"dpx:film.frame_id",cin.film.frame_id,
exception);
offset+=ReadBlob(image,sizeof(cin.film.slate_info),(unsigned char *)
cin.film.slate_info);
(void) SetImageProperty(image,"dpx:film.slate_info",cin.film.slate_info,
exception);
offset+=ReadBlob(image,sizeof(cin.film.reserve),(unsigned char *)
cin.film.reserve);
}
if ((cin.file.image_offset > 2048) && (cin.file.user_length != 0))
{
StringInfo
*profile;
/*
User defined data.
*/
profile=BlobToStringInfo((const void *) NULL,cin.file.user_length);
if (profile == (StringInfo *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
offset+=ReadBlob(image,GetStringInfoLength(profile),
GetStringInfoDatum(profile));
(void) SetImageProfile(image,"dpx:user.data",profile,exception);
profile=DestroyStringInfo(profile);
}
for ( ; offset < (MagickOffsetType) cin.file.image_offset; offset++)
(void) ReadBlobByte(image);
image->depth=cin.image.channel[0].bits_per_pixel;
image->columns=cin.image.channel[0].pixels_per_line;
image->rows=cin.image.channel[0].lines_per_image;
if (image_info->ping)
{
(void) CloseBlob(image);
return(image);
}
/*
Convert CIN raster image to pixel packets.
*/
quantum_info=AcquireQuantumInfo(image_info,image);
if (quantum_info == (QuantumInfo *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
quantum_info->quantum=32;
quantum_info->pack=MagickFalse;
quantum_type=RGBQuantum;
pixels=GetQuantumPixels(quantum_info);
length=GetQuantumExtent(image,quantum_info,quantum_type);
length=GetBytesPerRow(image->columns,3,image->depth,MagickTrue);
if (cin.image.number_channels == 1)
{
quantum_type=GrayQuantum;
length=GetBytesPerRow(image->columns,1,image->depth,MagickTrue);
}
for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (Quantum *) NULL)
break;
count=ReadBlob(image,length,pixels);
if ((size_t) count != length)
break;
(void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
quantum_type,pixels,exception);
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
SetQuantumImageType(image,quantum_type);
quantum_info=DestroyQuantumInfo(quantum_info);
if (EOFBlob(image) != MagickFalse)
ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
image->filename);
SetImageColorspace(image,LogColorspace,exception);
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
示例6: WriteFITSImage
//.........这里部分代码省略.........
{
length=GetQuantumExtent(image,quantum_info,GrayQuantum);
for (y=(ssize_t) image->rows-1; y >= 0; y--)
{
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
length=ExportQuantumPixels(image,(const CacheView *) NULL,quantum_info,
GrayQuantum,pixels,&image->exception);
if (image->depth == 16)
SetFITSUnsignedPixels(image->columns,image->depth,pixels);
if (((image->depth == 32) || (image->depth == 64)) &&
(quantum_info->format != FloatingPointQuantumFormat))
SetFITSUnsignedPixels(image->columns,image->depth,pixels);
count=WriteBlob(image,length,pixels);
if (count != (ssize_t) length)
break;
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
else
{
length=GetQuantumExtent(image,quantum_info,RedQuantum);
for (y=(ssize_t) image->rows-1; y >= 0; y--)
{
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
length=ExportQuantumPixels(image,(const CacheView *) NULL,quantum_info,
RedQuantum,pixels,&image->exception);
if (image->depth == 16)
SetFITSUnsignedPixels(image->columns,image->depth,pixels);
if (((image->depth == 32) || (image->depth == 64)) &&
(quantum_info->format != FloatingPointQuantumFormat))
SetFITSUnsignedPixels(image->columns,image->depth,pixels);
count=WriteBlob(image,length,pixels);
if (count != (ssize_t) length)
break;
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
length=GetQuantumExtent(image,quantum_info,GreenQuantum);
for (y=(ssize_t) image->rows-1; y >= 0; y--)
{
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
length=ExportQuantumPixels(image,(const CacheView *) NULL,quantum_info,
GreenQuantum,pixels,&image->exception);
if (image->depth == 16)
SetFITSUnsignedPixels(image->columns,image->depth,pixels);
if (((image->depth == 32) || (image->depth == 64)) &&
(quantum_info->format != FloatingPointQuantumFormat))
SetFITSUnsignedPixels(image->columns,image->depth,pixels);
count=WriteBlob(image,length,pixels);
if (count != (ssize_t) length)
break;
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
length=GetQuantumExtent(image,quantum_info,BlueQuantum);
for (y=(ssize_t) image->rows-1; y >= 0; y--)
{
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
length=ExportQuantumPixels(image,(const CacheView *) NULL,quantum_info,
BlueQuantum,pixels,&image->exception);
if (image->depth == 16)
SetFITSUnsignedPixels(image->columns,image->depth,pixels);
if (((image->depth == 32) || (image->depth == 64)) &&
(quantum_info->format != FloatingPointQuantumFormat))
SetFITSUnsignedPixels(image->columns,image->depth,pixels);
count=WriteBlob(image,length,pixels);
if (count != (ssize_t) length)
break;
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
quantum_info=DestroyQuantumInfo(quantum_info);
length=(size_t) (FITSBlocksize-TellBlob(image) % FITSBlocksize);
if (length != 0)
{
(void) ResetMagickMemory(fits_info,0,length*sizeof(*fits_info));
(void) WriteBlob(image,length,(unsigned char *) fits_info);
}
fits_info=DestroyString(fits_info);
(void) CloseBlob(image);
return(MagickTrue);
}
示例7: WriteVICARImage
//.........这里部分代码省略.........
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% WriteVICARImage() writes an image in the VICAR rasterfile format.
% Vicar files contain a text header, followed by one or more planes of binary
% grayscale image data. Vicar files are designed to allow many planes to be
% stacked together to form image cubes. This method only writes a single
% grayscale plane.
%
% WriteVICARImage was written contributed by [email protected]
%
% The format of the WriteVICARImage method is:
%
% MagickBooleanType WriteVICARImage(const ImageInfo *image_info,
% Image *image)
%
% A description of each parameter follows.
%
% o image_info: the image info.
%
% o image: The image.
%
*/
static MagickBooleanType WriteVICARImage(const ImageInfo *image_info,
Image *image)
{
char
header[MaxTextExtent];
int
y;
MagickBooleanType
status;
QuantumInfo
*quantum_info;
register const PixelPacket
*p;
size_t
length;
ssize_t
count;
unsigned char
*pixels;
/*
Open output image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
if (status == MagickFalse)
return(status);
if (IsRGBColorspace(image->colorspace) == MagickFalse)
(void) TransformImageColorspace(image,sRGBColorspace);
/*
Write header.
*/
(void) ResetMagickMemory(header,' ',MaxTextExtent);
(void) FormatLocaleString(header,MaxTextExtent,
"LBLSIZE=%.20g FORMAT='BYTE' TYPE='IMAGE' BUFSIZE=20000 DIM=2 EOL=0 "
"RECSIZE=%.20g ORG='BSQ' NL=%.20g NS=%.20g NB=1 N1=0 N2=0 N3=0 N4=0 NBB=0 "
"NLB=0 TASK='ImageMagick'",(double) MaxTextExtent,(double) image->columns,
(double) image->rows,(double) image->columns);
(void) WriteBlob(image,MaxTextExtent,(unsigned char *) header);
/*
Write VICAR pixels.
*/
image->depth=8;
quantum_info=AcquireQuantumInfo(image_info,image);
if (quantum_info == (QuantumInfo *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
pixels=GetQuantumPixels(quantum_info);
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
length=ExportQuantumPixels(image,(const CacheView *) NULL,quantum_info,
GrayQuantum,pixels,&image->exception);
count=WriteBlob(image,length,pixels);
if (count != (ssize_t) length)
break;
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
quantum_info=DestroyQuantumInfo(quantum_info);
(void) CloseBlob(image);
return(MagickTrue);
}
示例8: WriteYCBCRImage
//.........这里部分代码省略.........
if (status == MagickFalse)
break;
}
(void) CloseBlob(image);
AppendImageFormat("Cb",image->filename);
status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
AppendBinaryBlobMode,&image->exception);
if (status == MagickFalse)
return(status);
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
length=ExportQuantumPixels(image,(const CacheView *) NULL,
quantum_info,GreenQuantum,pixels,&image->exception);
count=WriteBlob(image,length,pixels);
if (count != (ssize_t) length)
break;
}
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,2,5);
if (status == MagickFalse)
break;
}
(void) CloseBlob(image);
AppendImageFormat("Cr",image->filename);
status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
AppendBinaryBlobMode,&image->exception);
if (status == MagickFalse)
return(status);
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
length=ExportQuantumPixels(image,(const CacheView *) NULL,
quantum_info,BlueQuantum,pixels,&image->exception);
count=WriteBlob(image,length,pixels);
if (count != (ssize_t) length)
break;
}
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,3,5);
if (status == MagickFalse)
break;
}
if (quantum_type == RGBAQuantum)
{
(void) CloseBlob(image);
AppendImageFormat("A",image->filename);
status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
AppendBinaryBlobMode,&image->exception);
if (status == MagickFalse)
return(status);
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,
&image->exception);
if (p == (const PixelPacket *) NULL)
break;
length=ExportQuantumPixels(image,(const CacheView *) NULL,
quantum_info,AlphaQuantum,pixels,&image->exception);
count=WriteBlob(image,length,pixels);
if (count != (ssize_t) length)
break;
}
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,4,5);
if (status == MagickFalse)
break;
}
}
(void) CloseBlob(image);
(void) CopyMagickString(image->filename,image_info->filename,
MaxTextExtent);
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,5,5);
if (status == MagickFalse)
break;
}
break;
}
}
quantum_info=DestroyQuantumInfo(quantum_info);
if (GetNextImageInList(image) == (Image *) NULL)
break;
image=SyncNextImageInList(image);
status=SetImageProgress(image,SaveImagesTag,scene++,
GetImageListLength(image));
if (status == MagickFalse)
break;
} while (image_info->adjoin != MagickFalse);
(void) CloseBlob(image);
return(MagickTrue);
}
示例9: ReadRAWImage
//.........这里部分代码省略.........
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
status=SetImageExtent(image,image->columns,image->rows);
if (status == MagickFalse)
{
InheritException(exception,&image->exception);
return(DestroyImageList(image));
}
if (scene == 0)
{
length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
pixels=(const unsigned char *) ReadBlobStream(image,length,
GetQuantumPixels(quantum_info),&count);
}
for (y=0; y < (ssize_t) image->extract_info.height; y++)
{
register const PixelPacket
*magick_restrict p;
register PixelPacket
*magick_restrict q;
register ssize_t
x;
if (count != (ssize_t) length)
{
ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
image->filename);
break;
}
q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,quantum_info,
quantum_type,pixels,exception);
if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
break;
if (((y-image->extract_info.y) >= 0) &&
((y-image->extract_info.y) < (ssize_t) image->rows))
{
p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
image->columns,1,exception);
q=QueueAuthenticPixels(image,0,y-image->extract_info.y,image->columns,
1,exception);
if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL))
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelRed(q,GetPixelRed(p));
SetPixelGreen(q,GetPixelGreen(p));
SetPixelBlue(q,GetPixelBlue(p));
p++;
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
pixels=(const unsigned char *) ReadBlobStream(image,length,
GetQuantumPixels(quantum_info),&count);
}
SetQuantumImageType(image,quantum_type);
/*
Proceed to next image.
*/
if (image_info->number_scenes != 0)
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
if (count == (ssize_t) length)
{
/*
Allocate next image structure.
*/
AcquireNextImage(image_info,image);
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
image=SyncNextImageInList(image);
status=SetImageProgress(image,LoadImagesTag,TellBlob(image),
GetBlobSize(image));
if (status == MagickFalse)
break;
}
scene++;
} while (count == (ssize_t) length);
quantum_info=DestroyQuantumInfo(quantum_info);
InheritException(&image->exception,&canvas_image->exception);
canvas_image=DestroyImage(canvas_image);
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
示例10: WriteRAWImage
//.........这里部分代码省略.........
{
quantum_type=CyanQuantum;
if (image->colorspace == CMYKColorspace)
break;
ThrowWriterException(ImageError,"ColorSeparatedImageRequired");
}
case 'g':
case 'G':
{
quantum_type=GreenQuantum;
break;
}
case 'I':
case 'i':
{
quantum_type=IndexQuantum;
break;
}
case 'K':
case 'k':
{
quantum_type=BlackQuantum;
if (image->colorspace == CMYKColorspace)
break;
ThrowWriterException(ImageError,"ColorSeparatedImageRequired");
}
case 'M':
case 'm':
{
quantum_type=MagentaQuantum;
if (image->colorspace == CMYKColorspace)
break;
ThrowWriterException(ImageError,"ColorSeparatedImageRequired");
}
case 'o':
case 'O':
{
quantum_type=OpacityQuantum;
break;
}
case 'R':
case 'r':
{
quantum_type=RedQuantum;
break;
}
case 'Y':
case 'y':
{
quantum_type=YellowQuantum;
if (image->colorspace == CMYKColorspace)
break;
ThrowWriterException(ImageError,"ColorSeparatedImageRequired");
}
default:
{
quantum_type=GrayQuantum;
break;
}
}
scene=0;
do
{
/*
Convert image to RAW raster pixels.
*/
quantum_info=AcquireQuantumInfo(image_info,image);
if (quantum_info == (QuantumInfo *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
pixels=GetQuantumPixels(quantum_info);
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
length=ExportQuantumPixels(image,(const CacheView *) NULL,quantum_info,
quantum_type,pixels,&image->exception);
count=WriteBlob(image,length,pixels);
if (count != (ssize_t) length)
break;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
quantum_info=DestroyQuantumInfo(quantum_info);
if (GetNextImageInList(image) == (Image *) NULL)
break;
image=SyncNextImageInList(image);
status=SetImageProgress(image,SaveImagesTag,scene++,
GetImageListLength(image));
if (status == MagickFalse)
break;
} while (image_info->adjoin != MagickFalse);
(void) CloseBlob(image);
return(MagickTrue);
}
示例11: WriteIPLImage
//.........这里部分代码省略.........
/*
Write IPL header.
*/
/* Shockingly (maybe not if you have used IPLab), IPLab itself CANNOT read MSBEndian
files! The reader above can, but they cannot. For compatability reasons, I will leave
the code in here, but it is all but useless if you want to use IPLab. */
if(image_info->endian == MSBEndian)
(void) WriteBlob(image, 4, (const unsigned char *) "mmmm");
else{
image->endian = LSBEndian;
(void) WriteBlob(image, 4, (const unsigned char *) "iiii");
}
(void) WriteBlobLong(image, 4);
(void) WriteBlob(image, 4, (const unsigned char *) "100f");
(void) WriteBlob(image, 4, (const unsigned char *) "data");
(void) WriteBlobLong(image, ipl_info.size);
(void) WriteBlobLong(image, ipl_info.width);
(void) WriteBlobLong(image, ipl_info.height);
(void) WriteBlobLong(image, ipl_info.colors);
if(image_info->adjoin == MagickFalse)
(void) WriteBlobLong(image, 1);
else
(void) WriteBlobLong(image, ipl_info.z);
(void) WriteBlobLong(image, ipl_info.time);
(void) WriteBlobLong(image, ipl_info.byteType);
exception=(&image->exception);
do
{
/*
Convert MIFF to IPL raster pixels.
*/
pixels=GetQuantumPixels(quantum_info);
if(ipl_info.colors == 1){
/* Red frame */
for(y = 0; y < (ssize_t) ipl_info.height; y++){
p=GetAuthenticPixels(image,0,y,image->columns,1,exception);
if (p == (PixelPacket *) NULL)
break;
(void) ExportQuantumPixels(image,(const CacheView *) NULL, quantum_info,
GrayQuantum, pixels,&image->exception);
(void) WriteBlob(image, image->columns*image->depth/8, pixels);
}
}
if(ipl_info.colors == 3){
/* Red frame */
for(y = 0; y < (ssize_t) ipl_info.height; y++){
p=GetAuthenticPixels(image,0,y,image->columns,1,exception);
if (p == (PixelPacket *) NULL)
break;
(void) ExportQuantumPixels(image,(const CacheView *) NULL, quantum_info,
RedQuantum, pixels,&image->exception);
(void) WriteBlob(image, image->columns*image->depth/8, pixels);
}
/* Green frame */
for(y = 0; y < (ssize_t) ipl_info.height; y++){
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (PixelPacket *) NULL)
break;
(void) ExportQuantumPixels(image,(const CacheView *) NULL, quantum_info,
GreenQuantum, pixels,&image->exception);
(void) WriteBlob(image, image->columns*image->depth/8, pixels);
}
/* Blue frame */
for(y = 0; y < (ssize_t) ipl_info.height; y++){
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (PixelPacket *) NULL)
break;
(void) ExportQuantumPixels(image,(const CacheView *) NULL, quantum_info,
BlueQuantum, pixels,&image->exception);
(void) WriteBlob(image, image->columns*image->depth/8, pixels);
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
}
quantum_info=DestroyQuantumInfo(quantum_info);
if (GetNextImageInList(image) == (Image *) NULL)
break;
image=SyncNextImageInList(image);
status=SetImageProgress(image,SaveImagesTag,scene++,
GetImageListLength(image));
if (status == MagickFalse)
break;
}while (image_info->adjoin != MagickFalse);
(void) WriteBlob(image, 4, (const unsigned char *) "fini");
(void) WriteBlobLong(image, 0);
CloseBlob(image);
return(MagickTrue);
}
示例12: assert
//.........这里部分代码省略.........
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
/*
printf("Length: %.20g, Memory size: %.20g\n", (double) length,(double)
image->depth);
*/
quantum_info=AcquireQuantumInfo(image_info,image);
if (quantum_info == (QuantumInfo *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
status=SetQuantumFormat(image,quantum_info,quantum_format);
if (status == MagickFalse)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
pixels=GetQuantumPixels(quantum_info);
if(image->columns != ipl_info.width){
/*
printf("Columns not set correctly! Wanted: %.20g, got: %.20g\n",
(double) ipl_info.width, (double) image->columns);
*/
}
/*
Covert IPL binary to pixel packets
*/
if(ipl_info.colors == 1){
for(y = 0; y < (ssize_t) image->rows; y++){
(void) ReadBlob(image, length*image->depth/8, pixels);
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
(void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
GrayQuantum,pixels,exception);
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
}
else{
for(y = 0; y < (ssize_t) image->rows; y++){
(void) ReadBlob(image, length*image->depth/8, pixels);
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
(void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
RedQuantum,pixels,exception);
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
for(y = 0; y < (ssize_t) image->rows; y++){
(void) ReadBlob(image, length*image->depth/8, pixels);
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
(void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
GreenQuantum,pixels,exception);
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
for(y = 0; y < (ssize_t) image->rows; y++){
(void) ReadBlob(image, length*image->depth/8, pixels);
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
(void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
BlueQuantum,pixels,exception);
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
}
SetQuantumImageType(image,quantum_type);
t_count++;
quantum_info = DestroyQuantumInfo(quantum_info);
if (EOFBlob(image) != MagickFalse)
{
ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
image->filename);
break;
}
if(t_count < ipl_info.z * ipl_info.time){
/*
Proceed to next image.
*/
AcquireNextImage(image_info, image);
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
image=SyncNextImageInList(image);
status=SetImageProgress(image,LoadImagesTag,TellBlob(image),
GetBlobSize(image));
if (status == MagickFalse)
break;
}
} while (t_count < ipl_info.z*ipl_info.time);
CloseBlob(image);
return(GetFirstImageInList(image));
}
示例13: WriteGRAYImage
//.........这里部分代码省略.........
%
% The format of the WriteGRAYImage method is:
%
% MagickBooleanType WriteGRAYImage(const ImageInfo *image_info,
% Image *image,ExceptionInfo *exception)
%
% A description of each parameter follows.
%
% o image_info: the image info.
%
% o image: The image.
%
% o exception: return any errors or warnings in this structure.
%
*/
static MagickBooleanType WriteGRAYImage(const ImageInfo *image_info,
Image *image,ExceptionInfo *exception)
{
MagickBooleanType
status;
MagickOffsetType
scene;
QuantumInfo
*quantum_info;
QuantumType
quantum_type;
size_t
length;
ssize_t
count,
y;
unsigned char
*pixels;
/*
Open output image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
scene=0;
do
{
/*
Write grayscale pixels.
*/
if (IsRGBColorspace(image->colorspace) == MagickFalse)
(void) TransformImageColorspace(image,sRGBColorspace,exception);
quantum_type=GrayQuantum;
quantum_info=AcquireQuantumInfo(image_info,image);
if (quantum_info == (QuantumInfo *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
pixels=GetQuantumPixels(quantum_info);
for (y=0; y < (ssize_t) image->rows; y++)
{
register const Quantum
*restrict p;
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
quantum_type,pixels,exception);
count=WriteBlob(image,length,pixels);
if (count != (ssize_t) length)
break;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
quantum_info=DestroyQuantumInfo(quantum_info);
if (GetNextImageInList(image) == (Image *) NULL)
break;
image=SyncNextImageInList(image);
status=SetImageProgress(image,SaveImagesTag,scene++,
GetImageListLength(image));
if (status == MagickFalse)
break;
} while (image_info->adjoin != MagickFalse);
(void) CloseBlob(image);
return(MagickTrue);
}
示例14: ReadYCBCRImage
//.........这里部分代码省略.........
canvas_image=DestroyImageList(canvas_image);
image=DestroyImageList(image);
return((Image *) NULL);
}
length=GetQuantumExtent(canvas_image,quantum_info,AlphaQuantum);
for (i=0; i < (ssize_t) scene; i++)
for (y=0; y < (ssize_t) image->extract_info.height; y++)
if (ReadBlob(image,length,pixels) != (ssize_t) length)
{
ThrowFileException(exception,CorruptImageError,
"UnexpectedEndOfFile",image->filename);
break;
}
count=ReadBlob(image,length,pixels);
for (y=0; y < (ssize_t) image->extract_info.height; y++)
{
if (count != (ssize_t) length)
{
ThrowFileException(exception,CorruptImageError,
"UnexpectedEndOfFile",image->filename);
break;
}
q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
exception);
if (q == (PixelPacket *) NULL)
break;
length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
quantum_info,BlueQuantum,pixels,exception);
if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
break;
if (((y-image->extract_info.y) >= 0) &&
((y-image->extract_info.y) < (ssize_t) image->rows))
{
p=GetVirtualPixels(canvas_image,
canvas_image->extract_info.x,0,canvas_image->columns,1,
exception);
q=GetAuthenticPixels(image,0,y-image->extract_info.y,
image->columns,1,exception);
if ((p == (const PixelPacket *) NULL) ||
(q == (PixelPacket *) NULL))
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelOpacity(q,GetPixelOpacity(p));
p++;
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
count=ReadBlob(image,length,pixels);
}
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,4,5);
if (status == MagickFalse)
break;
}
}
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,5,5);
if (status == MagickFalse)
break;
}
break;
}
}
SetQuantumImageType(image,quantum_type);
/*
Proceed to next image.
*/
if (image_info->number_scenes != 0)
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
if (count == (ssize_t) length)
{
/*
Allocate next image structure.
*/
AcquireNextImage(image_info,image);
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
image=SyncNextImageInList(image);
status=SetImageProgress(image,LoadImagesTag,TellBlob(image),
GetBlobSize(image));
if (status == MagickFalse)
break;
}
scene++;
} while (count == (ssize_t) length);
quantum_info=DestroyQuantumInfo(quantum_info);
InheritException(&image->exception,&canvas_image->exception);
canvas_image=DestroyImage(canvas_image);
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
示例15: WriteARTImage
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% W r i t e A R T I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% WriteARTImage() writes an image of raw bits in LSB order to a file.
%
% The format of the WriteARTImage method is:
%
% MagickBooleanType WriteARTImage(const ImageInfo *image_info,
% Image *image,ExceptionInfo *exception)
%
% A description of each parameter follows.
%
% o image_info: the image info.
%
% o image: The image.
%
% o exception: return any errors or warnings in this structure.
%
*/
static MagickBooleanType WriteARTImage(const ImageInfo *image_info,Image *image,
ExceptionInfo *exception)
{
MagickBooleanType
status;
QuantumInfo
*quantum_info;
register const Quantum
*p;
size_t
length;
ssize_t
count,
y;
unsigned char
*pixels;
/*
Open output image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
if ((image->columns > 65535UL) || (image->rows > 65535UL))
ThrowWriterException(ImageError,"WidthOrHeightExceedsLimit");
if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)
(void) TransformImageColorspace(image,sRGBColorspace,exception);
(void) SetImageType(image,BilevelType,exception);
image->endian=MSBEndian;
image->depth=1;
(void) WriteBlobLSBShort(image,0);
(void) WriteBlobLSBShort(image,(unsigned short) image->columns);
(void) WriteBlobLSBShort(image,0);
(void) WriteBlobLSBShort(image,(unsigned short) image->rows);
quantum_info=AcquireQuantumInfo(image_info,image);
pixels=GetQuantumPixels(quantum_info);
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
GrayQuantum,pixels,exception);
count=WriteBlob(image,length,pixels);
if (count != (ssize_t) length)
ThrowWriterException(CorruptImageError,"UnableToWriteImageData");
count=WriteBlob(image,(size_t) (-(ssize_t) length) & 0x01,pixels);
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
quantum_info=DestroyQuantumInfo(quantum_info);
(void) CloseBlob(image);
return(status);
}