Lines Matching refs:image
217 *image; in ReadPCXImage() local
274 image=AcquireImage(image_info,exception); in ReadPCXImage()
275 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); in ReadPCXImage()
278 image=DestroyImageList(image); in ReadPCXImage()
295 magic=ReadBlobLSBLong(image); in ReadPCXImage()
304 page_table[id]=(MagickOffsetType) ReadBlobLSBLong(image); in ReadPCXImage()
311 offset=SeekBlob(image,(MagickOffsetType) page_table[0],SEEK_SET); in ReadPCXImage()
315 count=ReadBlob(image,1,&pcx_info.identifier); in ReadPCXImage()
324 pcx_info.version=(unsigned char) ReadBlobByte(image); in ReadPCXImage()
327 pcx_info.encoding=(unsigned char) ReadBlobByte(image); in ReadPCXImage()
328 bits_per_pixel=ReadBlobByte(image); in ReadPCXImage()
332 pcx_info.left=ReadBlobLSBShort(image); in ReadPCXImage()
333 pcx_info.top=ReadBlobLSBShort(image); in ReadPCXImage()
334 pcx_info.right=ReadBlobLSBShort(image); in ReadPCXImage()
335 pcx_info.bottom=ReadBlobLSBShort(image); in ReadPCXImage()
336 pcx_info.horizontal_resolution=ReadBlobLSBShort(image); in ReadPCXImage()
337 pcx_info.vertical_resolution=ReadBlobLSBShort(image); in ReadPCXImage()
338 if (EOFBlob(image) != MagickFalse) in ReadPCXImage()
343 image->columns=(size_t) MagickAbsoluteValue((ssize_t) pcx_info.right- in ReadPCXImage()
345 image->rows=(size_t) MagickAbsoluteValue((ssize_t) pcx_info.bottom- in ReadPCXImage()
347 if ((image->columns == 0) || (image->rows == 0) || in ReadPCXImage()
351 image->depth=pcx_info.bits_per_pixel; in ReadPCXImage()
352 image->units=PixelsPerInchResolution; in ReadPCXImage()
353 image->resolution.x=(double) pcx_info.horizontal_resolution; in ReadPCXImage()
354 image->resolution.y=(double) pcx_info.vertical_resolution; in ReadPCXImage()
355 image->colors=16; in ReadPCXImage()
357 if (image->scene >= (image_info->scene+image_info->number_scenes-1)) in ReadPCXImage()
359 if ((MagickSizeType) (image->columns*image->rows/255) > GetBlobSize(image)) in ReadPCXImage()
361 status=SetImageExtent(image,image->columns,image->rows,exception); in ReadPCXImage()
364 (void) SetImageBackgroundColor(image,exception); in ReadPCXImage()
366 count=ReadBlob(image,3*image->colors,pcx_colormap); in ReadPCXImage()
367 if (count != (ssize_t) (3*image->colors)) in ReadPCXImage()
369 pcx_info.reserved=(unsigned char) ReadBlobByte(image); in ReadPCXImage()
370 pcx_info.planes=(unsigned char) ReadBlobByte(image); in ReadPCXImage()
381 image->colors=(size_t) MagickMin(one << (1UL* in ReadPCXImage()
383 if (AcquireImageColormap(image,image->colors,exception) == MagickFalse) in ReadPCXImage()
386 image->storage_class=DirectClass; in ReadPCXImage()
388 for (i=0; i < (ssize_t) image->colors; i++) in ReadPCXImage()
390 image->colormap[i].red=ScaleCharToQuantum(*p++); in ReadPCXImage()
391 image->colormap[i].green=ScaleCharToQuantum(*p++); in ReadPCXImage()
392 image->colormap[i].blue=ScaleCharToQuantum(*p++); in ReadPCXImage()
394 pcx_info.bytes_per_line=ReadBlobLSBShort(image); in ReadPCXImage()
395 pcx_info.palette_info=ReadBlobLSBShort(image); in ReadPCXImage()
396 pcx_info.horizontal_screensize=ReadBlobLSBShort(image); in ReadPCXImage()
397 pcx_info.vertical_screensize=ReadBlobLSBShort(image); in ReadPCXImage()
399 (void) ReadBlobByte(image); in ReadPCXImage()
403 if (HeapOverflowSanityCheck(image->rows, (size_t) pcx_info.bytes_per_line) != MagickFalse) in ReadPCXImage()
405 pcx_packets=(size_t) image->rows*pcx_info.bytes_per_line; in ReadPCXImage()
409 if ((size_t) (pcx_info.bits_per_pixel*pcx_info.planes*image->columns) > (pcx_packets*8U)) in ReadPCXImage()
411 if ((MagickSizeType) (pcx_packets/32+128) > GetBlobSize(image)) in ReadPCXImage()
413 scanline=(unsigned char *) AcquireQuantumMemory(MagickMax(image->columns, in ReadPCXImage()
425 (void) memset(scanline,0,(size_t) MagickMax(image->columns, in ReadPCXImage()
436 packet=(unsigned char) ReadBlobByte(image); in ReadPCXImage()
437 if (EOFBlob(image) != MagickFalse) in ReadPCXImage()
445 packet=(unsigned char) ReadBlobByte(image); in ReadPCXImage()
446 if (EOFBlob(image) != MagickFalse) in ReadPCXImage()
455 packet=(unsigned char) ReadBlobByte(image); in ReadPCXImage()
456 if (EOFBlob(image) != MagickFalse) in ReadPCXImage()
466 if (image->storage_class == DirectClass) in ReadPCXImage()
467 image->alpha_trait=pcx_info.planes > 3 ? BlendPixelTrait : in ReadPCXImage()
476 if (image->colors > 256) in ReadPCXImage()
483 image->colormap[0].red=(Quantum) 0; in ReadPCXImage()
484 image->colormap[0].green=(Quantum) 0; in ReadPCXImage()
485 image->colormap[0].blue=(Quantum) 0; in ReadPCXImage()
486 image->colormap[1].red=QuantumRange; in ReadPCXImage()
487 image->colormap[1].green=QuantumRange; in ReadPCXImage()
488 image->colormap[1].blue=QuantumRange; in ReadPCXImage()
491 if (image->colors > 16) in ReadPCXImage()
496 pcx_info.colormap_signature=(unsigned char) ReadBlobByte(image); in ReadPCXImage()
497 count=ReadBlob(image,3*image->colors,pcx_colormap); in ReadPCXImage()
499 for (i=0; i < (ssize_t) image->colors; i++) in ReadPCXImage()
501 image->colormap[i].red=ScaleCharToQuantum(*p++); in ReadPCXImage()
502 image->colormap[i].green=ScaleCharToQuantum(*p++); in ReadPCXImage()
503 image->colormap[i].blue=ScaleCharToQuantum(*p++); in ReadPCXImage()
510 for (y=0; y < (ssize_t) image->rows; y++) in ReadPCXImage()
513 q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); in ReadPCXImage()
517 if (image->storage_class == DirectClass) in ReadPCXImage()
553 for (x=0; x < (ssize_t) image->columns; x++) in ReadPCXImage()
578 for (x=0; x < ((ssize_t) image->columns-7); x+=8) in ReadPCXImage()
584 if ((image->columns % 8) != 0) in ReadPCXImage()
586 for (bit=7; bit >= (ssize_t) (8-(image->columns % 8)); bit--) in ReadPCXImage()
594 for (x=0; x < ((ssize_t) image->columns-3); x+=4) in ReadPCXImage()
602 if ((image->columns % 4) != 0) in ReadPCXImage()
604 for (i=3; i >= (ssize_t) (4-(image->columns % 4)); i--) in ReadPCXImage()
612 for (x=0; x < ((ssize_t) image->columns-1); x+=2) in ReadPCXImage()
618 if ((image->columns % 2) != 0) in ReadPCXImage()
624 (void) memcpy(r,p,image->columns); in ReadPCXImage()
634 for (x=0; x < (ssize_t) image->columns; x++) in ReadPCXImage()
636 if (image->storage_class == PseudoClass) in ReadPCXImage()
637 SetPixelIndex(image,*r++,q); in ReadPCXImage()
640 SetPixelRed(image,ScaleCharToQuantum(*r++),q); in ReadPCXImage()
641 SetPixelGreen(image,ScaleCharToQuantum(*r++),q); in ReadPCXImage()
642 SetPixelBlue(image,ScaleCharToQuantum(*r++),q); in ReadPCXImage()
643 if (image->alpha_trait != UndefinedPixelTrait) in ReadPCXImage()
644 SetPixelAlpha(image,ScaleCharToQuantum(*r++),q); in ReadPCXImage()
646 q+=GetPixelChannels(image); in ReadPCXImage()
648 if (SyncAuthenticPixels(image,exception) == MagickFalse) in ReadPCXImage()
650 if (image->previous == (Image *) NULL) in ReadPCXImage()
652 status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, in ReadPCXImage()
653 image->rows); in ReadPCXImage()
658 if (image->storage_class == PseudoClass) in ReadPCXImage()
659 (void) SyncImage(image,exception); in ReadPCXImage()
662 if (EOFBlob(image) != MagickFalse) in ReadPCXImage()
665 image->filename); in ReadPCXImage()
672 if (image->scene >= (image_info->scene+image_info->number_scenes-1)) in ReadPCXImage()
678 offset=SeekBlob(image,(MagickOffsetType) page_table[id],SEEK_SET); in ReadPCXImage()
681 count=ReadBlob(image,1,&pcx_info.identifier); in ReadPCXImage()
687 AcquireNextImage(image_info,image,exception); in ReadPCXImage()
688 if (GetNextImageInList(image) == (Image *) NULL) in ReadPCXImage()
693 image=SyncNextImageInList(image); in ReadPCXImage()
694 status=SetImageProgress(image,LoadImagesTag,TellBlob(image), in ReadPCXImage()
695 GetBlobSize(image)); in ReadPCXImage()
702 (void) CloseBlob(image); in ReadPCXImage()
704 return(DestroyImageList(image)); in ReadPCXImage()
705 return(GetFirstImageInList(image)); in ReadPCXImage()
809 const unsigned char *pixels,Image *image) in PCXWritePixels() argument
831 (void) WriteBlobByte(image,(unsigned char) (*q++)); in PCXWritePixels()
848 (void) WriteBlobByte(image,(unsigned char) count); in PCXWritePixels()
850 (void) WriteBlobByte(image,previous); in PCXWritePixels()
857 (void) WriteBlobByte(image,(unsigned char) count); in PCXWritePixels()
859 (void) WriteBlobByte(image,previous); in PCXWritePixels()
865 static MagickBooleanType WritePCXImage(const ImageInfo *image_info,Image *image, in WritePCXImage() argument
908 assert(image != (Image *) NULL); in WritePCXImage()
909 assert(image->signature == MagickCoreSignature); in WritePCXImage()
910 if (image->debug != MagickFalse) in WritePCXImage()
911 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); in WritePCXImage()
914 status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception); in WritePCXImage()
917 if ((image->columns > 65535UL) || (image->rows > 65535UL)) in WritePCXImage()
921 ((GetNextImageInList(image) != (Image *) NULL) && in WritePCXImage()
927 (void) WriteBlobLSBLong(image,0x3ADE68B1L); in WritePCXImage()
933 (void) WriteBlobLSBLong(image,0x00000000L); in WritePCXImage()
936 imageListLength=GetImageListLength(image); in WritePCXImage()
940 page_table[scene]=TellBlob(image); in WritePCXImage()
948 if ((image->storage_class == PseudoClass) && in WritePCXImage()
949 (SetImageMonochrome(image,exception) != MagickFalse)) in WritePCXImage()
952 (void) TransformImageColorspace(image,sRGBColorspace,exception); in WritePCXImage()
955 pcx_info.right=(unsigned short) (image->columns-1); in WritePCXImage()
956 pcx_info.bottom=(unsigned short) (image->rows-1); in WritePCXImage()
957 switch (image->units) in WritePCXImage()
963 pcx_info.horizontal_resolution=(unsigned short) image->resolution.x; in WritePCXImage()
964 pcx_info.vertical_resolution=(unsigned short) image->resolution.y; in WritePCXImage()
970 (2.54*image->resolution.x+0.5); in WritePCXImage()
972 (2.54*image->resolution.y+0.5); in WritePCXImage()
978 if ((image->storage_class == DirectClass) || (image->colors > 256)) in WritePCXImage()
981 if (image->alpha_trait != UndefinedPixelTrait) in WritePCXImage()
984 length=(((size_t) image->columns*pcx_info.bits_per_pixel+7)/8); in WritePCXImage()
997 (void) WriteBlobByte(image,pcx_info.identifier); in WritePCXImage()
998 (void) WriteBlobByte(image,pcx_info.version); in WritePCXImage()
999 (void) WriteBlobByte(image,pcx_info.encoding); in WritePCXImage()
1000 (void) WriteBlobByte(image,pcx_info.bits_per_pixel); in WritePCXImage()
1001 (void) WriteBlobLSBShort(image,pcx_info.left); in WritePCXImage()
1002 (void) WriteBlobLSBShort(image,pcx_info.top); in WritePCXImage()
1003 (void) WriteBlobLSBShort(image,pcx_info.right); in WritePCXImage()
1004 (void) WriteBlobLSBShort(image,pcx_info.bottom); in WritePCXImage()
1005 (void) WriteBlobLSBShort(image,pcx_info.horizontal_resolution); in WritePCXImage()
1006 (void) WriteBlobLSBShort(image,pcx_info.vertical_resolution); in WritePCXImage()
1020 if ((image->storage_class == PseudoClass) && (image->colors <= 256)) in WritePCXImage()
1021 for (i=0; i < (ssize_t) image->colors; i++) in WritePCXImage()
1023 *q++=ScaleQuantumToChar(image->colormap[i].red); in WritePCXImage()
1024 *q++=ScaleQuantumToChar(image->colormap[i].green); in WritePCXImage()
1025 *q++=ScaleQuantumToChar(image->colormap[i].blue); in WritePCXImage()
1027 (void) WriteBlob(image,3*16,(const unsigned char *) pcx_colormap); in WritePCXImage()
1028 (void) WriteBlobByte(image,pcx_info.reserved); in WritePCXImage()
1029 (void) WriteBlobByte(image,pcx_info.planes); in WritePCXImage()
1030 (void) WriteBlobLSBShort(image,pcx_info.bytes_per_line); in WritePCXImage()
1031 (void) WriteBlobLSBShort(image,pcx_info.palette_info); in WritePCXImage()
1033 (void) WriteBlobByte(image,'\0'); in WritePCXImage()
1045 if ((image->storage_class == DirectClass) || (image->colors > 256)) in WritePCXImage()
1050 for (y=0; y < (ssize_t) image->rows; y++) in WritePCXImage()
1055 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WritePCXImage()
1064 *q++=ScaleQuantumToChar(GetPixelRed(image,p)); in WritePCXImage()
1065 p+=GetPixelChannels(image); in WritePCXImage()
1073 *q++=ScaleQuantumToChar(GetPixelGreen(image,p)); in WritePCXImage()
1074 p+=GetPixelChannels(image); in WritePCXImage()
1082 *q++=ScaleQuantumToChar(GetPixelBlue(image,p)); in WritePCXImage()
1083 p+=GetPixelChannels(image); in WritePCXImage()
1092 *q++=ScaleQuantumToChar((Quantum) (GetPixelAlpha(image,p))); in WritePCXImage()
1093 p+=GetPixelChannels(image); in WritePCXImage()
1099 if (PCXWritePixels(&pcx_info,pixels,image) == MagickFalse) in WritePCXImage()
1101 if (image->previous == (Image *) NULL) in WritePCXImage()
1103 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, in WritePCXImage()
1104 image->rows); in WritePCXImage()
1113 for (y=0; y < (ssize_t) image->rows; y++) in WritePCXImage()
1115 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WritePCXImage()
1119 for (x=0; x < (ssize_t) image->columns; x++) in WritePCXImage()
1121 *q++=(unsigned char) GetPixelIndex(image,p); in WritePCXImage()
1122 p+=GetPixelChannels(image); in WritePCXImage()
1124 if (PCXWritePixels(&pcx_info,pixels,image) == MagickFalse) in WritePCXImage()
1126 if (image->previous == (Image *) NULL) in WritePCXImage()
1128 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) in WritePCXImage()
1129 y,image->rows); in WritePCXImage()
1143 for (y=0; y < (ssize_t) image->rows; y++) in WritePCXImage()
1145 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WritePCXImage()
1151 for (x=0; x < (ssize_t) image->columns; x++) in WritePCXImage()
1154 if (GetPixelLuma(image,p) >= (QuantumRange/2.0)) in WritePCXImage()
1163 p+=GetPixelChannels(image); in WritePCXImage()
1167 if (PCXWritePixels(&pcx_info,pixels,image) == MagickFalse) in WritePCXImage()
1169 if (image->previous == (Image *) NULL) in WritePCXImage()
1171 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) in WritePCXImage()
1172 y,image->rows); in WritePCXImage()
1178 (void) WriteBlobByte(image,pcx_info.colormap_signature); in WritePCXImage()
1179 (void) WriteBlob(image,3*256,pcx_colormap); in WritePCXImage()
1187 if (GetNextImageInList(image) == (Image *) NULL) in WritePCXImage()
1189 image=SyncNextImageInList(image); in WritePCXImage()
1190 status=SetImageProgress(image,SaveImagesTag,scene++,imageListLength); in WritePCXImage()
1200 offset=SeekBlob(image,0L,SEEK_SET); in WritePCXImage()
1206 (void) WriteBlobLSBLong(image,0x3ADE68B1L); in WritePCXImage()
1208 (void) WriteBlobLSBLong(image,(unsigned int) page_table[i]); in WritePCXImage()
1218 "UnableToWriteFile","`%s': %s",image->filename,message); in WritePCXImage()
1221 (void) CloseBlob(image); in WritePCXImage()