Home | History | Annotate | Download | only in coders

Lines Matching refs:image

53 #include "MagickCore/image.h"
54 #include "MagickCore/image-private.h"
149 static Image
150 *AutoResizeImage(const Image *,const char *,MagickOffsetType *,
154 WriteICONImage(const ImageInfo *,Image *,ExceptionInfo *);
156 Image *AutoResizeImage(const Image *image,const char *option,
167 Image
191 return((Image *) NULL);
205 resized=ResizeImage(image,sizes[i],sizes[i],image->filter,exception);
206 if (resized == (Image *) NULL)
209 if (images == (Image *) NULL)
229 % ReadICONImage() reads a Microsoft icon image file and returns it. It
230 % allocates the memory necessary for the new Image structure and returns a
231 % pointer to the new image.
235 % Image *ReadICONImage(const ImageInfo *image_info,
240 % o image_info: the image info.
245 static Image *ReadICONImage(const ImageInfo *image_info,
254 Image
255 *image;
283 Open image file.
290 image=AcquireImage(image_info,exception);
291 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
294 image=DestroyImageList(image);
295 return((Image *) NULL);
297 icon_file.reserved=(short) ReadBlobLSBShort(image);
298 icon_file.resource_type=(short) ReadBlobLSBShort(image);
299 icon_file.count=(short) ReadBlobLSBShort(image);
306 icon_file.directory[i].width=(unsigned char) ReadBlobByte(image);
307 icon_file.directory[i].height=(unsigned char) ReadBlobByte(image);
308 icon_file.directory[i].colors=(unsigned char) ReadBlobByte(image);
309 icon_file.directory[i].reserved=(unsigned char) ReadBlobByte(image);
310 icon_file.directory[i].planes=(unsigned short) ReadBlobLSBShort(image);
312 ReadBlobLSBShort(image);
313 icon_file.directory[i].size=ReadBlobLSBLong(image);
314 icon_file.directory[i].offset=ReadBlobLSBLong(image);
315 if (EOFBlob(image) != MagickFalse)
318 if (EOFBlob(image) != MagickFalse)
326 offset=(ssize_t) SeekBlob(image,(MagickOffsetType)
330 icon_info.size=ReadBlobLSBLong(image);
331 icon_info.width=(unsigned char) ReadBlobLSBSignedLong(image);
332 icon_info.height=(unsigned char) (ReadBlobLSBSignedLong(image)/2);
333 icon_info.planes=ReadBlobLSBShort(image);
334 icon_info.bits_per_pixel=ReadBlobLSBShort(image);
335 if (EOFBlob(image) != MagickFalse)
338 image->filename);
344 Image
357 Icon image encoded as a compressed PNG image.
370 count=ReadBlob(image,length-16,png+16);
371 icon_image=(Image *) NULL;
380 if (icon_image == (Image *) NULL)
385 image=DestroyImageList(image);
386 return((Image *) NULL);
389 icon_image->blob=ReferenceBlob(image->blob);
390 ReplaceImageInList(&image,icon_image);
396 icon_info.compression=ReadBlobLSBLong(image);
397 icon_info.image_size=ReadBlobLSBLong(image);
398 icon_info.x_pixels=ReadBlobLSBLong(image);
399 icon_info.y_pixels=ReadBlobLSBLong(image);
400 icon_info.number_colors=ReadBlobLSBLong(image);
401 icon_info.colors_important=ReadBlobLSBLong(image);
402 image->alpha_trait=BlendPixelTrait;
403 image->columns=(size_t) icon_file.directory[i].width;
404 if ((ssize_t) image->columns > icon_info.width)
405 image->columns=(size_t) icon_info.width;
406 if (image->columns == 0)
407 image->columns=256;
408 image->rows=(size_t) icon_file.directory[i].height;
409 if ((ssize_t) image->rows > icon_info.height)
410 image->rows=(size_t) icon_info.height;
411 if (image->rows == 0)
412 image->rows=256;
413 image->depth=icon_info.bits_per_pixel;
414 if (image->debug != MagickFalse)
433 image->storage_class=PseudoClass;
434 image->colors=icon_info.number_colors;
435 if (image->colors == 0)
436 image->colors=one << icon_info.bits_per_pixel;
438 if (image->storage_class == PseudoClass)
449 if (AcquireImageColormap(image,image->colors,exception) ==
453 image->colors,4UL*sizeof(*icon_colormap));
456 count=ReadBlob(image,(size_t) (4*image->colors),icon_colormap);
457 if (count != (ssize_t) (4*image->colors))
461 for (i=0; i < (ssize_t) image->colors; i++)
463 image->colormap[i].blue=(Quantum) ScaleCharToQuantum(*p++);
464 image->colormap[i].green=(Quantum) ScaleCharToQuantum(*p++);
465 image->colormap[i].red=(Quantum) ScaleCharToQuantum(*p++);
471 Convert Icon raster image to pixel packets.
475 if (image->scene >= (image_info->scene+image_info->number_scenes-1))
477 status=SetImageExtent(image,image->columns,image->rows,exception);
479 return(DestroyImageList(image));
480 bytes_per_line=(((image->columns*icon_info.bits_per_pixel)+31) &
483 scanline_pad=((((image->columns*icon_info.bits_per_pixel)+31) & ~31)-
484 (image->columns*icon_info.bits_per_pixel)) >> 3;
492 for (y=(ssize_t) image->rows-1; y >= 0; y--)
494 q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
497 image->columns-7); x+=8)
499 byte=(size_t) ReadBlobByte(image);
502 SetPixelIndex(image,((byte & (0x80 >> bit)) != 0 ? 0x01 :
504 q+=GetPixelChannels(image);
507 if ((image->columns % 8) != 0)
509 byte=(size_t) ReadBlobByte(image);
510 for (bit=0; bit < (image->columns % 8); bit++)
512 SetPixelIndex(image,((byte & (0x80 >> bit)) != 0 ? 0x01 :
514 q+=GetPixelChannels(image);
518 (void) ReadBlobByte(image);
519 if (SyncAuthenticPixels(image,exception) == MagickFalse)
521 if (image->previous == (Image *) NULL)
523 status=SetImageProgress(image,LoadImageTag,image->rows-y-1,
524 image->rows);
536 for (y=(ssize_t) image->rows-1; y >= 0; y--)
538 q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
541 for (x=0; x < ((ssize_t) image->columns-1); x+=2)
543 byte=(size_t) ReadBlobByte(image);
544 SetPixelIndex(image,((byte >> 4) & 0xf),q);
545 q+=GetPixelChannels(image);
546 SetPixelIndex(image,((byte) & 0xf),q);
547 q+=GetPixelChannels(image);
549 if ((image->columns % 2) != 0)
551 byte=(size_t) ReadBlobByte(image);
552 SetPixelIndex(image,((byte >> 4) & 0xf),q);
553 q+=GetPixelChannels(image);
556 (void) ReadBlobByte(image);
557 if (SyncAuthenticPixels(image,exception) == MagickFalse)
559 if (image->previous == (Image *) NULL)
561 status=SetImageProgress(image,LoadImageTag,image->rows-y-1,
562 image->rows);
574 for (y=(ssize_t) image->rows-1; y >= 0; y--)
576 q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
579 for (x=0; x < (ssize_t) image->columns; x++)
581 byte=(size_t) ReadBlobByte(image);
582 SetPixelIndex(image,(Quantum) byte,q);
583 q+=GetPixelChannels(image);
586 (void) ReadBlobByte(image);
587 if (SyncAuthenticPixels(image,exception) == MagickFalse)
589 if (image->previous == (Image *) NULL)
591 status=SetImageProgress(image,LoadImageTag,image->rows-y-1,
592 image->rows);
604 for (y=(ssize_t) image->rows-1; y >= 0; y--)
606 q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
609 for (x=0; x < (ssize_t) image->columns; x++)
611 byte=(size_t) ReadBlobByte(image);
612 byte|=(size_t) (ReadBlobByte(image) << 8);
613 SetPixelIndex(image,(Quantum) byte,q);
614 q+=GetPixelChannels(image);
617 (void) ReadBlobByte(image);
618 if (SyncAuthenticPixels(image,exception) == MagickFalse)
620 if (image->previous == (Image *) NULL)
622 status=SetImageProgress(image,LoadImageTag,image->rows-y-1,
623 image->rows);
636 for (y=(ssize_t) image->rows-1; y >= 0; y--)
638 q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
641 for (x=0; x < (ssize_t) image->columns; x++)
643 SetPixelBlue(image,ScaleCharToQuantum((unsigned char)
644 ReadBlobByte(image)),q);
645 SetPixelGreen(image,ScaleCharToQuantum((unsigned char)
646 ReadBlobByte(image)),q);
647 SetPixelRed(image,ScaleCharToQuantum((unsigned char)
648 ReadBlobByte(image)),q);
650 SetPixelAlpha(image,ScaleCharToQuantum((unsigned char)
651 ReadBlobByte(image)),q);
652 q+=GetPixelChannels(image);
656 (void) ReadBlobByte(image);
657 if (SyncAuthenticPixels(image,exception) == MagickFalse)
659 if (image->previous == (Image *) NULL)
661 status=SetImageProgress(image,LoadImageTag,image->rows-y-1,
662 image->rows);
674 (void) SyncImage(image,exception);
680 image->storage_class=DirectClass;
681 for (y=(ssize_t) image->rows-1; y >= 0; y--)
683 q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
686 for (x=0; x < ((ssize_t) image->columns-7); x+=8)
688 byte=(size_t) ReadBlobByte(image);
691 SetPixelAlpha(image,(((byte & (0x80 >> bit)) != 0) ?
693 q+=GetPixelChannels(image);
696 if ((image->columns % 8) != 0)
698 byte=(size_t) ReadBlobByte(image);
699 for (bit=0; bit < (image->columns % 8); bit++)
701 SetPixelAlpha(image,(((byte & (0x80 >> bit)) != 0) ?
703 q+=GetPixelChannels(image);
706 if ((image->columns % 32) != 0)
707 for (x=0; x < (ssize_t) ((32-(image->columns % 32))/8); x++)
708 (void) ReadBlobByte(image);
709 if (SyncAuthenticPixels(image,exception) == MagickFalse)
713 if (EOFBlob(image) != MagickFalse)
716 "UnexpectedEndOfFile",image->filename);
721 Proceed to next image.
724 if (image->scene >= (image_info->scene+image_info->number_scenes-1))
729 Allocate next image structure.
731 AcquireNextImage(image_info,image,exception);
732 if (GetNextImageInList(image) == (Image *) NULL)
734 image=DestroyImageList(image);
735 return((Image *) NULL);
737 image=SyncNextImageInList(image);
738 status=SetImageProgress(image,LoadImagesTag,TellBlob(image),
739 GetBlobSize(image));
744 (void) CloseBlob(image);
745 return(GetFirstImageInList(image));
760 % RegisterICONImage() adds attributes for the Icon image format to
761 % the list of supported formats. The attributes include the image format
836 % WriteICONImage() writes an image in Microsoft Windows bitmap encoded
837 % image format, version 3 for Windows or (if the image has a matte channel)
840 % It encodes any subimage as a compressed PNG image ("BI_PNG)", only when its
841 % dimensions are 256x256 and image->compression is undefined or is defined as
847 % Image *image,ExceptionInfo *exception)
851 % o image_info: the image info.
853 % o image: The image.
859 Image *image,ExceptionInfo *exception)
870 Image
904 Open output image file.
908 assert(image != (Image *) NULL);
909 assert(image->signature == MagickCoreSignature);
910 (void) LogMagickEvent(CoderEvent,GetMagickModule(),"%s",image->filename);
913 status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
916 images=(Image *) NULL;
920 images=AutoResizeImage(image,option,&scene,exception);
921 if (images == (Image *) NULL)
927 next=image;
930 if ((image->columns > 256L) || (image->rows > 256L))
934 } while ((next != (Image *) NULL) && (image_info->adjoin != MagickFalse));
939 (void) WriteBlobLSBShort(image,0);
940 (void) WriteBlobLSBShort(image,1);
941 (void) WriteBlobLSBShort(image,(unsigned char) scene);
945 next=(images != (Image *) NULL) ? images : image;
948 (void) WriteBlobByte(image,icon_file.directory[scene].width);
949 (void) WriteBlobByte(image,icon_file.directory[scene].height);
950 (void) WriteBlobByte(image,icon_file.directory[scene].colors);
951 (void) WriteBlobByte(image,icon_file.directory[scene].reserved);
952 (void) WriteBlobLSBShort(image,icon_file.directory[scene].planes);
953 (void) WriteBlobLSBShort(image,icon_file.directory[scene].bits_per_pixel);
954 (void) WriteBlobLSBLong(image,(unsigned int)
956 image,(unsigned int)
960 } while ((next != (Image *) NULL) && (image_info->adjoin != MagickFalse));
962 next=(images != (Image *) NULL) ? images : image;
969 Image
982 if (write_image == (Image *) NULL)
1012 icon_file.directory[scene].offset=(size_t) TellBlob(image);
1013 (void) WriteBlob(image,(size_t) length,png);
1123 Convert PseudoClass image to a ICON monochrome image.
1144 p+=GetPixelChannels(image);
1148 if (next->previous == (Image *) NULL)
1164 Convert PseudoClass image to a ICON monochrome image.
1185 p+=GetPixelChannels(image);
1189 if (next->previous == (Image *) NULL)
1212 p+=GetPixelChannels(image);
1214 if (next->previous == (Image *) NULL)
1249 if (next->previous == (Image *) NULL)
1270 icon_file.directory[scene].offset=(size_t) TellBlob(image);
1271 (void) WriteBlobLSBLong(image,(unsigned int) 40);
1272 (void) WriteBlobLSBLong(image,(unsigned int) icon_info.width);
1273 (void) WriteBlobLSBLong(image,(unsigned int) icon_info.height*2);
1274 (void) WriteBlobLSBShort(image,icon_info.planes);
1275 (void) WriteBlobLSBShort(image,icon_info.bits_per_pixel);
1276 (void) WriteBlobLSBLong(image,(unsigned int) icon_info.compression);
1277 (void) WriteBlobLSBLong(image,(unsigned int) icon_info.image_size);
1278 (void) WriteBlobLSBLong(image,(unsigned int) icon_info.x_pixels);
1279 (void) WriteBlobLSBLong(image,(unsigned int) icon_info.y_pixels);
1280 (void) WriteBlobLSBLong(image,(unsigned int) icon_info.number_colors);
1281 (void) WriteBlobLSBLong(image,(unsigned int) icon_info.colors_important);
1313 (void) WriteBlob(image,(size_t) (4UL*(1UL <<
1318 (void) WriteBlob(image,(size_t) icon_info.image_size,pixels);
1340 (void) WriteBlobByte(image,(unsigned char) byte);
1347 (void) WriteBlobByte(image,(unsigned char) (byte << (8-bit)));
1349 (void) WriteBlobByte(image,(unsigned char) 0);
1352 if (GetNextImageInList(next) == (Image *) NULL)
1359 } while ((next != (Image *) NULL) && (image_info->adjoin != MagickFalse));
1360 offset=SeekBlob(image,0,SEEK_SET);
1362 (void) WriteBlobLSBShort(image,0);
1363 (void) WriteBlobLSBShort(image,1);
1364 (void) WriteBlobLSBShort(image,(unsigned short) (scene+1));
1366 next=(images != (Image *) NULL) ? images : image;
1369 (void) WriteBlobByte(image,icon_file.directory[scene].width);
1370 (void) WriteBlobByte(image,icon_file.directory[scene].height);
1371 (void) WriteBlobByte(image,icon_file.directory[scene].colors);
1372 (void) WriteBlobByte(image,icon_file.directory[scene].reserved);
1373 (void) WriteBlobLSBShort(image,icon_file.directory[scene].planes);
1374 (void) WriteBlobLSBShort(image,icon_file.directory[scene].bits_per_pixel);
1375 (void) WriteBlobLSBLong(image,(unsigned int)
1377 (void) WriteBlobLSBLong(image,(unsigned int)
1381 } while ((next != (Image *) NULL) && (image_info->adjoin != MagickFalse));
1382 (void) CloseBlob(image);