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

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

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

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

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

示例1: ReadJNXImage

//.........这里部分代码省略.........    offset=SeekBlob(image,(MagickOffsetType) jnx_level_info[i].offset,SEEK_SET);    if (offset != (MagickOffsetType) jnx_level_info[i].offset)      continue;    for (j=0; j < (ssize_t) jnx_level_info[i].count; j++)    {      Image        *tile_image;      ImageInfo        *read_info;      int        tile_offset;      MagickOffsetType        restore_offset;      PointInfo        northeast,        southwest;      ssize_t        count;      unsigned char        *blob;      unsigned int        tile_length;      northeast.x=180.0*((int) ReadBlobLSBLong(image))/0x7fffffff;      northeast.y=180.0*((int) ReadBlobLSBLong(image))/0x7fffffff;      southwest.x=180.0*((int) ReadBlobLSBLong(image))/0x7fffffff;      southwest.y=180.0*((int) ReadBlobLSBLong(image))/0x7fffffff;      (void) ReadBlobLSBShort(image); /* width */      (void) ReadBlobLSBShort(image); /* height */      tile_length=ReadBlobLSBLong(image);      tile_offset=(int) ReadBlobLSBLong(image);      if (tile_offset == -1)        continue;      restore_offset=TellBlob(image);      if (restore_offset < 0)        continue;      offset=SeekBlob(image,(MagickOffsetType) tile_offset,SEEK_SET);      if (offset != (MagickOffsetType) tile_offset)        continue;      /*        Read a tile.      */      blob=(unsigned char *) AcquireQuantumMemory((size_t) tile_length+2,        sizeof(*blob));      if (blob == (unsigned char *) NULL)        {          if (images != (Image *) NULL)            images=DestroyImageList(images);          ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");        }      blob[0]=0xFF;      blob[1]=0xD8;      count=ReadBlob(image,tile_length,blob+2);      if (count != (ssize_t) tile_length)        {          if (images != (Image *) NULL)            images=DestroyImageList(images);          blob=(unsigned char *) RelinquishMagickMemory(blob);          ThrowReaderException(CorruptImageError,"UnexpectedEndOfFile");        }      read_info=CloneImageInfo(image_info);      (void) CopyMagickString(read_info->magick,"JPEG",MagickPathExtent);      tile_image=BlobToImage(read_info,blob,tile_length+2,exception);      read_info=DestroyImageInfo(read_info);      blob=(unsigned char *) RelinquishMagickMemory(blob);      offset=SeekBlob(image,restore_offset,SEEK_SET);      if (tile_image == (Image *) NULL)        continue;      (void) CopyMagickString(tile_image->magick,image->magick,MagickPathExtent);      (void) FormatImageProperty(tile_image,"jnx:northeast","%.20g,%.20g",        northeast.x,northeast.y);      (void) FormatImageProperty(tile_image,"jnx:southwest","%.20g,%.20g",        southwest.x,southwest.y);      AppendImageToList(&images,tile_image);    }    if (image->progress_monitor != (MagickProgressMonitor) NULL)      {        MagickBooleanType          proceed;        proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType) i,          (MagickSizeType) jnx_info.levels);        if (proceed == MagickFalse)          status=MagickFalse;      }  }  (void) CloseBlob(image);  image=DestroyImage(image);  if (images == (Image *) NULL)    return((Image *) NULL);  return(GetFirstImageInList(images));}
开发者ID:edalquist,项目名称:ImageMagick,代码行数:101,


示例2: WriteCALSImage

//.........这里部分代码省略.........    count=WriteCALSRecord(image,"docls: NONE");    count=WriteCALSRecord(image,"rtype: 1");    orient_x=0;    orient_y=0;    switch (image->orientation)    {    case TopRightOrientation:    {        orient_x=180;        orient_y=270;        break;    }    case BottomRightOrientation:    {        orient_x=180;        orient_y=90;        break;    }    case BottomLeftOrientation:    {        orient_y=90;        break;    }    case LeftTopOrientation:    {        orient_x=270;        break;    }    case RightTopOrientation:    {        orient_x=270;        orient_y=180;        break;    }    case RightBottomOrientation:    {        orient_x=90;        orient_y=180;        break;    }    case LeftBottomOrientation:    {        orient_x=90;        break;    }    default:    {        orient_y=270;        break;    }    }    (void) FormatLocaleString(header,sizeof(header),"rorient: %03ld,%03ld",                              (long) orient_x,(long) orient_y);    count=WriteCALSRecord(image,header);    (void) FormatLocaleString(header,sizeof(header),"rpelcnt: %06lu,%06lu",                              (unsigned long) image->columns,(unsigned long) image->rows);    count=WriteCALSRecord(image,header);    density=200;    if (image_info->density != (char *) NULL)    {        GeometryInfo        geometry_info;        (void) ParseGeometry(image_info->density,&geometry_info);        density=(size_t) floor(geometry_info.rho+0.5);    }    (void) FormatLocaleString(header,sizeof(header),"rdensty: %04lu",                              (unsigned long) density);    count=WriteCALSRecord(image,header);    count=WriteCALSRecord(image,"notes: NONE");    (void) ResetMagickMemory(header,' ',128);    for (i=0; i < 5; i++)        (void) WriteBlob(image,128,(unsigned char *) header);    /*      Write CALS pixels.    */    write_info=CloneImageInfo(image_info);    (void) CopyMagickString(write_info->filename,"GROUP4:",MagickPathExtent);    (void) CopyMagickString(write_info->magick,"GROUP4",MagickPathExtent);    group4_image=CloneImage(image,0,0,MagickTrue,exception);    if (group4_image == (Image *) NULL)    {        (void) CloseBlob(image);        return(MagickFalse);    }    group4=(unsigned char *) ImageToBlob(write_info,group4_image,&length,                                         exception);    group4_image=DestroyImage(group4_image);    if (group4 == (unsigned char *) NULL)    {        (void) CloseBlob(image);        return(MagickFalse);    }    write_info=DestroyImageInfo(write_info);    if (WriteBlob(image,length,group4) != (ssize_t) length)        status=MagickFalse;    group4=(unsigned char *) RelinquishMagickMemory(group4);    (void) CloseBlob(image);    return(status);}
开发者ID:anorland,项目名称:ImageMagick,代码行数:101,


