本文整理汇总了C++中GetAuthenticIndexQueue函数 的典型用法代码示例。如果您正苦于以下问题:C++ GetAuthenticIndexQueue函数的具体用法?C++ GetAuthenticIndexQueue怎么用?C++ GetAuthenticIndexQueue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetAuthenticIndexQueue函数 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ReadVIPSPixelsNONE
static MagickBooleanType ReadVIPSPixelsNONE(Image *image,
const VIPSBandFormat format,const VIPSType type,const unsigned int channels,
ExceptionInfo *exception)
{
Quantum
pixel;
register IndexPacket
*indexes;
register PixelPacket
*q;
register ssize_t
x;
ssize_t
y;
for (y = 0; y < (ssize_t) image->rows; y++)
{
q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
return MagickFalse;
indexes=GetAuthenticIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=ReadVIPSPixelNONE(image,format,type);
SetPixelRed(q,pixel);
if (channels < 3)
{
SetPixelGreen(q,pixel);
SetPixelBlue(q,pixel);
if (channels == 2)
SetPixelAlpha(q,ReadVIPSPixelNONE(image,format,type));
}
else
{
SetPixelGreen(q,ReadVIPSPixelNONE(image,format,type));
SetPixelBlue(q,ReadVIPSPixelNONE(image,format,type));
if (channels == 4)
{
if (image->colorspace == CMYKColorspace)
SetPixelIndex(indexes+x,ReadVIPSPixelNONE(image,format,type));
else
SetPixelAlpha(q,ReadVIPSPixelNONE(image,format,type));
}
else if (channels == 5)
{
SetPixelIndex(indexes+x,ReadVIPSPixelNONE(image,format,type));
SetPixelAlpha(q,ReadVIPSPixelNONE(image,format,type));
}
}
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
return MagickFalse;
}
return(MagickTrue);
}
开发者ID:JohnHeywardOBrien, 项目名称:photogram, 代码行数:60, 代码来源:vips.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
//.........这里部分代码省略.........
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 == (PixelPacket *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=XGetPixel(dps_image,x,y);
index=(pixel >> red_shift) & red_mask;
SetPixelRed(q,ScaleShortToQuantum(colors[index].red));
index=(pixel >> green_shift) & green_mask;
SetPixelGreen(q,ScaleShortToQuantum(colors[index].green));
index=(pixel >> blue_shift) & blue_mask;
SetPixelBlue(q,ScaleShortToQuantum(colors[index].blue));
q++;
}
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 == (PixelPacket *) 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(q,ScaleShortToQuantum((unsigned short) color));
color=(pixel >> green_shift) & green_mask;
color=(color*65535L)/green_mask;
SetPixelGreen(q,ScaleShortToQuantum((unsigned short)
color));
color=(pixel >> blue_shift) & blue_mask;
color=(color*65535L)/blue_mask;
SetPixelBlue(q,ScaleShortToQuantum((unsigned short)
color));
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (SetImageProgress(image,LoadImageTag,y,image->rows) == MagickFalse)
break;
}
break;
}
case PseudoClass:
{
/*
Create colormap.
*/
if (AcquireImageColormap(image,(size_t) visual_info->colormap_size) == MagickFalse)
{
image=DestroyImage(image);
colors=(XColor *) RelinquishMagickMemory(colors);
XDestroyImage(dps_image);
XFreeResources(display,visual_info,map_info,(XPixelInfo *) NULL,
(XFontStruct *) NULL,&resource_info,(XWindowInfo *) NULL);
return((Image *) NULL);
}
for (i=0; i < (ssize_t) image->colors; i++)
{
image->colormap[colors[i].pixel].red=ScaleShortToQuantum(colors[i].red);
image->colormap[colors[i].pixel].green=
ScaleShortToQuantum(colors[i].green);
image->colormap[colors[i].pixel].blue=
ScaleShortToQuantum(colors[i].blue);
}
/*
Convert X image to PseudoClass packets.
*/
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++)
SetPixelIndex(indexes+x,(unsigned short)
XGetPixel(dps_image,x,y));
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (SetImageProgress(image,LoadImageTag,y,image->rows) == MagickFalse)
break;
}
break;
}
}
开发者ID:0xPr0xy, 项目名称:ImageMagick, 代码行数:101, 代码来源:dps.c
示例4: WriteUILImage
//.........这里部分代码省略.........
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const PixelPacket *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
matte_image[i]=(unsigned char) (GetPixelOpacity(p) ==
(Quantum) TransparentOpacity ? 1 : 0);
if (matte_image[i] != 0)
transparent=MagickTrue;
i++;
p++;
}
}
}
(void) SetImageType(image,PaletteType);
colors=image->colors;
if (transparent != MagickFalse)
{
register IndexPacket
*indexes;
register PixelPacket
*q;
colors++;
for (y=0; y < (ssize_t) image->rows; y++)
{
q=GetAuthenticPixels(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 (matte_image[i] != 0)
SetPixelIndex(indexes+x,image->colors);
p++;
}
}
}
if (matte_image != (unsigned char *) NULL)
matte_image=(unsigned char *) RelinquishMagickMemory(matte_image);
}
/*
Compute the character per pixel.
*/
characters_per_pixel=1;
for (k=MaxCixels; (ssize_t) colors > k; k*=MaxCixels)
characters_per_pixel++;
/*
UIL header.
*/
symbol=AcquireString("");
(void) WriteBlobString(image,"/* UIL */\n");
GetPathComponent(image->filename,BasePath,basename);
(void) FormatLocaleString(buffer,MaxTextExtent,
"value\n %s_ct : color_table(\n",basename);
(void) WriteBlobString(image,buffer);
GetMagickPixelPacket(image,&pixel);
for (i=0; i < (ssize_t) colors; i++)
{
/*
Define UIL color.
*/
开发者ID:UIKit0, 项目名称:YoyaMagick, 代码行数:67, 代码来源:uil.c
示例5: 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
示例6: ReadRLEImage
//.........这里部分代码省略.........
if (AcquireImageColormap(image,map_length) == MagickFalse)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
p=colormap;
if (number_colormaps == 1)
for (i=0; i < (ssize_t) image->colors; i++)
{
/*
Pseudocolor.
*/
image->colormap[i].red=ScaleCharToQuantum((unsigned char) i);
image->colormap[i].green=ScaleCharToQuantum((unsigned char) i);
image->colormap[i].blue=ScaleCharToQuantum((unsigned char) i);
}
else
if (number_colormaps > 1)
for (i=0; i < (ssize_t) image->colors; i++)
{
image->colormap[i].red=ScaleCharToQuantum(*p);
image->colormap[i].green=ScaleCharToQuantum(*(p+map_length));
image->colormap[i].blue=ScaleCharToQuantum(*(p+map_length*2));
p++;
}
p=pixels;
if (image->matte == MagickFalse)
{
/*
Convert raster image to PseudoClass pixel packets.
*/
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++)
SetPixelIndex(indexes+x,*p++);
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)
y,image->rows);
if (status == MagickFalse)
break;
}
}
(void) SyncImage(image);
}
else
{
/*
Image has a matte channel-- promote to DirectClass.
*/
for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelRed(q,image->colormap[*p++].red);
SetPixelGreen(q,image->colormap[*p++].green);
SetPixelBlue(q,image->colormap[*p++].blue);
SetPixelAlpha(q,ScaleCharToQuantum(*p++));
q++;
}
开发者ID:UIKit0, 项目名称:YoyaMagick, 代码行数:67, 代码来源:rle.c
示例7: 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:
//.........这里部分代码省略.........
开发者ID:0xPr0xy, 项目名称:ImageMagick, 代码行数:101, 代码来源:stegano.c
示例8: ReadVIFFImage
//.........这里部分代码省略.........
case VFF_TYP_4_BYTE: value=1.0*((int *) viff_pixels)[i]; break;
case VFF_TYP_FLOAT: value=((float *) viff_pixels)[i]; break;
case VFF_TYP_DOUBLE: value=((double *) viff_pixels)[i]; break;
default: value=1.0*viff_pixels[i]; break;
}
if (viff_info.map_scheme == VFF_MS_NONE)
{
value=(value-min_value)*scale_factor;
if (value > QuantumRange)
value=QuantumRange;
else
if (value < 0)
value=0;
}
*p=(unsigned char) value;
p++;
}
/*
Convert VIFF raster image to pixel packets.
*/
p=(unsigned char *) viff_pixels;
if (viff_info.data_storage_type == VFF_TYP_BIT)
{
/*
Convert bitmap scanline.
*/
(void) SetImageType(image,BilevelType);
(void) SetImageType(image,PaletteType);
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-7); x+=8)
{
for (bit=0; bit < 8; bit++)
if (PixelIntensity(q) < ((MagickRealType) QuantumRange/2.0))
{
quantum=(size_t) indexes[x+bit];
quantum|=0x01;
indexes[x+bit]=(IndexPacket) quantum;
}
p++;
}
if ((image->columns % 8) != 0)
{
for (bit=0; bit < (ssize_t) (image->columns % 8); bit++)
if (PixelIntensity(q) < ((MagickRealType) QuantumRange/2.0))
{
quantum=(size_t) indexes[x+bit];
quantum|=0x01;
indexes[x+bit]=(IndexPacket) quantum;
}
p++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
开发者ID:0xPr0xy, 项目名称:ImageMagick, 代码行数:67, 代码来源:viff.c
示例9: assert
static Image *ReadWBMPImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
Image
*image;
int
byte;
MagickBooleanType
status;
register IndexPacket
*indexes;
register ssize_t
x;
register PixelPacket
*q;
ssize_t
y;
unsigned char
bit;
unsigned short
header;
/*
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);
}
if (ReadBlob(image,2,(unsigned char *) &header) == 0)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
if (header != 0)
ThrowReaderException(CoderError,"OnlyLevelZerofilesSupported");
/*
Initialize image structure.
*/
if (WBMPReadInteger(image,&image->columns) == MagickFalse)
ThrowReaderException(CorruptImageError,"CorruptWBMPimage");
if (WBMPReadInteger(image,&image->rows) == MagickFalse)
ThrowReaderException(CorruptImageError,"CorruptWBMPimage");
if ((image->columns == 0) || (image->rows == 0))
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
if (DiscardBlobBytes(image,image->offset) == MagickFalse)
ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
image->filename);
if (AcquireImageColormap(image,2) == MagickFalse)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
if (image_info->ping != MagickFalse)
{
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
status=SetImageExtent(image,image->columns,image->rows);
if (status == MagickFalse)
{
InheritException(exception,&image->exception);
return(DestroyImageList(image));
}
/*
Convert bi-level image to pixel packets.
*/
for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
indexes=GetAuthenticIndexQueue(image);
bit=0;
byte=0;
for (x=0; x < (ssize_t) image->columns; x++)
{
if (bit == 0)
{
byte=ReadBlobByte(image);
if (byte == EOF)
ThrowReaderException(CorruptImageError,"CorruptImage");
}
SetPixelIndex(indexes+x,(byte & (0x01 << (7-bit))) ? 1 : 0);
bit++;
if (bit == 8)
bit=0;
}
//.........这里部分代码省略.........
开发者ID:dadsez, 项目名称:SnoutPoint-Networks, 代码行数:101, 代码来源:wbmp.c
示例10: assert
//.........这里部分代码省略.........
SetPixelAlpha(q,ScaleCharToQuantum(*(p+3)));
p+=4;
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
}
else
{
/*
Create grayscale map.
*/
if (AcquireImageColormap(image,image->colors) == MagickFalse)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
/*
Convert SGI image to PseudoClass pixel packets.
*/
if (bytes_per_pixel == 2)
{
for (y=0; y < (ssize_t) image->rows; y++)
{
p=pixels+(image->rows-y-1)*8*image->columns;
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++)
{
quantum=(*p << 8);
quantum|=(*(p+1));
SetPixelIndex(indexes+x,quantum);
p+=8;
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)
y,image->rows);
if (status == MagickFalse)
break;
}
}
}
else
for (y=0; y < (ssize_t) image->rows; y++)
{
p=pixels+(image->rows-y-1)*4*image->columns;
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++)
{
SetPixelIndex(indexes+x,*p);
p+=4;
q++;
开发者ID:acal, 项目名称:alchemy, 代码行数:67, 代码来源:sgi.c
示例11: WritePCLImage
//.........这里部分代码省略.........
}
default:
{
compress_pixels=(unsigned char *) AcquireQuantumMemory(3*length+256,
sizeof(*compress_pixels));
if (compress_pixels == (unsigned char *) NULL)
{
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
}
(void) ResetMagickMemory(compress_pixels,0,(3*length+256)*
sizeof(*compress_pixels));
previous_pixels=(unsigned char *) AcquireQuantumMemory(length+1,
sizeof(*previous_pixels));
if (previous_pixels == (unsigned char *) NULL)
{
compress_pixels=(unsigned char *) RelinquishMagickMemory(
compress_pixels);
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
}
(void) ResetMagickMemory(previous_pixels,0,(length+1)*
sizeof(*previous_pixels));
(void) FormatLocaleString(buffer,MaxTextExtent,"\033*b3M");
(void) WriteBlobString(image,buffer);
break;
}
}
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;
indexes=GetAuthenticIndexQueue(image);
q=pixels;
switch (bits_per_pixel)
{
case 1:
{
register unsigned char
bit,
byte;
/*
Monochrome image.
*/
bit=0;
byte=0;
for (x=0; x < (ssize_t) image->columns; x++)
{
byte<<=1;
if (GetPixelIntensity(image,p) < (QuantumRange/2.0))
byte|=0x01;
bit++;
if (bit == 8)
{
*q++=byte;
bit=0;
byte=0;
}
p++;
}
if (bit != 0)
*q++=byte << (8-bit);
break;
}
开发者ID:0xPr0xy, 项目名称:ImageMagick, 代码行数:67, 代码来源:pcl.c
示例12: ReadTXTImage
//.........这里部分代码省略.........
status;
QuantumAny
range;
register long
i;
register PixelPacket
*q;
ssize_t
count;
unsigned long
depth,
max_value;
/*
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) ResetMagickMemory(text,0,sizeof(text));
(void) ReadBlobString(image,text);
if (LocaleNCompare((char *) text,MagickID,strlen(MagickID)) != 0)
return(ReadTEXTImage(image_info,image,text,exception));
*colorspace='\0';
count=(ssize_t) sscanf(text+32,"%lu,%lu,%lu,%s",&image->columns,
&image->rows,&max_value,colorspace);
if (count != 4)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
for (depth=1; (GetQuantumRange(depth)+1) < max_value; depth++) ;
image->depth=depth;
LocaleLower(colorspace);
i=(long) strlen(colorspace)-1;
image->matte=MagickFalse;
if ((i > 0) && (colorspace[i] == 'a'))
{
colorspace[i]='\0';
image->matte=MagickTrue;
}
type=ParseMagickOption(MagickColorspaceOptions,MagickFalse,colorspace);
if (type < 0)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
image->colorspace=(ColorspaceType) type;
(void) ResetMagickMemory(&pixel,0,sizeof(pixel));
(void) SetImageBackgroundColor(image);
range=GetQuantumRange(image->depth);
while (ReadBlobString(image,text) != (char *) NULL)
{
if (image->colorspace == CMYKColorspace)
{
if (image->matte != MagickFalse)
count=(ssize_t) sscanf(text,"%ld,%ld: (%lu,%lu,%lu,%lu,%lu",&x,&y,
&pixel.red,&pixel.green,&pixel.blue,&pixel.index,&pixel.opacity);
else
count=(ssize_t) sscanf(text,"%ld,%ld: (%lu,%lu,%lu,%lu",&x,&y,
&pixel.red,&pixel.green,&pixel.blue,&pixel.index);
}
else
if (image->matte != MagickFalse)
count=(ssize_t) sscanf(text,"%ld,%ld: (%lu,%lu,%lu,%lu",&x,&y,
&pixel.red,&pixel.green,&pixel.blue,&pixel.opacity);
else
count=(ssize_t) sscanf(text,"%ld,%ld: (%lu,%lu,%lu",&x,&y,
&pixel.red,&pixel.green,&pixel.blue);
if (count < 5)
continue;
q=GetAuthenticPixels(image,x,y,1,1,exception);
if (q == (PixelPacket *) NULL)
continue;
q->red=ScaleAnyToQuantum(pixel.red,range);
q->green=ScaleAnyToQuantum(pixel.green,range);
q->blue=ScaleAnyToQuantum(pixel.blue,range);
if (image->colorspace == CMYKColorspace)
{
indexes=GetAuthenticIndexQueue(image);
*indexes=ScaleAnyToQuantum(pixel.index,range);
}
if (image->matte != MagickFalse)
q->opacity=(Quantum) (QuantumRange-ScaleAnyToQuantum(pixel.opacity,
range));
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
return(GetFirstImageInList(image));
}
开发者ID:0xPr0xy, 项目名称:ImageMagick, 代码行数:101, 代码来源:txt.c
示例13: ReadMAPImage
//.........这里部分代码省略.........
(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");
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
/*
Initialize image structure.
*/
image->storage_class=PseudoClass;
status=AcquireImageColormap(image,(size_t)
(image->offset != 0 ? image->offset : 256));
if (status == MagickFalse)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
depth=GetImageQuantumDepth(image,MagickTrue);
packet_size=(size_t) (depth/8);
pixels=(unsigned char *) AcquireQuantumMemory(image->columns,packet_size*
sizeof(*pixels));
packet_size=(size_t) (image->colors > 256 ? 6UL : 3UL);
colormap=(unsigned char *) AcquireQuantumMemory(image->colors,packet_size*
sizeof(*colormap));
if ((pixels == (unsigned char *) NULL) ||
(colormap == (unsigned char *) NULL))
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
/*
Read image colormap.
*/
count=ReadBlob(image,packet_size*image->colors,colormap);
if (count != (ssize_t) (packet_size*image->colors))
ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");
p=colormap;
if (image->depth <= 8)
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++);
}
else
for (i=0; i < (ssize_t) image->colors; i++)
{
quantum=(*p++ << 8);
quantum|=(*p++);
image->colormap[i].red=(Quantum) quantum;
quantum=(*p++ << 8);
quantum|=(*p++);
image->colormap[i].green=(Quantum) quantum;
quantum=(*p++ << 8);
quantum|=(*p++);
image->colormap[i].blue=(Quantum) quantum;
}
colormap=(unsigned char *) RelinquishMagickMemory(colormap);
if (image_info->ping != MagickFalse)
{
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
/*
Read image pixels.
*/
packet_size=(size_t) (depth/8);
for (y=0; y < (ssize_t) image->rows; y++)
{
p=pixels;
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
indexes=GetAuthenticIndexQueue(image);
count=ReadBlob(image,(size_t) packet_size*image->columns,pixels);
if (count != (ssize_t) (packet_size*image->columns))
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
index=ConstrainColormapIndex(image,*p);
p++;
if (image->colors > 256)
{
index=ConstrainColormapIndex(image,((size_t) index << 8)+(*p));
p++;
}
indexes[x]=(IndexPacket) index;
*q++=image->colormap[(ssize_t) index];
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
if (y < (ssize_t) image->rows)
ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
image->filename);
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
开发者ID:0xPr0xy, 项目名称:ImageMagick, 代码行数:101, 代码来源:map.c
示例14: FloodfillPaintImage
//.........这里部分代码省略.........
q=GetAuthenticPixels(floodplane_image,x,y,image->columns-x,1,
exception);
if ((p == (const PixelPacket *) NULL) ||
(q == (PixelPacket *) NULL))
break;
indexes=GetVirtualIndexQueue(image);
for ( ; x < (long) image->columns; x++)
{
if (q->opacity == (Quantum) TransparentOpacity)
break;
SetMagickPixelPacket(image,p,indexes+x,&pixel);
if (IsMagickColorSimilar(&pixel,target) == invert)
break;
q->opacity=(Quantum) TransparentOpacity;
p++;
q++;
}
if (SyncAuthenticPixels(floodplane_image,exception) == MagickFalse)
break;
}
PushSegmentStack(y,start,x-1,offset);
if (x > (x2+1))
PushSegmentStack(y,x2+1,x-1,-offset);
}
skip=MagickFalse;
x++;
if (x <= x2)
{
p=GetVirtualPixels(image,x,y,(unsigned long) (x2-x+1),1,exception);
q=GetAuthenticPixels(floodplane_image,x,y,(unsigned long) (x2-x+1),1,
exception);
if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL))
break;
indexes=GetVirtualIndexQueue(image);
for ( ; x <= x2; x++)
{
if (q->opacity == (Quantum) TransparentOpacity)
break;
SetMagickPixelPacket(image,p,indexes+x,&pixel);
if (IsMagickColorSimilar(&pixel,target) != invert)
break;
p++;
q++;
}
}
start=x;
} while (x <= x2);
}
for (y=0; y < (long) image->rows; y++)
{
register const PixelPacket
*__restrict p;
register IndexPacket
*__restrict indexes;
register long
x;
register PixelPacket
*__restrict q;
/*
Tile fill color onto floodplane.
*/
p=GetVirtualPixels(floodplane_image,0,y,image->columns,1,exception);
q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL))
break;
indexes=GetAuthenticIndexQueue(image);
for (x=0; x < (long) image->columns; x++)
{
if (p->opacity != OpaqueOpacity)
{
(void) GetFillColor(draw_info,x,y,&fill_color);
SetMagickPixelPacket(image,&fill_color,(IndexPacket *) NULL,&fill);
if (image->colorspace == CMYKColorspace)
ConvertRGBToCMYK(&fill);
if ((channel & RedChannel) != 0)
q->red=RoundToQuantum(fill.red);
if ((channel & GreenChannel) != 0)
q->green=RoundToQuantum(fill.green);
if ((channel & BlueChannel) != 0)
q->blue=RoundToQuantum(fill.blue);
if ((channel & OpacityChannel) != 0)
q->opacity=RoundToQuantum(fill.opacity);
if (((channel & IndexChannel) != 0) &&
(image->colorspace == CMYKColorspace))
indexes[x]=RoundToQuantum(fill.index);
}
p++;
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
segment_stack=(SegmentInfo *) RelinquishMagickMemory(segment_stack);
floodplane_image=DestroyImage(floodplane_image);
return(y == (long) image->rows ? MagickTrue : MagickFalse);
}
开发者ID:0xPr0xy, 项目名称:ImageMagick, 代码行数:101, 代码来源:paint.c
示例15: assert
//.........这里部分代码省略.........
image->colormap[0].green=(Quantum) 0;
image->colormap[0].blue=(Quantum) 0;
image->colormap[1].red=(Quantum) QuantumRange;
image->colormap[1].green=(Quantum) QuantumRange;
image->colormap[1].blue=(Quantum) 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++);
}
}
pcx_colormap=(unsigned char *) RelinquishMagickMemory(pcx_colormap);
}
/*
Convert PCX raster image to pixel packets.
*/
for (y=0; y < (ssize_t) image->rows; y++)
{
p=pcx_pixels+(y*pcx_info.bytes_per_line*pcx_info.planes);
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
indexes=GetAuthenticIndexQueue(image);
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;
}
}
r+=pcx_info.planes;
开发者ID:0xPr0xy, 项目名称:ImageMagick, 代码行数:67, 代码来源:pcx.c
六六分期app的软件客服如何联系?不知道吗?加qq群【895510560】即可!标题:六六分期
阅读:19191| 2023-10-27
今天小编告诉大家如何处理win10系统火狐flash插件总是崩溃的问题,可能很多用户都不知
阅读:9988| 2022-11-06
今天小编告诉大家如何对win10系统删除桌面回收站图标进行设置,可能很多用户都不知道
阅读:8327| 2022-11-06
今天小编告诉大家如何对win10系统电脑设置节能降温的设置方法,想必大家都遇到过需要
阅读:8696| 2022-11-06
我们在使用xp系统的过程中,经常需要对xp系统无线网络安装向导设置进行设置,可能很多
阅读:8639| 2022-11-06
今天小编告诉大家如何处理win7系统玩cf老是与主机连接不稳定的问题,可能很多用户都不
阅读:9657| 2022-11-06
电脑对日常生活的重要性小编就不多说了,可是一旦碰到win7系统设置cf烟雾头的问题,很
阅读:8624| 2022-11-06
我们在日常使用电脑的时候,有的小伙伴们可能在打开应用的时候会遇见提示应用程序无法
阅读:7998| 2022-11-06
今天小编告诉大家如何对win7系统打开vcf文件进行设置,可能很多用户都不知道怎么对win
阅读:8656| 2022-11-06
今天小编告诉大家如何对win10系统s4开启USB调试模式进行设置,可能很多用户都不知道怎
阅读:7535| 2022-11-06
请发表评论