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

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

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

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

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

示例1: CycleColormap

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%     C y c l e C o l o r m a p I m a g e                                     %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  CycleColormap() displaces an image's colormap by a given number of%  positions.  If you cycle the colormap a number of times you can produce%  a psychodelic effect.%%  WARNING: this assumes an images colormap is in a well know and defined%  order. Currently Imagemagick has no way of setting that order.%%  The format of the CycleColormapImage method is:%%      MagickBooleanType CycleColormapImage(Image *image,const ssize_t displace,%        ExceptionInfo *exception)%%  A description of each parameter follows:%%    o image: the image.%%    o displace:  displace the colormap this amount.%%    o exception: return any errors or warnings in this structure.%*/MagickExport MagickBooleanType CycleColormapImage(Image *image,  const ssize_t displace,ExceptionInfo *exception){  CacheView    *image_view;  MagickBooleanType    status;  ssize_t    y;  assert(image != (Image *) NULL);  assert(image->signature == MagickCoreSignature);  if (image->debug != MagickFalse)    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);  if (image->storage_class == DirectClass)    (void) SetImageType(image,PaletteType,exception);  status=MagickTrue;  image_view=AcquireAuthenticCacheView(image,exception);#if defined(MAGICKCORE_OPENMP_SUPPORT)  #pragma omp parallel for schedule(static,4) /    magick_threads(image,image,1,1)#endif  for (y=0; y < (ssize_t) image->rows; y++)  {    register ssize_t      x;    register Quantum      *restrict q;    ssize_t      index;    if (status == MagickFalse)      continue;    q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);    if (q == (Quantum *) NULL)      {        status=MagickFalse;        continue;      }    for (x=0; x < (ssize_t) image->columns; x++)    {      index=(ssize_t) (GetPixelIndex(image,q)+displace) % image->colors;      if (index < 0)        index+=(ssize_t) image->colors;      SetPixelIndex(image,(Quantum) index,q);      SetPixelViaPixelInfo(image,image->colormap+(ssize_t) index,q);      q+=GetPixelChannels(image);    }    if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)      status=MagickFalse;  }  image_view=DestroyCacheView(image_view);  return(status);}
开发者ID:jeffasd,项目名称:ImageMagick,代码行数:90,


示例2: AcquireAuthenticCacheView

MAGICK_NET_EXPORT CacheView *PixelCollection_Create(const Image *image, ExceptionInfo **exception){  CacheView    *result;  MAGICK_NET_GET_EXCEPTION;  result = AcquireAuthenticCacheView(image, exceptionInfo);  MAGICK_NET_SET_EXCEPTION;  return result;}
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:10,


