当前位置: 首页>>代码示例>>C++>>正文


C++ context::depth方法代码示例

本文整理汇总了C++中context::depth方法的典型用法代码示例。如果您正苦于以下问题:C++ context::depth方法的具体用法?C++ context::depth怎么用?C++ context::depth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在context的用法示例。


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

示例1: if

std::string
magick::arguments (const context& ctx)
{
  using std::string;

  string argv;

  // Set up input data characteristics

  argv += " -size " + geom_(ctx.width (), ctx.height ());
  argv += " -depth " + lexical_cast< string > (ctx.depth ());
  argv += " -density " + geom_(ctx.x_resolution (), ctx.y_resolution ());
  argv += " -units PixelsPerInch";
  if (ctx.is_raster_image ())
    {
      /**/ if (ctx.is_rgb ())     argv += " rgb:-";
      else if (1 != ctx.depth ()) argv += " gray:-";
      else                        argv += " mono:-";
    }
  else
    argv += " -";

  // Pass output resolutions so they can be embedded where supported
  // by the data format.

  argv += " -density " + geom_(ctx_.x_resolution (), ctx_.y_resolution ());

  // Specify the "resampling" algorithm and parameters, if necessary.

  if (   x_resolution_ != ctx.x_resolution ()
      || y_resolution_ != ctx.y_resolution ())
    {
      double x_sample_factor = x_resolution_ / ctx.x_resolution ();
      double y_sample_factor = y_resolution_ / ctx.y_resolution ();

      argv += " -scale " + geom_(ctx.width ()  * x_sample_factor,
                                 ctx.height () * y_sample_factor) + "!";
    }

  if (force_extent_)
    argv += " -extent " + geom_(width_  * x_resolution_,
                                height_ * y_resolution_);

  if (color_correction_)
    {
      if (HAVE_IMAGE_MAGICK
          && !image_magick_version_before_("6.6.1-0"))
        argv += " -color-matrix";
      else
        argv += " -recolor";

      argv += " \"";
      for (size_t i = 0; i < sizeof (cct_) / sizeof (*cct_); ++i)
        argv += lexical_cast< string > (cct_[i]) + " ";
      argv += "\"";
    }

  if (bilevel_)
    {
      // Thresholding an already thresholded image should be safe
      argv += " -threshold " + lexical_cast< string > (threshold_) + "%";
      if (image_format_ == "PNG")
        {
          argv += " -monochrome";
        }
      else
        {
          argv += " -type bilevel";
        }
    }

  // Prevent GraphicsMagick from converting gray JPEG images to RGB
  if (HAVE_GRAPHICS_MAGICK && !ctx.is_rgb ())
    argv += " -colorspace gray";

  if (image_format_)
    {
      /**/ if (image_format_ == "GIF" ) argv += " gif:-";
      else if (image_format_ == "JPEG") argv += " jpeg:-";
      else if (image_format_ == "PDF" )
        {
          if (!bilevel_) argv += " jpeg:-";
          else           argv += " pbm:-";
        }
      else if (image_format_ == "PNG" ) argv += " png:-";
      else if (image_format_ == "PNM" ) argv += " pnm:-";
      else if (image_format_ == "TIFF")
        {
          argv += " -depth " + lexical_cast< string > (ctx_.depth ());
          /**/ if (ctx_.is_rgb ())
            argv += " rgb:-";
          else
            {
              if (HAVE_GRAPHICS_MAGICK
                  && bilevel_)
                argv += " mono:-";
              else
                argv += " gray:-";
            }
        }
//.........这里部分代码省略.........
开发者ID:sirjaren,项目名称:utsushi,代码行数:101,代码来源:magick.cpp


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