示例3: WriteImages

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   W r i t e I m a g e s                                                     %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  WriteImages() writes an image sequence.%%  The format of the WriteImages method is:%%      MagickBooleanType WriteImages(const ImageInfo *image_info,Image *images,%        const char *filename,ExceptionInfo *exception)%%  A description of each parameter follows:%%    o image_info: the image info.%%    o images: the image list.%%    o filename: the image filename.%%    o exception: return any errors or warnings in this structure.%*/MagickExport MagickBooleanType WriteImages(const ImageInfo *image_info,  Image *images,const char *filename,ExceptionInfo *exception){#define WriteImageTag  "Write/Image"  BlobInfo    *blob;  ExceptionInfo    *sans_exception;  ImageInfo    *write_info;  MagickBooleanType    proceed;  MagickOffsetType    i;  MagickProgressMonitor    progress_monitor;  MagickSizeType    number_images;  MagickStatusType    status;  register Image    *p;  assert(image_info != (const ImageInfo *) NULL);  assert(image_info->signature == MagickSignature);  assert(images != (Image *) NULL);  assert(images->signature == MagickSignature);  if (images->debug != MagickFalse)    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",images->filename);  assert(exception != (ExceptionInfo *) NULL);  write_info=CloneImageInfo(image_info);  images=GetFirstImageInList(images);  blob=CloneBlobInfo(images->blob);  /* thread specific I/O handler */  DestroyBlob(images);  images->blob=blob;  if (filename != (const char *) NULL)    for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))      (void) CopyMagickString(p->filename,filename,MaxTextExtent);  (void) CopyMagickString(write_info->filename,images->filename,MaxTextExtent);  if (*write_info->magick == '/0')    (void) CopyMagickString(write_info->magick,images->magick,MaxTextExtent);  sans_exception=AcquireExceptionInfo();  (void) SetImageInfo(write_info,MagickTrue,sans_exception);  sans_exception=DestroyExceptionInfo(sans_exception);  p=images;  for ( ; GetNextImageInList(p) != (Image *) NULL; p=GetNextImageInList(p))    if (p->scene >= GetNextImageInList(p)->scene)      {        register long          i;        /*          Generate consistent scene numbers.        */        i=(long) images->scene;        for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))          p->scene=(unsigned long) i++;        break;      }  /*    Write images.  *///.........这里部分代码省略.........
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,


示例4: ReadDOTImage

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   R e a d D O T I m a g e                                                   %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  ReadDOTImage() reads a Graphviz 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 ReadDOTImage method is:%%      Image *ReadDOTImage(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 *ReadDOTImage(const ImageInfo *image_info,ExceptionInfo *exception){  char    command[MaxTextExtent];  const char    *option;  graph_t    *graph;  Image    *image;  ImageInfo    *read_info;  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);  status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);  if (status == MagickFalse)    return((Image *) NULL);  read_info=CloneImageInfo(image_info);  SetImageInfoBlob(read_info,(void *) NULL,0);  (void) CopyMagickString(read_info->magick,"SVG",MaxTextExtent);  (void) AcquireUniqueFilename(read_info->filename);  (void) FormatLocaleString(command,MaxTextExtent,"-Tsvg -o%s %s",    read_info->filename,image_info->filename);#if !defined(WITH_CGRAPH)  graph=agread(GetBlobFileHandle(image));#else  graph=agread(GetBlobFileHandle(image),(Agdisc_t *) NULL);#endif  if (graph == (graph_t *) NULL)    return ((Image *) NULL);  option=GetImageOption(image_info,"dot:layout-engine");  if (option == (const char *) NULL)    gvLayout(graphic_context,graph,(char *) "dot");  else    gvLayout(graphic_context,graph,(char *) option);  gvRenderFilename(graphic_context,graph,(char *) "svg",read_info->filename);  gvFreeLayout(graphic_context,graph);  agclose(graph);  /*    Read SVG graph.  */  image=ReadImage(read_info,exception);  (void) RelinquishUniqueFileResource(read_info->filename);  read_info=DestroyImageInfo(read_info);  if (image == (Image *) NULL)    return((Image *) NULL);  return(GetFirstImageInList(image));}
开发者ID:UIKit0,项目名称:YoyaMagick,代码行数:91,


示例5: ngx_screenshot_handler

static ngx_int_tngx_screenshot_handler(ngx_http_request_t *r){    size_t                              len;    u_char                             *p;    ngx_buf_t                          *b;    ngx_chain_t                         cl;    u_char                              path[1024];    ExceptionInfo                      *exception;    Image                              *image = 0, *resized = 0;    ImageInfo                          *image_info = 0;    unsigned char                      *image_data;    ngx_str_t                           size;    ngx_int_t                           width = -1, height = -1;    ngx_screenshot_sizes_conf_t        *screenshot_sizes_conf = ngx_event_get_conf(ngx_cycle->conf_ctx, ngx_screenshot_module);    ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "TEST %d", screenshot_sizes_conf->sizes.nelts);        //TODO: generate unique name    system("avconv -analyzeduration 1000 -i /"rtmp://127.0.0.1:1935/" -vframes 1 -q:v 2 -f image2 /tmp/output.png -loglevel quiet");    MagickCoreGenesis("", MagickTrue);    exception = AcquireExceptionInfo();        ngx_memzero(path, sizeof(path));        strcpy((char *)path, "/tmp/output.png");        image_info = CloneImageInfo((ImageInfo *)NULL);    strcpy(image_info->filename, (const char*)path);        image = ReadImage(image_info, exception);        if (image == 0) {        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "Failed to open screenshot file");        goto error;    }        if (ngx_http_arg(r, (u_char *) "size", sizeof("size") - 1, &size) == NGX_OK) {                if (size.len > 0) {            if (size.data[0] == 'l' && size.data[1] == 'o' && size.data[2] == 'w') {                width = 320;                height = 180;            }            else if (size.data[0] == 'm' && size.data[1] == 'e' && size.data[2] == 'd') {                width = 640;                height = 360;            }            else if (size.data[0] == 'h' && size.data[1] == 'i') {                width = 960;                height = 540;            }            else if (size.data[0] == 'h' && size.data[1] == 'd') {                width = 1280;                height = 720;            }        }    }        if (width < 1 || width > (ngx_int_t)image->columns) {        width = image->columns;    }        if (height < 1 || height > (ngx_int_t)image->rows) {        height = image->rows;    }        if (width == (ngx_int_t)image->columns && height == (ngx_int_t)image->rows) {        resized = image;    }    else {        resized = ResizeImage(image, width, height, SincFilter, 1.0, exception);    }        if (resized == 0) {        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "Failed to resize screenshot file");        goto error;    }        image_data = ImageToBlob(image_info, resized, &len, exception);        p = ngx_palloc(r->connection->pool, len);    if (p == NULL) {        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "Failed to allocate memory for response");        goto error;    }        ngx_memcpy(p, image_data, len);        if (resized != image) {        DestroyImage(resized);    }        DestroyImage(image);    MagicComponentTerminus();        ngx_str_set(&r->headers_out.content_type, "image/png");    r->headers_out.status = NGX_HTTP_OK;    r->headers_out.content_length_n = len;//.........这里部分代码省略.........
开发者ID:elnormous,项目名称:nginx-screenshot-module,代码行数:101,


示例6: WriteHTMLImage

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   W r i t e H T M L I m a g e                                               %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  WriteHTMLImage() writes an image in the HTML encoded image format.%%  The format of the WriteHTMLImage method is:%%      MagickBooleanType WriteHTMLImage(const ImageInfo *image_info,Image *image)%%  A description of each parameter follows.%%    o image_info: the image info.%%    o image:  The image.%%*/static MagickBooleanType WriteHTMLImage(const ImageInfo *image_info,  Image *image){  char    basename[MaxTextExtent],    buffer[MaxTextExtent],    filename[MaxTextExtent],    mapname[MaxTextExtent],    url[MaxTextExtent];  Image    *next;  ImageInfo    *write_info;  MagickBooleanType    status;  RectangleInfo    geometry;  register char    *p;  /*    Open image.  */  assert(image_info != (const ImageInfo *) NULL);  assert(image_info->signature == MagickSignature);  assert(image != (Image *) NULL);  assert(image->signature == MagickSignature);  if (image->debug != MagickFalse)    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",      image_info->filename);  status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);  if (status == MagickFalse)    return(status);  (void) CloseBlob(image);  if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)    (void) TransformImageColorspace(image,sRGBColorspace);  *url='/0';  if ((LocaleCompare(image_info->magick,"FTP") == 0) ||      (LocaleCompare(image_info->magick,"HTTP") == 0))    {      /*        Extract URL base from filename.      */      p=strrchr(image->filename,'/');      if (p != (char *) NULL)        {          p++;          (void) CopyMagickString(url,image_info->magick,MaxTextExtent);          (void) ConcatenateMagickString(url,":",MaxTextExtent);          url[strlen(url)+p-image->filename]='/0';          (void) ConcatenateMagickString(url,image->filename,            p-image->filename+2);          (void) CopyMagickString(image->filename,p,MaxTextExtent);        }    }  /*    Refer to image map file.  */  (void) CopyMagickString(filename,image->filename,MaxTextExtent);  AppendImageFormat("map",filename);  GetPathComponent(filename,BasePath,basename);  (void) CopyMagickString(mapname,basename,MaxTextExtent);  (void) CopyMagickString(image->filename,image_info->filename,MaxTextExtent);  (void) CopyMagickString(filename,image->filename,MaxTextExtent);  write_info=CloneImageInfo(image_info);  write_info->adjoin=MagickTrue;  status=MagickTrue;  if (LocaleCompare(image_info->magick,"SHTML") != 0)    {      const char//.........这里部分代码省略.........
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,


示例7: SetImageInfoBlob

static Image *ReadPlasmaImage(const ImageInfo *image_info,  ExceptionInfo *exception){  Image    *image;  ImageInfo    *read_info;  ssize_t    y;  MagickBooleanType    status;  register ssize_t    x;  register PixelPacket    *q;  register size_t    i;  SegmentInfo    segment_info;  size_t    depth,    max_depth;  /*    Recursively apply plasma to the image.  */  read_info=CloneImageInfo(image_info);  SetImageInfoBlob(read_info,(void *) NULL,0);  (void) FormatMagickString(read_info->filename,MaxTextExtent,    "gradient:%s",image_info->filename);  image=ReadImage(read_info,exception);  read_info=DestroyImageInfo(read_info);  if (image == (Image *) NULL)    return((Image *) NULL);  image->storage_class=DirectClass;  for (y=0; y < (ssize_t) image->rows; y++)  {    q=GetAuthenticPixels(image,0,y,image->columns,1,exception);    if (q == (PixelPacket *) NULL)      break;    for (x=0; x < (ssize_t) image->columns; x++)    {      q->opacity=(Quantum) (QuantumRange/2);      q++;    }    if (SyncAuthenticPixels(image,exception) == MagickFalse)      break;  }  segment_info.x1=0;  segment_info.y1=0;  segment_info.x2=(double) image->columns-1;  segment_info.y2=(double) image->rows-1;  if (LocaleCompare(image_info->filename,"fractal") == 0)    {      RandomInfo        *random_info;      /*        Seed pixels before recursion.      */      random_info=AcquireRandomInfo();      PlasmaPixel(image,random_info,segment_info.x1,segment_info.y1);      PlasmaPixel(image,random_info,segment_info.x1,(segment_info.y1+        segment_info.y2)/2);      PlasmaPixel(image,random_info,segment_info.x1,segment_info.y2);      PlasmaPixel(image,random_info,(segment_info.x1+segment_info.x2)/2,        segment_info.y1);      PlasmaPixel(image,random_info,(segment_info.x1+segment_info.x2)/2,        (segment_info.y1+segment_info.y2)/2);      PlasmaPixel(image,random_info,(segment_info.x1+segment_info.x2)/2,        segment_info.y2);      PlasmaPixel(image,random_info,segment_info.x2,segment_info.y1);      PlasmaPixel(image,random_info,segment_info.x2,(segment_info.y1+        segment_info.y2)/2);      PlasmaPixel(image,random_info,segment_info.x2,segment_info.y2);      random_info=DestroyRandomInfo(random_info);    }  i=(size_t) MagickMax(image->columns,image->rows)/2;  for (max_depth=0; i != 0; max_depth++)    i>>=1;  for (depth=1; ; depth++)  {    if (PlasmaImage(image,&segment_info,0,depth) != MagickFalse)      break;    status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) depth,      max_depth);    if (status == MagickFalse)      break;  }  (void) SetImageAlphaChannel(image,DeactivateAlphaChannel);  return(GetFirstImageInList(image));}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:100,


示例8: return

