本文整理汇总了C++中QueueAuthenticPixels函数的典型用法代码示例。如果您正苦于以下问题:C++ QueueAuthenticPixels函数的具体用法?C++ QueueAuthenticPixels怎么用?C++ QueueAuthenticPixels使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QueueAuthenticPixels函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: WriteMATTEImage
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% W r i t e M A T T E I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% WriteMATTEImage() writes an image of matte bytes to a file. It consists of
% data from the matte component of the image [0..255].
%
% The format of the WriteMATTEImage method is:
%
% MagickBooleanType WriteMATTEImage(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 WriteMATTEImage(const ImageInfo *image_info,
Image *image,ExceptionInfo *exception)
{
Image
*matte_image;
MagickBooleanType
status;
register const Quantum
*p;
register ssize_t
x;
register Quantum
*q;
ssize_t
y;
if (image->matte == MagickFalse)
ThrowWriterException(CoderError,"ImageDoesNotHaveAAlphaChannel");
matte_image=CloneImage(image,image->columns,image->rows,MagickTrue,exception);
if (matte_image == (Image *) NULL)
return(MagickFalse);
(void) SetImageType(matte_image,TrueColorMatteType,exception);
matte_image->matte=MagickFalse;
/*
Convert image to matte pixels.
*/
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
q=QueueAuthenticPixels(matte_image,0,y,matte_image->columns,1,exception);
if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelRed(matte_image,GetPixelAlpha(image,p),q);
SetPixelGreen(matte_image,GetPixelAlpha(image,p),q);
SetPixelBlue(matte_image,GetPixelAlpha(image,p),q);
SetPixelAlpha(matte_image,OpaqueAlpha,q);
p+=GetPixelChannels(image);
q+=GetPixelChannels(matte_image);
}
if (SyncAuthenticPixels(matte_image,exception) == MagickFalse)
break;
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
(void) FormatLocaleString(matte_image->filename,MaxTextExtent,
"MIFF:%s",image->filename);
status=WriteImage(image_info,matte_image,exception);
matte_image=DestroyImage(matte_image);
return(status);
}
开发者ID:ChaseReid,项目名称:ImageMagick,代码行数:87,代码来源:matte.c
示例2: assert
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e a d N U L L I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ReadNULLImage creates a constant image and initializes it to the
% X server color as specified by the filename. It allocates the memory
% necessary for the new Image structure and returns a pointer to the new
% image.
%
% The format of the ReadNULLImage method is:
%
% Image *ReadNULLImage(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 *ReadNULLImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
Image
*image;
ssize_t
y;
MagickPixelPacket
background;
register IndexPacket
*indexes;
register ssize_t
x;
register PixelPacket
*q;
/*
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->columns=1;
if (image->rows == 0)
image->rows=1;
image->matte=MagickTrue;
GetMagickPixelPacket(image,&background);
background.opacity=(MagickRealType) TransparentOpacity;
if (image->colorspace == CMYKColorspace)
ConvertRGBToCMYK(&background);
for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
indexes=GetAuthenticIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelPacket(image,&background,q,indexes);
q++;
indexes++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
return(GetFirstImageInList(image));
}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:86,代码来源:null.c
示例3: assert
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e a d N U L L I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ReadNULLImage creates a constant image and initializes it to the
% X server color as specified by the filename. It allocates the memory
% necessary for the new Image structure and returns a pointer to the new
% image.
%
% The format of the ReadNULLImage method is:
%
% Image *ReadNULLImage(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 *ReadNULLImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
Image
*image;
MagickBooleanType
status;
PixelInfo
background;
register ssize_t
x;
register Quantum
*q;
ssize_t
y;
/*
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);
image=AcquireImage(image_info,exception);
if (image->columns == 0)
image->columns=1;
if (image->rows == 0)
image->rows=1;
status=SetImageExtent(image,image->columns,image->rows,exception);
if (status == MagickFalse)
return(DestroyImageList(image));
ConformPixelInfo(image,&image->background_color,&background,exception);
image->alpha_trait=BlendPixelTrait;
background.alpha=(double) TransparentAlpha;
for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelViaPixelInfo(image,&background,q);
q+=GetPixelChannels(image);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
return(GetFirstImageInList(image));
}
开发者ID:vcgato29,项目名称:ImageMagick,代码行数:85,代码来源:null.c
示例4: assert
//.........这里部分代码省略.........
p=next;
next=NextXPMLine(p);
(void) CopyXPMColor(key,p,MagickMin((size_t) width,MaxTextExtent-1));
status=AddValueToSplayTree(xpm_colors,ConstantString(key),(void *) j);
/*
Parse color.
*/
(void) CopyMagickString(target,"gray",MaxTextExtent);
q=ParseXPMColor(p+width,MagickTrue);
if (q != (char *) NULL)
{
while ((isspace((int) ((unsigned char) *q)) == 0) && (*q != '\0'))
q++;
if ((next-q) < 0)
break;
if (next != (char *) NULL)
(void) CopyXPMColor(target,q,MagickMin((size_t) (next-q),
MaxTextExtent-1));
else
(void) CopyMagickString(target,q,MaxTextExtent);
q=ParseXPMColor(target,MagickFalse);
if (q != (char *) NULL)
*q='\0';
}
StripString(target);
grey=strstr(target,"grey");
if (grey != (char *) NULL)
grey[2]='a';
if (LocaleCompare(target,"none") == 0)
{
image->storage_class=DirectClass;
image->matte=MagickTrue;
}
status=QueryColorCompliance(target,XPMCompliance,&image->colormap[j],
exception);
if (status == MagickFalse)
break;
(void) QueryMagickColorCompliance(target,XPMCompliance,&pixel,exception);
if (image->depth < pixel.depth)
image->depth=pixel.depth;
}
if (j < (ssize_t) image->colors)
{
xpm_colors=DestroySplayTree(xpm_colors);
xpm_buffer=DestroyString(xpm_buffer);
ThrowReaderException(CorruptImageError,"CorruptImage");
}
j=0;
if (image_info->ping == MagickFalse)
{
/*
Read image pixels.
*/
status=SetImageExtent(image,image->columns,image->rows);
if (status == MagickFalse)
{
InheritException(exception,&image->exception);
return(DestroyImageList(image));
}
for (y=0; y < (ssize_t) image->rows; y++)
{
p=NextXPMLine(p);
if (p == (char *) NULL)
break;
r=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (r == (PixelPacket *) NULL)
break;
indexes=GetAuthenticIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
{
ssize_t count=CopyXPMColor(key,p,MagickMin(width,MaxTextExtent-1));
if (count != (ssize_t) width)
break;
j=(ssize_t) GetValueFromSplayTree(xpm_colors,key);
if (image->storage_class == PseudoClass)
SetPixelIndex(indexes+x,j);
*r=image->colormap[j];
p+=count;
r++;
}
if (x < (ssize_t) image->columns)
break;
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
if (y < (ssize_t) image->rows)
{
xpm_colors=DestroySplayTree(xpm_colors);
xpm_buffer=DestroyString(xpm_buffer);
ThrowReaderException(CorruptImageError,"NotEnoughPixelData");
}
}
/*
Relinquish resources.
*/
xpm_colors=DestroySplayTree(xpm_colors);
xpm_buffer=DestroyString(xpm_buffer);
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
开发者ID:MarinaAndenko,项目名称:MyBlog,代码行数:101,代码来源:xpm.c
示例5: ReadAVSImage
//.........这里部分代码省略.........
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);
}
/*
Read AVS X image.
*/
width=ReadBlobMSBLong(image);
height=ReadBlobMSBLong(image);
if (EOFBlob(image) != MagickFalse)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
if ((width == 0UL) || (height == 0UL))
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
do
{
/*
Convert AVS raster image to pixel packets.
*/
image->columns=width;
image->rows=height;
image->depth=8;
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
pixels=(unsigned char *) AcquireQuantumMemory(image->columns,
4*sizeof(*pixels));
if (pixels == (unsigned char *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
length=(size_t) 4*image->columns;
for (y=0; y < (ssize_t) image->rows; y++)
{
count=ReadBlob(image,length,pixels);
if ((size_t) count != length)
ThrowReaderException(CorruptImageError,"UnableToReadImageData");
p=pixels;
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelAlpha(q,ScaleCharToQuantum(*p++));
SetPixelRed(q,ScaleCharToQuantum(*p++));
SetPixelGreen(q,ScaleCharToQuantum(*p++));
SetPixelBlue(q,ScaleCharToQuantum(*p++));
if (q->opacity != OpaqueOpacity)
image->matte=MagickTrue;
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=(unsigned char *) RelinquishMagickMemory(pixels);
if (EOFBlob(image) != MagickFalse)
{
ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
image->filename);
break;
}
/*
Proceed to next image.
*/
if (image_info->number_scenes != 0)
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
width=ReadBlobMSBLong(image);
height=ReadBlobMSBLong(image);
if ((width != 0UL) && (height != 0UL))
{
/*
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;
}
} while ((width != 0UL) && (height != 0UL));
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,代码来源:avs.c
示例6: 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));
}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,代码来源:cin.c
示例7: WriteMATTEImage
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% W r i t e M A T T E I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Function WriteMATTEImage() writes an image of matte bytes to a file. It
% consists of data from the matte component of the image [0..255].
%
% The format of the WriteMATTEImage method is:
%
% MagickBooleanType WriteMATTEImage(const ImageInfo *image_info,
% Image *image)
%
% A description of each parameter follows.
%
% o image_info: the image info.
%
% o image: The image.
%
*/
static MagickBooleanType WriteMATTEImage(const ImageInfo *image_info,
Image *image)
{
ExceptionInfo
*exception;
Image
*matte_image;
ssize_t
y;
MagickBooleanType
status;
register const PixelPacket
*p;
register ssize_t
x;
register PixelPacket
*q;
if (image->matte == MagickFalse)
ThrowWriterException(CoderError,"ImageDoesNotHaveAAlphaChannel");
matte_image=CloneImage(image,image->columns,image->rows,MagickTrue,
&image->exception);
if (matte_image == (Image *) NULL)
return(MagickFalse);
(void) SetImageType(matte_image,TrueColorMatteType);
matte_image->matte=MagickFalse;
/*
Convert image to matte pixels.
*/
exception=(&image->exception);
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
q=QueueAuthenticPixels(matte_image,0,y,matte_image->columns,1,exception);
if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL))
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
q->red=GetOpacityPixelComponent(p);
q->green=GetOpacityPixelComponent(p);
q->blue=GetOpacityPixelComponent(p);
SetOpacityPixelComponent(q,OpaqueOpacity);
p++;
q++;
}
if (SyncAuthenticPixels(matte_image,exception) == MagickFalse)
break;
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
(void) FormatMagickString(matte_image->filename,MaxTextExtent,
"MIFF:%s",image->filename);
status=WriteImage(image_info,matte_image);
matte_image=DestroyImage(matte_image);
return(status);
}
开发者ID:JasonGross,项目名称:characters,代码行数:90,代码来源:matte.c
示例8: ReadPIXImage
//.........这里部分代码省略.........
Read PIX image.
*/
width=ReadBlobMSBShort(image);
height=ReadBlobMSBShort(image);
(void) ReadBlobMSBShort(image); /* x-offset */
(void) ReadBlobMSBShort(image); /* y-offset */
bits_per_pixel=ReadBlobMSBShort(image);
if ((width == 0UL) || (height == 0UL) || ((bits_per_pixel != 8) &&
(bits_per_pixel != 24)))
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
do
{
/*
Initialize image structure.
*/
image->columns=width;
image->rows=height;
if (bits_per_pixel == 8)
if (AcquireImageColormap(image,256) == MagickFalse)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
/*
Convert PIX raster image to pixel packets.
*/
red=(Quantum) 0;
green=(Quantum) 0;
blue=(Quantum) 0;
index=(IndexPacket) 0;
length=0;
for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
indexes=GetAuthenticIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
{
if (length == 0)
{
length=(size_t) ReadBlobByte(image);
if (bits_per_pixel == 8)
index=ScaleCharToQuantum((unsigned char) ReadBlobByte(image));
else
{
blue=ScaleCharToQuantum((unsigned char) ReadBlobByte(image));
green=ScaleCharToQuantum((unsigned char) ReadBlobByte(image));
red=ScaleCharToQuantum((unsigned char) ReadBlobByte(image));
}
}
if (image->storage_class == PseudoClass)
SetPixelIndex(indexes+x,index);
SetPixelBlue(q,blue);
SetPixelGreen(q,green);
SetPixelRed(q,red);
length--;
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
开发者ID:271845221,项目名称:Android-ImageMagick,代码行数:67,代码来源:pix.c
示例9: assert
//.........这里部分代码省略.........
int
max_x,
max_y,
min_x,
min_y;
MagickBooleanType
status;
register ssize_t
x;
register Quantum
*q;
ssize_t
y;
/*
Open image.
*/
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)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
read_info=CloneImageInfo(image_info);
if (IsPathAccessible(read_info->filename) == MagickFalse)
{
(void) AcquireUniqueFilename(read_info->filename);
(void) ImageToFile(image,read_info->filename,exception);
}
file=ImfOpenInputFile(read_info->filename);
if (file == (ImfInputFile *) NULL)
{
ThrowFileException(exception,BlobError,"UnableToOpenBlob",
ImfErrorMessage());
read_info=DestroyImageInfo(read_info);
return((Image *) NULL);
}
hdr_info=ImfInputHeader(file);
ImfHeaderDataWindow(hdr_info,&min_x,&min_y,&max_x,&max_y);
image->columns=max_x-min_x+1UL;
image->rows=max_y-min_y+1UL;
image->matte=MagickTrue;
if (image_info->ping != MagickFalse)
{
(void) ImfCloseInputFile(file);
if (LocaleCompare(image_info->filename,read_info->filename) != 0)
(void) RelinquishUniqueFileResource(read_info->filename);
read_info=DestroyImageInfo(read_info);
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
scanline=(ImfRgba *) AcquireQuantumMemory(image->columns,sizeof(*scanline));
if (scanline == (ImfRgba *) NULL)
{
(void) ImfCloseInputFile(file);
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (Quantum *) NULL)
break;
ImfInputSetFrameBuffer(file,scanline-min_x-image->columns*(min_y+y),1,
image->columns);
ImfInputReadPixels(file,min_y+y,min_y+y);
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelRed(image,ClampToQuantum((MagickRealType) QuantumRange*
ImfHalfToFloat(scanline[x].r)),q);
SetPixelGreen(image,ClampToQuantum((MagickRealType) QuantumRange*
ImfHalfToFloat(scanline[x].g)),q);
SetPixelBlue(image,ClampToQuantum((MagickRealType) QuantumRange*
ImfHalfToFloat(scanline[x].b)),q);
SetPixelAlpha(image,ClampToQuantum((MagickRealType) QuantumRange*
ImfHalfToFloat(scanline[x].a)),q);
q+=GetPixelChannels(image);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
scanline=(ImfRgba *) RelinquishMagickMemory(scanline);
(void) ImfCloseInputFile(file);
if (LocaleCompare(image_info->filename,read_info->filename) != 0)
(void) RelinquishUniqueFileResource(read_info->filename);
read_info=DestroyImageInfo(read_info);
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
开发者ID:ChaseReid,项目名称:ImageMagick,代码行数:101,代码来源:exr.c
示例10: 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));
}
开发者ID:INT2208-ST,项目名称:MyFriend,代码行数:101,代码来源:raw.c
示例11: ReadPCXImage
//.........这里部分代码省略.........
/*
Monochrome colormap.
*/
image->colormap[0].red=(Quantum) 0;
image->colormap[0].green=(Quantum) 0;
image->colormap[0].blue=(Quantum) 0;
image->colormap[1].red=QuantumRange;
image->colormap[1].green=QuantumRange;
image->colormap[1].blue=QuantumRange;
}
else
if (image->colors > 16)
{
/*
256 color images have their color map at the end of the file.
*/
pcx_info.colormap_signature=(unsigned char) ReadBlobByte(image);
count=ReadBlob(image,3*image->colors,pcx_colormap);
p=pcx_colormap;
for (i=0; i < (ssize_t) image->colors; i++)
{
image->colormap[i].red=ScaleCharToQuantum(*p++);
image->colormap[i].green=ScaleCharToQuantum(*p++);
image->colormap[i].blue=ScaleCharToQuantum(*p++);
}
}
}
/*
Convert PCX raster image to pixel packets.
*/
for (y=0; y < (ssize_t) image->rows; y++)
{
p=pixels+(y*pcx_info.bytes_per_line*pcx_info.planes);
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (Quantum *) NULL)
break;
r=scanline;
if (image->storage_class == DirectClass)
for (i=0; i < pcx_info.planes; i++)
{
r=scanline+i;
for (x=0; x < (ssize_t) pcx_info.bytes_per_line; x++)
{
switch (i)
{
case 0:
{
*r=(*p++);
break;
}
case 1:
{
*r=(*p++);
break;
}
case 2:
{
*r=(*p++);
break;
}
case 3:
default:
{
*r=(*p++);
break;
}
开发者ID:278443820,项目名称:ImageMagick,代码行数:67,代码来源:pcx.c
示例12: ThrowReaderException
//.........这里部分代码省略.........
}
else
{
*p='\0';
flags=ParseMetaGeometry(geometry,&sans,&sans,&image->columns,
&image->rows);
if (image->x_resolution != 0.0)
image->columns=(unsigned long) (((image->columns*
image->x_resolution)/DefaultResolution)+0.5);
if (image->y_resolution != 0.0)
image->rows=(unsigned long) (((image->rows*image->y_resolution)/
DefaultResolution)+0.5);
}
geometry=DestroyString(geometry);
}
hDC=GetDC(NULL);
if (hDC == (HDC) NULL)
{
DeleteEnhMetaFile(hemf);
ThrowReaderException(ResourceLimitError,"UnableToCreateADC");
}
/*
Initialize the bitmap header info.
*/
(void) ResetMagickMemory(&DIBinfo,0,sizeof(BITMAPINFO));
DIBinfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
DIBinfo.bmiHeader.biWidth=image->columns;
DIBinfo.bmiHeader.biHeight=(-1)*image->rows;
DIBinfo.bmiHeader.biPlanes=1;
DIBinfo.bmiHeader.biBitCount=32;
DIBinfo.bmiHeader.biCompression=BI_RGB;
hBitmap=CreateDIBSection(hDC,&DIBinfo,DIB_RGB_COLORS,(void **) &ppBits,
NULL,0);
ReleaseDC(NULL,hDC);
if (hBitmap == (HBITMAP) NULL)
{
DeleteEnhMetaFile(hemf);
ThrowReaderException(ResourceLimitError,"UnableToCreateBitmap");
}
hDC=CreateCompatibleDC(NULL);
if (hDC == (HDC) NULL)
{
DeleteEnhMetaFile(hemf);
DeleteObject(hBitmap);
ThrowReaderException(ResourceLimitError,"UnableToCreateADC");
}
hOldBitmap=(HBITMAP) SelectObject(hDC,hBitmap);
if (hOldBitmap == (HBITMAP) NULL)
{
DeleteEnhMetaFile(hemf);
DeleteDC(hDC);
DeleteObject(hBitmap);
ThrowReaderException(ResourceLimitError,"UnableToCreateBitmap");
}
/*
Initialize the bitmap to the image background color.
*/
pBits=ppBits;
for (y=0; y < (long) image->rows; y++)
{
for (x=0; x < (long) image->columns; x++)
{
pBits->rgbRed=ScaleQuantumToChar(image->background_color.red);
pBits->rgbGreen=ScaleQuantumToChar(image->background_color.green);
pBits->rgbBlue=ScaleQuantumToChar(image->background_color.blue);
pBits++;
}
}
rect.top=0;
rect.left=0;
rect.right=image->columns;
rect.bottom=image->rows;
/*
Convert metafile pixels.
*/
PlayEnhMetaFile(hDC,hemf,&rect);
pBits=ppBits;
for (y=0; y < (long) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
for (x=0; x < (long) image->columns; x++)
{
q->red=ScaleCharToQuantum(pBits->rgbRed);
q->green=ScaleCharToQuantum(pBits->rgbGreen);
q->blue=ScaleCharToQuantum(pBits->rgbBlue);
q->opacity=OpaqueOpacity;
pBits++;
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
DeleteEnhMetaFile(hemf);
SelectObject(hDC,hOldBitmap);
DeleteDC(hDC);
DeleteObject(hBitmap);
return(GetFirstImageInList(image));
}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,代码来源:emf.c
示例13: ReadDPSImage
//.........这里部分代码省略.........
red_shift;
/*
Determine shift and mask for red, green, and blue.
*/
red_mask=visual_info->red_mask;
red_shift=0;
while ((red_mask != 0) && ((red_mask & 0x01) == 0))
{
red_mask>>=1;
red_shift++;
}
green_mask=visual_info->green_mask;
green_shift=0;
while ((green_mask != 0) && ((green_mask & 0x01) == 0))
{
green_mask>>=1;
green_shift++;
}
blue_mask=visual_info->blue_mask;
blue_shift=0;
while ((blue_mask != 0) && ((blue_mask & 0x01) == 0))
{
blue_mask>>=1;
blue_shift++;
}
/*
Convert X image to DirectClass packets.
*/
if ((visual_info->colormap_size > 0) &&
(visual_info->klass == DirectColor))
for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=XGetPixel(dps_image,x,y);
index=(pixel >> red_shift) & red_mask;
SetPixelRed(image,ScaleShortToQuantum(colors[index].red),q);
index=(pixel >> green_shift) & green_mask;
SetPixelGreen(image,ScaleShortToQuantum(colors[index].green),q);
index=(pixel >> blue_shift) & blue_mask;
SetPixelBlue(image,ScaleShortToQuantum(colors[index].blue),q);
q+=GetPixelChannels(image);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (SetImageProgress(image,LoadImageTag,y,image->rows) == MagickFalse)
break;
}
else
for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=XGetPixel(dps_image,x,y);
color=(pixel >> red_shift) & red_mask;
color=(color*65535L)/red_mask;
SetPixelRed(image,ScaleShortToQuantum((unsigned short) color),q);
color=(pixel >> green_shift) & green_mask;
color=(color*65535L)/green_mask;
开发者ID:edalquist,项目名称:ImageMagick,代码行数:67,代码来源:dps.c
示例14: ReadYUVImage
//.........这里部分代码省略.........
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
/*
Convert raster image to pixel packets.
*/
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
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 (interlace == PartitionInterlace)
{
AppendImageFormat("Y",image->filename);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
}
for (y=0; y < (ssize_t) image->rows; y++)
{
register PixelPacket
*chroma_pixels;
if (interlace == NoInterlace)
{
if ((y > 0) || (GetPreviousImageInList(image) == (Image *) NULL))
(void) ReadBlob(image,(size_t) (2*quantum*image->columns),scanline);
p=scanline;
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
chroma_pixels=QueueAuthenticPixels(chroma_image,0,y,
chroma_image->columns,1,exception);
if (chroma_pixels == (PixelPacket *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x+=2)
{
SetPixelRed(chroma_pixels,0);
if (quantum == 1)
SetPixelGreen(chroma_pixels,ScaleCharToQuantum(*p++));
else
{
SetPixelGreen(chroma_pixels,ScaleShortToQuantum(((*p) << 8) |
*(p+1)));
p+=2;
}
if (quantum == 1)
SetPixelRed(q,ScaleCharToQuantum(*p++));
else
{
SetPixelRed(q,ScaleShortToQuantum(((*p) << 8) | *(p+1)));
p+=2;
}
SetPixelGreen(q,0);
SetPixelBlue(q,0);
q++;
SetPixelGreen(q,0);
SetPixelBlue(q,0);
if (quantum == 1)
SetPixelBlue(chroma_pixels,ScaleCharToQuantum(*p++));
else
开发者ID:JohnHeywardOBrien,项目名称:photogram,代码行数:67,代码来源:yuv.c
示例15: ReadSCRImage
//.........这里部分代码省略.........
(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);
}
image->columns = 256;
image->rows = 192;
count=ReadBlob(image,6144,(unsigned char *) zxscr);
(void) count;
count=ReadBlob(image,768,(unsigned char *) zxattr);
for(zonenr=0; zonenr<3; zonenr++)
{
for(zoneline=0; zoneline<8; zoneline++)
{
for(octetline=0; octetline<8; octetline++)
{
for(octetnr=(zoneline*32); octetnr<((zoneline*32)+32); octetnr++)
|
请发表评论