示例3: SeparateImage

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%     S e p a r a t e I m a g e                                               %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  SeparateImage() separates a channel from the image and returns it as a%  grayscale image.%%  The format of the SeparateImage method is:%%      Image *SeparateImage(const Image *image,const ChannelType channel,%        ExceptionInfo *exception)%%  A description of each parameter follows:%%    o image: the image.%%    o channel: the image channel.%%    o exception: return any errors or warnings in this structure.%*/MagickExport Image *SeparateImage(const Image *image,  const ChannelType channel_type,ExceptionInfo *exception){#define GetChannelBit(mask,bit)  (((size_t) (mask) >> (size_t) (bit)) & 0x01)#define SeparateImageTag  "Separate/Image"  CacheView    *image_view,    *separate_view;  Image    *separate_image;  MagickBooleanType    status;  MagickOffsetType    progress;  ssize_t    y;  /*    Initialize separate image attributes.  */  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);  separate_image=CloneImage(image,image->columns,image->rows,MagickTrue,    exception);  if (separate_image == (Image *) NULL)    return((Image *) NULL);  if (SetImageStorageClass(separate_image,DirectClass,exception) == MagickFalse)    {      separate_image=DestroyImage(separate_image);      return((Image *) NULL);    }  (void) SetImageColorspace(separate_image,GRAYColorspace,exception);  separate_image->alpha_trait=UndefinedPixelTrait;  /*    Separate image.  */  status=MagickTrue;  progress=0;  image_view=AcquireVirtualCacheView(image,exception);  separate_view=AcquireAuthenticCacheView(separate_image,exception);#if defined(MAGICKCORE_OPENMP_SUPPORT)  #pragma omp parallel for schedule(static,4) shared(progress,status) /    magick_threads(image,image,image->rows,1)#endif  for (y=0; y < (ssize_t) image->rows; y++)  {    register const Quantum      *restrict p;    register Quantum      *restrict q;    register ssize_t      x;    if (status == MagickFalse)      continue;    p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception);    q=QueueCacheViewAuthenticPixels(separate_view,0,y,separate_image->columns,1,      exception);    if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))      {        status=MagickFalse;//.........这里部分代码省略.........
开发者ID:saitoha,项目名称:ImageMagick-V7-SIXEL,代码行数:101,


示例4: ChannelImage

static MagickBooleanType ChannelImage(Image *destination_image,  const PixelChannel destination_channel,const ChannelFx channel_op,  const Image *source_image,const PixelChannel source_channel,  const Quantum pixel,ExceptionInfo *exception){  CacheView    *source_view,    *destination_view;  MagickBooleanType    status;  size_t    height,    width;  ssize_t    y;  status=MagickTrue;  source_view=AcquireVirtualCacheView(source_image,exception);  destination_view=AcquireAuthenticCacheView(destination_image,exception);  height=MagickMin(source_image->rows,destination_image->rows);  width=MagickMin(source_image->columns,destination_image->columns);#if defined(MAGICKCORE_OPENMP_SUPPORT)  #pragma omp parallel for schedule(static,4) shared(status) /    magick_threads(source_image,source_image,height,1)#endif  for (y=0; y < (ssize_t) height; y++)  {    PixelTrait      destination_traits,      source_traits;    register const Quantum      *restrict p;    register Quantum      *restrict q;    register ssize_t      x;    if (status == MagickFalse)      continue;    p=GetCacheViewVirtualPixels(source_view,0,y,source_image->columns,1,      exception);    q=GetCacheViewAuthenticPixels(destination_view,0,y,      destination_image->columns,1,exception);    if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))      {        status=MagickFalse;        continue;      }    destination_traits=GetPixelChannelTraits(destination_image,      destination_channel);    source_traits=GetPixelChannelTraits(source_image,source_channel);    if ((destination_traits == UndefinedPixelTrait) ||        (source_traits == UndefinedPixelTrait))      continue;    for (x=0; x < (ssize_t) width; x++)    {      if (channel_op == AssignChannelOp)        SetPixelChannel(destination_image,destination_channel,pixel,q);      else        SetPixelChannel(destination_image,destination_channel,          GetPixelChannel(source_image,source_channel,p),q);      p+=GetPixelChannels(source_image);      q+=GetPixelChannels(destination_image);    }    if (SyncCacheViewAuthenticPixels(destination_view,exception) == MagickFalse)      status=MagickFalse;  }  destination_view=DestroyCacheView(destination_view);  source_view=DestroyCacheView(source_view);  return(status);}
开发者ID:saitoha,项目名称:ImageMagick-V7-SIXEL,代码行数:77,


示例5: CombineImages

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%     C o m b i n e I m a g e s                                               %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  CombineImages() combines one or more images into a single image.  The%  grayscale value of the pixels of each image in the sequence is assigned in%  order to the specified channels of the combined image.   The typical%  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.%%  The format of the CombineImages method is:%%      Image *CombineImages(const Image *images,const ColorspaceType colorspace,%        ExceptionInfo *exception)%%  A description of each parameter follows:%%    o images: the image sequence.%%    o colorspace: the image colorspace.%%    o exception: return any errors or warnings in this structure.%*/MagickExport Image *CombineImages(const Image *image,  const ColorspaceType colorspace,ExceptionInfo *exception){#define CombineImageTag  "Combine/Image"  CacheView    *combine_view;  Image    *combine_image;  MagickBooleanType    status;  MagickOffsetType    progress;  ssize_t    y;  /*    Ensure the image are the same size.  */  assert(image != (const 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);  combine_image=CloneImage(image,0,0,MagickTrue,exception);  if (combine_image == (Image *) NULL)    return((Image *) NULL);  if (SetImageStorageClass(combine_image,DirectClass,exception) == MagickFalse)    {      combine_image=DestroyImage(combine_image);      return((Image *) NULL);    }  (void) SetImageColorspace(combine_image,colorspace,exception);  if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)    combine_image->alpha_trait=BlendPixelTrait;  /*    Combine images.  */  status=MagickTrue;  progress=0;  combine_view=AcquireAuthenticCacheView(combine_image,exception);  for (y=0; y < (ssize_t) combine_image->rows; y++)  {    CacheView      *image_view;    const Image      *next;    Quantum      *pixels;    register const Quantum      *restrict p;    register Quantum      *restrict q;    register ssize_t      i;    if (status == MagickFalse)      continue;    pixels=GetCacheViewAuthenticPixels(combine_view,0,y,combine_image->columns,      1,exception);//.........这里部分代码省略.........
开发者ID:saitoha,项目名称:ImageMagick-V7-SIXEL,代码行数:101,


示例6: MergeConnectedComponents

static MagickBooleanType MergeConnectedComponents(Image *image,  const size_t number_objects,const double area_threshold,  ExceptionInfo *exception){  CacheView    *image_view;  CCObject    *object;  MagickBooleanType    status;  register ssize_t    i;  ssize_t    y;  /*    Collect statistics on unique objects.  */  object=(CCObject *) AcquireQuantumMemory(number_objects,sizeof(*object));  if (object == (CCObject *) NULL)    {      (void) ThrowMagickException(exception,GetMagickModule(),        ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename);      return(MagickFalse);    }  (void) ResetMagickMemory(object,0,number_objects*sizeof(*object));  for (i=0; i < (ssize_t) number_objects; i++)  {    object[i].id=i;    object[i].bounding_box.x=(ssize_t) image->columns;    object[i].bounding_box.y=(ssize_t) image->rows;  }  status=MagickTrue;  image_view=AcquireVirtualCacheView(image,exception);  for (y=0; y < (ssize_t) image->rows; y++)  {    register const PixelPacket      *restrict p;    register ssize_t      x;    if (status == MagickFalse)      continue;    p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception);    if (p == (const PixelPacket *) NULL)      {        status=MagickFalse;        continue;      }    for (x=0; x < (ssize_t) image->columns; x++)    {      i=(ssize_t) p->red;      if (x < object[i].bounding_box.x)        object[i].bounding_box.x=x;      if (x > (ssize_t) object[i].bounding_box.width)        object[i].bounding_box.width=(size_t) x;      if (y < object[i].bounding_box.y)        object[i].bounding_box.y=y;      if (y > (ssize_t) object[i].bounding_box.height)        object[i].bounding_box.height=(size_t) y;      object[i].area++;      p++;    }  }  image_view=DestroyCacheView(image_view);  for (i=0; i < (ssize_t) number_objects; i++)  {    object[i].bounding_box.width-=(object[i].bounding_box.x-1);    object[i].bounding_box.height-=(object[i].bounding_box.y-1);  }  /*    Merge objects below area threshold.  */  image_view=AcquireAuthenticCacheView(image,exception);  for (i=0; i < (ssize_t) number_objects; i++)  {    double      census;    RectangleInfo      bounding_box;    register ssize_t      j;    size_t      id;    if (status == MagickFalse)      continue;    if ((double) object[i].area >= area_threshold)      continue;    for (j=0; j < (ssize_t) number_objects; j++)      object[j].census=0;    bounding_box=object[i].bounding_box;//.........这里部分代码省略.........
开发者ID:JohnHeywardOBrien,项目名称:photogram,代码行数:101,


示例7: SortColormapByIntensity

MagickExport MagickBooleanType SortColormapByIntensity(Image *image,  ExceptionInfo *exception){  CacheView    *image_view;  MagickBooleanType    status;  register ssize_t    i;  ssize_t    y;  unsigned short    *pixels;  assert(image != (Image *) NULL);  if (image->debug != MagickFalse)    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");  assert(image->signature == MagickCoreSignature);  if (image->storage_class != PseudoClass)    return(MagickTrue);  /*    Allocate memory for pixel indexes.  */  pixels=(unsigned short *) AcquireQuantumMemory((size_t) image->colors,    sizeof(*pixels));  if (pixels == (unsigned short *) NULL)    ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",      image->filename);  /*    Assign index values to colormap entries.  */#if defined(MAGICKCORE_OPENMP_SUPPORT)  #pragma omp parallel for schedule(static,4) shared(status) /    magick_threads(image,image,1,1)#endif  for (i=0; i < (ssize_t) image->colors; i++)    image->colormap[i].alpha=(double) i;  /*    Sort image colormap by decreasing color popularity.  */  qsort((void *) image->colormap,(size_t) image->colors,    sizeof(*image->colormap),IntensityCompare);  /*    Update image colormap indexes to sorted colormap order.  */#if defined(MAGICKCORE_OPENMP_SUPPORT)  #pragma omp parallel for schedule(static,4) shared(status)#endif  for (i=0; i < (ssize_t) image->colors; i++)    pixels[(ssize_t) image->colormap[i].alpha]=(unsigned short) i;  status=MagickTrue;  image_view=AcquireAuthenticCacheView(image,exception);  for (y=0; y < (ssize_t) image->rows; y++)  {    Quantum      index;    register ssize_t      x;    register Quantum      *restrict q;    q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);    if (q == (Quantum *) NULL)      {        status=MagickFalse;        break;      }    for (x=0; x < (ssize_t) image->columns; x++)    {      index=(Quantum) pixels[(ssize_t) GetPixelIndex(image,q)];      SetPixelIndex(image,index,q);      SetPixelViaPixelInfo(image,image->colormap+(ssize_t) index,q);      q+=GetPixelChannels(image);    }    if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)      status=MagickFalse;    if (status == MagickFalse)      break;  }  image_view=DestroyCacheView(image_view);  pixels=(unsigned short *) RelinquishMagickMemory(pixels);  return(status);}
开发者ID:jeffasd,项目名称:ImageMagick,代码行数:89,


示例8: FloodfillPaintImage

//.........这里部分代码省略.........    (void) SetImageAlpha(image,OpaqueAlpha,exception);  /*    Set floodfill state.  */  floodplane_image=CloneImage(image,image->columns,image->rows,MagickTrue,    exception);  if (floodplane_image == (Image *) NULL)    return(MagickFalse);  floodplane_image->alpha_trait=UndefinedPixelTrait;  floodplane_image->colorspace=GRAYColorspace;  (void) QueryColorCompliance("#000",AllCompliance,    &floodplane_image->background_color,exception);  (void) SetImageBackgroundColor(floodplane_image,exception);  segment_info=AcquireVirtualMemory(MaxStacksize,sizeof(*segment_stack));  if (segment_info == (MemoryInfo *) NULL)    {      floodplane_image=DestroyImage(floodplane_image);      ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",        image->filename);    }  segment_stack=(SegmentInfo *) GetVirtualMemoryBlob(segment_info);  /*    Push initial segment on stack.  */  status=MagickTrue;  x=x_offset;  y=y_offset;  start=0;  s=segment_stack;  PushSegmentStack(y,x,x,1);  PushSegmentStack(y+1,x,x,-1);  GetPixelInfo(image,&pixel);  image_view=AcquireVirtualCacheView(image,exception);  floodplane_view=AcquireAuthenticCacheView(floodplane_image,exception);  while (s > segment_stack)  {    register const Quantum      *restrict p;    register Quantum      *restrict q;    register ssize_t      x;    /*      Pop segment off stack.    */    s--;    x1=(ssize_t) s->x1;    x2=(ssize_t) s->x2;    offset=(ssize_t) s->y2;    y=(ssize_t) s->y1+offset;    /*      Recolor neighboring pixels.    */    p=GetCacheViewVirtualPixels(image_view,0,y,(size_t) (x1+1),1,exception);    q=GetCacheViewAuthenticPixels(floodplane_view,0,y,(size_t) (x1+1),1,      exception);    if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))      break;    p+=x1*GetPixelChannels(image);    q+=x1*GetPixelChannels(floodplane_image);    for (x=x1; x >= 0; x--)    {      if (GetPixelGray(floodplane_image,q) != 0)
开发者ID:eulerhit,项目名称:ImageMagick,代码行数:67,


示例9: SetImageAlphaChannel

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   S e t I m a g e A l p h a C h a n n e l                                   %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  SetImageAlphaChannel() activates, deactivates, resets, or sets the alpha%  channel.%%  The format of the SetImageAlphaChannel method is:%%      MagickBooleanType SetImageAlphaChannel(Image *image,%        const AlphaChannelType alpha_type)%%  A description of each parameter follows:%%    o image: the image.%%    o alpha_type:  The alpha channel type: ActivateAlphaChannel,%      CopyAlphaChannel, DeactivateAlphaChannel, ExtractAlphaChannel,%      OpaqueAlphaChannel, ResetAlphaChannel, SetAlphaChannel,%      ShapeAlphaChannel, and TransparentAlphaChannel.%*/MagickExport MagickBooleanType SetImageAlphaChannel(Image *image,  const AlphaChannelType alpha_type){  MagickBooleanType    status;  assert(image != (Image *) NULL);  if (image->debug != MagickFalse)    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");  assert(image->signature == MagickSignature);  status=MagickTrue;  switch (alpha_type)  {    case ActivateAlphaChannel:    {      image->matte=MagickTrue;      break;    }    case BackgroundAlphaChannel:    {      CacheView        *image_view;      ExceptionInfo        *exception;      IndexPacket        index;      MagickBooleanType        status;      MagickPixelPacket        background;      PixelPacket        pixel;      ssize_t        y;      /*        Set transparent pixels to background color.      */      if (image->matte == MagickFalse)        break;      if (SetImageStorageClass(image,DirectClass) == MagickFalse)        break;      GetMagickPixelPacket(image,&background);      SetMagickPixelPacket(image,&image->background_color,(const IndexPacket *)        NULL,&background);      if (image->colorspace == CMYKColorspace)        ConvertRGBToCMYK(&background);      index=0;      SetPixelPacket(image,&background,&pixel,&index);      status=MagickTrue;      exception=(&image->exception);      image_view=AcquireAuthenticCacheView(image,exception);      #if defined(MAGICKCORE_OPENMP_SUPPORT)        #pragma omp parallel for schedule(static,4) shared(status) /          magick_threads(image,image,image->rows,1)      #endif      for (y=0; y < (ssize_t) image->rows; y++)      {        register IndexPacket          *restrict indexes;        register PixelPacket          *restrict q;        register ssize_t//.........这里部分代码省略.........
开发者ID:abzolute0,项目名称:Ruby_Blog,代码行数:101,


示例10: ForwardFourier

static MagickBooleanType ForwardFourier(const FourierInfo *fourier_info,  Image *image,double *magnitude,double *phase,ExceptionInfo *exception){  CacheView    *magnitude_view,    *phase_view;  double    *magnitude_source,    *phase_source;  Image    *magnitude_image,    *phase_image;  MagickBooleanType    status;  register IndexPacket    *indexes;  register ssize_t    x;  register PixelPacket    *q;  ssize_t    i,    y;  magnitude_image=GetFirstImageInList(image);  phase_image=GetNextImageInList(image);  if (phase_image == (Image *) NULL)    {      (void) ThrowMagickException(exception,GetMagickModule(),ImageError,        "ImageSequenceRequired","`%s'",image->filename);      return(MagickFalse);    }  /*    Create "Fourier Transform" image from constituent arrays.  */  magnitude_source=(double *) AcquireQuantumMemory((size_t)    fourier_info->height,fourier_info->width*sizeof(*magnitude_source));  if (magnitude_source == (double *) NULL)    return(MagickFalse);  (void) ResetMagickMemory(magnitude_source,0,fourier_info->height*    fourier_info->width*sizeof(*magnitude_source));  phase_source=(double *) AcquireQuantumMemory((size_t) fourier_info->height,    fourier_info->width*sizeof(*phase_source));  if (phase_source == (double *) NULL)    {      (void) ThrowMagickException(exception,GetMagickModule(),        ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename);      magnitude_source=(double *) RelinquishMagickMemory(magnitude_source);      return(MagickFalse);    }  status=ForwardQuadrantSwap(fourier_info->height,fourier_info->height,    magnitude,magnitude_source);  if (status != MagickFalse)    status=ForwardQuadrantSwap(fourier_info->height,fourier_info->height,phase,      phase_source);  CorrectPhaseLHS(fourier_info->height,fourier_info->height,phase_source);  if (fourier_info->modulus != MagickFalse)    {      i=0L;      for (y=0L; y < (ssize_t) fourier_info->height; y++)        for (x=0L; x < (ssize_t) fourier_info->width; x++)        {          phase_source[i]/=(2.0*MagickPI);          phase_source[i]+=0.5;          i++;        }    }  magnitude_view=AcquireAuthenticCacheView(magnitude_image,exception);  i=0L;  for (y=0L; y < (ssize_t) fourier_info->height; y++)  {    q=GetCacheViewAuthenticPixels(magnitude_view,0L,y,fourier_info->height,1UL,      exception);    if (q == (PixelPacket *) NULL)      break;    indexes=GetCacheViewAuthenticIndexQueue(magnitude_view);    for (x=0L; x < (ssize_t) fourier_info->width; x++)    {      switch (fourier_info->channel)      {        case RedChannel:        default:        {          SetPixelRed(q,ClampToQuantum(QuantumRange*            magnitude_source[i]));          break;        }        case GreenChannel:        {          SetPixelGreen(q,ClampToQuantum(QuantumRange*            magnitude_source[i]));          break;        }//.........这里部分代码省略.........
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,


示例11: TransparentPaintImage

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%     T r a n s p a r e n t P a i n t I m a g e                               %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  TransparentPaintImage() changes the opacity value associated with any pixel%  that matches color to the value defined by opacity.%%  By default color must match a particular pixel color exactly.  However, in%  many cases two colors may differ by a small amount.  Fuzz defines how much%  tolerance is acceptable to consider two colors as the same.  For example,%  set fuzz to 10 and the color red at intensities of 100 and 102 respectively%  are now interpreted as the same color.%%  The format of the TransparentPaintImage method is:%%      MagickBooleanType TransparentPaintImage(Image *image,%        const PixelInfo *target,const Quantum opacity,%        const MagickBooleanType invert,ExceptionInfo *exception)%%  A description of each parameter follows:%%    o image: the image.%%    o target: the target color.%%    o opacity: the replacement opacity value.%%    o invert: paint any pixel that does not match the target color.%%    o exception: return any errors or warnings in this structure.%*/MagickExport MagickBooleanType TransparentPaintImage(Image *image,  const PixelInfo *target,const Quantum opacity,const MagickBooleanType invert,  ExceptionInfo *exception){#define TransparentPaintImageTag  "Transparent/Image"  CacheView    *image_view;  MagickBooleanType    status;  MagickOffsetType    progress;  PixelInfo    zero;  ssize_t    y;  assert(image != (Image *) NULL);  assert(image->signature == MagickCoreSignature);  assert(target != (PixelInfo *) NULL);  if (image->debug != MagickFalse)    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);  if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)    return(MagickFalse);  if (image->alpha_trait == UndefinedPixelTrait)    (void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception);  /*    Make image color transparent.  */  status=MagickTrue;  progress=0;  GetPixelInfo(image,&zero);  image_view=AcquireAuthenticCacheView(image,exception);#if defined(MAGICKCORE_OPENMP_SUPPORT)  #pragma omp parallel for schedule(static,4) shared(progress,status) /    magick_threads(image,image,image->rows,1)#endif  for (y=0; y < (ssize_t) image->rows; y++)  {    PixelInfo      pixel;    register ssize_t      x;    register Quantum      *restrict q;    if (status == MagickFalse)      continue;    q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);    if (q == (Quantum *) NULL)      {        status=MagickFalse;        continue;      }    pixel=zero;//.........这里部分代码省略.........
开发者ID:eulerhit,项目名称:ImageMagick,代码行数:101,


示例12: assert

MagickExport Image *OilPaintImage(const Image *image,const double radius,  const double sigma,ExceptionInfo *exception){#define NumberPaintBins  256#define OilPaintImageTag  "OilPaint/Image"  CacheView    *image_view,    *paint_view;  Image    *linear_image,    *paint_image;  MagickBooleanType    status;  MagickOffsetType    progress;  size_t    **histograms,    width;  ssize_t    center,    y;  /*    Initialize painted image attributes.  */  assert(image != (const Image *) NULL);  assert(image->signature == MagickCoreSignature);  if (image->debug != MagickFalse)    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);  assert(exception != (ExceptionInfo *) NULL);  assert(exception->signature == MagickCoreSignature);  width=GetOptimalKernelWidth2D(radius,sigma);  linear_image=CloneImage(image,0,0,MagickTrue,exception);  paint_image=CloneImage(image,image->columns,image->rows,MagickTrue,exception);  if ((linear_image == (Image *) NULL) || (paint_image == (Image *) NULL))    {      if (linear_image != (Image *) NULL)        linear_image=DestroyImage(linear_image);      if (paint_image != (Image *) NULL)        linear_image=DestroyImage(paint_image);      return((Image *) NULL);    }  if (SetImageStorageClass(paint_image,DirectClass,exception) == MagickFalse)    {      linear_image=DestroyImage(linear_image);      paint_image=DestroyImage(paint_image);      return((Image *) NULL);    }  histograms=AcquireHistogramThreadSet(NumberPaintBins);  if (histograms == (size_t **) NULL)    {      linear_image=DestroyImage(linear_image);      paint_image=DestroyImage(paint_image);      ThrowImageException(ResourceLimitError,"MemoryAllocationFailed");    }  /*    Oil paint image.  */  status=MagickTrue;  progress=0;  center=(ssize_t) GetPixelChannels(linear_image)*(linear_image->columns+width)*    (width/2L)+GetPixelChannels(linear_image)*(width/2L);  image_view=AcquireVirtualCacheView(linear_image,exception);  paint_view=AcquireAuthenticCacheView(paint_image,exception);#if defined(MAGICKCORE_OPENMP_SUPPORT)  #pragma omp parallel for schedule(static,4) shared(progress,status) /    magick_threads(linear_image,paint_image,linear_image->rows,1)#endif  for (y=0; y < (ssize_t) linear_image->rows; y++)  {    register const Quantum      *restrict p;    register Quantum      *restrict q;    register size_t      *histogram;    register ssize_t      x;    if (status == MagickFalse)      continue;    p=GetCacheViewVirtualPixels(image_view,-((ssize_t) width/2L),y-(ssize_t)      (width/2L),linear_image->columns+width,width,exception);    q=QueueCacheViewAuthenticPixels(paint_view,0,y,paint_image->columns,1,      exception);    if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))      {        status=MagickFalse;        continue;      }    histogram=histograms[GetOpenMPThreadId()];//.........这里部分代码省略.........
开发者ID:eulerhit,项目名称:ImageMagick,代码行数:101,


示例13: SetImageAlphaChannel

MagickExport MagickBooleanType SetImageAlphaChannel(Image *image,  const AlphaChannelOption alpha_type,ExceptionInfo *exception){  CacheView    *image_view;  MagickBooleanType    status;  ssize_t    y;  assert(image != (Image *) NULL);  if (image->debug != MagickFalse)    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");  assert(image->signature == MagickSignature);  status=MagickTrue;  switch (alpha_type)  {    case ActivateAlphaChannel:    {      image->alpha_trait=BlendPixelTrait;      break;    }    case AssociateAlphaChannel:    {      /*        Associate alpha.      */      status=SetImageStorageClass(image,DirectClass,exception);      if (status == MagickFalse)        break;      image_view=AcquireAuthenticCacheView(image,exception);#if defined(MAGICKCORE_OPENMP_SUPPORT)      #pragma omp parallel for schedule(static,4) shared(status) /        magick_threads(image,image,image->rows,1)#endif      for (y=0; y < (ssize_t) image->rows; y++)      {        register Quantum          *restrict q;        register ssize_t          x;        if (status == MagickFalse)          continue;        q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,          exception);        if (q == (Quantum *) NULL)          {            status=MagickFalse;            continue;          }        for (x=0; x < (ssize_t) image->columns; x++)        {          double            Sa;            register ssize_t            i;            if (GetPixelReadMask(image,q) == 0)            {              q+=GetPixelChannels(image);              continue;            }          Sa=QuantumScale*GetPixelAlpha(image,q);          for (i=0; i < (ssize_t) GetPixelChannels(image); i++)          {            PixelChannel channel=GetPixelChannelChannel(image,i);            PixelTrait traits=GetPixelChannelTraits(image,channel);            if ((traits & UpdatePixelTrait) == 0)              continue;            q[i]=ClampToQuantum(Sa*q[i]);          }          q+=GetPixelChannels(image);        }        if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)          status=MagickFalse;      }      image_view=DestroyCacheView(image_view);      image->alpha_trait=CopyPixelTrait;      return(status);    }    case BackgroundAlphaChannel:    {      /*        Set transparent pixels to background color.      */      if (image->alpha_trait != BlendPixelTrait)        break;      status=SetImageStorageClass(image,DirectClass,exception);      if (status == MagickFalse)        break;      image_view=AcquireAuthenticCacheView(image,exception);#if defined(MAGICKCORE_OPENMP_SUPPORT)      #pragma omp parallel for schedule(static,4) shared(status) /        magick_threads(image,image,image->rows,1)#endif//.........这里部分代码省略.........
开发者ID:saitoha,项目名称:ImageMagick-V7-SIXEL,代码行数:101,


示例14: SetImageDepth

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   S e t I m a g e D e p t h                                                 %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  SetImageDepth() sets the depth of the image.%%  The format of the SetImageDepth method is:%%      MagickBooleanType SetImageDepth(Image *image,const size_t depth,%        ExceptionInfo *exception)%%  A description of each parameter follows:%%    o image: the image.%%    o channel: the channel.%%    o depth: the image depth.%%    o exception: return any errors or warnings in this structure.%*/MagickExport MagickBooleanType SetImageDepth(Image *image,  const size_t depth,ExceptionInfo *exception){  CacheView    *image_view;  MagickBooleanType    status;  QuantumAny    range;  ssize_t    y;  assert(image != (Image *) NULL);  if (image->debug != MagickFalse)    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");  assert(image->signature == MagickSignature);  if (depth >= MAGICKCORE_QUANTUM_DEPTH)    {      image->depth=depth;      return(MagickTrue);    }  range=GetQuantumRange(depth);  if (image->storage_class == PseudoClass)    {      register ssize_t        i;#if defined(MAGICKCORE_OPENMP_SUPPORT)      #pragma omp parallel for schedule(static,4) shared(status) /        magick_threads(image,image,1,1)#endif      for (i=0; i < (ssize_t) image->colors; i++)      {        if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)          image->colormap[i].red=(double) ScaleAnyToQuantum(ScaleQuantumToAny(            ClampToQuantum(image->colormap[i].red),range),range);        if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)          image->colormap[i].green=(double) ScaleAnyToQuantum(ScaleQuantumToAny(            ClampToQuantum(image->colormap[i].green),range),range);        if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)          image->colormap[i].blue=(double) ScaleAnyToQuantum(ScaleQuantumToAny(            ClampToQuantum(image->colormap[i].blue),range),range);        if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)          image->colormap[i].alpha=(double) ScaleAnyToQuantum(ScaleQuantumToAny(            ClampToQuantum(image->colormap[i].alpha),range),range);      }    }  status=MagickTrue;  image_view=AcquireAuthenticCacheView(image,exception);#if !defined(MAGICKCORE_HDRI_SUPPORT)  if (QuantumRange <= MaxMap)    {      Quantum        *depth_map;      register ssize_t        i;      /*        Scale pixels to desired (optimized with depth map).      */      depth_map=(Quantum *) AcquireQuantumMemory(MaxMap+1,sizeof(*depth_map));      if (depth_map == (Quantum *) NULL)        ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");      for (i=0; i <= (ssize_t) MaxMap; i++)        depth_map[i]=ScaleAnyToQuantum(ScaleQuantumToAny((Quantum) i,range),          range);#if defined(MAGICKCORE_OPENMP_SUPPORT)//.........这里部分代码省略.........
开发者ID:epu,项目名称:ImageMagick,代码行数:101,


示例15: InverseFourierTransform

static MagickBooleanType InverseFourierTransform(FourierInfo *fourier_info,  fftw_complex *fourier,Image *image,ExceptionInfo *exception){  CacheView    *image_view;  double    *source;  fftw_plan    fftw_c2r_plan;  register IndexPacket    *indexes;  register PixelPacket    *q;  register ssize_t    i,    x;  ssize_t    y;  source=(double *) AcquireQuantumMemory((size_t) fourier_info->height,    fourier_info->width*sizeof(*source));  if (source == (double *) NULL)    {      (void) ThrowMagickException(exception,GetMagickModule(),        ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename);      return(MagickFalse);    }#if defined(MAGICKCORE_OPENMP_SUPPORT)  #pragma omp critical (MagickCore_InverseFourierTransform)#endif  {    fftw_c2r_plan=fftw_plan_dft_c2r_2d(fourier_info->width,fourier_info->height,      fourier,source,FFTW_ESTIMATE);    fftw_execute(fftw_c2r_plan);    fftw_destroy_plan(fftw_c2r_plan);  }  i=0L;  image_view=AcquireAuthenticCacheView(image,exception);  for (y=0L; y < (ssize_t) fourier_info->height; y++)  {    if (y >= (ssize_t) image->rows)      break;    q=GetCacheViewAuthenticPixels(image_view,0L,y,fourier_info->width >      image->columns ? image->columns : fourier_info->width,1UL,exception);    if (q == (PixelPacket *) NULL)      break;    indexes=GetCacheViewAuthenticIndexQueue(image_view);    for (x=0L; x < (ssize_t) fourier_info->width; x++)    {      if (x < (ssize_t) image->columns)        switch (fourier_info->channel)        {          case RedChannel:          default:          {            SetPixelRed(q,ClampToQuantum(QuantumRange*source[i]));            break;          }          case GreenChannel:          {            SetPixelGreen(q,ClampToQuantum(QuantumRange*source[i]));            break;          }          case BlueChannel:          {            SetPixelBlue(q,ClampToQuantum(QuantumRange*source[i]));            break;          }          case OpacityChannel:          {            SetPixelOpacity(q,ClampToQuantum(QuantumRange*source[i]));            break;          }          case IndexChannel:          {            SetPixelIndex(indexes+x,ClampToQuantum(QuantumRange*source[i]));            break;          }          case GrayChannels:          {            SetPixelGray(q,ClampToQuantum(QuantumRange*source[i]));            break;          }        }      i++;      q++;    }    if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)      break;  }  image_view=DestroyCacheView(image_view);  source=(double *) RelinquishMagickMemory(source);  return(MagickTrue);}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:100,


示例16: assert

//.........这里部分代码省略.........          {            status=SetMatrixElement(equivalences,oy,0,&ox);            root=ox;          }        else          {            status=SetMatrixElement(equivalences,ox,0,&oy);            root=oy;          }        ox=offset;        status=GetMatrixElement(equivalences,ox,0,&object);        while (object != root)        {          status=GetMatrixElement(equivalences,ox,0,&object);          status=SetMatrixElement(equivalences,ox,0,&root);        }        oy=offset+neighbor_offset;        status=GetMatrixElement(equivalences,oy,0,&object);        while (object != root)        {          status=GetMatrixElement(equivalences,oy,0,&object);          status=SetMatrixElement(equivalences,oy,0,&root);        }        status=SetMatrixElement(equivalences,y*image->columns+x,0,&root);        p++;      }    }  }  image_view=DestroyCacheView(image_view);  /*    Label connected components.  */  n=0;  component_view=AcquireAuthenticCacheView(component_image,exception);  for (y=0; y < (ssize_t) component_image->rows; y++)  {    register PixelPacket      *restrict q;    register ssize_t      x;    if (status == MagickFalse)      continue;    q=QueueCacheViewAuthenticPixels(component_view,0,y,component_image->columns,      1,exception);    if (q == (PixelPacket *) NULL)      {        status=MagickFalse;        continue;      }    for (x=0; x < (ssize_t) component_image->columns; x++)    {      ssize_t        id,        offset;      offset=y*image->columns+x;      status=GetMatrixElement(equivalences,offset,0,&id);      if (id == offset)        {          id=n++;          status=SetMatrixElement(equivalences,offset,0,&id);        }      else        {
开发者ID:JohnHeywardOBrien,项目名称:photogram,代码行数:67,


示例17: assert

//.........这里部分代码省略.........            status=SetMatrixElement(equivalences,oy,0,&ox);            root=ox;          }        else          {            status=SetMatrixElement(equivalences,ox,0,&oy);            root=oy;          }        ox=offset;        status=GetMatrixElement(equivalences,ox,0,&object);        while (object != root)        {          status=GetMatrixElement(equivalences,ox,0,&object);          status=SetMatrixElement(equivalences,ox,0,&root);        }        oy=offset+neighbor_offset;        status=GetMatrixElement(equivalences,oy,0,&object);        while (object != root)        {          status=GetMatrixElement(equivalences,oy,0,&object);          status=SetMatrixElement(equivalences,oy,0,&root);        }        status=SetMatrixElement(equivalences,y*image->columns+x,0,&root);        p+=GetPixelChannels(image);      }    }  }  image_view=DestroyCacheView(image_view);  /*    Label connected components.  */  n=0;  image_view=AcquireVirtualCacheView(image,exception);  component_view=AcquireAuthenticCacheView(component_image,exception);  for (y=0; y < (ssize_t) component_image->rows; y++)  {    register const Quantum      *magick_restrict p;    register Quantum      *magick_restrict q;    register ssize_t      x;    if (status == MagickFalse)      continue;    p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception);    q=QueueCacheViewAuthenticPixels(component_view,0,y,component_image->columns,      1,exception);    if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))      {        status=MagickFalse;        continue;      }    for (x=0; x < (ssize_t) component_image->columns; x++)    {      ssize_t        id,        offset;      offset=y*image->columns+x;      status=GetMatrixElement(equivalences,offset,0,&id);      if (id == offset)        {          id=n++;
开发者ID:DINKIN,项目名称:ImageMagick,代码行数:67,


示例18: FrameImage

//.........这里部分代码省略.........    AccentuateModulate)*matte.blue+(QuantumRange*AccentuateModulate)));  accentuate.opacity=matte.opacity;  GetMagickPixelPacket(frame_image,&highlight);  highlight.red=(MagickRealType) (QuantumScale*((QuantumRange-    HighlightModulate)*matte.red+(QuantumRange*HighlightModulate)));  highlight.green=(MagickRealType) (QuantumScale*((QuantumRange-    HighlightModulate)*matte.green+(QuantumRange*HighlightModulate)));  highlight.blue=(MagickRealType) (QuantumScale*((QuantumRange-    HighlightModulate)*matte.blue+(QuantumRange*HighlightModulate)));  highlight.opacity=matte.opacity;  GetMagickPixelPacket(frame_image,&shadow);  shadow.red=QuantumScale*matte.red*ShadowModulate;  shadow.green=QuantumScale*matte.green*ShadowModulate;  shadow.blue=QuantumScale*matte.blue*ShadowModulate;  shadow.opacity=matte.opacity;  GetMagickPixelPacket(frame_image,&trough);  trough.red=QuantumScale*matte.red*TroughModulate;  trough.green=QuantumScale*matte.green*TroughModulate;  trough.blue=QuantumScale*matte.blue*TroughModulate;  trough.opacity=matte.opacity;  if (image->colorspace == CMYKColorspace)    {      ConvertRGBToCMYK(&interior);      ConvertRGBToCMYK(&matte);      ConvertRGBToCMYK(&border);      ConvertRGBToCMYK(&accentuate);      ConvertRGBToCMYK(&highlight);      ConvertRGBToCMYK(&shadow);      ConvertRGBToCMYK(&trough);    }  status=MagickTrue;  progress=0;  image_view=AcquireVirtualCacheView(image,exception);  frame_view=AcquireAuthenticCacheView(frame_image,exception);  height=(size_t) (frame_info->outer_bevel+(frame_info->y-bevel_width)+    frame_info->inner_bevel);  if (height != 0)    {      register IndexPacket        *restrict frame_indexes;      register ssize_t        x;      register PixelPacket        *restrict q;      /*        Draw top of ornamental border.      */      q=QueueCacheViewAuthenticPixels(frame_view,0,0,frame_image->columns,        height,exception);      frame_indexes=GetCacheViewAuthenticIndexQueue(frame_view);      if (q != (PixelPacket *) NULL)        {          /*            Draw top of ornamental border.          */          for (y=0; y < (ssize_t) frame_info->outer_bevel; y++)          {            for (x=0; x < (ssize_t) (frame_image->columns-y); x++)            {              if (x < y)                SetPixelPacket(frame_image,&highlight,q,frame_indexes);              else                SetPixelPacket(frame_image,&accentuate,q,frame_indexes);
开发者ID:AlexiaChen,项目名称:ImageMagick_Cmake,代码行数:67,


示例19: SeparateImageChannel

MagickExport MagickBooleanType SeparateImageChannel(Image *image,  const ChannelType channel){#define SeparateImageTag  "Separate/Image"  CacheView    *image_view;  ExceptionInfo    *exception;  MagickBooleanType    status;  MagickOffsetType    progress;  ssize_t    y;  assert(image != (Image *) NULL);  assert(image->signature == MagickSignature);  if (image->debug != MagickFalse)    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);  if (SetImageStorageClass(image,DirectClass) == MagickFalse)    return(MagickFalse);  if (channel == GrayChannels)    image->matte=MagickTrue;  /*    Separate image channels.  */  status=MagickTrue;  progress=0;  exception=(&image->exception);  image_view=AcquireAuthenticCacheView(image,exception);#if defined(MAGICKCORE_OPENMP_SUPPORT)  #pragma omp parallel for schedule(static,4) shared(progress,status) /    magick_threads(image,image,image->rows,1)#endif  for (y=0; y < (ssize_t) image->rows; y++)  {    register IndexPacket      *restrict indexes;    register PixelPacket      *restrict q;    register ssize_t      x;    if (status == MagickFalse)      continue;    q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);    if (q == (PixelPacket *) NULL)      {        status=MagickFalse;        continue;      }    indexes=GetCacheViewAuthenticIndexQueue(image_view);    switch (channel)    {      case RedChannel:      {        for (x=0; x < (ssize_t) image->columns; x++)        {          SetPixelGreen(q,GetPixelRed(q));          SetPixelBlue(q,GetPixelRed(q));          q++;        }        break;      }      case GreenChannel:      {        for (x=0; x < (ssize_t) image->columns; x++)        {          SetPixelRed(q,GetPixelGreen(q));          SetPixelBlue(q,GetPixelGreen(q));          q++;        }        break;      }      case BlueChannel:      {        for (x=0; x < (ssize_t) image->columns; x++)        {          SetPixelRed(q,GetPixelBlue(q));          SetPixelGreen(q,GetPixelBlue(q));          q++;        }        break;      }      case OpacityChannel:      {        for (x=0; x < (ssize_t) image->columns; x++)        {          SetPixelRed(q,GetPixelOpacity(q));          SetPixelGreen(q,GetPixelOpacity(q));          SetPixelBlue(q,GetPixelOpacity(q));          q++;        }//.........这里部分代码省略.........
开发者ID:abzolute0,项目名称:Ruby_Blog,代码行数:101,


示例20: RaiseImage

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   R a i s e I m a g e                                                       %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  RaiseImage() creates a simulated three-dimensional button-like effect%  by lightening and darkening the edges of the image.  Members width and%  height of raise_info define the width of the vertical and horizontal%  edge of the effect.%%  The format of the RaiseImage method is:%%      MagickBooleanType RaiseImage(const Image *image,%        const RectangleInfo *raise_info,const MagickBooleanType raise)%%  A description of each parameter follows:%%    o image: the image.%%    o raise_info: Define the width and height of the raise area.%%    o raise: A value other than zero creates a 3-D raise effect,%      otherwise it has a lowered effect.%*/MagickExport MagickBooleanType RaiseImage(Image *image,  const RectangleInfo *raise_info,const MagickBooleanType raise){#define AccentuateFactor  ScaleCharToQuantum(135)#define HighlightFactor  ScaleCharToQuantum(190)#define ShadowFactor  ScaleCharToQuantum(190)#define RaiseImageTag  "Raise/Image"#define TroughFactor  ScaleCharToQuantum(135)  CacheView    *image_view;  ExceptionInfo    *exception;  MagickBooleanType    status;  MagickOffsetType    progress;  Quantum    foreground,    background;  ssize_t    y;  assert(image != (Image *) NULL);  assert(image->signature == MagickSignature);  if (image->debug != MagickFalse)    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);  assert(raise_info != (RectangleInfo *) NULL);  if ((image->columns <= (raise_info->width << 1)) ||      (image->rows <= (raise_info->height << 1)))    ThrowBinaryException(OptionError,"ImageSizeMustExceedBevelWidth",      image->filename);  foreground=QuantumRange;  background=(Quantum) 0;  if (raise == MagickFalse)    {      foreground=(Quantum) 0;      background=QuantumRange;    }  if (SetImageStorageClass(image,DirectClass) == MagickFalse)    return(MagickFalse);  /*    Raise image.  */  status=MagickTrue;  progress=0;  exception=(&image->exception);  image_view=AcquireAuthenticCacheView(image,exception);#if defined(MAGICKCORE_OPENMP_SUPPORT)  #pragma omp parallel for schedule(static,4) shared(status) /    magick_threads(image,image,1,1)#endif  for (y=0; y < (ssize_t) raise_info->height; y++)  {    register ssize_t      x;    register PixelPacket      *restrict q;    if (status == MagickFalse)      continue;    q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);    if (q == (PixelPacket *) NULL)//.........这里部分代码省略.........
开发者ID:AlexiaChen,项目名称:ImageMagick_Cmake,代码行数:101,


示例21: CombineImages

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%     C o m b i n e I m a g e s                                               %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  CombineImages() combines one or more images into a single image.  The%  grayscale value of the pixels of each image in the sequence is assigned in%  order to the specified channels of the combined image.   The typical%  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.%%  The format of the CombineImages method is:%%      Image *CombineImages(const Image *image,const ChannelType channel,%        ExceptionInfo *exception)%%  A description of each parameter follows:%%    o image: the image.%%    o exception: return any errors or warnings in this structure.%*/MagickExport Image *CombineImages(const Image *image,const ChannelType channel,  ExceptionInfo *exception){#define CombineImageTag  "Combine/Image"  CacheView    *combine_view;  const Image    *next;  Image    *combine_image;  MagickBooleanType    status;  MagickOffsetType    progress;  ssize_t    y;  /*    Ensure the image are the same size.  */  assert(image != (const 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);  for (next=image; next != (Image *) NULL; next=GetNextImageInList(next))  {    if ((next->columns != image->columns) || (next->rows != image->rows))      ThrowImageException(OptionError,"ImagesAreNotTheSameSize");  }  combine_image=CloneImage(image,0,0,MagickTrue,exception);  if (combine_image == (Image *) NULL)    return((Image *) NULL);  if (SetImageStorageClass(combine_image,DirectClass) == MagickFalse)    {      InheritException(exception,&combine_image->exception);      combine_image=DestroyImage(combine_image);      return((Image *) NULL);    }  if (IssRGBCompatibleColorspace(image->colorspace) != MagickFalse)    (void) SetImageColorspace(combine_image,sRGBColorspace);  if ((channel & OpacityChannel) != 0)    combine_image->matte=MagickTrue;  (void) SetImageBackgroundColor(combine_image);  /*    Combine images.  */  status=MagickTrue;  progress=0;  combine_view=AcquireAuthenticCacheView(combine_image,exception);  for (y=0; y < (ssize_t) combine_image->rows; y++)  {    CacheView      *image_view;    const Image      *next;    PixelPacket      *pixels;    register const PixelPacket      *restrict p;    register PixelPacket//.........这里部分代码省略.........
开发者ID:abzolute0,项目名称:Ruby_Blog,代码行数:101,


示例22: return

static Image *MaskImage(const Image *image,ExceptionInfo *exception){  CacheView    *image_view,    *mask_view;  Image    *mask_image;  MagickBooleanType    status;  ssize_t    y;  mask_image=CloneImage(image,image->columns,image->rows,MagickTrue,    exception);  if (mask_image == (Image *) NULL)    return((Image *) NULL);  if (SetImageStorageClass(mask_image,DirectClass,exception) == MagickFalse)    {      mask_image=DestroyImage(mask_image);      return((Image *) NULL);    }  mask_image->alpha_trait=UndefinedPixelTrait;  (void) SetImageColorspace(mask_image,GRAYColorspace,exception);  /*    Mask image.  */  status=MagickTrue;  image_view=AcquireVirtualCacheView(image,exception);  mask_view=AcquireAuthenticCacheView(mask_image,exception);  for (y=0; y < (ssize_t) image->rows; y++)  {    register const Quantum      *restrict p;    register Quantum      *restrict q;    register ssize_t      x;    if (status == MagickFalse)      continue;    p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception);    q=QueueCacheViewAuthenticPixels(mask_view,0,y,mask_image->columns,1,      exception);    if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))      {        status=MagickFalse;        continue;      }    for (x=0; x < (ssize_t) image->columns; x++)    {      SetPixelChannel(mask_image,GrayPixelChannel,0,q);      SetPixelChannel(mask_image,GrayPixelChannel,GetPixelReadMask(image,p),q);      p+=GetPixelChannels(image);      q+=GetPixelChannels(mask_image);    }    if (SyncCacheViewAuthenticPixels(mask_view,exception) == MagickFalse)      status=MagickFalse;  }  mask_view=DestroyCacheView(mask_view);  image_view=DestroyCacheView(image_view);  if (status == MagickFalse)    mask_image=DestroyImage(mask_image);  return(mask_image);}
开发者ID:Distrotech,项目名称:ImageMagick,代码行数:69,



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


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