您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ EOFBlob函数代码示例

51自学网 2021-06-01 20:32:59
  C++
这篇教程C++ EOFBlob函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中EOFBlob函数的典型用法代码示例。如果您正苦于以下问题:C++ EOFBlob函数的具体用法?C++ EOFBlob怎么用?C++ EOFBlob使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了EOFBlob函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ReadFAXImage

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   R e a d F A X I m a g e                                                   %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  ReadFAXImage() reads a Group 3 FAX image file and returns it.  It%  allocates the memory necessary for the new Image structure and returns a%  pointer to the new image.%%  The format of the ReadFAXImage method is:%%      Image *ReadFAXImage(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 *ReadFAXImage(const ImageInfo *image_info,ExceptionInfo *exception){  Image    *image;  MagickBooleanType    status;  /*    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,exception);  status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);  if (status == MagickFalse)    {      image=DestroyImageList(image);      return((Image *) NULL);    }  /*    Initialize image structure.  */  image->storage_class=PseudoClass;  if (image->columns == 0)    image->columns=2592;  if (image->rows == 0)    image->rows=3508;  image->depth=8;  if (AcquireImageColormap(image,2,exception) == MagickFalse)    ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");  /*    Monochrome 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));    }  status=HuffmanDecodeImage(image,exception);  if (status == MagickFalse)    ThrowReaderException(CorruptImageError,"UnableToReadImageData");  if (EOFBlob(image) != MagickFalse)    ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",      image->filename);  (void) CloseBlob(image);  return(GetFirstImageInList(image));}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:85,


示例2: assert

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   R e a d F A X I m a g e                                                   %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Method ReadFAXImage reads a Group 3 FAX image file and returns it.  It%  allocates the memory necessary for the new Image structure and returns a%  pointer to the new image.%%  The format of the ReadFAXImage method is:%%      Image *ReadFAXImage(const ImageInfo *image_info,ExceptionInfo *exception)%%  A description of each parameter follows:%%    o image:  Method ReadFAXImage returns a pointer to the image after%      reading.  A null image is returned if there is a memory shortage or%      if the image cannot be read.%%    o image_info: Specifies a pointer to a ImageInfo structure.%%    o exception: return any errors or warnings in this structure.%%*/static Image *ReadFAXImage(const ImageInfo *image_info,ExceptionInfo *exception){  Image    *image;  unsigned int    status;  /*    Open image file.  */  assert(image_info != (const ImageInfo *) NULL);  assert(image_info->signature == MagickSignature);  assert(exception != (ExceptionInfo *) NULL);  assert(exception->signature == MagickSignature);  image=AllocateImage(image_info);  status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);  if (status == False)    ThrowReaderException(FileOpenError,UnableToOpenFile,image);  /*    Initialize image structure.  */  image->storage_class=PseudoClass;  if (image->columns == 0)    image->columns=2592;  if (image->rows == 0)    image->rows=3508;  image->depth=8;  if (!AllocateImageColormap(image,2))    ThrowReaderException(ResourceLimitError,MemoryAllocationFailed,image);  /*    Monochrome colormap.  */  image->colormap[0].red=MaxRGB;  image->colormap[0].green=MaxRGB;  image->colormap[0].blue=MaxRGB;  image->colormap[1].red=0;  image->colormap[1].green=0;  image->colormap[1].blue=0;  if (image_info->ping)    {      CloseBlob(image);      return(image);    }  if (CheckImagePixelLimits(image, exception) != MagickPass)    ThrowReaderException(ResourceLimitError,ImagePixelLimitExceeded,image);  status=HuffmanDecodeImage(image);  if (status == False)    ThrowReaderException(CorruptImageError,UnableToReadImageData,image);  if (EOFBlob(image))    ThrowException(exception,CorruptImageError,UnexpectedEndOfFile,      image->filename);  CloseBlob(image);  return(image);}
开发者ID:hank2015,项目名称:testCMS,代码行数:88,


