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

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

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

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

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

示例1: ConvertHSLToRGB

MagickExport void ConvertHSLToRGB(const double hue,const double saturation,  const double lightness,Quantum *red,Quantum *green,Quantum *blue){  MagickRealType    b,    g,    r,    m1,    m2;  /*    Convert HSL to RGB colorspace.  */  assert(red != (Quantum *) NULL);  assert(green != (Quantum *) NULL);  assert(blue != (Quantum *) NULL);  if (saturation == 0)    {      *red=ClampToQuantum((MagickRealType) QuantumRange*lightness);      *green=(*red);      *blue=(*red);      return;    }  if (lightness < 0.5)    m2=lightness*(saturation+1.0);  else    m2=(lightness+saturation)-(lightness*saturation);  m1=2.0*lightness-m2;  r=ConvertHueToRGB(m1,m2,hue+1.0/3.0);  g=ConvertHueToRGB(m1,m2,hue);  b=ConvertHueToRGB(m1,m2,hue-1.0/3.0);  *red=ClampToQuantum((MagickRealType) QuantumRange*r);  *green=ClampToQuantum((MagickRealType) QuantumRange*g);  *blue=ClampToQuantum((MagickRealType) QuantumRange*b);}
开发者ID:271845221,项目名称:Android-ImageMagick,代码行数:35,


示例2: sanpera_magick_pixel_from_doubles

void sanpera_magick_pixel_from_doubles(MagickPixelPacket *pixel, double in[4]) {    SetPixelRed(pixel, ClampToQuantum(in[0] * QuantumRange));    SetPixelGreen(pixel, ClampToQuantum(in[1] * QuantumRange));    SetPixelBlue(pixel, ClampToQuantum(in[2] * QuantumRange));    // Distinct from "opacity", which treats 0 as opaque    SetPixelAlpha(pixel, ClampToQuantum(in[3] * QuantumRange));}
开发者ID:harvimt,项目名称:sanpera,代码行数:7,


示例3: sanpera_magick_pixel_from_doubles_channel

void sanpera_magick_pixel_from_doubles_channel(        MagickPixelPacket *pixel, double in[4], ChannelType channels){    if (channels & RedChannel)        SetPixelRed(pixel, ClampToQuantum(in[0] * QuantumRange));    if (channels & GreenChannel)        SetPixelGreen(pixel, ClampToQuantum(in[1] * QuantumRange));    if (channels & BlueChannel)        SetPixelBlue(pixel, ClampToQuantum(in[2] * QuantumRange));    // Distinct from "opacity", which treats 0 as opaque    if (channels & AlphaChannel)        SetPixelAlpha(pixel, ClampToQuantum(in[3] * QuantumRange));}
开发者ID:harvimt,项目名称:sanpera,代码行数:13,


示例4: GetOneCacheViewVirtualPixel

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   G e t O n e C a c h e V i e w V i r t u a l P i x e l                     %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  GetOneCacheViewVirtualPixel() returns a single pixel at the specified (x,y)%  location.  The image background color is returned if an error occurs.  If%  you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead.%%  The format of the GetOneCacheViewVirtualPixel method is:%%      MagickBooleanType GetOneCacheViewVirtualPixel(%        const CacheView *cache_view,const ssize_t x,const ssize_t y,%        Quantum *pixel,ExceptionInfo *exception)%%  A description of each parameter follows:%%    o cache_view: the cache view.%%    o x,y:  These values define the offset of the pixel.%%    o pixel: return a pixel at the specified (x,y) location.%%    o exception: return any errors or warnings in this structure.%*/MagickExport MagickBooleanType GetOneCacheViewVirtualPixel(  const CacheView *cache_view,const ssize_t x,const ssize_t y,Quantum *pixel,  ExceptionInfo *exception){  const int    id = GetOpenMPThreadId();  register const Quantum    *magick_restrict p;  register ssize_t    i;  assert(cache_view != (CacheView *) NULL);  assert(cache_view->signature == MagickCoreSignature);  assert(id < (int) cache_view->number_threads);  (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));  p=GetVirtualPixelsFromNexus(cache_view->image,    cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id],    exception);  if (p == (const Quantum *) NULL)    {      PixelInfo        background_color;      background_color=cache_view->image->background_color;      pixel[RedPixelChannel]=ClampToQuantum(background_color.red);      pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);      pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);      pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);      pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);      return(MagickFalse);    }  for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)  {    PixelChannel channel=GetPixelChannelChannel(cache_view->image,i);    pixel[channel]=p[i];  }  return(MagickTrue);}
开发者ID:DINKIN,项目名称:ImageMagick,代码行数:72,


示例5: PrintChannelStatistics