//.........这里部分代码省略.........  MagickBooleanType    status;  unsigned long    flags;  wmfAPI    *wmf_info;  wmfAPI_Options    options;  wmfD_Rect    bounding_box;  wmf_eps_t    *eps_info;  wmf_error_t    wmf_status;  /*    Read WMF image.  */  image=AcquireImage(image_info);  status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);  if (status == MagickFalse)    {      image=DestroyImageList(image);      return((Image *) NULL);    }  wmf_info=(wmfAPI *) NULL;  flags=0;  flags|=WMF_OPT_IGNORE_NONFATAL;  flags|=WMF_OPT_FUNCTION;  options.function=wmf_eps_function;  wmf_status=wmf_api_create(&wmf_info,flags,&options);  if (wmf_status != wmf_E_None)    {      if (wmf_info != (wmfAPI *) NULL)        wmf_api_destroy(wmf_info);      ThrowReaderException(DelegateError,"UnableToInitializeWMFLibrary");    }  wmf_status=wmf_bbuf_input(wmf_info,WMFReadBlob,WMFSeekBlob,WMFTellBlob,    (void *) image);  if (wmf_status != wmf_E_None)    {      wmf_api_destroy(wmf_info);      ThrowFileException(exception,FileOpenError,"UnableToOpenFile",        image->filename);      image=DestroyImageList(image);      return((Image *) NULL);    }  wmf_status=wmf_scan(wmf_info,0,&bounding_box);  if (wmf_status != wmf_E_None)    {      wmf_api_destroy(wmf_info);      ThrowReaderException(DelegateError,"FailedToScanFile");    }  eps_info=WMF_EPS_GetData(wmf_info);  file=(FILE *) NULL;  unique_file=AcquireUniqueFileResource(filename);  if (unique_file != -1)    file=fdopen(unique_file,"wb");  if ((unique_file == -1) || (file == (FILE *) NULL))    {      wmf_api_destroy(wmf_info);      ThrowReaderException(FileOpenError,"UnableToCreateTemporaryFile");    }  eps_info->out=wmf_stream_create(wmf_info,file);  eps_info->bbox=bounding_box;  wmf_status=wmf_play(wmf_info,0,&bounding_box);  if (wmf_status != wmf_E_None)    {      wmf_api_destroy(wmf_info);      ThrowReaderException(DelegateError,"FailedToRenderFile");    }  (void) fclose(file);  wmf_api_destroy(wmf_info);  (void) CloseBlob(image);  image=DestroyImage(image);  /*    Read EPS image.  */  read_info=CloneImageInfo(image_info);  (void) FormatMagickString(read_info->filename,MaxTextExtent,"eps:%.1024s",    filename);  image=ReadImage(read_info,exception);  read_info=DestroyImageInfo(read_info);  if (image != (Image *) NULL)    {      (void) CopyMagickString(image->filename,image_info->filename,        MaxTextExtent);      (void) CopyMagickString(image->magick_filename,image_info->filename,        MaxTextExtent);      (void) CopyMagickString(image->magick,"WMF",MaxTextExtent);    }  (void) RelinquishUniqueFileResource(filename);  return(GetFirstImageInList(image));}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,


示例9: _imageInfo

Magick::ReadOptions::ReadOptions(const Magick::ReadOptions& options_)  : _imageInfo(CloneImageInfo(options_._imageInfo)),    _quiet(false){}
开发者ID:anorland,项目名称:ImageMagick,代码行数:5,