示例3: ReadFAXImage

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   R e a d F A X I m a g e                                                   %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  ReadFAXImage() reads a Group 3 FAX image file and returns it.  It%  allocates the memory necessary for the new Image structure and returns a%  pointer to the new image.%%  The format of the ReadFAXImage method is:%%      Image *ReadFAXImage(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* FaxReadG3(Image *image,ExceptionInfo *exception){  MagickBooleanType    status;  status=HuffmanDecodeImage(image,exception);  if (status == MagickFalse)    ThrowFileException(exception,CorruptImageError,"UnableToReadImageData",      image->filename);  if (EOFBlob(image) != MagickFalse)    ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",      image->filename);  (void) CloseBlob(image);  return(GetFirstImageInList(image));}
开发者ID:vcgato29,项目名称:ImageMagick,代码行数:41,


示例4: ReadTIMImage

//.........这里部分代码省略.........      }      case 16:      {        /*          Convert DirectColor scanline.        */        for (y=(ssize_t) image->rows-1; y >= 0; y--)        {          p=tim_pixels+y*bytes_per_line;          q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);          if (q == (Quantum *) NULL)            break;          for (x=0; x < (ssize_t) image->columns; x++)          {            word=(*p++);            word|=(*p++ << 8);            SetPixelBlue(image,ScaleCharToQuantum(ScaleColor5to8(              (1UL*word >> 10) & 0x1f)),q);            SetPixelGreen(image,ScaleCharToQuantum(ScaleColor5to8(              (1UL*word >> 5) & 0x1f)),q);            SetPixelRed(image,ScaleCharToQuantum(ScaleColor5to8(              (1UL*word >> 0) & 0x1f)),q);            q+=GetPixelChannels(image);          }          if (SyncAuthenticPixels(image,exception) == MagickFalse)            break;          if (image->previous == (Image *) NULL)            {              status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,                image->rows);              if (status == MagickFalse)                break;            }        }        break;      }      case 24:      {        /*          Convert DirectColor scanline.        */        for (y=(ssize_t) image->rows-1; y >= 0; y--)        {          p=tim_pixels+y*bytes_per_line;          q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);          if (q == (Quantum *) NULL)            break;          for (x=0; x < (ssize_t) image->columns; x++)          {            SetPixelRed(image,ScaleCharToQuantum(*p++),q);            SetPixelGreen(image,ScaleCharToQuantum(*p++),q);            SetPixelBlue(image,ScaleCharToQuantum(*p++),q);            q+=GetPixelChannels(image);          }          if (SyncAuthenticPixels(image,exception) == MagickFalse)            break;          if (image->previous == (Image *) NULL)            {              status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,                image->rows);              if (status == MagickFalse)                break;            }        }        break;      }      default:        ThrowReaderException(CorruptImageError,"ImproperImageHeader");    }    if (image->storage_class == PseudoClass)      (void) SyncImage(image,exception);    tim_pixels=(unsigned char *) RelinquishMagickMemory(tim_pixels);    if (EOFBlob(image) != MagickFalse)      {        ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",          image->filename);        break;      }    /*      Proceed to next image.    */    tim_info.id=ReadBlobLSBLong(image);    if (tim_info.id == 0x00000010)      {        /*          Allocate next image structure.        */        AcquireNextImage(image_info,image,exception);        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 (tim_info.id == 0x00000010);
开发者ID:ChaseReid,项目名称:ImageMagick,代码行数:101,


示例5: ReadAVSImage

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   R e a d A V S I m a g e                                                   %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  ReadAVSImage() reads an AVS X image file and returns it.  It%  allocates the memory necessary for the new Image structure and returns a%  pointer to the new image.%%  The format of the ReadAVSImage method is:%%      Image *ReadAVSImage(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 *ReadAVSImage(const ImageInfo *image_info,ExceptionInfo *exception){  Image    *image;  MagickBooleanType    status;  register PixelPacket    *q;  register ssize_t    x;  register unsigned char    *p;  size_t    height,    length,    width;  ssize_t    count,    y;  unsigned char    *pixels;  /*    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 AVS X image.  */  width=ReadBlobMSBLong(image);  height=ReadBlobMSBLong(image);  if (EOFBlob(image) != MagickFalse)    ThrowReaderException(CorruptImageError,"ImproperImageHeader");  if ((width == 0UL) || (height == 0UL))    ThrowReaderException(CorruptImageError,"ImproperImageHeader");  do  {    /*      Convert AVS raster image to pixel packets.    */    image->columns=width;    image->rows=height;    image->depth=8;    if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))      if (image->scene >= (image_info->scene+image_info->number_scenes-1))        break;    pixels=(unsigned char *) AcquireQuantumMemory(image->columns,      4*sizeof(*pixels));    if (pixels == (unsigned char *) NULL)       ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");    length=(size_t) 4*image->columns;    for (y=0; y < (ssize_t) image->rows; y++)    {      count=ReadBlob(image,length,pixels);//.........这里部分代码省略.........
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,


示例6: assert

//.........这里部分代码省略.........                                       cin.film.prefix);        cin.film.count=ReadBlobLong(image);        offset+=4;        offset+=ReadBlob(image,sizeof(cin.film.format),(unsigned char *)                         cin.film.format);        (void) SetImageProperty(image,"dpx:film.format",cin.film.format,                                exception);        cin.film.frame_position=ReadBlobLong(image);        offset+=4;        if (cin.film.frame_position != ~0UL)            (void) FormatImageProperty(image,"dpx:film.frame_position","%.20g",                                       (double) cin.film.frame_position);        cin.film.frame_rate=ReadBlobFloat(image);        offset+=4;        if (IsFloatDefined(cin.film.frame_rate) != MagickFalse)            (void) FormatImageProperty(image,"dpx:film.frame_rate","%g",                                       cin.film.frame_rate);        offset+=ReadBlob(image,sizeof(cin.film.frame_id),(unsigned char *)                         cin.film.frame_id);        (void) SetImageProperty(image,"dpx:film.frame_id",cin.film.frame_id,                                exception);        offset+=ReadBlob(image,sizeof(cin.film.slate_info),(unsigned char *)                         cin.film.slate_info);        (void) SetImageProperty(image,"dpx:film.slate_info",cin.film.slate_info,                                exception);        offset+=ReadBlob(image,sizeof(cin.film.reserve),(unsigned char *)                         cin.film.reserve);    }    if ((cin.file.image_offset > 2048) && (cin.file.user_length != 0))    {        StringInfo        *profile;        /*          User defined data.        */        profile=BlobToStringInfo((const void *) NULL,cin.file.user_length);        if (profile == (StringInfo *) NULL)            ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");        offset+=ReadBlob(image,GetStringInfoLength(profile),                         GetStringInfoDatum(profile));        (void) SetImageProfile(image,"dpx:user.data",profile,exception);        profile=DestroyStringInfo(profile);    }    for ( ; offset < (MagickOffsetType) cin.file.image_offset; offset++)        (void) ReadBlobByte(image);    image->depth=cin.image.channel[0].bits_per_pixel;    image->columns=cin.image.channel[0].pixels_per_line;    image->rows=cin.image.channel[0].lines_per_image;    if (image_info->ping)    {        (void) CloseBlob(image);        return(image);    }    /*      Convert CIN raster image to pixel packets.    */    quantum_info=AcquireQuantumInfo(image_info,image);    if (quantum_info == (QuantumInfo *) NULL)        ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");    quantum_info->quantum=32;    quantum_info->pack=MagickFalse;    quantum_type=RGBQuantum;    pixels=GetQuantumPixels(quantum_info);    length=GetQuantumExtent(image,quantum_info,quantum_type);    length=GetBytesPerRow(image->columns,3,image->depth,MagickTrue);    if (cin.image.number_channels == 1)    {        quantum_type=GrayQuantum;        length=GetBytesPerRow(image->columns,1,image->depth,MagickTrue);    }    for (y=0; y < (ssize_t) image->rows; y++)    {        q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);        if (q == (Quantum *) NULL)            break;        count=ReadBlob(image,length,pixels);        if ((size_t) count != length)            break;        (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,                                   quantum_type,pixels,exception);        if (SyncAuthenticPixels(image,exception) == MagickFalse)            break;        if (image->previous == (Image *) NULL)        {            status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,                                    image->rows);            if (status == MagickFalse)                break;        }    }    SetQuantumImageType(image,quantum_type);    quantum_info=DestroyQuantumInfo(quantum_info);    if (EOFBlob(image) != MagickFalse)        ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",                           image->filename);    SetImageColorspace(image,LogColorspace,exception);    (void) CloseBlob(image);    return(GetFirstImageInList(image));}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,


示例7: assert

//.........这里部分代码省略.........      if ((strlen(name) >= 7) &&          (LocaleCompare(name+strlen(name)-7,"_height") == 0))        break;  image->columns=width;  image->rows=height;  image->depth=8;  image->storage_class=PseudoClass;  image->colors=2;  /*    Scan until hex digits.  */  version=11;  while (ReadBlobString(image,buffer) != (char *) NULL)  {    if (sscanf(buffer,"static short %s = {",name) == 1)      version=10;    else      if (sscanf(buffer,"static unsigned char %s = {",name) == 1)        version=11;      else        if (sscanf(buffer,"static char %s = {",name) == 1)          version=11;        else          continue;    p=(unsigned char *) strrchr(name,'_');    if (p == (unsigned char *) NULL)      p=(unsigned char *) name;    else      p++;    if (LocaleCompare("bits[]",(char *) p) == 0)      break;  }  if ((image->columns == 0) || (image->rows == 0) ||      (EOFBlob(image) != MagickFalse))    ThrowReaderException(CorruptImageError,"ImproperImageHeader");  /*    Initialize image structure.  */  if (AcquireImageColormap(image,image->colors) == MagickFalse)    ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");  /*    Initialize colormap.  */  image->colormap[0].red=(Quantum) QuantumRange;  image->colormap[0].green=(Quantum) QuantumRange;  image->colormap[0].blue=(Quantum) 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));    }  /*    Initialize hex values.  */  hex_digits[(int) '0']=0;  hex_digits[(int) '1']=1;  hex_digits[(int) '2']=2;  hex_digits[(int) '3']=3;  hex_digits[(int) '4']=4;  hex_digits[(int) '5']=5;  hex_digits[(int) '6']=6;  hex_digits[(int) '7']=7;  hex_digits[(int) '8']=8;
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:67,


示例8: ReadPIXImage

//.........这里部分代码省略.........  {    /*      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;        }    }    if (image->storage_class == PseudoClass)      (void) SyncImage(image);    if (EOFBlob(image) != MagickFalse)      {        ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",          image->filename);        break;      }    /*      Proceed to next image.    */    if (image_info->number_scenes != 0)      if (image->scene >= (image_info->scene+image_info->number_scenes-1))        break;    width=ReadBlobMSBLong(image);    height=ReadBlobMSBLong(image);    (void) ReadBlobMSBShort(image);    (void) ReadBlobMSBShort(image);    bits_per_pixel=ReadBlobMSBShort(image);    status=(width != 0UL) && (height == 0UL) && ((bits_per_pixel == 8) ||      (bits_per_pixel == 24)) ? MagickTrue : MagickFalse;    if (status == MagickTrue)      {        /*          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 (status == MagickTrue);  (void) CloseBlob(image);  return(GetFirstImageInList(image));}
开发者ID:271845221,项目名称:Android-ImageMagick,代码行数:101,


示例9: ReadXCFImage

//.........这里部分代码省略.........  count=ReadBlob(image,14,(unsigned char *) magick);  if ((count == 0) ||      (LocaleNCompare((char *) magick,"gimp xcf",8) != 0))    ThrowReaderException(CorruptImageError,"ImproperImageHeader");  (void) ResetMagickMemory(&doc_info,0,sizeof(XCFDocInfo));  doc_info.exception=exception;  doc_info.width=ReadBlobMSBLong(image);  doc_info.height=ReadBlobMSBLong(image);  if ((doc_info.width > 262144) || (doc_info.height > 262144))    ThrowReaderException(CorruptImageError,"ImproperImageHeader");  doc_info.image_type=ReadBlobMSBLong(image);  /*    Initialize image attributes.  */  image->columns=doc_info.width;  image->rows=doc_info.height;  image_type=doc_info.image_type;  doc_info.file_size=GetBlobSize(image);  image->compression=NoCompression;  image->depth=8;  if (image_type == GIMP_RGB)    image->colorspace=RGBColorspace;  else    if (image_type == GIMP_GRAY)      image->colorspace=GRAYColorspace;    else      if (image_type == GIMP_INDEXED)        ThrowReaderException(CoderError,"ColormapTypeNotSupported");  (void) SetImageBackgroundColor(image);  image->matte=MagickTrue;  /*    Read properties.  */  while ((foundPropEnd == MagickFalse) && (EOFBlob(image) == MagickFalse))  {    PropType prop_type = (PropType) ReadBlobMSBLong(image);    size_t prop_size = ReadBlobMSBLong(image);    switch (prop_type)    {      case PROP_END:        foundPropEnd=1;        break;      case PROP_COLORMAP:      {        /* Cannot rely on prop_size here--the value is set incorrectly           by some Gimp versions.        */        size_t num_colours = ReadBlobMSBLong(image);        for (i=0; i < (ssize_t) (3L*num_colours); i++ )          (void) ReadBlobByte(image);    /*      if (info->file_version == 0)      {        gint i;        g_message (_("XCF warning: version 0 of XCF file format/n"           "did not save indexed colormaps correctly./n"           "Substituting grayscale map."));        info->cp +=          xcf_read_int32 (info->fp, (guint32*) &gimage->num_cols, 1);        gimage->cmap = g_new (guchar, gimage->num_cols*3);        xcf_seek_pos (info, info->cp + gimage->num_cols);        for (i = 0; i<gimage->num_cols; i++)          {            gimage->cmap[i*3+0] = i;
开发者ID:fightingillini5,项目名称:cs225-1,代码行数:67,


示例10: assert

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   R e a d A R T I m a g e                                                   %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Method ReadARTImage reads an ART X image file and returns it.  It%  allocates the memory necessary for the new Image structure and returns a%  pointer to the new image.%%  The format of the ReadARTImage method is:%%      Image *ReadARTImage(const ImageInfo *image_info,ExceptionInfo *exception)%%  A description of each parameter follows:%%    o image:  Method ReadARTImage returns a pointer to the image after%      reading. A null image is returned if there is a memory shortage or if%      the image cannot be read.%%    o image_info: Specifies a pointer to a ImageInfo structure.%%    o exception: return any errors or warnings in this structure.%%*/static Image *ReadARTImage(const ImageInfo *image_info,ExceptionInfo *exception){  Image *image;  int i;  unsigned width,height,dummy;  long ldblk;  unsigned char *BImgBuff=NULL;  unsigned char Padding;  unsigned int status;  const PixelPacket *q;  /*    Open image file.  */  assert(image_info != (const ImageInfo *) NULL);  assert(image_info->signature == MagickSignature);  assert(exception != (ExceptionInfo *) NULL);  assert(exception->signature == MagickSignature);  image=AllocateImage(image_info);  status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);  if (status == False)    ThrowReaderException(FileOpenError,UnableToOpenFile,image);  /*    Read ART image.  */  dummy=ReadBlobLSBShort(image);  width=ReadBlobLSBShort(image);  dummy=ReadBlobLSBShort(image);  height=ReadBlobLSBShort(image);  ldblk=(long) ((width+7) / 8);  Padding=(unsigned char) ((-ldblk) & 0x01);  if(GetBlobSize(image)!=(8+((long)ldblk+Padding)*height))    ThrowReaderException(CorruptImageError,ImproperImageHeader,image);  image->columns=width;  image->rows=height;  image->depth=1;  image->colors=1l << image->depth;   /* printf("ART header checked OK %d,%d/n",image->colors,image->depth); */  if (!AllocateImageColormap(image,image->colors)) goto NoMemory;  /* If ping is true, then only set image size and colors without reading any image data. */  if (image_info->ping) goto DONE_READING;  /* ----- Load RLE compressed raster ----- */  BImgBuff=MagickAllocateMemory(unsigned char *,((size_t) ldblk));  /*Ldblk was set in the check phase*/  if(BImgBuff==NULL)    NoMemory:  ThrowReaderException(ResourceLimitError,MemoryAllocationFailed,image);  for(i=0; i<(int)height; i++)    {      (void) ReadBlob(image,(size_t)ldblk,(char *)BImgBuff);      (void) ReadBlob(image,Padding,(char *)&dummy);            q=SetImagePixels(image,0,i,image->columns,1);      if (q == (PixelPacket *)NULL) break;      (void)ImportImagePixelArea(image,GrayQuantum,1,BImgBuff,NULL,0);      if (!SyncImagePixels(image)) break;    }  if(BImgBuff!=NULL)    MagickFreeMemory(BImgBuff);  if (EOFBlob(image))    ThrowException(exception,CorruptImageError,UnexpectedEndOfFile,                   image->filename);//.........这里部分代码省略.........
开发者ID:acobus,项目名称:PDF2TeX,代码行数:101,


示例11: ReadYUVImage

//.........这里部分代码省略.........          AppendImageFormat("V",image->filename);          status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);          if (status == MagickFalse)            {              image=DestroyImageList(image);              return((Image *) NULL);            }        }      for (y=0; y < (ssize_t) chroma_image->rows; y++)      {        (void) ReadBlob(image,(size_t) quantum*chroma_image->columns,scanline);        p=scanline;        q=GetAuthenticPixels(chroma_image,0,y,chroma_image->columns,1,          exception);        if (q == (PixelPacket *) NULL)          break;        for (x=0; x < (ssize_t) chroma_image->columns; x++)        {          if (quantum == 1)            SetPixelBlue(q,ScaleCharToQuantum(*p++));          else            {              SetPixelBlue(q,ScaleShortToQuantum(((*p) << 8) | *(p+1)));              p+=2;            }          q++;        }        if (SyncAuthenticPixels(chroma_image,exception) == MagickFalse)          break;      }    }    /*      Scale image.    */    resize_image=ResizeImage(chroma_image,image->columns,image->rows,      TriangleFilter,1.0,exception);    chroma_image=DestroyImage(chroma_image);    if (resize_image == (Image *) NULL)      ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");    for (y=0; y < (ssize_t) image->rows; y++)    {      q=GetAuthenticPixels(image,0,y,image->columns,1,exception);      chroma_pixels=GetVirtualPixels(resize_image,0,y,resize_image->columns,1,        &resize_image->exception);      if ((q == (PixelPacket *) NULL) ||          (chroma_pixels == (const PixelPacket *) NULL))        break;      for (x=0; x < (ssize_t) image->columns; x++)      {        SetPixelGreen(q,GetPixelGreen(chroma_pixels));        SetPixelBlue(q,GetPixelBlue(chroma_pixels));        chroma_pixels++;        q++;      }      if (SyncAuthenticPixels(image,exception) == MagickFalse)        break;    }    resize_image=DestroyImage(resize_image);    SetImageColorspace(image,YCbCrColorspace);    if (interlace == PartitionInterlace)      (void) CopyMagickString(image->filename,image_info->filename,        MaxTextExtent);    if (EOFBlob(image) != MagickFalse)      {        ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",          image->filename);        break;      }    /*      Proceed to next image.    */    if (image_info->number_scenes != 0)      if (image->scene >= (image_info->scene+image_info->number_scenes-1))        break;    if (interlace == NoInterlace)      count=ReadBlob(image,(size_t) (2*quantum*image->columns),scanline);    else      count=ReadBlob(image,(size_t) quantum*image->columns,scanline);    if (count != 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 (count != 0);  scanline=(unsigned char *) RelinquishMagickMemory(scanline);  (void) CloseBlob(image);  return(GetFirstImageInList(image));}
开发者ID:JohnHeywardOBrien,项目名称:photogram,代码行数:101,


示例12: ReadHRZImage

//.........这里部分代码省略.........%  pointer to the new image.%%  The format of the ReadHRZImage method is:%%      Image *ReadHRZImage(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 *ReadHRZImage(const ImageInfo *image_info,ExceptionInfo *exception){  Image    *image;  MagickBooleanType    status;  register ssize_t    x;  register Quantum    *q;  register unsigned char    *p;  ssize_t    count,    y;  size_t    length;  unsigned char    *pixels;  /*    Open image file.  */  assert(image_info != (const ImageInfo *) NULL);  assert(image_info->signature == MagickCoreSignature);  if (image_info->debug != MagickFalse)    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",      image_info->filename);  assert(exception != (ExceptionInfo *) NULL);  assert(exception->signature == MagickCoreSignature);  image=AcquireImage(image_info,exception);  status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);  if (status == MagickFalse)    {      image=DestroyImageList(image);      return((Image *) NULL);    }  /*    Convert HRZ raster image to pixel packets.  */  image->columns=256;  image->rows=240;  image->depth=8;  status=SetImageExtent(image,image->columns,image->rows,exception);  if (status == MagickFalse)    return(DestroyImageList(image));  pixels=(unsigned char *) AcquireQuantumMemory(image->columns,3*    sizeof(*pixels));  if (pixels == (unsigned char *) NULL)     ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");  length=(size_t) (3*image->columns);  for (y=0; y < (ssize_t) image->rows; y++)  {    count=ReadBlob(image,length,pixels);    if ((size_t) count != length)      ThrowReaderException(CorruptImageError,"UnableToReadImageData");    p=pixels;    q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);    if (q == (Quantum *) NULL)      break;    for (x=0; x < (ssize_t) image->columns; x++)    {      SetPixelRed(image,ScaleCharToQuantum(4**p++),q);      SetPixelGreen(image,ScaleCharToQuantum(4**p++),q);      SetPixelBlue(image,ScaleCharToQuantum(4**p++),q);      SetPixelAlpha(image,OpaqueAlpha,q);      q+=GetPixelChannels(image);    }    if (SyncAuthenticPixels(image,exception) == MagickFalse)      break;    if (SetImageProgress(image,LoadImageTag,y,image->rows) == MagickFalse)      break;  }  pixels=(unsigned char *) RelinquishMagickMemory(pixels);  if (EOFBlob(image) != MagickFalse)    ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",      image->filename);  (void) CloseBlob(image);  return(GetFirstImageInList(image));}
开发者ID:riingo,项目名称:ImageMagick,代码行数:101,


示例13: assert

//.........这里部分代码省略.........  if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))      if (image->scene >= (image_info->scene+image_info->number_scenes-1))        break;/*   printf("Length: %.20g, Memory size: %.20g/n", (double) length,(double)     image->depth);*/     quantum_info=AcquireQuantumInfo(image_info,image);     if (quantum_info == (QuantumInfo *) NULL)       ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");     status=SetQuantumFormat(image,quantum_info,quantum_format);     if (status == MagickFalse)       ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");     pixels=GetQuantumPixels(quantum_info);      if(image->columns != ipl_info.width){/*     printf("Columns not set correctly!  Wanted: %.20g, got: %.20g/n",       (double) ipl_info.width, (double) image->columns);*/     }    /*     Covert IPL binary to pixel packets     */      if(ipl_info.colors == 1){      for(y = 0; y < (ssize_t) image->rows; y++){        (void) ReadBlob(image, length*image->depth/8, pixels);        q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);        if (q == (PixelPacket *) NULL)                break;        (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,          GrayQuantum,pixels,exception);        if (SyncAuthenticPixels(image,exception) == MagickFalse)          break;    }  }  else{      for(y = 0; y < (ssize_t) image->rows; y++){        (void) ReadBlob(image, length*image->depth/8, pixels);        q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);        if (q == (PixelPacket *) NULL)                break;        (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,          RedQuantum,pixels,exception);          if (SyncAuthenticPixels(image,exception) == MagickFalse)          break;      }      for(y = 0; y < (ssize_t) image->rows; y++){        (void) ReadBlob(image, length*image->depth/8, pixels);        q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);        if (q == (PixelPacket *) NULL)          break;        (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,          GreenQuantum,pixels,exception);        if (SyncAuthenticPixels(image,exception) == MagickFalse)          break;      }      for(y = 0; y < (ssize_t) image->rows; y++){        (void) ReadBlob(image, length*image->depth/8, pixels);        q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);        if (q == (PixelPacket *) NULL)          break;        (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,          BlueQuantum,pixels,exception);        if (SyncAuthenticPixels(image,exception) == MagickFalse)          break;      }   }   SetQuantumImageType(image,quantum_type);     t_count++;  quantum_info = DestroyQuantumInfo(quantum_info);    if (EOFBlob(image) != MagickFalse)    {      ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",                 image->filename);      break;    }   if(t_count < ipl_info.z * ipl_info.time){      /*       Proceed to next image.       */      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 (t_count < ipl_info.z*ipl_info.time);  CloseBlob(image);  return(GetFirstImageInList(image));}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,


示例14: ReadOTBImage

//.........这里部分代码省略.........    x;  register PixelPacket    *q;  unsigned char    bit,    info,    depth;  /*    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=AllocateImage(image_info);  status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);  if (status == MagickFalse)    {      image=DestroyImageList(image);      return((Image *) NULL);    }  /*    Initialize image structure.  */  info=(unsigned char) ReadBlobByte(image);  if (GetBit(info,4) == 0)    {      image->columns=(unsigned long) ReadBlobByte(image);      image->rows=(unsigned long) ReadBlobByte(image);    }  else    {      image->columns=(unsigned long) ReadBlobMSBShort(image);      image->rows=(unsigned long) ReadBlobMSBShort(image);    }  if ((image->columns == 0) || (image->rows == 0))    ThrowReaderException(CorruptImageError,"ImproperImageHeader");  depth=(unsigned char) ReadBlobByte(image);  if (depth != 1)    ThrowReaderException(CoderError,"OnlyLevelZerofilesSupported");  if (AllocateImageColormap(image,2) == MagickFalse)    ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");  if (image_info->ping != MagickFalse)    {      CloseBlob(image);      return(GetFirstImageInList(image));    }  if (SetImageExtent(image,0,0) == MagickFalse)    {      InheritException(exception,&image->exception);      return(DestroyImageList(image));    }  /*    Convert bi-level image to pixel packets.  */  for (y=0; y < (long) image->rows; y++)  {    q=SetImagePixels(image,0,y,image->columns,1);    if (q == (PixelPacket *) NULL)      break;    indexes=GetIndexes(image);    bit=0;    byte=0;    for (x=0; x < (long) image->columns; x++)    {      if (bit == 0)        {          byte=ReadBlobByte(image);          if (byte == EOF)            ThrowReaderException(CorruptImageError,"CorruptImage");        }      indexes[x]=(IndexPacket) ((byte & (0x01 << (7-bit))) ? 0x00 : 0x01);      bit++;      if (bit == 8)        bit=0;    }    if (SyncImagePixels(image) == MagickFalse)      break;    if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&        (QuantumTick(y,image->rows) != MagickFalse))      {        status=image->progress_monitor(LoadImageTag,y,image->rows,          image->client_data);        if (status == MagickFalse)          break;      }  }  (void) SyncImage(image);  if (EOFBlob(image) != MagickFalse)    ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",      image->filename);  CloseBlob(image);  return(GetFirstImageInList(image));}
开发者ID:scuddalo,项目名称:cq,代码行数:101,


示例15: assert

static Image *ReadFITSImage(const ImageInfo *image_info,                            ExceptionInfo *exception){    typedef struct _FITSInfo    {        MagickBooleanType        extend,        simple;        int        bits_per_pixel,        columns,        rows,        number_axes,        number_planes;        double        min_data,        max_data,        zero,        scale;        EndianType        endian;    } FITSInfo;    char    *comment,    keyword[9],    property[MaxTextExtent],    value[73];    double    pixel,    scale;    FITSInfo    fits_info;    Image    *image;    int    c;    MagickBooleanType    status;    MagickSizeType    number_pixels;    register ssize_t    i,    x;    register PixelPacket    *q;    ssize_t    count,    scene,    y;    /*      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);    }    /*      Initialize image header.    */    (void) ResetMagickMemory(&fits_info,0,sizeof(fits_info));    fits_info.extend=MagickFalse;    fits_info.simple=MagickFalse;    fits_info.bits_per_pixel=8;    fits_info.columns=1;    fits_info.rows=1;    fits_info.rows=1;    fits_info.number_planes=1;    fits_info.min_data=0.0;    fits_info.max_data=0.0;    fits_info.zero=0.0;    fits_info.scale=1.0;    fits_info.endian=MSBEndian;    /*      Decode image header.    */    for (comment=(char *) NULL; EOFBlob(image) == MagickFalse; )//.........这里部分代码省略.........
开发者ID:Deni-al,项目名称:Android-ImageMagick,代码行数:101,


示例16: ReadOneLayer

static MagickBooleanType ReadOneLayer(Image* image,XCFDocInfo* inDocInfo,  XCFLayerInfo *outLayer ){  ssize_t    i;  MagickOffsetType    offset;  unsigned int    foundPropEnd = 0;  size_t    hierarchy_offset,    layer_mask_offset;  /* clear the block! */  (void) ResetMagickMemory( outLayer, 0, sizeof( XCFLayerInfo ) );  /* read in the layer width, height, type and name */  outLayer->width = ReadBlobMSBLong(image);  outLayer->height = ReadBlobMSBLong(image);  outLayer->type = ReadBlobMSBLong(image);  (void) ReadBlobStringWithLongSize(image, outLayer->name,    sizeof(outLayer->name));  /* allocate the image for this layer */  outLayer->image=CloneImage(image,outLayer->width, outLayer->height,MagickTrue,     &image->exception);  if (outLayer->image == (Image *) NULL)    return MagickFalse;  /* read the layer properties! */  foundPropEnd = 0;  while ( (foundPropEnd == MagickFalse) && (EOFBlob(image) == MagickFalse) ) {  PropType    prop_type = (PropType) ReadBlobMSBLong(image);  size_t  prop_size = ReadBlobMSBLong(image);    switch (prop_type)    {    case PROP_END:      foundPropEnd = 1;      break;    case PROP_ACTIVE_LAYER:      outLayer->active = 1;      break;    case PROP_FLOATING_SELECTION:      outLayer->floating_offset = ReadBlobMSBLong(image);      break;    case PROP_OPACITY:      outLayer->opacity = ReadBlobMSBLong(image);      break;    case PROP_VISIBLE:      outLayer->visible = ReadBlobMSBLong(image);      break;    case PROP_LINKED:      outLayer->linked = ReadBlobMSBLong(image);      break;    case PROP_PRESERVE_TRANSPARENCY:      outLayer->preserve_trans = ReadBlobMSBLong(image);      break;    case PROP_APPLY_MASK:      outLayer->apply_mask = ReadBlobMSBLong(image);      break;    case PROP_EDIT_MASK:      outLayer->edit_mask = ReadBlobMSBLong(image);      break;    case PROP_SHOW_MASK:      outLayer->show_mask = ReadBlobMSBLong(image);      break;    case PROP_OFFSETS:      outLayer->offset_x = (ssize_t) ReadBlobMSBLong(image);      outLayer->offset_y = (ssize_t) ReadBlobMSBLong(image);      break;    case PROP_MODE:      outLayer->mode = ReadBlobMSBLong(image);      break;    case PROP_TATTOO:      outLayer->preserve_trans = ReadBlobMSBLong(image);      break;     case PROP_PARASITES:     {        for (i=0; i < (ssize_t) prop_size; i++ )          (void) ReadBlobByte(image);        /*       ssize_t base = info->cp;       GimpParasite *p;       while (info->cp - base < prop_size)       {       p = xcf_load_parasite(info);       gimp_drawable_parasite_attach(GIMP_DRAWABLE(layer), p);       gimp_parasite_free(p);       }       if (info->cp - base != prop_size)       g_message ("Error detected while loading a layer's parasites");       */     }     break;    default:      /* g_message ("unexpected/unknown layer property: %d (skipping)",         prop_type); */      {//.........这里部分代码省略.........
开发者ID:fightingillini5,项目名称:cs225-1,代码行数:101,


示例17: ReadPCXImage

//.........这里部分代码省略.........    /*      Read image data.    */    if (HeapOverflowSanityCheck(image->rows, (size_t) pcx_info.bytes_per_line) != MagickFalse)      ThrowReaderException(CorruptImageError,"ImproperImageHeader");    pcx_packets=(size_t) image->rows*pcx_info.bytes_per_line;    if (HeapOverflowSanityCheck(pcx_packets, (size_t)pcx_info.planes) != MagickFalse)      ThrowReaderException(CorruptImageError,"ImproperImageHeader");    pcx_packets=(size_t) pcx_packets*pcx_info.planes;    if ((size_t) (pcx_info.bits_per_pixel*pcx_info.planes*image->columns) >        (pcx_packets*8U))      ThrowReaderException(CorruptImageError,"ImproperImageHeader");    scanline=(unsigned char *) AcquireQuantumMemory(MagickMax(image->columns,      pcx_info.bytes_per_line),MagickMax(8,pcx_info.planes)*sizeof(*scanline));    pixel_info=AcquireVirtualMemory(pcx_packets,2*sizeof(*pixels));    if ((scanline == (unsigned char *) NULL) ||        (pixel_info == (MemoryInfo *) NULL))      {        if (scanline != (unsigned char *) NULL)          scanline=(unsigned char *) RelinquishMagickMemory(scanline);        if (pixel_info != (MemoryInfo *) NULL)          pixel_info=RelinquishVirtualMemory(pixel_info);        ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");      }    pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);    /*      Uncompress image data.    */    p=pixels;    if (pcx_info.encoding == 0)      while (pcx_packets != 0)      {        packet=(unsigned char) ReadBlobByte(image);        if (EOFBlob(image) != MagickFalse)          ThrowPCXException(CorruptImageError,"UnexpectedEndOfFile");        *p++=packet;        pcx_packets--;      }    else      while (pcx_packets != 0)      {        packet=(unsigned char) ReadBlobByte(image);        if (EOFBlob(image) != MagickFalse)          ThrowPCXException(CorruptImageError,"UnexpectedEndOfFile");        if ((packet & 0xc0) != 0xc0)          {            *p++=packet;            pcx_packets--;            continue;          }        count=(ssize_t) (packet & 0x3f);        packet=(unsigned char) ReadBlobByte(image);        if (EOFBlob(image) != MagickFalse)          ThrowPCXException(CorruptImageError,"UnexpectedEndOfFile");        for ( ; count != 0; count--)        {          *p++=packet;          pcx_packets--;          if (pcx_packets == 0)            break;        }      }    if (image->storage_class == DirectClass)      image->alpha_trait=pcx_info.planes > 3 ? BlendPixelTrait :        UndefinedPixelTrait;    else
开发者ID:278443820,项目名称:ImageMagick,代码行数:67,


示例18: ReadMTVImage

//.........这里部分代码省略.........        (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 MTV image.    */    (void) ReadBlobString(image,buffer);    count=(ssize_t) sscanf(buffer,"%lu %lu/n",&columns,&rows);    if (count <= 0)        ThrowReaderException(CorruptImageError,"ImproperImageHeader");    do    {        /*          Initialize image structure.        */        image->columns=columns;        image->rows=rows;        image->depth=8;        if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))            if (image->scene >= (image_info->scene+image_info->number_scenes-1))                break;        /*          Convert MTV raster image to pixel packets.        */        pixels=(unsigned char *) AcquireQuantumMemory((size_t) image->columns,                3UL*sizeof(*pixels));        if (pixels == (unsigned char *) NULL)            ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");        for (y=0; y < (ssize_t) image->rows; y++)        {            count=(ssize_t) ReadBlob(image,(size_t) (3*image->columns),pixels);            if (count != (ssize_t) (3*image->columns))                ThrowReaderException(CorruptImageError,"UnableToReadImageData");            p=pixels;            q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);            if (q == (PixelPacket *) NULL)                break;            for (x=0; x < (ssize_t) image->columns; x++)            {                SetPixelRed(q,ScaleCharToQuantum(*p++));                SetPixelGreen(q,ScaleCharToQuantum(*p++));                SetPixelBlue(q,ScaleCharToQuantum(*p++));                SetPixelOpacity(q,OpaqueOpacity);                q++;            }            if (SyncAuthenticPixels(image,exception) == MagickFalse)                break;            if (image->previous == (Image *) NULL)            {                status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,                                        image->rows);                if (status == MagickFalse)                    break;            }        }        pixels=(unsigned char *) RelinquishMagickMemory(pixels);        if (EOFBlob(image) != MagickFalse)        {            ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",                               image->filename);            break;        }        /*          Proceed to next image.        */        if (image_info->number_scenes != 0)            if (image->scene >= (image_info->scene+image_info->number_scenes-1))                break;        *buffer='/0';        (void) ReadBlobString(image,buffer);        count=(ssize_t) sscanf(buffer,"%lu %lu/n",&columns,&rows);        if (count > 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 (count > 0);    (void) CloseBlob(image);    return(GetFirstImageInList(image));}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,


示例19: ReadVICARImage

//.........这里部分代码省略.........          if ((size_t) (p-keyword) < MaxTextExtent)            *p++=c;          c=ReadBlobByte(image);          count++;        } while (isalnum(c) || (c == '_'));        *p='/0';        value_expected=MagickFalse;        while ((isspace((int) ((unsigned char) c)) != 0) || (c == '='))        {          if (c == '=')            value_expected=MagickTrue;          c=ReadBlobByte(image);          count++;        }        if (value_expected == MagickFalse)          continue;        p=value;        while (isalnum(c))        {          if ((size_t) (p-value) < MaxTextExtent)            *p++=c;          c=ReadBlobByte(image);          count++;        }        *p='/0';        /*          Assign a value to the specified keyword.        */        if (LocaleCompare(keyword,"Label_RECORDS") == 0)          length=(ssize_t) atol(value);        if (LocaleCompare(keyword,"LBLSIZE") == 0)          length=(ssize_t) atol(value);        if (LocaleCompare(keyword,"RECORD_BYTES") == 0)          image->columns=1UL*atol(value);        if (LocaleCompare(keyword,"NS") == 0)          image->columns=1UL*atol(value);        if (LocaleCompare(keyword,"LINES") == 0)          image->rows=1UL*atol(value);        if (LocaleCompare(keyword,"NL") == 0)          image->rows=1UL*atol(value);      }    while (isspace((int) ((unsigned char) c)) != 0)    {      c=ReadBlobByte(image);      count++;    }  }  while (count < (ssize_t) length)  {    c=ReadBlobByte(image);    count++;  }  if ((image->columns == 0) || (image->rows == 0))    ThrowReaderException(CorruptImageError,"NegativeOrZeroImageSize");  image->depth=8;  if (AllocateImageColormap(image,256) == MagickFalse)    ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");  if (image_info->ping != MagickFalse)    {      (void) CloseBlob(image);      return(GetFirstImageInList(image));    }  /*    Read VICAR pixels.  */  if (SetImageExtent(image,0,0) == MagickFalse)    {      InheritException(exception,&image->exception);      return(DestroyImageList(image));    }  GetQuantumInfo(image_info,&quantum_info);  scanline=(unsigned char *) AcquireQuantumMemory(image->columns,    sizeof(*scanline));  if (scanline == (unsigned char *) NULL)    ThrowReaderException(CorruptImageError,"UnableToReadImageData");  for (y=0; y < (long) image->rows; y++)  {    q=SetImagePixels(image,0,y,image->columns,1);    if (q == (PixelPacket *) NULL)      break;    count=ReadBlob(image,image->columns,scanline);    (void) ExportQuantumPixels(image,&quantum_info,GrayQuantum,scanline);    if (SyncImagePixels(image) == MagickFalse)      break;    if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&        (QuantumTick(y,image->rows) != MagickFalse))      {        status=image->progress_monitor(LoadImageTag,y,image->rows,          image->client_data);        if (status == MagickFalse)          break;      }  }  scanline=(unsigned char *) RelinquishMagickMemory(scanline);  if (EOFBlob(image) != MagickFalse)    ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",      image->filename);  (void) CloseBlob(image);  return(GetFirstImageInList(image));}
开发者ID:KiiCorp,项目名称:ImageMagick,代码行数:101,


示例20: ReadVIFFImage

//.........这里部分代码省略.........                        break;                }            }        }        else if (image->storage_class == PseudoClass)            for (y=0; y < (ssize_t) image->rows; y++)            {                q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);                if (q == (Quantum *) NULL)                    break;                for (x=0; x < (ssize_t) image->columns; x++)                {                    SetPixelIndex(image,*p++,q);                    q+=GetPixelChannels(image);                }                if (SyncAuthenticPixels(image,exception) == MagickFalse)                    break;                if (image->previous == (Image *) NULL)                {                    status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,                                            image->rows);                    if (status == MagickFalse)                        break;                }            }        else        {            /*              Convert DirectColor scanline.            */            number_pixels=(MagickSizeType) image->columns*image->rows;            for (y=0; y < (ssize_t) image->rows; y++)            {                q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);                if (q == (Quantum *) NULL)                    break;                for (x=0; x < (ssize_t) image->columns; x++)                {                    SetPixelRed(image,ScaleCharToQuantum(*p),q);                    SetPixelGreen(image,ScaleCharToQuantum(*(p+number_pixels)),q);                    SetPixelBlue(image,ScaleCharToQuantum(*(p+2*number_pixels)),q);                    if (image->colors != 0)                    {                        SetPixelRed(image,image->colormap[(ssize_t)                                                          GetPixelRed(image,q)].red,q);                        SetPixelGreen(image,image->colormap[(ssize_t)                                                            GetPixelGreen(image,q)].green,q);                        SetPixelBlue(image,image->colormap[(ssize_t)                                                           GetPixelBlue(image,q)].blue,q);                    }                    SetPixelAlpha(image,image->alpha_trait == BlendPixelTrait ?                                  ScaleCharToQuantum(*(p+number_pixels*3)) : OpaqueAlpha,q);                    p++;                    q+=GetPixelChannels(image);                }                if (SyncAuthenticPixels(image,exception) == MagickFalse)                    break;                if (image->previous == (Image *) NULL)                {                    status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,                                            image->rows);                    if (status == MagickFalse)                        break;                }            }        }        viff_pixels=(unsigned char *) RelinquishMagickMemory(viff_pixels);        if (image->storage_class == PseudoClass)            (void) SyncImage(image,exception);        if (EOFBlob(image) != MagickFalse)        {            ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",                               image->filename);            break;        }        /*          Proceed to next image.        */        if (image_info->number_scenes != 0)            if (image->scene >= (image_info->scene+image_info->number_scenes-1))                break;        count=ReadBlob(image,1,&viff_info.identifier);        if ((count != 0) && (viff_info.identifier == 0xab))        {            /*              Allocate next image structure.            */            AcquireNextImage(image_info,image,exception);            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 ((count != 0) && (viff_info.identifier == 0xab));
开发者ID:verma-manish58,项目名称:ImageMagick,代码行数:101,


示例21: ReadRLAImage

//.........这里部分代码省略.........        runlength=byte;        if (byte > 127)          runlength=byte-256;        length--;        if (length == 0)          break;        if (runlength < 0)          {            while (runlength < 0)            {              q=GetAuthenticPixels(image,(ssize_t) (x % image->columns),                (ssize_t) (y % image->rows),1,1,exception);              if (q == (Quantum *) NULL)                break;              byte=(unsigned char) ReadBlobByte(image);              length--;              switch (channel)              {                case 0:                {                  SetPixelRed(image,ScaleCharToQuantum(byte),q);                  break;                }                case 1:                {                  SetPixelGreen(image,ScaleCharToQuantum(byte),q);                  break;                }                case 2:                {                  SetPixelBlue(image,ScaleCharToQuantum(byte),q);                  break;                }                case 3:                default:                {                  SetPixelAlpha(image,ScaleCharToQuantum(byte),q);                  break;                }              }              if (SyncAuthenticPixels(image,exception) == MagickFalse)                break;              x++;              runlength++;            }            continue;          }        byte=(unsigned char) ReadBlobByte(image);        length--;        runlength++;        do        {          q=GetAuthenticPixels(image,(ssize_t) (x % image->columns),            (ssize_t) (y % image->rows),1,1,exception);          if (q == (Quantum *) NULL)            break;          switch (channel)          {            case 0:            {              SetPixelRed(image,ScaleCharToQuantum(byte),q);              break;            }            case 1:            {              SetPixelGreen(image,ScaleCharToQuantum(byte),q);              break;            }            case 2:            {              SetPixelBlue(image,ScaleCharToQuantum(byte),q);              break;            }            case 3:            default:            {              SetPixelAlpha(image,ScaleCharToQuantum(byte),q);              break;            }          }          if (SyncAuthenticPixels(image,exception) == MagickFalse)            break;          x++;          runlength--;        }        while (runlength > 0);      }    }    status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,      image->rows);    if (status == MagickFalse)      break;  }  if (EOFBlob(image) != MagickFalse)    ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",      image->filename);  scanlines=(MagickOffsetType *) RelinquishMagickMemory(scanlines);  (void) CloseBlob(image);  return(GetFirstImageInList(image));}
开发者ID:278443820,项目名称:ImageMagick,代码行数:101,


示例22: ReadRLEImage

//.........这里部分代码省略.........              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++;              }              if (SyncAuthenticPixels(image,exception) == MagickFalse)                break;              if (image->previous == (Image *) NULL)                {                  status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)                    y,image->rows);                  if (status == MagickFalse)                    break;                }            }            image->colormap=(PixelPacket *) RelinquishMagickMemory(              image->colormap);            image->storage_class=DirectClass;            image->colors=0;          }      }    if (number_colormaps != 0)      colormap=(unsigned char *) RelinquishMagickMemory(colormap);    pixel_info=RelinquishVirtualMemory(pixel_info);    if (EOFBlob(image) != MagickFalse)      {        ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",          image->filename);        break;      }    /*      Proceed to next image.    */    if (image_info->number_scenes != 0)      if (image->scene >= (image_info->scene+image_info->number_scenes-1))        break;    (void) ReadBlobByte(image);    count=ReadBlob(image,2,(unsigned char *) magick);    if ((count != 0) && (memcmp(magick,"/122/314",2) == 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 ((count != 0) && (memcmp(magick,"/122/314",2) == 0));  (void) CloseBlob(image);  return(GetFirstImageInList(image));}
开发者ID:UIKit0,项目名称:YoyaMagick,代码行数:101,


示例23: ReadHDRImage

//.........这里部分代码省略.........    if (image->compression != RLECompression)      {        count=ReadBlob(image,4*image->columns*sizeof(*pixels),pixels);        if (count != (ssize_t) (4*image->columns*sizeof(*pixels)))          break;      }    else      {        count=ReadBlob(image,4*sizeof(*pixel),pixel);        if (count != 4)          break;        if ((size_t) ((((size_t) pixel[2]) << 8) | pixel[3]) != image->columns)          {            (void) memcpy(pixels,pixel,4*sizeof(*pixel));            (void) ReadBlob(image,4*(image->columns-1)*sizeof(*pixels),pixels+4);            image->compression=NoCompression;          }        else          {            p=pixels;            for (i=0; i < 4; i++)            {              end=&pixels[(i+1)*image->columns];              while (p < end)              {                count=ReadBlob(image,2*sizeof(*pixel),pixel);                if (count < 1)                  break;                if (pixel[0] > 128)                  {                    count=(ssize_t) pixel[0]-128;                    if ((count == 0) || (count > (ssize_t) (end-p)))                      break;                    while (count-- > 0)                      *p++=pixel[1];                  }                else                  {                    count=(ssize_t) pixel[0];                    if ((count == 0) || (count > (ssize_t) (end-p)))                      break;                    *p++=pixel[1];                    if (--count > 0)                      {                        count=ReadBlob(image,(size_t) count*sizeof(*p),p);                        if (count < 1)                          break;                        p+=count;                      }                  }              }            }          }      }    q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);    if (q == (PixelPacket *) NULL)      break;    i=0;    for (x=0; x < (ssize_t) image->columns; x++)    {      if (image->compression == RLECompression)        {          pixel[0]=pixels[x];          pixel[1]=pixels[x+image->columns];          pixel[2]=pixels[x+2*image->columns];          pixel[3]=pixels[x+3*image->columns];        }      else        {          pixel[0]=pixels[i++];          pixel[1]=pixels[i++];          pixel[2]=pixels[i++];          pixel[3]=pixels[i++];        }      SetPixelRed(q,0);      SetPixelGreen(q,0);      SetPixelBlue(q,0);      if (pixel[3] != 0)        {          gamma=pow(2.0,pixel[3]-(128.0+8.0));          SetPixelRed(q,ClampToQuantum(QuantumRange*gamma*pixel[0]));          SetPixelGreen(q,ClampToQuantum(QuantumRange*gamma*pixel[1]));          SetPixelBlue(q,ClampToQuantum(QuantumRange*gamma*pixel[2]));        }      q++;    }    if (SyncAuthenticPixels(image,exception) == MagickFalse)      break;    status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,      image->rows);    if (status == MagickFalse)      break;  }  pixels=(unsigned char *) RelinquishMagickMemory(pixels);  if (EOFBlob(image) != MagickFalse)    ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",      image->filename);  (void) CloseBlob(image);  return(GetFirstImageInList(image));}
开发者ID:INT2208-ST,项目名称:MyFriend,代码行数:101,


示例24: assert

//.........这里部分代码省略.........          (void) ImportImagePixelArea(image,BlackQuantum,quantum_size,scanline+x,				      &import_options,0);          if (!SyncImagePixels(image))            break;          if (image->previous == (Image *) NULL)            if (QuantumTick(i,span))              if (!MagickMonitorFormatted(i,span,&image->exception,                                          LoadImageText,image->filename,					  image->columns,image->rows))                break;          i++;        }        count=image->tile_info.height-image->rows-image->tile_info.y;        for (i=0; i < (long) count; i++)          (void) ReadBlob(image,packet_size*image->tile_info.width,scanline);        if (image->matte)          {            /*              Read matte channel.            */            if (image_info->interlace == PartitionInterlace)              {                CloseBlob(image);                AppendImageFormat("A",image->filename);                status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);                if (status == False)                  ThrowReaderException(FileOpenError,UnableToOpenFile,image);              }            for (y=0; y < image->tile_info.y; y++)              (void) ReadBlob(image,packet_size*image->tile_info.width,                scanline);            for (y=0; y < (long) image->rows; y++)            {              (void) ReadBlob(image,packet_size*image->tile_info.width,                scanline);              q=GetImagePixels(image,0,y,image->columns,1);              if (q == (PixelPacket *) NULL)                break;              (void) ImportImagePixelArea(image,AlphaQuantum,quantum_size,scanline+x,					  &import_options,0);              if (!SyncImagePixels(image))                break;              if (image->previous == (Image *) NULL)                if (QuantumTick(i,span))                  if (!MagickMonitorFormatted(i,span,&image->exception,                                              LoadImageText,image->filename,					      image->columns,image->rows))                    break;              i++;            }            count=image->tile_info.height-image->rows-image->tile_info.y;            for (i=0; i < (long) count; i++)              (void) ReadBlob(image,packet_size*image->tile_info.width,                scanline);          }        if (image_info->interlace == PartitionInterlace)          (void) strlcpy(image->filename,image_info->filename,MaxTextExtent);        break;      }    }    if (EOFBlob(image))      {        ThrowException(exception,CorruptImageError,UnexpectedEndOfFile,          image->filename);        break;      }    /*      Proceed to next image.    */    if (image_info->subrange != 0)      if (image->scene >= (image_info->subimage+image_info->subrange-1))        break;    if (image_info->interlace == PartitionInterlace)      break;    count=ReadBlob(image,packet_size*image->tile_info.width,scanline);    if (count != 0)      {        /*          Allocate next image structure.        */        AllocateNextImage(image_info,image);        if (image->next == (Image *) NULL)          {            DestroyImageList(image);            return((Image *) NULL);          }        image=SyncNextImageInList(image);        status=MagickMonitorFormatted(TellBlob(image),GetBlobSize(image),                                      exception,LoadImagesText,                                      image->filename);        if (status == False)          break;      }  } while (count != 0);  MagickFreeMemory(scanline);  while (image->previous != (Image *) NULL)    image=image->previous;  CloseBlob(image);  return(image);}
开发者ID:CliffsDover,项目名称:graphicsmagick,代码行数:101,


示例25: ReadVICARImage

//.........这里部分代码省略.........        /*          Determine a keyword and its value.        */        p=keyword;        do        {          if ((size_t) (p-keyword) < (MaxTextExtent-1))            *p++=c;          c=ReadBlobByte(image);          count++;        } while (isalnum(c) || (c == '_'));        *p='/0';        value_expected=MagickFalse;        while ((isspace((int) ((unsigned char) c)) != 0) || (c == '='))        {          if (c == '=')            value_expected=MagickTrue;          c=ReadBlobByte(image);          count++;        }        if (value_expected == MagickFalse)          continue;        p=value;        while (isalnum(c))        {          if ((size_t) (p-value) < (MaxTextExtent-1))            *p++=c;          c=ReadBlobByte(image);          count++;        }        *p='/0';        /*          Assign a value to the specified keyword.        */        if (LocaleCompare(keyword,"Label_RECORDS") == 0)          length=(ssize_t) StringToLong(value);        if (LocaleCompare(keyword,"LBLSIZE") == 0)          length=(ssize_t) StringToLong(value);        if (LocaleCompare(keyword,"RECORD_BYTES") == 0)          image->columns=StringToUnsignedLong(value);        if (LocaleCompare(keyword,"NS") == 0)          image->columns=StringToUnsignedLong(value);        if (LocaleCompare(keyword,"LINES") == 0)          image->rows=StringToUnsignedLong(value);        if (LocaleCompare(keyword,"NL") == 0)          image->rows=StringToUnsignedLong(value);      }    while (isspace((int) ((unsigned char) c)) != 0)    {      c=ReadBlobByte(image);      count++;    }  }  while (count < (ssize_t) length)  {    c=ReadBlobByte(image);    count++;  }  if ((image->columns == 0) || (image->rows == 0))    ThrowReaderException(CorruptImageError,"NegativeOrZeroImageSize");  image->depth=8;  if (AcquireImageColormap(image,256) == MagickFalse)    ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");  if (image_info->ping != MagickFalse)    {      (void) CloseBlob(image);      return(GetFirstImageInList(image));    }  /*    Read VICAR pixels.  */  quantum_type=IndexQuantum;  quantum_info=AcquireQuantumInfo(image_info,image);  if (quantum_info == (QuantumInfo *) NULL)    ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");  pixels=GetQuantumPixels(quantum_info);  length=GetQuantumExtent(image,quantum_info,IndexQuantum);  for (y=0; y < (ssize_t) image->rows; y++)  {    q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);    if (q == (PixelPacket *) NULL)      break;    count=ReadBlob(image,length,pixels);    (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,      quantum_type,pixels,exception);    if (SyncAuthenticPixels(image,exception) == MagickFalse)      break;    status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,      image->rows);    if (status == MagickFalse)      break;  }  SetQuantumImageType(image,quantum_type);  quantum_info=DestroyQuantumInfo(quantum_info);  if (EOFBlob(image) != MagickFalse)    ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",      image->filename);  (void) CloseBlob(image);  return(GetFirstImageInList(image));}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,


示例26: assert

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   R e a d M A C I m a g e                                                   %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Method ReadMACImage reads an MAC image file and returns it.  It%  allocates the memory necessary for the new Image structure and returns a%  pointer to the new image.%%  The format of the ReadMACImage method is:%%      Image *ReadMACImage(const ImageInfo *image_info,ExceptionInfo *exception)%%  A description of each parameter follows:%%    o image:  Method ReadMACImage returns a pointer to the image after%      reading. A null image is returned if there is a memory shortage or if%      the image cannot be read.%%    o image_info: Specifies a pointer to a ImageInfo structure.%%    o exception: return any errors or warnings in this structure.%%*/static Image *ReadMACImage(const ImageInfo *image_info,ExceptionInfo *exception){  Image *image;  unsigned int y;    unsigned char x8, rep, b;  long ldblk;  unsigned char *BImgBuff = NULL;  unsigned char *DataPtr;  unsigned int status;  const PixelPacket *q;	/* Open image file. */  assert(image_info != (const ImageInfo *) NULL);  assert(image_info->signature == MagickSignature);  assert(exception != (ExceptionInfo *) NULL);  assert(exception->signature == MagickSignature);  image = AllocateImage(image_info);  status = OpenBlob(image_info,image,ReadBinaryBlobMode,exception);  if(status == False)    ThrowReaderException(FileOpenError,UnableToOpenFile,image);	/* Read MAC image. */  ldblk = ReadBlobLSBShort(image);  if((ldblk & 0xFF)!=0)	ThrowReaderException(CorruptImageError,ImproperImageHeader,image);  if(ldblk==0)		/* ???? don't know why */	SeekBlob(image,0x200,SEEK_SET);  else	SeekBlob(image,0x280,SEEK_SET);  image->columns = 576;  image->rows = 720;  image->depth = 1;  image->colors = 1l << image->depth;  if (!AllocateImageColormap(image,image->colors)) goto NoMemory;    /* If ping is true, then only set image size and colors without reading any image data. */  if (image_info->ping) goto DONE_READING;  /* ----- Load RLE compressed raster ----- */  ldblk = (image->depth*image->columns) /8;  BImgBuff = MagickAllocateMemory(unsigned char *, ((size_t)ldblk));  if(BImgBuff==NULL)    NoMemory:      ThrowReaderException(ResourceLimitError,MemoryAllocationFailed,image);    DataPtr = BImgBuff;    x8=0; y=0;  while(y<image->rows)  {    rep = ReadBlobByte(image);    if(EOFBlob(image)) break;    if( rep>=128 || rep<=0)    {      b = ~ReadBlobByte(image);;      rep = ~rep + 2;      while(rep>0)      {        *DataPtr++ = b;        x8++;        rep--;        if(x8>=ldblk)	{	  x8=0;//.........这里部分代码省略.........
开发者ID:CliffsDover,项目名称:graphicsmagick,代码行数:101,


示例27: ReadPESImage

//.........这里部分代码省略.........  unsigned char    magick[4],    version[4];  /*    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);    }  /*    Verify PES identifier.  */  count=ReadBlob(image,4,magick);  if ((count != 4) || (LocaleNCompare((char *) magick,"#PES",4) != 0))    ThrowReaderException(CorruptImageError,"ImproperImageHeader");  count=ReadBlob(image,4,version);  offset=(int) ReadBlobLSBLong(image);  if (DiscardBlobBytes(image,offset+36) == MagickFalse)    ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",      image->filename);  if (EOFBlob(image) != MagickFalse)    ThrowReaderException(CorruptImageError,"UnexpectedEndOfFile");  /*    Get PES colors.  */  number_colors=(size_t) ReadBlobByte(image)+1;  for (i=0; i < (ssize_t) number_colors; i++)  {    j=(int) ReadBlobByte(image);    blocks[i].color=PESColor+(j < 0 ? 0 : j);    blocks[i].offset=0;  }  for ( ; i < 256L; i++)    blocks[i].offset=0;  if (DiscardBlobBytes(image,532L-number_colors-21) == MagickFalse)    ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",      image->filename);  if (EOFBlob(image) != MagickFalse)    ThrowReaderException(CorruptImageError,"UnexpectedEndOfFile");  /*    Stitch away.  */  number_stitches=64;  stitches=(PointInfo *) AcquireQuantumMemory(number_stitches,    sizeof(*stitches));  if (stitches == (PointInfo *) NULL)    ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");  bounds.x1=65535.0;  bounds.y1=65535.0;  bounds.x2=(-65535.0);  bounds.y2=(-65535.0);  i=0;  j=0;
开发者ID:GalliumOS,项目名称:imagemagick,代码行数:67,


示例28: ReadARTImage

//.........这里部分代码省略.........%%  The format of the ReadARTImage method is:%%      Image *ReadARTImage(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 *ReadARTImage(const ImageInfo *image_info,ExceptionInfo *exception){  Image    *image;  QuantumInfo    *quantum_info;  MagickBooleanType    status;  size_t    length;  ssize_t    count,    y;  unsigned char    *pixels;  /*    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,exception);  status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);  if (status == MagickFalse)    {      image=DestroyImageList(image);      return((Image *) NULL);    }  image->depth=1;  image->endian=MSBEndian;  (void) ReadBlobLSBShort(image);  image->columns=(size_t) ReadBlobLSBShort(image);  (void) ReadBlobLSBShort(image);  image->rows=(size_t) ReadBlobLSBShort(image);  if ((image->columns == 0) || (image->rows == 0))    ThrowReaderException(CorruptImageError,"ImproperImageHeader");  if (image_info->ping != MagickFalse)    {      (void) CloseBlob(image);      return(GetFirstImageInList(image));    }  /*    Convert bi-level image to pixel packets.  */  SetImageColorspace(image,GRAYColorspace,exception);  quantum_info=AcquireQuantumInfo(image_info,image);  if (quantum_info == (QuantumInfo *) NULL)    ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");  pixels=GetQuantumPixels(quantum_info);  length=GetQuantumExtent(image,quantum_info,GrayQuantum);  for (y=0; y < (ssize_t) image->rows; y++)  {    register Quantum      *restrict q;    q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);    if (q == (Quantum *) NULL)      break;    count=ReadBlob(image,length,pixels);    if (count != (ssize_t) length)      ThrowReaderException(CorruptImageError,"UnableToReadImageData");    (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,      GrayQuantum,pixels,exception);    count=ReadBlob(image,(size_t) (-(ssize_t) length) & 0x01,pixels);    if (SyncAuthenticPixels(image,exception) == MagickFalse)      break;    if (SetImageProgress(image,LoadImageTag,y,image->rows) == MagickFalse)      break;  }  SetQuantumImageType(image,GrayQuantum);  quantum_info=DestroyQuantumInfo(quantum_info);  if (EOFBlob(image) != MagickFalse)    ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",      image->filename);  (void) CloseBlob(image);  return(GetFirstImageInList(image));}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,


示例29: ReadPWPImage

//.........这里部分代码省略.........    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);  pwp_image=AcquireImage(image_info);  image=pwp_image;  status=OpenBlob(image_info,pwp_image,ReadBinaryBlobMode,exception);  if (status == MagickFalse)    return((Image *) NULL);  count=ReadBlob(pwp_image,5,magick);  if ((count == 0) || (LocaleNCompare((char *) magick,"SFW95",5) != 0))    ThrowReaderException(CorruptImageError,"ImproperImageHeader");  read_info=CloneImageInfo(image_info);  (void) SetImageInfoProgressMonitor(read_info,(MagickProgressMonitor) NULL,    (void *) NULL);  SetImageInfoBlob(read_info,(void *) NULL,0);  unique_file=AcquireUniqueFileResource(read_info->filename);  for ( ; ; )  {    for (c=ReadBlobByte(pwp_image); c != EOF; c=ReadBlobByte(pwp_image))    {      for (i=0; i < 17; i++)        magick[i]=magick[i+1];      magick[17]=(unsigned char) c;      if (LocaleNCompare((char *) (magick+12),"SFW94A",6) == 0)        break;    }    if (c == EOF)      break;    if (LocaleNCompare((char *) (magick+12),"SFW94A",6) != 0)      ThrowReaderException(CorruptImageError,"ImproperImageHeader");    /*      Dump SFW image to a temporary file.    */    file=(FILE *) NULL;    if (unique_file != -1)      file=fdopen(unique_file,"wb");    if ((unique_file == -1) || (file == (FILE *) NULL))      {        ThrowFileException(exception,FileOpenError,"UnableToWriteFile",          image->filename);        image=DestroyImageList(image);        return((Image *) NULL);      }    length=fwrite("SFW94A",1,6,file);    (void) length;    filesize=65535UL*magick[2]+256L*magick[1]+magick[0];    for (i=0; i < (ssize_t) filesize; i++)    {      c=ReadBlobByte(pwp_image);      (void) fputc(c,file);    }    (void) fclose(file);    next_image=ReadImage(read_info,exception);    if (next_image == (Image *) NULL)      break;    (void) FormatLocaleString(next_image->filename,MaxTextExtent,      "slide_%02ld.sfw",(long) next_image->scene);    if (image == (Image *) NULL)      image=next_image;    else      {        /*          Link image into image list.        */        for (p=image; p->next != (Image *) NULL; p=GetNextImageInList(p)) ;        next_image->previous=p;        next_image->scene=p->scene+1;        p->next=next_image;      }    if (image_info->number_scenes != 0)      if (next_image->scene >= (image_info->scene+image_info->number_scenes-1))        break;    status=SetImageProgress(image,LoadImagesTag,TellBlob(pwp_image),      GetBlobSize(pwp_image));    if (status == MagickFalse)      break;  }  (void) RelinquishUniqueFileResource(read_info->filename);  read_info=DestroyImageInfo(read_info);  (void) CloseBlob(pwp_image);  pwp_image=DestroyImage(pwp_image);  if (EOFBlob(image) != MagickFalse)    {      char        *message;      message=GetExceptionMessage(errno);      (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError,        "UnexpectedEndOfFile","`%s': %s",image->filename,message);      message=DestroyString(message);    }  (void) CloseBlob(image);  return(GetFirstImageInList(image));}
开发者ID:divyasnair123,项目名称:vegetable_store,代码行数:101,



注:本文中的EOFBlob函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ EPETRA_CHK_ERR函数代码示例
C++ ENUM_TO_STRING函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。