这篇教程C++ GetAuthenticIndexQueue函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetAuthenticIndexQueue函数的典型用法代码示例。如果您正苦于以下问题:C++ GetAuthenticIndexQueue函数的具体用法?C++ GetAuthenticIndexQueue怎么用?C++ GetAuthenticIndexQueue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetAuthenticIndexQueue函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ReadVIPSPixelsNONEstatic 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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例7: GetBitstatic 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,
示例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,
示例9: assertstatic 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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例16: ReadJBIGImage//.........这里部分代码省略......... /* Initialize JBIG toolkit. */ jbg_dec_init(&jbig_info); jbg_dec_maxsize(&jbig_info,(unsigned long) image->columns,(unsigned long) image->rows); image->columns=jbg_dec_getwidth(&jbig_info); image->rows=jbg_dec_getheight(&jbig_info); image->depth=8; image->storage_class=PseudoClass; image->colors=2; /* Read JBIG file. */ buffer=(unsigned char *) AcquireQuantumMemory(MagickMaxBufferExtent, sizeof(*buffer)); if (buffer == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); status=JBG_EAGAIN; do { length=(ssize_t) ReadBlob(image,MagickMaxBufferExtent,buffer); if (length == 0) break; p=buffer; count=0; while ((length > 0) && ((status == JBG_EAGAIN) || (status == JBG_EOK))) { size_t count; status=jbg_dec_in(&jbig_info,p,length,&count); p+=count; length-=(ssize_t) count; } } while ((status == JBG_EAGAIN) || (status == JBG_EOK)); /* Create colormap. */ image->columns=jbg_dec_getwidth(&jbig_info); image->rows=jbg_dec_getheight(&jbig_info); image->compression=JBIG2Compression; if (AcquireImageColormap(image,2) == MagickFalse) { buffer=(unsigned char *) RelinquishMagickMemory(buffer); ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); } image->colormap[0].red=0; image->colormap[0].green=0; image->colormap[0].blue=0; image->colormap[1].red=QuantumRange; image->colormap[1].green=QuantumRange; image->colormap[1].blue=QuantumRange; image->x_resolution=300; image->y_resolution=300; if (image_info->ping != MagickFalse) { (void) CloseBlob(image); return(GetFirstImageInList(image)); } /* Convert X bitmap image to pixel packets. */ p=jbg_dec_getimage(&jbig_info,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); bit=0; byte=0; for (x=0; x < (ssize_t) image->columns; x++) { if (bit == 0) byte=(*p++); index=(byte & 0x80) ? 0 : 1; bit++; byte<<=1; if (bit == 8) bit=0; SetPixelIndex(indexes+x,index); SetPixelRGBO(q,image->colormap+(ssize_t) index); q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } /* Free scale resource. */ jbg_dec_free(&jbig_info); buffer=(unsigned char *) RelinquishMagickMemory(buffer); (void) CloseBlob(image); return(GetFirstImageInList(image));}
开发者ID:271845221,项目名称:Android-ImageMagick,代码行数:101,
示例17: assert/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% %% R e a d X C I m a g e %% %% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ReadXCImage 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 ReadXCImage method is:%% Image *ReadXCImage(const ImageInfo *image_info,ExceptionInfo *exception)%% A description of each parameter follows:%% o image: The image.%% o image_info: the image info.%% o exception: return any errors or warnings in this structure.%*/static Image *ReadXCImage(const ImageInfo *image_info,ExceptionInfo *exception){ Image *image; IndexPacket index, *indexes; MagickBooleanType status; MagickPixelPacket color; ssize_t y; PixelPacket pixel; 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; (void) CopyMagickString(image->filename,image_info->filename,MaxTextExtent); status=QueryMagickColor((char *) image_info->filename,&color,exception); if (status == MagickFalse) { image=DestroyImage(image); return((Image *) NULL); } image->colorspace=color.colorspace; image->matte=color.matte; index=0; SetPixelPacket(image,&color,&pixel,&index); 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++) *q++=pixel; if (image->colorspace == CMYKColorspace) { indexes=GetAuthenticIndexQueue(image); for (x=0; x < (ssize_t) image->columns; x++) indexes[x]=index; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } return(GetFirstImageInList(image));}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:100,
示例18: ReadSIXELImage//.........这里部分代码省略......... 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 SIXEL file. */ length=MaxTextExtent; sixel_buffer=(char *) AcquireQuantumMemory((size_t) length,sizeof(*sixel_buffer)); p=sixel_buffer; if (sixel_buffer != (char *) NULL) while (ReadBlobString(image,p) != (char *) NULL) { if ((*p == '#') && ((p == sixel_buffer) || (*(p-1) == '/n'))) continue; if ((*p == '}') && (*(p+1) == ';')) break; p+=strlen(p); if ((size_t) (p-sixel_buffer+MaxTextExtent) < length) continue; length<<=1; sixel_buffer=(char *) ResizeQuantumMemory(sixel_buffer,length+MaxTextExtent, sizeof(*sixel_buffer)); if (sixel_buffer == (char *) NULL) break; p=sixel_buffer+strlen(sixel_buffer); } if (sixel_buffer == (char *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); /* Decode SIXEL */ if (sixel_decode((unsigned char *)sixel_buffer, &sixel_pixels, &image->columns, &image->rows, &sixel_palette, &image->colors) == MagickFalse) { sixel_buffer=(char *) RelinquishMagickMemory(sixel_buffer); ThrowReaderException(CorruptImageError,"CorruptImage"); } sixel_buffer=(char *) RelinquishMagickMemory(sixel_buffer); image->depth=24; image->storage_class=PseudoClass; status=SetImageExtent(image,image->columns,image->rows); if (status == MagickFalse) { InheritException(exception,&image->exception); return(DestroyImageList(image)); } if (AcquireImageColormap(image,image->colors) == MagickFalse) { sixel_pixels=(unsigned char *) RelinquishMagickMemory(sixel_pixels); sixel_palette=(unsigned char *) RelinquishMagickMemory(sixel_palette); ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); } for (i = 0; i < (ssize_t) image->colors; ++i) { image->colormap[i].red = ScaleCharToQuantum(sixel_palette[i * 4 + 0]); image->colormap[i].green = ScaleCharToQuantum(sixel_palette[i * 4 + 1]); image->colormap[i].blue = ScaleCharToQuantum(sixel_palette[i * 4 + 2]); } j=0; if (image_info->ping == MagickFalse) { /* Read image pixels. */ for (y=0; y < (ssize_t) image->rows; y++) { 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++) { j=(ssize_t) sixel_pixels[y * image->columns + x]; SetPixelIndex(indexes+x,j); r++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } if (y < (ssize_t) image->rows) { sixel_pixels=(unsigned char *) RelinquishMagickMemory(sixel_pixels); sixel_palette=(unsigned char *) RelinquishMagickMemory(sixel_palette); ThrowReaderException(CorruptImageError,"NotEnoughPixelData"); } } /* Relinquish resources. */ sixel_pixels=(unsigned char *) RelinquishMagickMemory(sixel_pixels); sixel_palette=(unsigned char *) RelinquishMagickMemory(sixel_palette); (void) CloseBlob(image); return(GetFirstImageInList(image));}
开发者ID:CamiloBenavides,项目名称:SnoutPoint-Web,代码行数:101,
示例19: ReadRGFImage//.........这里部分代码省略......... ssize_t y; unsigned char *data; /* 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); } /* Read RGF header. */ image->columns = (unsigned long) ReadBlobByte(image); image->rows = (unsigned long) ReadBlobByte(image); image->depth=8; image->storage_class=PseudoClass; image->colors=2; /* Initialize image structure. */ if (AcquireImageColormap(image,image->colors) == MagickFalse) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); /* Initialize colormap. */ image->colormap[0].red=QuantumRange; image->colormap[0].green=QuantumRange; image->colormap[0].blue=QuantumRange; image->colormap[1].red=(Quantum) 0; image->colormap[1].green=(Quantum) 0; image->colormap[1].blue=(Quantum) 0; if (image_info->ping != MagickFalse) { (void) CloseBlob(image); return(GetFirstImageInList(image)); } /* Read hex image data. */ data=(unsigned char *) AcquireQuantumMemory(image->rows,image->columns* sizeof(*data)); if (data == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); p=data; for (i=0; i < (ssize_t) (image->columns * image->rows); i++) { *p++=ReadBlobByte(image); } /* Convert RGF image to pixel packets. */ p=data; 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=(size_t) (*p++); SetPixelIndex(indexes+x,(Quantum) ((byte & 0x01) != 0 ? 0x01 : 0x00)); bit++; byte>>=1; if (bit == 8) bit=0; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } data=(unsigned char *) RelinquishMagickMemory(data); (void) SyncImage(image); (void) CloseBlob(image); return(GetFirstImageInList(image));}
开发者ID:UIKit0,项目名称:YoyaMagick,代码行数:101,
示例20: ReadPIXImage//.........这里部分代码省略......... 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) break; } }
开发者ID:271845221,项目名称:Android-ImageMagick,代码行数:67,
示例21: ReadMACImage//.........这里部分代码省略......... { (void) CloseBlob(image); return(GetFirstImageInList(image)); } status=SetImageExtent(image,image->columns,image->rows); if (status == MagickFalse) { InheritException(exception,&image->exception); return(DestroyImageList(image)); } /* Convert MAC raster image to pixel packets. */ length=(image->columns+7)/8; pixels=(unsigned char *) AcquireQuantumMemory(length+1,sizeof(*pixels)); if (pixels == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); p=pixels; offset=0; for (y=0; y < (ssize_t) image->rows; ) { count=(unsigned char) ReadBlobByte(image); if (EOFBlob(image) != MagickFalse) break; if ((count <= 0) || (count >= 128)) { byte=(unsigned char) (~ReadBlobByte(image)); count=(~count)+2; while (count != 0) { *p++=byte; offset++; count--; if (offset >= (ssize_t) length) { q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; indexes=GetAuthenticIndexQueue(image); p=pixels; bit=0; byte=0; for (x=0; x < (ssize_t) image->columns; x++) { if (bit == 0) byte=(*p++); SetPixelIndex(indexes+x,((byte & 0x80) != 0 ? 0x01 : 0x00)); bit++; byte<<=1; if (bit == 8) bit=0; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; offset=0; p=pixels; y++; } } continue; } count++; while (count != 0) { byte=(unsigned char) (~ReadBlobByte(image)); *p++=byte; offset++; count--; if (offset >= (ssize_t) length) { q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; indexes=GetAuthenticIndexQueue(image); p=pixels; bit=0; byte=0; for (x=0; x < (ssize_t) image->columns; x++) { if (bit == 0) byte=(*p++); SetPixelIndex(indexes+x,((byte & 0x80) != 0 ? 0x01 : 0x00)); bit++; byte<<=1; if (bit == 8) bit=0; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; offset=0; p=pixels; y++; } } } pixels=(unsigned char *) RelinquishMagickMemory(pixels); (void) SyncImage(image); (void) CloseBlob(image); return(GetFirstImageInList(image));}
开发者ID:CamiloBenavides,项目名称:SnoutPoint-Web,代码行数:101,
示例22: ReadTXTImage//.........这里部分代码省略......... if (image->matte != MagickFalse) { count=(ssize_t) sscanf(text,"%ld,%ld: (%lf%*[%,]%lf%*[%,]", &x_offset,&y_offset,&red,&opacity); green=red; blue=red; break; } count=(ssize_t) sscanf(text,"%ld,%ld: (%lf%*[%,]",&x_offset, &y_offset,&red); green=red; blue=red; break; } case CMYKColorspace: { if (image->matte != MagickFalse) { count=(ssize_t) sscanf(text, "%ld,%ld: (%lf%*[%,]%lf%*[%,]%lf%*[%,]%lf%*[%,]%lf%*[%,]", &x_offset,&y_offset,&red,&green,&blue,&index,&opacity); break; } count=(ssize_t) sscanf(text, "%ld,%ld: (%lf%*[%,]%lf%*[%,]%lf%*[%,]%lf%*[%,]",&x_offset, &y_offset,&red,&green,&blue,&index); break; } default: { if (image->matte != MagickFalse) { count=(ssize_t) sscanf(text, "%ld,%ld: (%lf%*[%,]%lf%*[%,]%lf%*[%,]%lf%*[%,]", &x_offset,&y_offset,&red,&green,&blue,&opacity); break; } count=(ssize_t) sscanf(text, "%ld,%ld: (%lf%*[%,]%lf%*[%,]%lf%*[%,]",&x_offset,&y_offset, &red,&green,&blue); break; } } if (strchr(text,'%') != (char *) NULL) { red*=0.01*range; green*=0.01*range; blue*=0.01*range; index*=0.01*range; opacity*=0.01*range; } if (image->colorspace == LabColorspace) { green+=(range+1)/2.0; blue+=(range+1)/2.0; } pixel.red=ScaleAnyToQuantum((QuantumAny) (red+0.5),range); pixel.green=ScaleAnyToQuantum((QuantumAny) (green+0.5),range); pixel.blue=ScaleAnyToQuantum((QuantumAny) (blue+0.5),range); pixel.index=ScaleAnyToQuantum((QuantumAny) (index+0.5),range); pixel.opacity=ScaleAnyToQuantum((QuantumAny) (opacity+0.5),range); q=GetAuthenticPixels(image,x_offset,y_offset,1,1,exception); if (q == (PixelPacket *) NULL) continue; SetPixelRed(q,pixel.red); SetPixelGreen(q,pixel.green); SetPixelBlue(q,pixel.blue); if (image->colorspace == CMYKColorspace) { indexes=GetAuthenticIndexQueue(image); SetPixelIndex(indexes,pixel.index); } if (image->matte != MagickFalse) SetPixelAlpha(q,pixel.opacity); if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } } (void) ReadBlobString(image,text); if (LocaleNCompare((char *) text,MagickID,strlen(MagickID)) == 0) { /* 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 (LocaleNCompare((char *) text,MagickID,strlen(MagickID)) == 0); (void) CloseBlob(image); return(GetFirstImageInList(image));}
开发者ID:GalliumOS,项目名称:imagemagick,代码行数:101,
示例23: get_page_image/* * DjVu advertised readiness to provide bitmap: So get it! * we use the RGB format! */static voidget_page_image(LoadContext *lc, ddjvu_page_t *page, int x, int y, int w, int h, const ImageInfo *image_info ) { ddjvu_format_t *format; ddjvu_page_type_t type; Image *image; int ret, stride; unsigned char *q; ddjvu_rect_t rect; rect.x = x; rect.y = y; rect.w = (unsigned int) w; /* /10 */ rect.h = (unsigned int) h; /* /10 */ image = lc->image; type = ddjvu_page_get_type(lc->page); /* stride of this temporary buffer: */ stride = (type == DDJVU_PAGETYPE_BITONAL)? (image->columns + 7)/8 : image->columns *3; q = (unsigned char *) AcquireQuantumMemory(image->rows,stride); if (q == (unsigned char *) NULL) return; format = ddjvu_format_create( (type == DDJVU_PAGETYPE_BITONAL)?DDJVU_FORMAT_LSBTOMSB : DDJVU_FORMAT_RGB24, /* DDJVU_FORMAT_RGB24 * DDJVU_FORMAT_RGBMASK32*/ /* DDJVU_FORMAT_RGBMASK32 */ 0, NULL);#if 0 /* fixme: ThrowReaderException is a macro, which uses `exception' variable */ if (format == NULL) { abort(); /* ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); */ }#endif ddjvu_format_set_row_order(format, 1); ddjvu_format_set_y_direction(format, 1); ret = ddjvu_page_render(page, DDJVU_RENDER_COLOR, /* ddjvu_render_mode_t */ &rect, &rect, /* mmc: ?? */ format, stride, /* ?? */ (char*)q); (void) ret; ddjvu_format_release(format); if (type == DDJVU_PAGETYPE_BITONAL) { /* */#if DEBUG printf("%s: expanding BITONAL page/image/n", __FUNCTION__);#endif register IndexPacket *indexes; size_t bit, byte; for (y=0; y < (ssize_t) image->rows; y++) { PixelPacket * o = QueueAuthenticPixels(image,0,y,image->columns,1,&image->exception); if (o == (PixelPacket *) NULL) break; indexes=GetAuthenticIndexQueue(image); bit=0; byte=0; /* fixme: the non-aligned, last =<7 bits ! that's ok!!!*/ for (x= 0; x < (ssize_t) image->columns; x++) { if (bit == 0) byte= (size_t) q[(y * stride) + (x / 8)]; if (indexes != (IndexPacket *) NULL) SetPixelIndex(indexes+x,(IndexPacket) (((byte & 0x01) != 0) ? 0x00 : 0x01)); bit++; if (bit == 8) bit=0; byte>>=1; } if (SyncAuthenticPixels(image,&image->exception) == MagickFalse) break;//.........这里部分代码省略.........
开发者ID:YutaMatsumoto,项目名称:icehockey,代码行数:101,
示例24: WritePICONImage//.........这里部分代码省略......... q=GetAuthenticPixels(picon,0,y,picon->columns,1,exception); if (q == (PixelPacket *) NULL) break; for (x=0; x < (ssize_t) picon->columns; x++) { if (q->opacity == (Quantum) TransparentOpacity) transparent=MagickTrue; else SetPixelOpacity(q,OpaqueOpacity); q++; } if (SyncAuthenticPixels(picon,exception) == MagickFalse) break; } } (void) SetImageType(picon,PaletteType); } colors=picon->colors; if (transparent != MagickFalse) { register IndexPacket *indexes; colors++; picon->colormap=(PixelPacket *) ResizeQuantumMemory((void **) picon->colormap,(size_t) colors,sizeof(*picon->colormap)); if (picon->colormap == (PixelPacket *) NULL) ThrowWriterException(ResourceLimitError,"MemoryAllocationError"); for (y=0; y < (ssize_t) picon->rows; y++) { q=GetAuthenticPixels(picon,0,y,picon->columns,1,exception); if (q == (PixelPacket *) NULL) break; indexes=GetAuthenticIndexQueue(picon); for (x=0; x < (ssize_t) picon->columns; x++) { if (q->opacity == (Quantum) TransparentOpacity) SetPixelIndex(indexes+x,picon->colors); q++; } if (SyncAuthenticPixels(picon,exception) == MagickFalse) break; } } /* Compute the character per pixel. */ characters_per_pixel=1; for (k=MaxCixels; (ssize_t) colors > k; k*=MaxCixels) characters_per_pixel++; /* XPM header. */ (void) WriteBlobString(image,"/* XPM *//n"); GetPathComponent(picon->filename,BasePath,basename); (void) FormatLocaleString(buffer,MaxTextExtent, "static char *%s[] = {/n",basename); (void) WriteBlobString(image,buffer); (void) WriteBlobString(image,"/* columns rows colors chars-per-pixel *//n"); (void) FormatLocaleString(buffer,MaxTextExtent, "/"%.20g %.20g %.20g %.20g/",/n",(double) picon->columns,(double) picon->rows,(double) colors,(double) characters_per_pixel); (void) WriteBlobString(image,buffer); GetMagickPixelPacket(image,&pixel); for (i=0; i < (ssize_t) colors; i++) {
开发者ID:MarinaAndenko,项目名称:MyBlog,代码行数:67,
示例25: ReadSCTImage//.........这里部分代码省略......... (LocaleNCompare((char *) magick,"LW",2) != 0) && (LocaleNCompare((char *) magick,"BM",2) != 0) && (LocaleNCompare((char *) magick,"PG",2) != 0) && (LocaleNCompare((char *) magick,"TX",2) != 0)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); if ((LocaleNCompare((char *) magick,"LW",2) == 0) || (LocaleNCompare((char *) magick,"BM",2) == 0) || (LocaleNCompare((char *) magick,"PG",2) == 0) || (LocaleNCompare((char *) magick,"TX",2) == 0)) ThrowReaderException(CoderError,"OnlyContinuousTonePictureSupported"); count=ReadBlob(image,174,buffer); count=ReadBlob(image,768,buffer); /* Read paramter block. */ units=1UL*ReadBlobByte(image); if (units == 0) image->units=PixelsPerCentimeterResolution; separations=1UL*ReadBlobByte(image); separations_mask=ReadBlobMSBShort(image); count=ReadBlob(image,14,buffer); buffer[14]='/0'; height=StringToDouble((char *) buffer); count=ReadBlob(image,14,buffer); width=StringToDouble((char *) buffer); count=ReadBlob(image,12,buffer); buffer[12]='/0'; image->rows=StringToUnsignedLong((char *) buffer); count=ReadBlob(image,12,buffer); image->columns=StringToUnsignedLong((char *) buffer); count=ReadBlob(image,200,buffer); count=ReadBlob(image,768,buffer); if (separations_mask == 0x0f) image->colorspace=CMYKColorspace; image->x_resolution=1.0*image->columns/width; image->y_resolution=1.0*image->rows/height; if (image_info->ping != MagickFalse) { (void) CloseBlob(image); return(GetFirstImageInList(image)); } /* Convert SCT raster image to pixel packets. */ for (y=0; y < (long) image->rows; y++) { for (i=0; i < (long) separations; i++) { q=GetAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; indexes=GetAuthenticIndexQueue(image); for (x=0; x < (long) image->columns; x++) { pixel=(Quantum) ScaleCharToQuantum((unsigned char) ReadBlobByte(image)); if (image->colorspace == CMYKColorspace) pixel=(Quantum) (QuantumRange-pixel); switch (i) { case 0: { q->red=pixel; q->green=pixel; q->blue=pixel; break; } case 1: { q->green=pixel; break; } case 2: { q->blue=pixel; break; break; } case 3: { if (image->colorspace == CMYKColorspace) indexes[x]=(IndexPacket) pixel; break; } } q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if ((image->columns % 2) != 0) (void) ReadBlobByte(image); /* pad */ } status=SetImageProgress(image,LoadImageTag,y,image->rows); if (status == MagickFalse) break; } if (EOFBlob(image) != MagickFalse) ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile", image->filename); (void) CloseBlob(image); return(GetFirstImageInList(image));}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,
注:本文中的GetAuthenticIndexQueue函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetAuthenticPixels函数代码示例 C++ GetAurasByType函数代码示例 |