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


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

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


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

示例1: rv

context
magick::estimate (const context& ctx)
{
  double x_sample_factor = x_resolution_ / ctx.x_resolution ();
  double y_sample_factor = y_resolution_ / ctx.y_resolution ();

  context rv (ctx);

  rv.width  (ctx.width  () * x_sample_factor);
  rv.height (ctx.height () * y_sample_factor);
  rv.resolution (x_resolution_, y_resolution_);

  if (force_extent_)
    {
      rv.width  (width_  * x_resolution_);
      rv.height (height_ * y_resolution_);
    }

  if (image_format_)
    {
      /**/ if (image_format_ == "GIF" ) rv.content_type ("image/gif");
      else if (image_format_ == "JPEG") rv.content_type ("image/jpeg");
      else if (image_format_ == "PDF")
        {
          rv.content_type (bilevel_
                           ? "image/x-portable-bitmap"
                           : "image/jpeg");
        }
      else if (image_format_ == "PNG" ) rv.content_type ("image/png");
      else if (image_format_ == "PNM" )
        {
          rv.content_type ("image/x-portable-anymap");
        }
      else if (image_format_ == "TIFF") rv.content_type ("image/x-raster");
      else
        {
          // internal error
        }
    }
  else
    {
      rv.content_type ("image/x-raster");
    }

  if (bilevel_)
    {
      rv.depth (1);
    }
  return rv;
}
开发者ID:sirjaren,项目名称:utsushi,代码行数:50,代码来源:magick.cpp

示例2:

void
padding::eoi (const context& ctx)
{
  context::size_type padding;

  if (ctx_.width () >= ctx.width ())
    {
      padding = ctx_.scan_width () - ctx.scan_width ();

      if (padding)
        log::alert ("%1% padding octets remain") % padding;

      ctx_.width (ctx.width (), padding);
    }
  else
    {
      log::alert
        ("%1% pixels inadvertently cropped when removing padding octets")
        % (ctx.width () - ctx_.width ());
    }

  if (ctx_.height () >= ctx.height ())
    {
      padding = ctx_.scan_height () - ctx.scan_height ();

      if (padding)
        log::alert ("%1% padding scan lines remain") % padding;

      ctx_.height (ctx.height (), padding);
    }
  else
    {
      log::alert
        ("%1% pixels inadvertently cropped when removing padding lines")
        % (ctx.height () - ctx_.height ());
    }
}
开发者ID:jlpoolen,项目名称:utsushi,代码行数:37,代码来源:padding.cpp

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