static int PrintChannelStatistics(FILE *file,const ChannelType channel,                                  const char *name,const double scale,                                  const ChannelStatistics *channel_statistics){#define StatisticsFormat "    %s:/n      min: " QuantumFormat  /  " (%g)/n      max: " QuantumFormat " (%g)/n"  /  "      mean: %g (%g)/n      standard deviation: %g (%g)/n"  /  "      kurtosis: %g/n      skewness: %g/n"    int    status;    if (channel == AlphaChannel)    {        status=fprintf(file,StatisticsFormat,name,ClampToQuantum(scale*                       (QuantumRange-channel_statistics[channel].maxima)),                       (QuantumRange-channel_statistics[channel].maxima)/(double) QuantumRange,                       ClampToQuantum(scale*(QuantumRange-channel_statistics[channel].minima)),                       (QuantumRange-channel_statistics[channel].minima)/(double) QuantumRange,                       scale*(QuantumRange-channel_statistics[channel].mean),(QuantumRange-                               channel_statistics[channel].mean)/(double) QuantumRange,scale*                       channel_statistics[channel].standard_deviation,                       channel_statistics[channel].standard_deviation/(double) QuantumRange,                       channel_statistics[channel].kurtosis,                       channel_statistics[channel].skewness);        return(status);    }    status=fprintf(file,StatisticsFormat,name,ClampToQuantum(scale*                   channel_statistics[channel].minima),channel_statistics[channel].minima/                   (double) QuantumRange,ClampToQuantum(scale*                           channel_statistics[channel].maxima),channel_statistics[channel].maxima/                   (double) QuantumRange,scale*channel_statistics[channel].mean,                   channel_statistics[channel].mean/(double) QuantumRange,scale*                   channel_statistics[channel].standard_deviation,                   channel_statistics[channel].standard_deviation/(double) QuantumRange,                   channel_statistics[channel].kurtosis,channel_statistics[channel].skewness);    return(status);}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:38,


示例6: PrintChannelStatistics

static ssize_t PrintChannelStatistics(FILE *file,const PixelChannel channel,  const char *name,const double scale,  const ChannelStatistics *channel_statistics){#define StatisticsFormat "    %s:/n      min: " QuantumFormat  /  " (%g)/n      max: " QuantumFormat " (%g)/n"  /  "      mean: %g (%g)/n      standard deviation: %g (%g)/n"  /  "      kurtosis: %g/n      skewness: %g/n"  ssize_t    n;  n=FormatLocaleFile(file,StatisticsFormat,name,ClampToQuantum(scale*    channel_statistics[channel].minima),channel_statistics[channel].minima/    (double) QuantumRange,ClampToQuantum(scale*    channel_statistics[channel].maxima),channel_statistics[channel].maxima/    (double) QuantumRange,scale*channel_statistics[channel].mean,    channel_statistics[channel].mean/(double) QuantumRange,scale*    channel_statistics[channel].standard_deviation,    channel_statistics[channel].standard_deviation/(double) QuantumRange,    channel_statistics[channel].kurtosis,channel_statistics[channel].skewness);  return(n);}
开发者ID:Ladeira,项目名称:ImageMagick,代码行数:23,


示例7: ConvertHWBToRGB

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   C o n v e r t H W B T o R G B                                             %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  ConvertHWBToRGB() transforms a (hue, whiteness, blackness) to a (red, green,%  blue) triple.%%  The format of the ConvertHWBToRGBImage method is:%%      void ConvertHWBToRGB(const double hue,const double whiteness,%        const double blackness,Quantum *red,Quantum *green,Quantum *blue)%%  A description of each parameter follows:%%    o hue, whiteness, blackness: A double value representing a%      component of the HWB color space.%%    o red, green, blue: A pointer to a pixel component of type Quantum.%*/MagickExport void ConvertHWBToRGB(const double hue,const double whiteness,  const double blackness,Quantum *red,Quantum *green,Quantum *blue){  MagickRealType    b,    f,    g,    n,    r,    v;  register ssize_t    i;  /*    Convert HWB to RGB colorspace.  */  assert(red != (Quantum *) NULL);  assert(green != (Quantum *) NULL);  assert(blue != (Quantum *) NULL);  v=1.0-blackness;  if (hue == 0.0)    {      *red=ClampToQuantum((MagickRealType) QuantumRange*v);      *green=ClampToQuantum((MagickRealType) QuantumRange*v);      *blue=ClampToQuantum((MagickRealType) QuantumRange*v);      return;    }  i=(ssize_t) floor(6.0*hue);  f=6.0*hue-i;  if ((i & 0x01) != 0)    f=1.0-f;  n=whiteness+f*(v-whiteness);  /* linear interpolation */  switch (i)  {    default:    case 6:    case 0: r=v; g=n; b=whiteness; break;    case 1: r=n; g=v; b=whiteness; break;    case 2: r=whiteness; g=v; b=n; break;    case 3: r=whiteness; g=n; b=v; break;    case 4: r=n; g=whiteness; b=v; break;    case 5: r=v; g=whiteness; b=n; break;  }  *red=ClampToQuantum((MagickRealType) QuantumRange*r);  *green=ClampToQuantum((MagickRealType) QuantumRange*g);  *blue=ClampToQuantum((MagickRealType) QuantumRange*b);}
开发者ID:271845221,项目名称:Android-ImageMagick,代码行数:75,


示例8: assert

//.........这里部分代码省略.........  int    max_x,    max_y,    min_x,    min_y;  MagickBooleanType    status;  register ssize_t    x;  register Quantum    *q;  ssize_t    y;  /*    Open image.  */  assert(image_info != (const ImageInfo *) NULL);  assert(image_info->signature == MagickSignature);  if (image_info->debug != MagickFalse)    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",      image_info->filename);  assert(exception != (ExceptionInfo *) NULL);  assert(exception->signature == MagickSignature);  image=AcquireImage(image_info,exception);  status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);  if (status == MagickFalse)    {      image=DestroyImageList(image);      return((Image *) NULL);    }  read_info=CloneImageInfo(image_info);  if (IsPathAccessible(read_info->filename) == MagickFalse)    {      (void) AcquireUniqueFilename(read_info->filename);      (void) ImageToFile(image,read_info->filename,exception);    }  file=ImfOpenInputFile(read_info->filename);  if (file == (ImfInputFile *) NULL)    {      ThrowFileException(exception,BlobError,"UnableToOpenBlob",        ImfErrorMessage());      read_info=DestroyImageInfo(read_info);      return((Image *) NULL);    }  hdr_info=ImfInputHeader(file);  ImfHeaderDataWindow(hdr_info,&min_x,&min_y,&max_x,&max_y);  image->columns=max_x-min_x+1UL;  image->rows=max_y-min_y+1UL;  image->matte=MagickTrue;  if (image_info->ping != MagickFalse)    {      (void) ImfCloseInputFile(file);      if (LocaleCompare(image_info->filename,read_info->filename) != 0)        (void) RelinquishUniqueFileResource(read_info->filename);      read_info=DestroyImageInfo(read_info);      (void) CloseBlob(image);      return(GetFirstImageInList(image));    }  scanline=(ImfRgba *) AcquireQuantumMemory(image->columns,sizeof(*scanline));  if (scanline == (ImfRgba *) NULL)    {      (void) ImfCloseInputFile(file);      ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");    }  for (y=0; y < (ssize_t) image->rows; y++)  {    q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);    if (q == (Quantum *) NULL)      break;    ImfInputSetFrameBuffer(file,scanline-min_x-image->columns*(min_y+y),1,      image->columns);    ImfInputReadPixels(file,min_y+y,min_y+y);    for (x=0; x < (ssize_t) image->columns; x++)    {      SetPixelRed(image,ClampToQuantum((MagickRealType) QuantumRange*        ImfHalfToFloat(scanline[x].r)),q);      SetPixelGreen(image,ClampToQuantum((MagickRealType) QuantumRange*        ImfHalfToFloat(scanline[x].g)),q);      SetPixelBlue(image,ClampToQuantum((MagickRealType) QuantumRange*        ImfHalfToFloat(scanline[x].b)),q);      SetPixelAlpha(image,ClampToQuantum((MagickRealType) QuantumRange*        ImfHalfToFloat(scanline[x].a)),q);      q+=GetPixelChannels(image);    }    if (SyncAuthenticPixels(image,exception) == MagickFalse)      break;  }  scanline=(ImfRgba *) RelinquishMagickMemory(scanline);  (void) ImfCloseInputFile(file);  if (LocaleCompare(image_info->filename,read_info->filename) != 0)    (void) RelinquishUniqueFileResource(read_info->filename);  read_info=DestroyImageInfo(read_info);  (void) CloseBlob(image);  return(GetFirstImageInList(image));}
开发者ID:ChaseReid,项目名称:ImageMagick,代码行数:101,


示例9: ConvertHCLToRGB

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   C o n v e r t H C L T o R G B                                             %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  ConvertHCLToRGB() transforms a (hue, chroma, luma) to a (red, green,%  blue) triple.%%  The format of the ConvertHCLToRGBImage method is:%%      void ConvertHCLToRGB(const double hue,const double chroma,%        const double luma,Quantum *red,Quantum *green,Quantum *blue)%%  A description of each parameter follows:%%    o hue, chroma, luma: A double value representing a%      component of the HCL color space.%%    o red, green, blue: A pointer to a pixel component of type Quantum.%*/MagickExport void ConvertHCLToRGB(const double hue,const double chroma,  const double luma,Quantum *red,Quantum *green,Quantum *blue){  double    b,    c,    g,    h,    m,    r,    x;  /*    Convert HCL to RGB colorspace.  */  assert(red != (Quantum *) NULL);  assert(green != (Quantum *) NULL);  assert(blue != (Quantum *) NULL);  h=6.0*hue;  c=chroma;  x=c*(1.0-fabs(fmod(h,2.0)-1.0));  r=0.0;  g=0.0;  b=0.0;  if ((0.0 <= h) && (h < 1.0))    {      r=c;      g=x;    }  else    if ((1.0 <= h) && (h < 2.0))      {        r=x;        g=c;      }    else      if ((2.0 <= h) && (h < 3.0))        {          g=c;          b=x;        }      else        if ((3.0 <= h) && (h < 4.0))          {            g=x;            b=c;          }        else          if ((4.0 <= h) && (h < 5.0))            {              r=x;              b=c;            }          else            if ((5.0 <= h) && (h < 6.0))              {                r=c;                b=x;              }  m=luma-(0.298839f*r+0.586811f*g+0.114350f*b);  *red=ClampToQuantum(QuantumRange*(r+m));  *green=ClampToQuantum(QuantumRange*(g+m));  *blue=ClampToQuantum(QuantumRange*(b+m));}
开发者ID:MaximOrlovsky,项目名称:unix-toolbox.js-imagemagick,代码行数:91,


示例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: ReadHALDImage

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   R e a d H A L D I m a g e                                                 %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  ReadHALDImage() creates a Hald color lookup table image 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 ReadHALDImage method is:%%      Image *ReadHALDImage(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 *ReadHALDImage(const ImageInfo *image_info,  ExceptionInfo *exception){  Image    *image;  MagickBooleanType    status;  size_t    cube_size,    level;  ssize_t    y;  /*    Create HALD color lookup table image.  */  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);  level=0;  if (*image_info->filename != '/0')    level=StringToUnsignedLong(image_info->filename);  if (level < 2)    level=8;  status=MagickTrue;  cube_size=level*level;  image->columns=(size_t) (level*cube_size);  image->rows=(size_t) (level*cube_size);  for (y=0; y < (ssize_t) image->rows; y+=(ssize_t) level)  {    ssize_t      blue,      green,      red;    register PixelPacket      *restrict q;    if (status == MagickFalse)      continue;    q=QueueAuthenticPixels(image,0,y,image->columns,(size_t) level,      exception);    if (q == (PixelPacket *) NULL)      {        status=MagickFalse;        continue;      }    blue=y/(ssize_t) level;    for (green=0; green < (ssize_t) cube_size; green++)    {      for (red=0; red < (ssize_t) cube_size; red++)      {        SetPixelRed(q,ClampToQuantum(QuantumRange*red/          (cube_size-1.0)));        SetPixelGreen(q,ClampToQuantum(QuantumRange*green/          (cube_size-1.0)));        SetPixelBlue(q,ClampToQuantum(QuantumRange*blue/          (cube_size-1.0)));        SetPixelOpacity(q,OpaqueOpacity);        q++;      }    }    if (SyncAuthenticPixels(image,exception) == MagickFalse)      status=MagickFalse;  }//.........这里部分代码省略.........
开发者ID:271845221,项目名称:Android-ImageMagick,代码行数:101,


示例12: 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,


示例13: CombineImages

//.........这里部分代码省略.........      *next;    PixelPacket      *pixels;    register const PixelPacket      *restrict p;    register PixelPacket      *restrict q;    register ssize_t      x;    if (status == MagickFalse)      continue;    pixels=GetCacheViewAuthenticPixels(combine_view,0,y,combine_image->columns,      1,exception);    if (pixels == (PixelPacket *) NULL)      {        status=MagickFalse;        continue;      }    next=image;    if (((channel & RedChannel) != 0) && (next != (Image *) NULL))      {        image_view=AcquireVirtualCacheView(next,exception);        p=GetCacheViewVirtualPixels(image_view,0,y,next->columns,1,exception);        if (p == (const PixelPacket *) NULL)          continue;        q=pixels;        for (x=0; x < (ssize_t) combine_image->columns; x++)        {          SetPixelRed(q,ClampToQuantum(GetPixelIntensity(image,p)));          p++;          q++;        }        image_view=DestroyCacheView(image_view);        next=GetNextImageInList(next);      }    if (((channel & GreenChannel) != 0) && (next != (Image *) NULL))      {        image_view=AcquireVirtualCacheView(next,exception);        p=GetCacheViewVirtualPixels(image_view,0,y,next->columns,1,exception);        if (p == (const PixelPacket *) NULL)          continue;        q=pixels;        for (x=0; x < (ssize_t) combine_image->columns; x++)        {          SetPixelGreen(q,ClampToQuantum(GetPixelIntensity(image,p)));          p++;          q++;        }        image_view=DestroyCacheView(image_view);        next=GetNextImageInList(next);      }    if (((channel & BlueChannel) != 0) && (next != (Image *) NULL))      {        image_view=AcquireVirtualCacheView(next,exception);        p=GetCacheViewVirtualPixels(image_view,0,y,next->columns,1,exception);        if (p == (const PixelPacket *) NULL)          continue;        q=pixels;        for (x=0; x < (ssize_t) combine_image->columns; x++)        {          SetPixelBlue(q,ClampToQuantum(GetPixelIntensity(image,p)));
开发者ID:abzolute0,项目名称:Ruby_Blog,代码行数:67,


示例14: SeparateImageChannel

//.........这里部分代码省略.........    {      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++;        }        break;      }      case BlackChannel:      {        if ((image->storage_class != PseudoClass) &&            (image->colorspace != CMYKColorspace))          break;        for (x=0; x < (ssize_t) image->columns; x++)        {          SetPixelRed(q,GetPixelIndex(indexes+x));          SetPixelGreen(q,GetPixelIndex(indexes+x));          SetPixelBlue(q,GetPixelIndex(indexes+x));          q++;        }        break;      }      case TrueAlphaChannel:      {        for (x=0; x < (ssize_t) image->columns; x++)        {          SetPixelRed(q,GetPixelAlpha(q));          SetPixelGreen(q,GetPixelAlpha(q));          SetPixelBlue(q,GetPixelAlpha(q));          q++;        }        break;      }      case GrayChannels:      {        for (x=0; x < (ssize_t) image->columns; x++)        {          SetPixelAlpha(q,ClampToQuantum(GetPixelIntensity(image,q)));          q++;        }        break;      }      default:        break;    }    if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)      status=MagickFalse;    if (image->progress_monitor != (MagickProgressMonitor) NULL)      {        MagickBooleanType          proceed;#if defined(MAGICKCORE_OPENMP_SUPPORT)        #pragma omp critical (MagickCore_SeparateImageChannel)#endif        proceed=SetImageProgress(image,SeparateImageTag,progress++,image->rows);        if (proceed == MagickFalse)          status=MagickFalse;      }  }  image_view=DestroyCacheView(image_view);  if (channel != GrayChannels)    image->matte=MagickFalse;  (void) SetImageColorspace(image,GRAYColorspace);  return(status);}
开发者ID:abzolute0,项目名称:Ruby_Blog,代码行数:101,


示例15: 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,


示例16: ReadHDRImage

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


示例17: FlattenPixelInfo

static inline void FlattenPixelInfo(const Image *image,const PixelInfo *p,  const double alpha,const Quantum *q,const double beta,  Quantum *composite){  double    Da,    gamma,    Sa;  register ssize_t    i;  /*    Compose pixel p over pixel q with the given alpha.  */  Sa=QuantumScale*alpha;  Da=QuantumScale*beta,  gamma=Sa*(-Da)+Sa+Da;  gamma=PerceptibleReciprocal(gamma);  for (i=0; i < (ssize_t) GetPixelChannels(image); i++)  {    PixelChannel channel=GetPixelChannelChannel(image,i);    PixelTrait traits=GetPixelChannelTraits(image,channel);    if (traits == UndefinedPixelTrait)      continue;    switch (channel)    {      case RedPixelChannel:      {        composite[i]=ClampToQuantum(gamma*MagickOver_((double) q[i],beta,          (double) p->red,alpha));        break;      }      case GreenPixelChannel:      {        composite[i]=ClampToQuantum(gamma*MagickOver_((double) q[i],beta,          (double) p->green,alpha));        break;      }      case BluePixelChannel:      {        composite[i]=ClampToQuantum(gamma*MagickOver_((double) q[i],beta,          (double) p->blue,alpha));        break;      }      case BlackPixelChannel:      {        composite[i]=ClampToQuantum(gamma*MagickOver_((double) q[i],beta,          (double) p->black,alpha));        break;      }      case AlphaPixelChannel:      {        composite[i]=ClampToQuantum(QuantumRange*(Sa*(-Da)+Sa+Da));        break;      }      default:        break;    }  }}
开发者ID:saitoha,项目名称:ImageMagick-V7-SIXEL,代码行数:61,


示例18: assert

//.........这里部分代码省略.........      }      case ExchangeChannelOp:      case TransferChannelOp:      {        i=ParsePixelChannelOption(token);        if (i < 0)          {            (void) ThrowMagickException(exception,GetMagickModule(),OptionError,              "UnrecognizedChannelType","`%s'",token);            destination_image=DestroyImageList(destination_image);            return(destination_image);          }        destination_channel=(PixelChannel) i;        switch (destination_channel)        {          case RedPixelChannel:          case GreenPixelChannel:          case BluePixelChannel:          case BlackPixelChannel:          case IndexPixelChannel:            break;          case AlphaPixelChannel:          {            destination_image->alpha_trait=BlendPixelTrait;            break;          }          case ReadMaskPixelChannel:          {            destination_image->read_mask=MagickTrue;            break;          }          case WriteMaskPixelChannel:          {            destination_image->write_mask=MagickTrue;            break;          }          case MetaPixelChannel:          default:          {            (void) SetPixelMetaChannels(destination_image,(size_t) (i-              GetPixelChannels(destination_image)+1),exception);            break;          }        }        channel_mask=(ChannelType) (channel_mask | ParseChannelOption(token));        if (((channels >= 1)  || (destination_channel >= 1)) &&            (IsGrayColorspace(destination_image->colorspace) != MagickFalse))          (void) SetImageColorspace(destination_image,sRGBColorspace,exception);        GetMagickToken(p,&p,token);        break;      }      default:        break;    }    status=ChannelImage(destination_image,destination_channel,channel_op,      source_image,source_channel,ClampToQuantum(pixel),exception);    if (status == MagickFalse)      {        destination_image=DestroyImageList(destination_image);        break;      }    channels++;    if (channel_op == ExchangeChannelOp)      {        status=ChannelImage(destination_image,source_channel,channel_op,          source_image,destination_channel,ClampToQuantum(pixel),exception);        if (status == MagickFalse)          {            destination_image=DestroyImageList(destination_image);            break;          }        channels++;      }    switch (channel_op)    {      case ExtractChannelOp:      {        channel_mask=(ChannelType) (channel_mask | (1 << destination_channel));        destination_channel=(PixelChannel) (destination_channel+1);        break;      }      default:        break;    }    status=SetImageProgress(source_image,ChannelFxImageTag,p-expression,      strlen(expression));    if (status == MagickFalse)      break;  }  SetPixelChannelMask(destination_image,channel_mask);  if ((channel_op == ExtractChannelOp) && (channels == 1))    (void) SetImageColorspace(destination_image,GRAYColorspace,exception);  status=SetImageStorageClass(destination_image,DirectClass,exception);  if (status == MagickFalse)    {      destination_image=GetLastImageInList(destination_image);      return((Image *) NULL);    }  return(GetFirstImageInList(destination_image));}
开发者ID:saitoha,项目名称:ImageMagick-V7-SIXEL,代码行数:101,


示例19: ReadRLEImage

//.........这里部分代码省略.........                break;              for (x=0; x < (ssize_t) image->columns; x++)              {                SetPixelIndex(image,*p++,q);                q+=GetPixelChannels(image);              }              if (SyncAuthenticPixels(image,exception) == MagickFalse)                break;              if (image->previous == (Image *) NULL)                {                  status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)                    y,image->rows);                  if (status == MagickFalse)                    break;                }            }            (void) SyncImage(image,exception);          }        else          {            /*              Image has a matte channel-- promote to DirectClass.            */            for (y=0; y < (ssize_t) image->rows; y++)            {              q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);              if (q == (Quantum *) NULL)                break;              for (x=0; x < (ssize_t) image->columns; x++)              {                if (IsValidColormapIndex(image,(ssize_t) *p++,&index,                    exception) == MagickFalse)                  break;                SetPixelRed(image,ClampToQuantum(image->colormap[(ssize_t)                  index].red),q);                if (IsValidColormapIndex(image,(ssize_t) *p++,&index,                    exception) == MagickFalse)                  break;                SetPixelGreen(image,ClampToQuantum(image->colormap[(ssize_t)                  index].green),q);                if (IsValidColormapIndex(image,(ssize_t) *p++,&index,                    exception) == MagickFalse)                  break;                SetPixelBlue(image,ClampToQuantum(image->colormap[(ssize_t)                  index].blue),q);                SetPixelAlpha(image,ScaleCharToQuantum(*p++),q);                q+=GetPixelChannels(image);              }              if (x < (ssize_t) image->columns)                break;              if (SyncAuthenticPixels(image,exception) == MagickFalse)                break;              if (image->previous == (Image *) NULL)                {                  status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)                    y,image->rows);                  if (status == MagickFalse)                    break;                }            }            image->colormap=(PixelInfo *) RelinquishMagickMemory(              image->colormap);            image->storage_class=DirectClass;            image->colors=0;          }      }
开发者ID:freehawkzk,项目名称:ImageMagick,代码行数:67,


示例20: GetImageDepth

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   G e t I m a g e D e p t h                                                 %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  GetImageDepth() returns the depth of a particular image channel.%%  The format of the GetImageDepth method is:%%      size_t GetImageDepth(const Image *image,ExceptionInfo *exception)%%  A description of each parameter follows:%%    o image: the image.%%    o exception: return any errors or warnings in this structure.%*/MagickExport size_t GetImageDepth(const Image *image,ExceptionInfo *exception){  CacheView    *image_view;  MagickBooleanType    status;  register ssize_t    id;  size_t    *current_depth,    depth,    number_threads;  ssize_t    y;  /*    Compute image depth.  */  assert(image != (Image *) NULL);  assert(image->signature == MagickSignature);  if (image->debug != MagickFalse)    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);  number_threads=(size_t) GetMagickResourceLimit(ThreadResource);  current_depth=(size_t *) AcquireQuantumMemory(number_threads,    sizeof(*current_depth));  if (current_depth == (size_t *) NULL)    ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");  status=MagickTrue;  for (id=0; id < (ssize_t) number_threads; id++)    current_depth[id]=1;  if ((image->storage_class == PseudoClass) && (image->alpha_trait != BlendPixelTrait))    {      register ssize_t        i;#if defined(MAGICKCORE_OPENMP_SUPPORT)      #pragma omp parallel for schedule(static,4) shared(status) /        if ((image->colors) > 256) /          num_threads(GetMagickResourceLimit(ThreadResource))#endif      for (i=0; i < (ssize_t) image->colors; i++)      {        const int          id = GetOpenMPThreadId();        if (status == MagickFalse)          continue;        while (current_depth[id] < MAGICKCORE_QUANTUM_DEPTH)        {          MagickStatusType            status;          QuantumAny            range;          status=0;          range=GetQuantumRange(current_depth[id]);          if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)            status|=ClampToQuantum(image->colormap[i].red) !=              ScaleAnyToQuantum(ScaleQuantumToAny(ClampToQuantum(              image->colormap[i].red),range),range);          if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)            status|=ClampToQuantum(image->colormap[i].green) !=              ScaleAnyToQuantum(ScaleQuantumToAny(ClampToQuantum(              image->colormap[i].green),range),range);          if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)            status|=ClampToQuantum(image->colormap[i].blue) !=              ScaleAnyToQuantum(ScaleQuantumToAny(ClampToQuantum(              image->colormap[i].blue),range),range);          if (status == 0)            break;          current_depth[id]++;//.........这里部分代码省略.........
开发者ID:epu,项目名称:ImageMagick,代码行数:101,


示例21: 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,


示例22: assert

//.........这里部分代码省略.........    /*      Verify that required image information is defined.    */    if (comment != (char *) NULL)    {        (void) SetImageProperty(image,"comment",comment);        comment=DestroyString(comment);    }    if (EOFBlob(image) != MagickFalse)        ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",                           image->filename);    number_pixels=(MagickSizeType) fits_info.columns*fits_info.rows;    if ((fits_info.simple == MagickFalse) || (fits_info.number_axes < 1) ||            (fits_info.number_axes > 4) || (number_pixels == 0))        ThrowReaderException(CorruptImageError,"ImageTypeNotSupported");    for (scene=0; scene < (ssize_t) fits_info.number_planes; scene++)    {        image->columns=(size_t) fits_info.columns;        image->rows=(size_t) fits_info.rows;        image->depth=(size_t) (fits_info.bits_per_pixel < 0 ? -1 : 1)*                     fits_info.bits_per_pixel;        image->endian=fits_info.endian;        image->scene=(size_t) scene;        if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))            if (image->scene >= (image_info->scene+image_info->number_scenes-1))                break;        /*          Initialize image structure.        */        if ((fits_info.min_data != 0.0) || (fits_info.max_data != 0.0))        {            if ((fits_info.bits_per_pixel != 0) && (fits_info.max_data == 0.0))                fits_info.max_data=GetFITSPixelRange((size_t)                                                     fits_info.bits_per_pixel);        }        else            GetFITSPixelExtrema(image,fits_info.bits_per_pixel,&fits_info.min_data,                                &fits_info.max_data);        /*          Convert FITS pixels to pixel packets.        */        scale=(double) QuantumRange/(fits_info.scale*(fits_info.max_data-                                     fits_info.min_data)+fits_info.zero);        for (y=(ssize_t) image->rows-1; y >= 0; y--)        {            q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);            if (q == (PixelPacket *) NULL)                break;            for (x=0; x < (ssize_t) image->columns; x++)            {                pixel=GetFITSPixel(image,fits_info.bits_per_pixel);                SetPixelRed(q,ClampToQuantum(scale*(fits_info.scale*(pixel-                                                    fits_info.min_data)+fits_info.zero)));                SetPixelGreen(q,GetPixelRed(q));                SetPixelBlue(q,GetPixelRed(q));                q++;            }            if (SyncAuthenticPixels(image,exception) == MagickFalse)                break;            if (image->previous == (Image *) NULL)            {                status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,                                        image->rows);                if (status == MagickFalse)                    break;            }        }        if (EOFBlob(image) != MagickFalse)        {            ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",                               image->filename);            break;        }        /*          Proceed to next image.        */        if (image_info->number_scenes != 0)            if (image->scene >= (image_info->scene+image_info->number_scenes-1))                break;        if (scene < (ssize_t) (fits_info.number_planes-1))        {            /*              Allocate next image structure.            */            AcquireNextImage(image_info,image);            if (GetNextImageInList(image) == (Image *) NULL)            {                image=DestroyImageList(image);                return((Image *) NULL);            }            image=SyncNextImageInList(image);            status=SetImageProgress(image,LoadImagesTag,TellBlob(image),                                    GetBlobSize(image));            if (status == MagickFalse)                break;        }    }    (void) CloseBlob(image);    return(GetFirstImageInList(image));}
开发者ID:Deni-al,项目名称:Android-ImageMagick,代码行数:101,


示例23: SetImageAlphaChannel

//.........这里部分代码省略.........        y;      /*        Flatten image pixels over the background pixels.      */      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          x;        if (status == MagickFalse)          continue;        q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,          exception);        if (q == (PixelPacket *) NULL)          {            status=MagickFalse;            continue;          }        for (x=0; x < (ssize_t) image->columns; x++)        {          double            gamma,            opacity;          gamma=1.0-QuantumScale*QuantumScale*q->opacity*pixel.opacity;          opacity=(double) QuantumRange*(1.0-gamma);          gamma=PerceptibleReciprocal(gamma);          q->red=ClampToQuantum(gamma*MagickOver_((MagickRealType) q->red,            (MagickRealType) q->opacity,(MagickRealType) pixel.red,            (MagickRealType) pixel.opacity));          q->green=ClampToQuantum(gamma*MagickOver_((MagickRealType) q->green,            (MagickRealType) q->opacity,(MagickRealType) pixel.green,            (MagickRealType) pixel.opacity));          q->blue=ClampToQuantum(gamma*MagickOver_((MagickRealType) q->blue,            (MagickRealType) q->opacity,(MagickRealType) pixel.blue,            (MagickRealType) pixel.opacity));          q->opacity=ClampToQuantum(opacity);          q++;        }        if (image->colorspace == CMYKColorspace)          {            indexes=GetCacheViewAuthenticIndexQueue(image_view);            for (x=0; x < (ssize_t) image->columns; x++)              SetPixelIndex(indexes+x,index);          }        if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)          status=MagickFalse;      }      image_view=DestroyCacheView(image_view);      return(status);    }    case ResetAlphaChannel: /* deprecated */    case OpaqueAlphaChannel:    {      status=SetImageOpacity(image,OpaqueOpacity);      break;    }    case SetAlphaChannel:    {      if (image->matte == MagickFalse)        status=SetImageOpacity(image,OpaqueOpacity);      break;    }    case TransparentAlphaChannel:    {      status=SetImageOpacity(image,TransparentOpacity);      break;    }    case UndefinedAlphaChannel:      break;  }  if (status == MagickFalse)    return(status);  return(SyncImagePixelCache(image,&image->exception));}
开发者ID:abzolute0,项目名称:Ruby_Blog,代码行数:101,


示例24: WriteCIPImage

//.........这里部分代码省略.........  const char    *value;  MagickBooleanType    status;  register const Quantum    *p;  register ssize_t    i,    x;  ssize_t    y;  unsigned char    byte;  /*    Open output image file.  */  assert(image_info != (const ImageInfo *) NULL);  assert(image_info->signature == MagickCoreSignature);  assert(image != (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);  status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);  if (status == MagickFalse)    return(status);  (void) WriteBlobString(image,"<CiscoIPPhoneImage>/n");  value=GetImageProperty(image,"label",exception);  if (value != (const char *) NULL)    (void) FormatLocaleString(buffer,MagickPathExtent,"<Title>%s</Title>/n",value);  else    {      char        basename[MagickPathExtent];      GetPathComponent(image->filename,BasePath,basename);      (void) FormatLocaleString(buffer,MagickPathExtent,"<Title>%s</Title>/n",        basename);    }  (void) WriteBlobString(image,buffer);  (void) FormatLocaleString(buffer,MagickPathExtent,    "<LocationX>%.20g</LocationX>/n",(double) image->page.x);  (void) WriteBlobString(image,buffer);  (void) FormatLocaleString(buffer,MagickPathExtent,    "<LocationY>%.20g</LocationY>/n",(double) image->page.y);  (void) WriteBlobString(image,buffer);  (void) FormatLocaleString(buffer,MagickPathExtent,"<Width>%.20g</Width>/n",    (double) (image->columns+(image->columns % 2)));  (void) WriteBlobString(image,buffer);  (void) FormatLocaleString(buffer,MagickPathExtent,"<Height>%.20g</Height>/n",    (double) image->rows);  (void) WriteBlobString(image,buffer);  (void) FormatLocaleString(buffer,MagickPathExtent,"<Depth>2</Depth>/n");  (void) WriteBlobString(image,buffer);  (void) WriteBlobString(image,"<Data>");  (void) TransformImageColorspace(image,sRGBColorspace,exception);  for (y=0; y < (ssize_t) image->rows; y++)  {    p=GetVirtualPixels(image,0,y,image->columns,1,exception);    if (p == (const Quantum *) NULL)      break;    for (x=0; x < ((ssize_t) image->columns-3); x+=4)    {      byte=(unsigned char)        ((((size_t) (3*ClampToQuantum(GetPixelLuma(image,p+3))/QuantumRange) & 0x03) << 6) |         (((size_t) (3*ClampToQuantum(GetPixelLuma(image,p+2))/QuantumRange) & 0x03) << 4) |         (((size_t) (3*ClampToQuantum(GetPixelLuma(image,p+1))/QuantumRange) & 0x03) << 2) |         (((size_t) (3*ClampToQuantum(GetPixelLuma(image,p+0))/QuantumRange) & 0x03) << 0));      (void) FormatLocaleString(buffer,MagickPathExtent,"%02x",byte);      (void) WriteBlobString(image,buffer);      p+=4;    }    if ((image->columns % 4) != 0)      {        i=(ssize_t) image->columns % 4;        byte=(unsigned char)          ((((size_t) (3*ClampToQuantum(GetPixelLuma(image,p+MagickMin(i,3)))/QuantumRange) & 0x03) << 6) |           (((size_t) (3*ClampToQuantum(GetPixelLuma(image,p+MagickMin(i,2)))/QuantumRange) & 0x03) << 4) |           (((size_t) (3*ClampToQuantum(GetPixelLuma(image,p+MagickMin(i,1)))/QuantumRange) & 0x03) << 2) |           (((size_t) (3*ClampToQuantum(GetPixelLuma(image,p+MagickMin(i,0)))/QuantumRange) & 0x03) << 0));        (void) FormatLocaleString(buffer,MagickPathExtent,"%02x",~byte);        (void) WriteBlobString(image,buffer);      }    status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,      image->rows);    if (status == MagickFalse)      break;  }  (void) WriteBlobString(image,"</Data>/n");  (void) WriteBlobString(image,"</CiscoIPPhoneImage>/n");  (void) CloseBlob(image);  return(MagickTrue);}
开发者ID:278443820,项目名称:ImageMagick,代码行数:101,


示例25: 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[MaxTextExtent];  MagickBooleanType    status;  MagickPixelPacket    start_pixel,    stop_pixel;  PixelPacket    start_color,    stop_color;  Image    *image;  /*    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);  image=AcquireImage(image_info);  if ((image->columns == 0) || (image->rows == 0))    ThrowReaderException(OptionError,"MustSpecifyImageSize");  (void) SetImageOpacity(image,(Quantum) TransparentOpacity);  (void) CopyMagickString(image->filename,image_info->filename,MaxTextExtent);  (void) CopyMagickString(colorname,image_info->filename,MaxTextExtent);  (void) sscanf(image_info->filename,"%[^-]",colorname);  if (QueryColorDatabase(colorname,&start_color,exception) == MagickFalse)    {      image=DestroyImage(image);      return((Image *) NULL);    }  (void) QueryMagickColor(colorname,&start_pixel,exception);  (void) CopyMagickString(colorname,"white",MaxTextExtent);  if (PixelIntensityToQuantum(image,&start_color) > (Quantum) (QuantumRange/2))    (void) CopyMagickString(colorname,"black",MaxTextExtent);  (void) sscanf(image_info->filename,"%*[^-]-%s",colorname);  if (QueryColorDatabase(colorname,&stop_color,exception) == MagickFalse)    {      image=DestroyImage(image);      return((Image *) NULL);    }  (void) QueryMagickColor(colorname,&stop_pixel,exception);  if (IssRGBColorspace(start_pixel.colorspace) != MagickFalse)    {      start_color.red=ClampToQuantum(QuantumRange*DecompandsRGB(QuantumScale*        start_color.red));      start_color.green=ClampToQuantum(QuantumRange*DecompandsRGB(QuantumScale*        start_color.green));      start_color.blue=ClampToQuantum(QuantumRange*DecompandsRGB(QuantumScale*        start_color.blue));    }  if (IssRGBColorspace(stop_pixel.colorspace) != MagickFalse)    {      stop_color.red=ClampToQuantum(QuantumRange*DecompandsRGB(QuantumScale*        stop_color.red));      stop_color.green=ClampToQuantum(QuantumRange*DecompandsRGB(QuantumScale*        stop_color.green));      stop_color.blue=ClampToQuantum(QuantumRange*DecompandsRGB(QuantumScale*        stop_color.blue));    }  status=GradientImage(image,LocaleCompare(image_info->magick,"GRADIENT") == 0 ?//.........这里部分代码省略.........
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,


示例26: assert

//.........这里部分代码省略.........    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()];    for (x=0; x < (ssize_t) linear_image->columns; x++)    {      register ssize_t        i,        u;      size_t        count;      ssize_t        j,        k,        n,        v;      /*        Assign most frequent color.      */      k=0;      j=0;      count=0;      (void) ResetMagickMemory(histogram,0,NumberPaintBins* sizeof(*histogram));      for (v=0; v < (ssize_t) width; v++)      {        for (u=0; u < (ssize_t) width; u++)        {          n=(ssize_t) ScaleQuantumToChar(ClampToQuantum(GetPixelIntensity(            linear_image,p+GetPixelChannels(linear_image)*(u+k))));          histogram[n]++;          if (histogram[n] > count)            {              j=k+u;              count=histogram[n];            }        }        k+=(ssize_t) (linear_image->columns+width);      }      for (i=0; i < (ssize_t) GetPixelChannels(linear_image); i++)      {        PixelChannel channel=GetPixelChannelChannel(linear_image,i);        PixelTrait traits=GetPixelChannelTraits(linear_image,channel);        PixelTrait paint_traits=GetPixelChannelTraits(paint_image,channel);        if ((traits == UndefinedPixelTrait) ||            (paint_traits == UndefinedPixelTrait))          continue;        if (((paint_traits & CopyPixelTrait) != 0) ||            (GetPixelReadMask(linear_image,p) == 0))          {            SetPixelChannel(paint_image,channel,p[center+i],q);            continue;          }        SetPixelChannel(paint_image,channel,p[j*GetPixelChannels(linear_image)+          i],q);      }      p+=GetPixelChannels(linear_image);      q+=GetPixelChannels(paint_image);    }    if (SyncCacheViewAuthenticPixels(paint_view,exception) == MagickFalse)      status=MagickFalse;    if (linear_image->progress_monitor != (MagickProgressMonitor) NULL)      {        MagickBooleanType          proceed;#if defined(MAGICKCORE_OPENMP_SUPPORT)        #pragma omp critical (MagickCore_OilPaintImage)#endif        proceed=SetImageProgress(linear_image,OilPaintImageTag,progress++,          linear_image->rows);        if (proceed == MagickFalse)          status=MagickFalse;      }  }  paint_view=DestroyCacheView(paint_view);  image_view=DestroyCacheView(image_view);  histograms=DestroyHistogramThreadSet(histograms);  linear_image=DestroyImage(linear_image);  if (status == MagickFalse)    paint_image=DestroyImage(paint_image);  return(paint_image);}
开发者ID:eulerhit,项目名称:ImageMagick,代码行数:101,


示例27: ConvertHSBToRGB

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                                                                             %%                                                                             %%                                                                             %%   C o n v e r t H S B T o R G B                                             %%                                                                             %%                                                                             %%                                                                             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  ConvertHSBToRGB() transforms a (hue, saturation, brightness) to a (red,%  green, blue) triple.%%  The format of the ConvertHSBToRGBImage method is:%%      void ConvertHSBToRGB(const double hue,const double saturation,%        const double brightness,Quantum *red,Quantum *green,Quantum *blue)%%  A description of each parameter follows:%%    o hue, saturation, brightness: A double value representing a%      component of the HSB color space.%%    o red, green, blue: A pointer to a pixel component of type Quantum.%*/MagickExport void ConvertHSBToRGB(const double hue,const double saturation,  const double brightness,Quantum *red,Quantum *green,Quantum *blue){  MagickRealType    f,    h,    p,    q,    t;  /*    Convert HSB to RGB colorspace.  */  assert(red != (Quantum *) NULL);  assert(green != (Quantum *) NULL);  assert(blue != (Quantum *) NULL);  if (saturation == 0.0)    {      *red=ClampToQuantum((MagickRealType) QuantumRange*brightness);      *green=(*red);      *blue=(*red);      return;    }  h=6.0*(hue-floor(hue));  f=h-floor((double) h);  p=brightness*(1.0-saturation);  q=brightness*(1.0-saturation*f);  t=brightness*(1.0-(saturation*(1.0-f)));  switch ((int) h)  {    case 0:    default:    {      *red=ClampToQuantum((MagickRealType) QuantumRange*brightness);      *green=ClampToQuantum((MagickRealType) QuantumRange*t);      *blue=ClampToQuantum((MagickRealType) QuantumRange*p);      break;    }    case 1:    {      *red=ClampToQuantum((MagickRealType) QuantumRange*q);      *green=ClampToQuantum((MagickRealType) QuantumRange*brightness);      *blue=ClampToQuantum((MagickRealType) QuantumRange*p);      break;    }    case 2:    {      *red=ClampToQuantum((MagickRealType) QuantumRange*p);      *green=ClampToQuantum((MagickRealType) QuantumRange*brightness);      *blue=ClampToQuantum((MagickRealType) QuantumRange*t);      break;    }    case 3:    {      *red=ClampToQuantum((MagickRealType) QuantumRange*p);      *green=ClampToQuantum((MagickRealType) QuantumRange*q);      *blue=ClampToQuantum((MagickRealType) QuantumRange*brightness);      break;    }    case 4:    {      *red=ClampToQuantum((MagickRealType) QuantumRange*t);      *green=ClampToQuantum((MagickRealType) QuantumRange*p);      *blue=ClampToQuantum((MagickRealType) QuantumRange*brightness);      break;    }    case 5:    {      *red=ClampToQuantum((MagickRealType) QuantumRange*brightness);      *green=ClampToQuantum((MagickRealType) QuantumRange*p);      *blue=ClampToQuantum((MagickRealType) QuantumRange*q);      break;    }//.........这里部分代码省略.........
开发者ID:271845221,项目名称:Android-ImageMagick,代码行数:101,


示例28: RaiseImage

//.........这里部分代码省略.........      foreground=(Quantum) 0;      background=(Quantum) QuantumRange;    }  if (SetImageStorageClass(image,DirectClass) == MagickFalse)    return(MagickFalse);  /*    Raise image.  */  status=MagickTrue;  progress=0;  exception=(&image->exception);  image_view=AcquireCacheView(image);#if defined(MAGICKCORE_OPENMP_SUPPORT)   #pragma omp parallel for schedule(dynamic,4) shared(progress,status) omp_throttle(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)      {        status=MagickFalse;        continue;      }    for (x=0; x < y; x++)    {      q->red=ClampToQuantum(QuantumScale*((MagickRealType) q->red*        HighlightFactor+(MagickRealType) foreground*(QuantumRange-        HighlightFactor)));      q->green=ClampToQuantum(QuantumScale*((MagickRealType) q->green*        HighlightFactor+(MagickRealType) foreground*(QuantumRange-        HighlightFactor)));      q->blue=ClampToQuantum(QuantumScale*((MagickRealType) q->blue*        HighlightFactor+(MagickRealType) foreground*(QuantumRange-        HighlightFactor)));      q++;    }    for ( ; x < (ssize_t) (image->columns-y); x++)    {      q->red=ClampToQuantum(QuantumScale*((MagickRealType) q->red*        AccentuateFactor+(MagickRealType) foreground*(QuantumRange-        AccentuateFactor)));      q->green=ClampToQuantum(QuantumScale*((MagickRealType) q->green*        AccentuateFactor+(MagickRealType) foreground*(QuantumRange-        AccentuateFactor)));      q->blue=ClampToQuantum(QuantumScale*((MagickRealType) q->blue*        AccentuateFactor+(MagickRealType) foreground*(QuantumRange-        AccentuateFactor)));      q++;    }    for ( ; x < (ssize_t) image->columns; x++)    {      q->red=ClampToQuantum(QuantumScale*((MagickRealType) q->red*ShadowFactor+        (MagickRealType) background*(QuantumRange-ShadowFactor)));      q->green=ClampToQuantum(QuantumScale*((MagickRealType) q->green*        ShadowFactor+(MagickRealType) background*(QuantumRange-ShadowFactor)));      q->blue=ClampToQuantum(QuantumScale*((MagickRealType) q->blue*        ShadowFactor+(MagickRealType) background*(QuantumRange-ShadowFactor)));      q++;
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:67,



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


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