示例10: assert

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   R e a d G R A D I E N T I m a g e                                         %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  ReadGRADIENTImage creates a gradient image and initializes it to%  the color range as specified by the filename.  It allocates the memory%  necessary for the new Image structure and returns a pointer to the new%  image.%%  The format of the ReadGRADIENTImage method is:%%      Image *ReadGRADIENTImage(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 *ReadGRADIENTImage(const ImageInfo *image_info,  ExceptionInfo *exception){  char    colorname[MagickPathExtent+4];  Image    *image;  ImageInfo    *read_info;  MagickBooleanType    icc_color,    status;  StopInfo    *stops;  /*    Initialize Image structure.  */  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);  read_info=CloneImageInfo(image_info);  SetImageInfoBlob(read_info,(void *) NULL,0);  (void) CopyMagickString(colorname,image_info->filename,MagickPathExtent);  (void) sscanf(image_info->filename,"%[^-]",colorname);  (void) FormatLocaleString(read_info->filename,MagickPathExtent,"xc:%s",    colorname);  image=ReadImage(read_info,exception);  read_info=DestroyImageInfo(read_info);  if (image == (Image *) NULL)    return((Image *) NULL);  (void) SetImageAlpha(image,(Quantum) TransparentAlpha,exception);  (void) CopyMagickString(image->filename,image_info->filename,MagickPathExtent);  icc_color=MagickFalse;  if (LocaleCompare(colorname,"icc") == 0)    {      (void) ConcatenateMagickString(colorname,"-",MagickPathExtent);      (void) sscanf(image_info->filename,"%*[^-]-%[^-]",colorname+4);      icc_color=MagickTrue;    }  stops=(StopInfo *) AcquireQuantumMemory(2,sizeof(*stops));  if (stops == (StopInfo *) NULL)    ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");  stops[0].offset=0.0;  stops[1].offset=1.0;  status=QueryColorCompliance(colorname,AllCompliance,&stops[0].color,exception);  if (status == MagickFalse)    {      stops=(StopInfo *) RelinquishMagickMemory(stops);      image=DestroyImage(image);      return((Image *) NULL);    }  (void) SetImageColorspace(image,stops[0].color.colorspace,exception);  (void) CopyMagickString(colorname,"white",MagickPathExtent);  if (GetPixelInfoIntensity(image,&stops[0].color) > (QuantumRange/2.0))    (void) CopyMagickString(colorname,"black",MagickPathExtent);  if (icc_color == MagickFalse)    (void) sscanf(image_info->filename,"%*[^-]-%[^-]",colorname);  else    (void) sscanf(image_info->filename,"%*[^-]-%*[^-]-%[^-]",colorname);  status=QueryColorCompliance(colorname,AllCompliance,&stops[1].color,exception);  if (status == MagickFalse)    {      stops=(StopInfo *) RelinquishMagickMemory(stops);//.........这里部分代码省略.........
开发者ID:JosephineWolff,项目名称:ImageMagick,代码行数:101,


示例11: ReadPWPImage

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   R e a d P W P I m a g e                                                   %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  ReadPWPImage() reads a Seattle Film Works multi-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 ReadPWPImage method is:%%      Image *ReadPWPImage(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 *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception){  FILE    *file;  Image    *image,    *next_image,    *pwp_image;  ImageInfo    *read_info;  int    c,    unique_file;  MagickBooleanType    status;  register Image    *p;  register ssize_t    i;  size_t    filesize,    length;  ssize_t    count;  unsigned char    magick[MaxTextExtent];  /*    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 != 5) || (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)      {        (void) RelinquishUniqueFileResource(read_info->filename);//.........这里部分代码省略.........
开发者ID:CamiloBenavides,项目名称:SnoutPoint-Web,代码行数:101,


示例12: WriteEPTImage

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   W r i t e E P T I m a g e                                                 %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  WriteEPTImage() writes an image in the Encapsulated Postscript format%  with a TIFF preview.%%  The format of the WriteEPTImage method is:%%      MagickBooleanType WriteEPTImage(const ImageInfo *image_info,Image *image)%%  A description of each parameter follows.%%    o image_info: the image info.%%    o image:  The image.%*/static MagickBooleanType WriteEPTImage(const ImageInfo *image_info,Image *image){  char     filename[MaxTextExtent];  EPTInfo    ept_info;  Image    *write_image;  ImageInfo    *write_info;  MagickBooleanType    status;  /*    Write EPT image.  */  assert(image_info != (const ImageInfo *) NULL);  assert(image_info->signature == MagickSignature);  assert(image != (Image *) NULL);  assert(image->signature == MagickSignature);  if (image->debug != MagickFalse)    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);  status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);  if (status == MagickFalse)    return(status);  write_image=CloneImage(image,0,0,MagickTrue,&image->exception);  if (write_image == (Image *) NULL)    return(MagickFalse);  write_info=CloneImageInfo(image_info);  (void) CopyMagickString(write_info->magick,"EPS",MaxTextExtent);  if (LocaleCompare(image_info->magick,"EPT2") == 0)    (void) CopyMagickString(write_info->magick,"EPS2",MaxTextExtent);  if (LocaleCompare(image_info->magick,"EPT3") == 0)    (void) CopyMagickString(write_info->magick,"EPS3",MaxTextExtent);  (void) ResetMagickMemory(&ept_info,0,sizeof(ept_info));  ept_info.magick=0xc6d3d0c5ul;  ept_info.postscript=(unsigned char *) ImageToBlob(write_info,write_image,    &ept_info.postscript_length,&image->exception);  write_image=DestroyImage(write_image);  write_info=DestroyImageInfo(write_info);  if (ept_info.postscript == (void *) NULL)    return(MagickFalse);  write_image=CloneImage(image,0,0,MagickTrue,&image->exception);  if (write_image == (Image *) NULL)    return(MagickFalse);  write_info=CloneImageInfo(image_info);  (void) CopyMagickString(write_info->magick,"TIFF",MaxTextExtent);  (void) FormatMagickString(filename,MaxTextExtent,"tiff:%.1024s",    write_info->filename);   (void) CopyMagickString(write_info->filename,filename,MaxTextExtent);  (void) TransformImage(&write_image,(char *) NULL,"512x512>");  if ((write_image->storage_class == DirectClass) ||      (write_image->colors > 256))    {      QuantizeInfo        quantize_info;      /*        EPT preview requires that the image is colormapped.      */      GetQuantizeInfo(&quantize_info);      quantize_info.dither=IsPaletteImage(write_image,&image->exception) ==        MagickFalse ? MagickTrue : MagickFalse;      (void) QuantizeImage(&quantize_info,write_image);    }  write_info->compression=NoCompression;  ept_info.tiff=(unsigned char *) ImageToBlob(write_info,write_image,    &ept_info.tiff_length,&image->exception);  write_image=DestroyImage(write_image);  write_info=DestroyImageInfo(write_info);  if (ept_info.tiff == (void *) NULL)//.........这里部分代码省略.........
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,


示例13: ReadEPTImage

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   R e a d E P T I m a g e                                                   %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  ReadEPTImage() reads a binary Postscript 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 ReadEPTImage method is:%%      Image *ReadEPTImage(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 *ReadEPTImage(const ImageInfo *image_info,ExceptionInfo *exception){  EPTInfo    ept_info;  Image    *image;  ImageInfo    *read_info;  ssize_t    count;  MagickBooleanType    status;  MagickOffsetType    offset;  /*    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);    }  ept_info.magick=ReadBlobLSBLong(image);  if (ept_info.magick != 0xc6d3d0c5ul)    ThrowReaderException(CorruptImageError,"ImproperImageHeader");  ept_info.postscript_offset=(MagickOffsetType) ReadBlobLSBLong(image);  ept_info.postscript_length=ReadBlobLSBLong(image);  (void) ReadBlobLSBLong(image);  (void) ReadBlobLSBLong(image);  ept_info.tiff_offset=(MagickOffsetType) ReadBlobLSBLong(image);  ept_info.tiff_length=ReadBlobLSBLong(image);  (void) ReadBlobLSBShort(image);  ept_info.postscript=(unsigned char *) AcquireQuantumMemory(    ept_info.postscript_length,sizeof(*ept_info.postscript));  if (ept_info.postscript == (unsigned char *) NULL)    ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");  ept_info.tiff=(unsigned char *) AcquireQuantumMemory(ept_info.tiff_length,    sizeof(*ept_info.tiff));  if ((ept_info.tiff_length != 0) && (ept_info.tiff == (unsigned char *) NULL))    ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");  offset=SeekBlob(image,ept_info.tiff_offset,SEEK_SET);  if (offset < 0)    ThrowReaderException(CorruptImageError,"ImproperImageHeader");  count=ReadBlob(image,ept_info.tiff_length,ept_info.tiff);  if (count != (ssize_t) (ept_info.tiff_length))    ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");  offset=SeekBlob(image,ept_info.postscript_offset,SEEK_SET);  if (offset < 0)    ThrowReaderException(CorruptImageError,"ImproperImageHeader");  count=ReadBlob(image,ept_info.postscript_length,ept_info.postscript);  if (count != (ssize_t) (ept_info.postscript_length))    ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");  (void) CloseBlob(image);  image=DestroyImage(image);  read_info=CloneImageInfo(image_info);  (void) CopyMagickString(read_info->magick,"EPS",MaxTextExtent);  image=BlobToImage(read_info,ept_info.postscript,ept_info.postscript_length,    exception);//.........这里部分代码省略.........
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,


示例14: IdentifyImageCommand

//.........这里部分代码省略.........    option=argv[i];    if (LocaleCompare(option,"(") == 0)      {        FireImageStack(MagickFalse,MagickTrue,pend);        if (k == MaxImageStackDepth)          ThrowIdentifyException(OptionError,"ParenthesisNestedTooDeeply",            option);        PushImageStack();        continue;      }    if (LocaleCompare(option,")") == 0)      {        FireImageStack(MagickFalse,MagickTrue,MagickTrue);        if (k == 0)          ThrowIdentifyException(OptionError,"UnableToParseExpression",option);        PopImageStack();        continue;      }    if (IsCommandOption(option) == MagickFalse)      {        char          *filename;        Image          *images;        ImageInfo          *identify_info;        /*          Read input image.        */        FireImageStack(MagickFalse,MagickFalse,pend);        identify_info=CloneImageInfo(image_info);        identify_info->verbose=MagickFalse;        filename=argv[i];        if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))          filename=argv[++i];        (void) CopyMagickString(identify_info->filename,filename,MaxTextExtent);        if (identify_info->ping != MagickFalse)          images=PingImages(identify_info,exception);        else          images=ReadImages(identify_info,exception);        identify_info=DestroyImageInfo(identify_info);        status&=(images != (Image *) NULL) &&          (exception->severity < ErrorException);        if (images == (Image *) NULL)          continue;        AppendImageStack(images);        FinalizeImageSettings(image_info,image,MagickFalse);        for ( ; image != (Image *) NULL; image=GetNextImageInList(image))        {          if (image->scene == 0)            image->scene=count++;          if (format == (char *) NULL)            {              (void) IdentifyImage(image,stdout,image_info->verbose);              continue;            }          if (metadata != (char **) NULL)            {              char                *text;              text=InterpretImageProperties(image_info,image,format);              if (text == (char *) NULL)
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:67,


示例15: GetBit

static Image *ReadSTEGANOImage(const ImageInfo *image_info,  ExceptionInfo *exception){#define GetBit(alpha,i) MagickMin((((size_t) (alpha) >> (size_t) /  (i)) & 0x01),16)#define SetBit(alpha,i,set) (alpha)=(IndexPacket) ((set) != 0 ? /  (size_t) (alpha) | (one << (size_t) (i)) : (size_t) /  (alpha) & ~(one << (size_t) (i)))  Image    *image,    *watermark;  ImageInfo    *read_info;  int    c;  MagickBooleanType    status;  PixelPacket    pixel;  register IndexPacket    *indexes;  register PixelPacket    *q;  register ssize_t    x;  size_t    depth,    one;  ssize_t    i,    j,    k,    y;  /*    Initialize Image structure.  */  assert(image_info != (const ImageInfo *) NULL);  assert(image_info->signature == MagickSignature);  if (image_info->debug != MagickFalse)    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",      image_info->filename);  assert(exception != (ExceptionInfo *) NULL);  assert(exception->signature == MagickSignature);  one=1;  image=AcquireImage(image_info);  if ((image->columns == 0) || (image->rows == 0))    ThrowReaderException(OptionError,"MustSpecifyImageSize");  read_info=CloneImageInfo(image_info);  SetImageInfoBlob(read_info,(void *) NULL,0);  *read_info->magick='/0';  watermark=ReadImage(read_info,exception);  read_info=DestroyImageInfo(read_info);  if (watermark == (Image *) NULL)    return((Image *) NULL);  watermark->depth=MAGICKCORE_QUANTUM_DEPTH;  if (AcquireImageColormap(image,MaxColormapSize) == MagickFalse)    ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");  if (image_info->ping != MagickFalse)    {      (void) CloseBlob(image);      return(GetFirstImageInList(image));    }  /*    Get hidden watermark from low-order bits of image.  */  c=0;  i=0;  j=0;  i=(ssize_t) (watermark->depth-1);  depth=watermark->depth;  for (k=image->offset; (i >= 0) && (j < (ssize_t) depth); i--)  {    for (y=0; (y < (ssize_t) image->rows) && (j < (ssize_t) depth); y++)    {      x=0;      for ( ; (x < (ssize_t) image->columns) && (j < (ssize_t) depth); x++)      {        if ((k/(ssize_t) watermark->columns) >= (ssize_t) watermark->rows)          break;        (void) GetOneVirtualPixel(watermark,k % (ssize_t) watermark->columns,          k/(ssize_t) watermark->columns,&pixel,exception);        q=GetAuthenticPixels(image,x,y,1,1,exception);        if (q == (PixelPacket *) NULL)          break;        indexes=GetAuthenticIndexQueue(image);        switch (c)        {          case 0:          {//.........这里部分代码省略.........
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,


示例16: ReadPCLImage

//.........这里部分代码省略.........    if (count != 4)      continue;    /*      Set PCL render geometry.    */    width=(size_t) floor(bounds.x2-bounds.x1+0.5);    height=(size_t) floor(bounds.y2-bounds.y1+0.5);    if (width > page.width)      page.width=width;    if (height > page.height)      page.height=height;  }  (void) CloseBlob(image);  /*    Render PCL with the GhostPCL delegate.  */  if ((page.width == 0) || (page.height == 0))    (void) ParseAbsoluteGeometry(PSPageGeometry,&page);  if (image_info->page != (char *) NULL)    (void) ParseAbsoluteGeometry(image_info->page,&page);  (void) FormatLocaleString(geometry,MaxTextExtent,"%.20gx%.20g",(double)    page.width,(double) page.height);  if (image_info->monochrome != MagickFalse)    delegate_info=GetDelegateInfo("pcl:mono",(char *) NULL,exception);  else     if (cmyk != MagickFalse)       delegate_info=GetDelegateInfo("pcl:cmyk",(char *) NULL,exception);     else       delegate_info=GetDelegateInfo("pcl:color",(char *) NULL,exception);  if (delegate_info == (const DelegateInfo *) NULL)    return((Image *) NULL);  *options='/0';  if ((page.width == 0) || (page.height == 0))    (void) ParseAbsoluteGeometry(PSPageGeometry,&page);  if (image_info->page != (char *) NULL)    (void) ParseAbsoluteGeometry(image_info->page,&page);  (void) FormatLocaleString(density,MaxTextExtent,"%gx%g",    image->x_resolution,image->y_resolution);  page.width=(size_t) floor((double) page.width*image->x_resolution/delta.x+    0.5);  page.height=(size_t) floor((double) page.height*image->y_resolution/delta.y+    0.5);  (void) FormatLocaleString(options,MaxTextExtent,"-g%.20gx%.20g ",(double)     page.width,(double) page.height);  image=DestroyImage(image);  read_info=CloneImageInfo(image_info);  *read_info->magick='/0';  if (read_info->number_scenes != 0)    {      if (read_info->number_scenes != 1)        (void) FormatLocaleString(options,MaxTextExtent,"-dLastPage=%.20g",          (double) (read_info->scene+read_info->number_scenes));      else        (void) FormatLocaleString(options,MaxTextExtent,          "-dFirstPage=%.20g -dLastPage=%.20g",(double) read_info->scene+1,          (double) (read_info->scene+read_info->number_scenes));      read_info->number_scenes=0;      if (read_info->scenes != (char *) NULL)        *read_info->scenes='/0';    }  if (read_info->authenticate != (char *) NULL)    (void) FormatLocaleString(options+strlen(options),MaxTextExtent,      " -sPCLPassword=%s",read_info->authenticate);  (void) CopyMagickString(filename,read_info->filename,MaxTextExtent);  (void) AcquireUniqueFilename(read_info->filename);  (void) FormatLocaleString(command,MaxTextExtent,    GetDelegateCommands(delegate_info),    read_info->antialias != MagickFalse ? 4 : 1,    read_info->antialias != MagickFalse ? 4 : 1,density,options,    read_info->filename,input_filename);  status=SystemCommand(MagickFalse,read_info->verbose,command,exception) != 0 ?    MagickTrue : MagickFalse;  image=ReadImage(read_info,exception);  (void) RelinquishUniqueFileResource(read_info->filename);  (void) RelinquishUniqueFileResource(input_filename);  read_info=DestroyImageInfo(read_info);  if (image == (Image *) NULL)    ThrowReaderException(DelegateError,"PCLDelegateFailed");  if (LocaleCompare(image->magick,"BMP") == 0)    {      Image        *cmyk_image;      cmyk_image=ConsolidateCMYKImages(image,&image->exception);      if (cmyk_image != (Image *) NULL)        {          image=DestroyImageList(image);          image=cmyk_image;        }    }  do  {    (void) CopyMagickString(image->filename,filename,MaxTextExtent);    image->page=page;    next_image=SyncNextImageInList(image);    if (next_image != (Image *) NULL)      image=next_image;  } while (next_image != (Image *) NULL);  return(GetFirstImageInList(image));}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,


示例17: ReadICONImage

//.........这里部分代码省略.........  /*    Open image file.  */  assert(image_info != (const ImageInfo *) NULL);  assert(image_info->signature == MagickSignature);  (void) LogMagickEvent(CoderEvent,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);    }  icon_file.reserved=(short) ReadBlobLSBShort(image);  icon_file.resource_type=(short) ReadBlobLSBShort(image);  icon_file.count=(short) ReadBlobLSBShort(image);  if ((icon_file.reserved != 0) ||      ((icon_file.resource_type != 1) && (icon_file.resource_type != 2)) ||      (icon_file.count > MaxIcons))    ThrowReaderException(CorruptImageError,"ImproperImageHeader");  for (i=0; i < icon_file.count; i++)  {    icon_file.directory[i].width=(unsigned char) ReadBlobByte(image);    icon_file.directory[i].height=(unsigned char) ReadBlobByte(image);    icon_file.directory[i].colors=(unsigned char) ReadBlobByte(image);    icon_file.directory[i].reserved=(unsigned char) ReadBlobByte(image);    icon_file.directory[i].planes=(unsigned short) ReadBlobLSBShort(image);    icon_file.directory[i].bits_per_pixel=(unsigned short)      ReadBlobLSBShort(image);    icon_file.directory[i].size=ReadBlobLSBLong(image);    icon_file.directory[i].offset=ReadBlobLSBLong(image);  }  one=1;  for (i=0; i < icon_file.count; i++)  {    /*      Verify Icon identifier.    */    offset=(ssize_t) SeekBlob(image,(MagickOffsetType)      icon_file.directory[i].offset,SEEK_SET);    if (offset < 0)      ThrowReaderException(CorruptImageError,"ImproperImageHeader");    icon_info.size=ReadBlobLSBLong(image);    icon_info.width=(unsigned char) ((int) ReadBlobLSBLong(image));    icon_info.height=(unsigned char) ((int) ReadBlobLSBLong(image)/2);    icon_info.planes=ReadBlobLSBShort(image);    icon_info.bits_per_pixel=ReadBlobLSBShort(image);    if ((icon_info.planes == 18505) && (icon_info.bits_per_pixel == 21060))      {        Image          *icon_image;        ImageInfo          *read_info;        size_t          length;        unsigned char          *png;        /*          Icon image encoded as a compressed PNG image.        */        length=icon_file.directory[i].size;        png=(unsigned char *) AcquireQuantumMemory(length+16,sizeof(*png));        if (png == (unsigned char *) NULL)          ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");        (void) CopyMagickMemory(png,"/211PNG/r/n/032/n/000/000/000/015",12);        png[12]=(unsigned char) icon_info.planes;        png[13]=(unsigned char) (icon_info.planes >> 8);        png[14]=(unsigned char) icon_info.bits_per_pixel;        png[15]=(unsigned char) (icon_info.bits_per_pixel >> 8);        count=ReadBlob(image,length-16,png+16);        if (count != (ssize_t) (length-16))          {            png=(unsigned char *) RelinquishMagickMemory(png);            ThrowReaderException(CorruptImageError,              "InsufficientImageDataInFile");          }        read_info=CloneImageInfo(image_info);        (void) CopyMagickString(read_info->magick,"PNG",MaxTextExtent);        icon_image=BlobToImage(read_info,png,length+16,exception);        read_info=DestroyImageInfo(read_info);        png=(unsigned char *) RelinquishMagickMemory(png);        if (icon_image == (Image *) NULL)          {            image=DestroyImageList(image);            return((Image *) NULL);          }        DestroyBlob(icon_image);        icon_image->blob=ReferenceBlob(image->blob);        ReplaceImageInList(&image,icon_image);      }    else      {        if (icon_info.bits_per_pixel > 32)
开发者ID:tokenblakk,项目名称:python,代码行数:101,


示例18: ReadXTRNImage

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   R e a d X T R N I m a g e                                                 %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  ReadXTRNImage() reads a XTRN 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 ReadXTRNImage method is:%%      Image *ReadXTRNImage(const ImageInfo *image_info,%        ExceptionInfo *exception)%%  A description of each parameter follows:%%    o image_info: Specifies a pointer to an ImageInfo structure.%%    o exception: return any errors or warnings in this structure.%*/static Image *ReadXTRNImage(const ImageInfo *image_info,  ExceptionInfo *exception){  Image    *image;  ImageInfo    *clone_info;  void    *param1,    *param2,    *param3;  param1 = param2 = param3 = (void *) NULL;  image = (Image *) NULL;  clone_info=CloneImageInfo(image_info);  if (clone_info->filename == NULL)    {      clone_info=DestroyImageInfo(clone_info);      ThrowReaderException(FileOpenWarning,"No filename specified");    }  if (LocaleCompare(image_info->magick,"XTRNFILE") == 0)    {      image=ReadImage(clone_info,exception);      CatchException(exception);    }  else if (LocaleCompare(image_info->magick,"XTRNIMAGE") == 0)    {      Image        **image_ptr;#ifdef ALL_IMAGEINFO      ImageInfo        **image_info_ptr;#endif      (void) sscanf(clone_info->filename,"%lx,%lx",&param1,&param2);      image_ptr=(Image **) param2;      if (*image_ptr != (Image *)NULL)        image=CloneImage(*image_ptr,0,0,MagickFalse,&(*image_ptr)->exception);#ifdef ALL_IMAGEINFO      image_info_ptr=(ImageInfo **) param1;      if (*image_info_ptr != (ImageInfo *)NULL)        image_info=*image_info_ptr;#endif    }  else if (LocaleCompare(image_info->magick,"XTRNBLOB") == 0)    {      char        **blob_data;      size_t        *blob_length;      char        filename[MaxTextExtent];      (void) sscanf(clone_info->filename,"%lx,%lx,%s",&param1,&param2,&filename);      blob_data=(char **) param1;      blob_length=(size_t *) param2;      image=BlobToImage(clone_info,*blob_data,*blob_length,exception);      CatchException(exception);    }  else if (LocaleCompare(image_info->magick,"XTRNSTREAM") == 0)    {#ifdef IMPLEMENT_THIS      MagickBooleanType        status;#endif      char        filename[MaxTextExtent];//.........这里部分代码省略.........
开发者ID:ChaseReid,项目名称:ImageMagick,代码行数:101,


示例19: assert

//.........这里部分代码省略.........    {      char        absolute_geometry[MagickPathExtent];      frame_info.width=extract_info.width;      frame_info.height=extract_info.height;      (void) FormatLocaleString(absolute_geometry,MagickPathExtent,"%s!",        montage_info->frame);      flags=ParseMetaGeometry(absolute_geometry,&frame_info.outer_bevel,        &frame_info.inner_bevel,&frame_info.width,&frame_info.height);      if ((flags & HeightValue) == 0)        frame_info.height=frame_info.width;      if ((flags & XiValue) == 0)        frame_info.outer_bevel=(ssize_t) frame_info.width/2;      if ((flags & PsiValue) == 0)        frame_info.inner_bevel=frame_info.outer_bevel;      frame_info.x=(ssize_t) frame_info.width;      frame_info.y=(ssize_t) frame_info.height;      bevel_width=(size_t) MagickMax(frame_info.inner_bevel,        frame_info.outer_bevel);      border_width=(size_t) MagickMax((ssize_t) frame_info.width,        (ssize_t) frame_info.height);    }  for (i=0; i < (ssize_t) number_images; i++)  {    if (image_list[i]->columns > extract_info.width)      extract_info.width=image_list[i]->columns;    if (image_list[i]->rows > extract_info.height)      extract_info.height=image_list[i]->rows;  }  /*    Initialize draw attributes.  */  clone_info=CloneImageInfo(image_info);  clone_info->background_color=montage_info->background_color;  clone_info->border_color=montage_info->border_color;  draw_info=CloneDrawInfo(clone_info,(DrawInfo *) NULL);  if (montage_info->font != (char *) NULL)    (void) CloneString(&draw_info->font,montage_info->font);  if (montage_info->pointsize != 0.0)    draw_info->pointsize=montage_info->pointsize;  draw_info->gravity=CenterGravity;  draw_info->stroke=montage_info->stroke;  draw_info->fill=montage_info->fill;  draw_info->text=AcquireString("");  (void) GetTypeMetrics(image_list[0],draw_info,&metrics,exception);  texture=NewImageList();  if (montage_info->texture != (char *) NULL)    {      (void) CopyMagickString(clone_info->filename,montage_info->texture,        MagickPathExtent);      texture=ReadImage(clone_info,exception);    }  /*    Determine the number of lines in an next label.  */  title=InterpretImageProperties(clone_info,image_list[0],montage_info->title,    exception);  title_offset=0;  if (montage_info->title != (char *) NULL)    title_offset=(size_t) (2*(metrics.ascent-metrics.descent)*      MultilineCensus(title)+2*extract_info.y);  number_lines=0;  for (i=0; i < (ssize_t) number_images; i++)  {    value=GetImageProperty(image_list[i],"label",exception);
开发者ID:anorland,项目名称:ImageMagick,代码行数:67,


示例20: WriteXTRNImage

static MagickBooleanType WriteXTRNImage(const ImageInfo *image_info,Image *image,ExceptionInfo *exception){  Image *    p;  ImageInfo    *clone_info;  int    scene;  MagickBooleanType    status;  void    *param1,    *param2,    *param3;  param1 = param2 = param3 = (void *) NULL;  if (LocaleCompare(image_info->magick,"XTRNFILE") == 0)    {      clone_info=CloneImageInfo(image_info);      status=WriteImage(image_info,image,exception);      if (status == MagickFalse)        CatchImageException(image);      clone_info=DestroyImageInfo(clone_info);    }  else if (LocaleCompare(image_info->magick,"XTRNIMAGE") == 0)    {      Image        **image_ptr;      ImageInfo        **image_info_ptr;      clone_info=CloneImageInfo(image_info);      if (clone_info->filename[0])        {          (void) sscanf(clone_info->filename,"%lx,%lx",&param1,&param2);          image_info_ptr=(ImageInfo **) param1;          image_ptr=(Image **) param2;          if ((image_info_ptr != (ImageInfo **) NULL) &&              (image_ptr != (Image **) NULL))            {              *image_ptr=CloneImage(image,0,0,MagickFalse,exception);              *image_info_ptr=clone_info;            }        }    }  else if (LocaleCompare(image_info->magick,"XTRNBLOB") == 0)    {      char        **blob_data;      size_t        *blob_length;      char        filename[MaxTextExtent];      clone_info=CloneImageInfo(image_info);      if (clone_info->filename[0])        {          (void) sscanf(clone_info->filename,"%lx,%lx,%s",            &param1,&param2,&filename);          blob_data=(char **) param1;          blob_length=(size_t *) param2;          scene = 0;          (void) CopyMagickString(clone_info->filename,filename,MaxTextExtent);          for (p=image; p != (Image *) NULL; p=GetNextImageInList(p))          {            (void) CopyMagickString(p->filename,filename,MaxTextExtent);            p->scene=scene++;          }          SetImageInfo(clone_info,1,exception);          (void) CopyMagickString(image->magick,clone_info->magick,            MaxTextExtent);          if (*blob_length == 0)            *blob_length=8192;          *blob_data=(char *) ImageToBlob(clone_info,image,blob_length,            exception);          if (*blob_data == NULL)            status=MagickFalse;          if (status == MagickFalse)            CatchImageException(image);        }      clone_info=DestroyImageInfo(clone_info);    }  else if (LocaleCompare(image_info->magick,"XTRNSTREAM") == 0)    {      size_t        (*fifo)(const Image *,const void *,const size_t);      char        filename[MaxTextExtent];      clone_info=CloneImageInfo(image_info);//.........这里部分代码省略.........
开发者ID:ChaseReid,项目名称:ImageMagick,代码行数:101,


示例21: WritePICONImage

//.........这里部分代码省略.........    register Quantum    *q;    size_t    characters_per_pixel,    colors;    ssize_t    j,    k,    y;    /*      Open output image file.    */    assert(image_info != (const ImageInfo *) NULL);    assert(image_info->signature == MagickSignature);    assert(image != (Image *) NULL);    assert(image->signature == MagickSignature);    if (image->debug != MagickFalse)        (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);    assert(exception != (ExceptionInfo *) NULL);    assert(exception->signature == MagickSignature);    status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);    if (status == MagickFalse)        return(status);    if (IsRGBColorspace(image->colorspace) == MagickFalse)        (void) TransformImageColorspace(image,sRGBColorspace,exception);    SetGeometry(image,&geometry);    (void) ParseMetaGeometry(PiconGeometry,&geometry.x,&geometry.y,                             &geometry.width,&geometry.height);    picon=ResizeImage(image,geometry.width,geometry.height,TriangleFilter,                      exception);    blob_info=CloneImageInfo(image_info);    (void) AcquireUniqueFilename(blob_info->filename);    if ((image_info->type != TrueColorType) &&            (IsImageGray(image,exception) != MagickFalse))        affinity_image=BlobToImage(blob_info,Graymap,GraymapExtent,exception);    else        affinity_image=BlobToImage(blob_info,Colormap,ColormapExtent,exception);    (void) RelinquishUniqueFileResource(blob_info->filename);    blob_info=DestroyImageInfo(blob_info);    if ((picon == (Image *) NULL) || (affinity_image == (Image *) NULL))        return(MagickFalse);    quantize_info=AcquireQuantizeInfo(image_info);    status=RemapImage(quantize_info,picon,affinity_image,exception);    quantize_info=DestroyQuantizeInfo(quantize_info);    affinity_image=DestroyImage(affinity_image);    transparent=MagickFalse;    if (picon->storage_class == PseudoClass)    {        (void) CompressImageColormap(picon,exception);        if (picon->matte != MagickFalse)            transparent=MagickTrue;    }    else    {        /*          Convert DirectClass to PseudoClass picon.        */        if (picon->matte != MagickFalse)        {            /*              Map all the transparent pixels.            */            for (y=0; y < (ssize_t) picon->rows; y++)
开发者ID:aakritigupta,项目名称:ImageMagick,代码行数:67,


示例22: SetImageInfoBlob

static Image *ReadPlasmaImage(const ImageInfo *image_info,  ExceptionInfo *exception){#define PlasmaImageTag  "Plasma/Image"  Image    *image;  ImageInfo    *read_info;  long    y;  MagickBooleanType    status;  register long    x;  register PixelPacket    *q;  register unsigned long    i;  SegmentInfo    segment_info;  unsigned long    depth,    max_depth;  /*    Recursively apply plasma to the image.  */  read_info=CloneImageInfo(image_info);  SetImageInfoBlob(read_info,(void *) NULL,0);  (void) FormatMagickString(read_info->filename,MaxTextExtent,    "gradient:%s",image_info->filename);  image=ReadImage(read_info,exception);  read_info=DestroyImageInfo(read_info);  if (image == (Image *) NULL)    return((Image *) NULL);  image->storage_class=DirectClass;  for (y=0; y < (long) image->rows; y++)  {    q=GetImagePixels(image,0,y,image->columns,1);    if (q == (PixelPacket *) NULL)      break;    for (x=0; x < (long) image->columns; x++)    {      q->opacity=(Quantum) (QuantumRange/2);      q++;    }    if (SyncImagePixels(image) == MagickFalse)      break;  }  segment_info.x1=0;  segment_info.y1=0;  segment_info.x2=(double) image->columns-1;  segment_info.y2=(double) image->rows-1;  if (LocaleCompare(image_info->filename,"fractal") == 0)    {      /*        Seed pixels before recursion.      */      PlasmaPixel(image,segment_info.x1,segment_info.y1);      PlasmaPixel(image,segment_info.x1,(segment_info.y1+segment_info.y2)/2);      PlasmaPixel(image,segment_info.x1,segment_info.y2);      PlasmaPixel(image,(segment_info.x1+segment_info.x2)/2,segment_info.y1);      PlasmaPixel(image,(segment_info.x1+segment_info.x2)/2,        (segment_info.y1+segment_info.y2)/2);      PlasmaPixel(image,(segment_info.x1+segment_info.x2)/2,segment_info.y2);      PlasmaPixel(image,segment_info.x2,segment_info.y1);      PlasmaPixel(image,segment_info.x2,(segment_info.y1+segment_info.y2)/2);      PlasmaPixel(image,segment_info.x2,segment_info.y2);    }  i=(unsigned long) MagickMax(image->columns,image->rows)/2;  for (max_depth=0; i != 0; max_depth++)    i>>=1;  for (depth=1; ; depth++)  {    if (PlasmaImage(image,&segment_info,0,depth) != MagickFalse)      break;    if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&        (QuantumTick((MagickOffsetType) depth,max_depth) != MagickFalse))      {        status=image->progress_monitor(PlasmaImageTag,(MagickOffsetType) depth,          max_depth,image->client_data);        if (status == MagickFalse)          break;      }  }  (void) SetImageOpacity(image,OpaqueOpacity);  return(GetFirstImageInList(image));}
开发者ID:KiiCorp,项目名称:ImageMagick,代码行数:97,


示例23: SetImageInfoBlob

static Image *ReadURLImage(const ImageInfo *image_info,ExceptionInfo *exception){#define MaxBufferExtent  8192    char    filename[MaxTextExtent];    FILE    *file;    Image    *image;    ImageInfo    *read_info;    int    unique_file;    image=(Image *) NULL;    read_info=CloneImageInfo(image_info);    SetImageInfoBlob(read_info,(void *) NULL,0);    file=(FILE *) NULL;    unique_file=AcquireUniqueFileResource(read_info->filename);    if (unique_file != -1)        file=fdopen(unique_file,"wb");    if ((unique_file == -1) || (file == (FILE *) NULL))    {        read_info=DestroyImageInfo(read_info);        (void) CopyMagickString(image->filename,read_info->filename,                                MaxTextExtent);        ThrowFileException(exception,FileOpenError,"UnableToCreateTemporaryFile",                           image->filename);        image=DestroyImageList(image);        return((Image *) NULL);    }    (void) CopyMagickString(filename,image_info->magick,MaxTextExtent);    (void) ConcatenateMagickString(filename,":",MaxTextExtent);    LocaleLower(filename);    (void) ConcatenateMagickString(filename,image_info->filename,MaxTextExtent);    if (LocaleCompare(read_info->magick,"file") == 0)    {        (void) RelinquishUniqueFileResource(read_info->filename);        unique_file=(-1);        (void) CopyMagickString(read_info->filename,image_info->filename+2,                                MaxTextExtent);    }#if defined(MAGICKCORE_XML_DELEGATE) && defined(LIBXML_FTP_ENABLED)    if (LocaleCompare(read_info->magick,"ftp") == 0)    {        void        *context;        xmlNanoFTPInit();        context=xmlNanoFTPNewCtxt(filename);        if (context != (void *) NULL)        {            if (xmlNanoFTPConnect(context) >= 0)                (void) xmlNanoFTPGet(context,GetFTPData,(void *) file,                                     (char *) NULL);            (void) xmlNanoFTPClose(context);        }    }#endif#if defined(MAGICKCORE_XML_DELEGATE) && defined(LIBXML_HTTP_ENABLED)    if (LocaleCompare(read_info->magick,"http") == 0)    {        char        buffer[MaxBufferExtent],               *type;        int        bytes;        void        *context;        type=(char *) NULL;        context=xmlNanoHTTPMethod(filename,(const char *) NULL,                                  (const char *) NULL,&type,(const char *) NULL,0);        if (context != (void *) NULL)        {            ssize_t            count;            while ((bytes=xmlNanoHTTPRead(context,buffer,MaxBufferExtent)) > 0)                count=(ssize_t) fwrite(buffer,bytes,1,file);            xmlNanoHTTPClose(context);            xmlFree(type);            xmlNanoHTTPCleanup();        }    }#endif    (void) fclose(file);    *read_info->magick='/0';    image=ReadImage(read_info,exception);    if (unique_file != -1)        (void) RelinquishUniqueFileResource(read_info->filename);    read_info=DestroyImageInfo(read_info);    if (image == (Image *) NULL)//.........这里部分代码省略.........
开发者ID:leloulight,项目名称:cs225,代码行数:101,


示例24: WriteMATTEImage

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   W r i t e M A T T E I m a g e                                             %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Function WriteMATTEImage() writes an image of matte bytes to a file.  It%  consists of data from the matte component of the image [0..255].%%  The format of the WriteMATTEImage method is:%%      MagickBooleanType WriteMATTEImage(const ImageInfo *image_info,%        Image *image)%%  A description of each parameter follows.%%    o image_info: the image info.%%    o image:  The image.%*/static MagickBooleanType WriteMATTEImage(const ImageInfo *image_info,  Image *image){  ExceptionInfo    *exception;  Image    *matte_image;  ImageInfo    *write_info;  MagickBooleanType    status;  register const PixelPacket    *p;  register ssize_t    x;  register PixelPacket    *q;  ssize_t    y;  if (image->matte == MagickFalse)    ThrowWriterException(CoderError,"ImageDoesNotHaveAAlphaChannel");  matte_image=CloneImage(image,image->columns,image->rows,MagickTrue,    &image->exception);  if (matte_image == (Image *) NULL)    return(MagickFalse);  (void) SetImageType(matte_image,TrueColorMatteType);  matte_image->matte=MagickFalse;  /*    Convert image to matte pixels.  */  exception=(&image->exception);  for (y=0; y < (ssize_t) image->rows; y++)  {    p=GetVirtualPixels(image,0,y,image->columns,1,exception);    q=QueueAuthenticPixels(matte_image,0,y,matte_image->columns,1,exception);    if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL))      break;    for (x=0; x < (ssize_t) image->columns; x++)    {      SetPixelRed(q,GetPixelOpacity(p));      SetPixelGreen(q,GetPixelOpacity(p));      SetPixelBlue(q,GetPixelOpacity(p));      SetPixelOpacity(q,OpaqueOpacity);      p++;      q++;    }    if (SyncAuthenticPixels(matte_image,exception) == MagickFalse)      break;    status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,      image->rows);    if (status == MagickFalse)      break;  }  write_info=CloneImageInfo(image_info);  *write_info->magick='/0';  (void) FormatLocaleString(matte_image->filename,MaxTextExtent,    "MIFF:%s",image->filename);  status=WriteImage(write_info,matte_image);  write_info=DestroyImageInfo(write_info);  matte_image=DestroyImage(matte_image);  return(status);}
开发者ID:CamiloBenavides,项目名称:SnoutPoint-Web,代码行数:96,


示例25: ReadCALSImage

//.........这里部分代码省略.........    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);    }    /*      Read CALS header.    */    (void) ResetMagickMemory(header,0,sizeof(header));    density=0;    direction=0;    orientation=1;    pel_path=0;    type=1;    width=0;    height=0;    for (i=0; i < 16; i++)    {        if (ReadBlob(image,128,(unsigned char *) header) != 128)            break;        switch (*header)        {        case 'R':        case 'r':        {            if (LocaleNCompare(header,"rdensty:",8) == 0)            {                (void) sscanf(header+8,"%lu",&density);                break;            }            if (LocaleNCompare(header,"rpelcnt:",8) == 0)            {                (void) sscanf(header+8,"%lu,%lu",&width,&height);                break;            }            if (LocaleNCompare(header,"rorient:",8) == 0)            {                (void) sscanf(header+8,"%lu,%lu",&pel_path,&direction);                if (pel_path == 90)                    orientation=5;                else if (pel_path == 180)                    orientation=3;                else if (pel_path == 270)                    orientation=7;                if (direction == 90)                    orientation++;                break;            }            if (LocaleNCompare(header,"rtype:",6) == 0)            {                (void) sscanf(header+6,"%lu",&type);                break;            }            break;        }        }    }    /*      Read CALS pixels.    */    file=(FILE *) NULL;    unique_file=AcquireUniqueFileResource(filename);    if (unique_file != -1)        file=fdopen(unique_file,"wb");    if ((unique_file == -1) || (file == (FILE *) NULL))        ThrowImageException(FileOpenError,"UnableToCreateTemporaryFile");    while ((c=ReadBlobByte(image)) != EOF)        (void) fputc(c,file);    (void) fclose(file);    (void) CloseBlob(image);    image=DestroyImage(image);    read_info=CloneImageInfo(image_info);    SetImageInfoBlob(read_info,(void *) NULL,0);    (void) FormatLocaleString(read_info->filename,MagickPathExtent,"group4:%s",                              filename);    (void) FormatLocaleString(message,MagickPathExtent,"%lux%lu",width,height);    (void) CloneString(&read_info->size,message);    (void) FormatLocaleString(message,MagickPathExtent,"%lu",density);    (void) CloneString(&read_info->density,message);    read_info->orientation=(OrientationType) orientation;    image=ReadImage(read_info,exception);    if (image != (Image *) NULL)    {        (void) CopyMagickString(image->filename,image_info->filename,                                MagickPathExtent);        (void) CopyMagickString(image->magick_filename,image_info->filename,                                MagickPathExtent);        (void) CopyMagickString(image->magick,"CALS",MagickPathExtent);    }    read_info=DestroyImageInfo(read_info);    (void) RelinquishUniqueFileResource(filename);    return(image);}
开发者ID:anorland,项目名称:ImageMagick,代码行数:101,


示例26: ReadPESImage

//.........这里部分代码省略.........      {        /*          Normal stitch.        */        if ((y & 0x40) != 0)          y-=0x80;      }    else      {        /*          Jump stitch.        */        y=((y & 0x0f) << 8)+ReadBlobByte(image);        if ((y & 0x800) != 0)          y-=0x1000;      }    /*      Note stitch (x,y).    */    x+=delta_x;    y+=delta_y;    delta_x=x;    delta_y=y;    stitches[i].x=(double) x;    stitches[i].y=(double) y;    if ((double) x < bounds.x1)      bounds.x1=(double) x;    if ((double) x > bounds.x2)      bounds.x2=(double) x;    if ((double) y < bounds.y1)      bounds.y1=(double) y;    if ((double) y > bounds.y2)      bounds.y2=(double) y;    i++;    if (i >= (ssize_t) number_stitches)      {        /*          Make room for more stitches.        */        number_stitches<<=1;        stitches=(PointInfo *)  ResizeQuantumMemory(stitches,(size_t)          number_stitches,sizeof(*stitches));        if (stitches == (PointInfo *) NULL)          ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");     }  }  j++;  blocks[j].offset=(ssize_t) i;  number_blocks=(size_t) j;  /*    Write stitches as SVG file.  */  file=(FILE *) NULL;  unique_file=AcquireUniqueFileResource(filename);  if (unique_file != -1)    file=fdopen(unique_file,"wb");  if ((unique_file == -1) || (file == (FILE *) NULL))    ThrowImageException(FileOpenError,"UnableToCreateTemporaryFile");  (void) FormatLocaleFile(file,"<?xml version=/"1.0/"?>/n");  (void) FormatLocaleFile(file,"<svg xmlns=/"http://www.w3.org/2000/svg/" "    "xlink=/"http://www.w3.org/1999/xlink/" "    "ev=/"http://www.w3.org/2001/xml-events/" version=/"1.1/" "    "baseProfile=/"full/" width=/"%g/" height=/"%g/">/n",bounds.x2-bounds.x1,    bounds.y2-bounds.y1);  for (i=0; i < (ssize_t) number_blocks; i++)  {    offset=blocks[i].offset;    (void) FormatLocaleFile(file,"  <path stroke=/"#%02x%02x%02x/" "      "fill=/"none/" d=/"M %g %g",blocks[i].color->red,blocks[i].color->green,      blocks[i].color->blue,stitches[offset].x-bounds.x1,      stitches[offset].y-bounds.y1);    for (j=1; j < (ssize_t) (blocks[i+1].offset-offset); j++)      (void) FormatLocaleFile(file," L %g %g",stitches[offset+j].x-bounds.x1,        stitches[offset+j].y-bounds.y1);    (void) FormatLocaleFile(file,"/"/>/n");  }  (void) FormatLocaleFile(file,"</svg>/n");  (void) fclose(file);  (void) CloseBlob(image);  image=DestroyImage(image);  /*    Read SVG file.  */  read_info=CloneImageInfo(image_info);  SetImageInfoBlob(read_info,(void *) NULL,0);  (void) FormatLocaleString(read_info->filename,MaxTextExtent,"svg:%s",    filename);  image=ReadImage(read_info,exception);  if (image != (Image *) NULL)    {      (void) CopyMagickString(image->filename,image_info->filename,        MaxTextExtent);      (void) CopyMagickString(image->magick_filename,image_info->filename,        MaxTextExtent);      (void) CopyMagickString(image->magick,"PES",MaxTextExtent);    }  read_info=DestroyImageInfo(read_info);  (void) RelinquishUniqueFileResource(filename);  return(GetFirstImageInList(image));}
开发者ID:INT2208-ST,项目名称:MyFriend,代码行数:101,


示例27: ReadDNGImage

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   R e a d D N G I m a g e                                                   %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  ReadDNGImage() reads an binary file in the Digital Negative format 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 ReadDNGImage method is:%%      Image *ReadDNGImage(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 *ReadDNGImage(const ImageInfo *image_info,ExceptionInfo *exception){  ExceptionInfo    *sans_exception;  Image    *image;  ImageInfo    *read_info;  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);  status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);  if (status == MagickFalse)    {      image=DestroyImageList(image);      return((Image *) NULL);    }  (void) CloseBlob(image);  (void) DestroyImageList(image);  /*    Convert DNG to PPM with delegate.  */  image=AcquireImage(image_info);  read_info=CloneImageInfo(image_info);  (void) InvokeDelegate(read_info,image,"dng:decode",(char *) NULL,exception);  image=DestroyImage(image);  (void) FormatMagickString(read_info->filename,MaxTextExtent,"%s.png",    read_info->unique);  sans_exception=AcquireExceptionInfo();  image=ReadImage(read_info,sans_exception);  sans_exception=DestroyExceptionInfo(sans_exception);  if (image == (Image *) NULL)    {      (void) FormatMagickString(read_info->filename,MaxTextExtent,"%s.ppm",        read_info->unique);      image=ReadImage(read_info,exception);    }  (void) RelinquishUniqueFileResource(read_info->filename);  if (image != (Image *) NULL)    {      char        filename[MaxTextExtent],        *xml;      ExceptionInfo        *sans;      (void) CopyMagickString(image->magick,read_info->magick,MaxTextExtent);      (void) FormatMagickString(filename,MaxTextExtent,"%s.ufraw",        read_info->unique);      sans=AcquireExceptionInfo();      xml=FileToString(filename,MaxTextExtent,sans);      (void) RelinquishUniqueFileResource(filename);      if (xml != (char *) NULL)        {          XMLTreeInfo           *ufraw;          /*//.........这里部分代码省略.........
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,


示例28: assert

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   R e a d P W P I m a g e                                                   %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Method ReadPWPImage reads a Seattle Film Works multi-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 ReadPWPImage method is:%%      Image *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception)%%  A description of each parameter follows:%%    o image:  Method ReadPWPImage 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 *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception){  FILE    *file;  Image    *image,    *next_image,    *pwp_image;  ImageInfo    *clone_info;  int    c;  MonitorHandler    handler;  register Image    *p;  register unsigned long    i;  size_t    count;  unsigned char    magick[MaxTextExtent];  unsigned int    status;  unsigned long    filesize;  /*    Open image file.  */  assert(image_info != (const ImageInfo *) NULL);  assert(image_info->signature == MagickSignature);  assert(exception != (ExceptionInfo *) NULL);  assert(exception->signature == MagickSignature);  image=(Image *) NULL;  pwp_image=AllocateImage(image_info);  status=OpenBlob(image_info,pwp_image,ReadBinaryBlobMode,exception);  if (status == False)    ThrowReaderException(FileOpenError,UnableToOpenFile,pwp_image);  count=ReadBlob(pwp_image,5,(char *) magick);  if ((count == 0) || (LocaleNCompare((char *) magick,"SFW95",5) != 0))    ThrowReaderException(CorruptImageError,ImproperImageHeader,pwp_image);  clone_info=CloneImageInfo(image_info);  clone_info->blob=(void *) NULL;  clone_info->length=0;  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)      {//.........这里部分代码省略.........
开发者ID:hank2015,项目名称:testCMS,代码行数:101,


示例29: ReadImage

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   R e a d I m a g e                                                         %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  ReadImage() reads an image or image sequence from a file or file handle.%  The method returns a NULL if there is a memory shortage or if the image%  cannot be read.  On failure, a NULL image is returned and exception%  describes the reason for the failure.%%  The format of the ReadImage method is:%%      Image *ReadImage(const ImageInfo *image_info,ExceptionInfo *exception)%%  A description of each parameter follows:%%    o image_info: Read the image defined by the file or filename members of%      this structure.%%    o exception: return any errors or warnings in this structure.%*/MagickExport Image *ReadImage(const ImageInfo *image_info,  ExceptionInfo *exception){  char    filename[MaxTextExtent],    magick[MaxTextExtent],    magick_filename[MaxTextExtent];  const char    *value;  const DelegateInfo    *delegate_info;  const MagickInfo    *magick_info;  ExceptionInfo    *sans_exception;  GeometryInfo    geometry_info;  Image    *image,    *next;  ImageInfo    *read_info;  MagickStatusType    flags,    thread_support;  PolicyDomain    domain;  PolicyRights    rights;  /*    Determine image type from filename prefix or suffix (e.g. image.jpg).  */  assert(image_info != (ImageInfo *) NULL);  assert(image_info->signature == MagickSignature);  assert(image_info->filename != (char *) NULL);  if (image_info->debug != MagickFalse)    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",      image_info->filename);  assert(exception != (ExceptionInfo *) NULL);  read_info=CloneImageInfo(image_info);  (void) CopyMagickString(magick_filename,read_info->filename,MaxTextExtent);  (void) SetImageInfo(read_info,MagickFalse,exception);  (void) CopyMagickString(filename,read_info->filename,MaxTextExtent);  (void) CopyMagickString(magick,read_info->magick,MaxTextExtent);  domain=CoderPolicyDomain;  rights=ReadPolicyRights;  if (IsRightsAuthorized(domain,rights,read_info->magick) == MagickFalse)    {      errno=EPERM;      (void) ThrowMagickException(exception,GetMagickModule(),PolicyError,        "NotAuthorized","`%s'",read_info->filename);      return((Image *) NULL);    }  /*    Call appropriate image reader based on image type.  */  sans_exception=AcquireExceptionInfo();  magick_info=GetMagickInfo(read_info->magick,sans_exception);  sans_exception=DestroyExceptionInfo(sans_exception);  if (magick_info != (const MagickInfo *) NULL)    {//.........这里部分代码省略.........
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,


示例30: SetImageRegistry

MagickExport MagickBooleanType SetImageRegistry(const RegistryType type,  const char *key,const void *value,ExceptionInfo *exception){  MagickBooleanType    status;  RegistryInfo    *registry_info;  void    *clone_value;  if (IsEventLogging() != MagickFalse)    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",key);  if (value == (const void *) NULL)    return(MagickFalse);  clone_value=(void *) NULL;  switch (type)  {    case StringRegistryType:    default:    {      const char        *string;      string=(const char *) value;      clone_value=(void *) ConstantString(string);      break;    }    case ImageRegistryType:    {      const Image        *image;      image=(const Image *) value;      if (image->signature != MagickSignature)        {          (void) ThrowMagickException(exception,GetMagickModule(),RegistryError,            "UnableToSetRegistry","%s",key);          return(MagickFalse);        }      clone_value=(void *) CloneImageList(image,exception);      break;    }    case ImageInfoRegistryType:    {      const ImageInfo        *image_info;      image_info=(const ImageInfo *) value;      if (image_info->signature != MagickSignature)        {          (void) ThrowMagickException(exception,GetMagickModule(),RegistryError,            "UnableToSetRegistry","%s",key);          return(MagickFalse);        }      clone_value=(void *) CloneImageInfo(image_info);      break;    }  }  if (clone_value == (void *) NULL)    return(MagickFalse);  registry_info=(RegistryInfo *) AcquireMagickMemory(sizeof(*registry_info));  if (registry_info == (RegistryInfo *) NULL)    ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");  (void) ResetMagickMemory(registry_info,0,sizeof(*registry_info));  registry_info->type=type;  registry_info->value=clone_value;  registry_info->signature=MagickSignature;  if (registry == (SplayTreeInfo *) NULL)    {      if (registry_semaphore == (SemaphoreInfo *) NULL)        ActivateSemaphoreInfo(&registry_semaphore);      LockSemaphoreInfo(registry_semaphore);      if (registry == (SplayTreeInfo *) NULL)        registry=NewSplayTree(CompareSplayTreeString,RelinquishMagickMemory,          DestroyRegistryNode);      UnlockSemaphoreInfo(registry_semaphore);    }  status=AddValueToSplayTree(registry,ConstantString(key),registry_info);  return(status);}
开发者ID:Babelz,项目名称:SaNi,代码行数:82,



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


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