Ejemplo n.º 1
0
void
padding::boi (const context& ctx)
{
  logic_error e
    (_("padding only works with raster images of known size"));

  if (!ctx.is_raster_image ())
    BOOST_THROW_EXCEPTION (e);
  if (0 != ctx.padding_octets ()
      && context::unknown_size == ctx.width ())
    BOOST_THROW_EXCEPTION (e);
  if (0 != ctx.padding_lines ()
      && context::unknown_size == ctx.height ())
    BOOST_THROW_EXCEPTION (e);

  w_padding_ = ctx.padding_octets ();
  h_padding_ = ctx.padding_lines ();
  scan_line_count_ = 0;
  skip_ = 0;

  ctx_ = ctx;
  ctx_.width (ctx.width (), 0);          // zap our padding settings
  ctx_.height (ctx.height (), 0);
}