
Shoes.app :height => 400, :width => 400 do
  background gradient('888855', 'bbaa88')

  def snapshot(options = {}, &block)
    options[:format]   ||= :svg

    options[:filename] ||= ( tf_path = ( require 'tempfile'
                 tf = Tempfile.new(File.basename(__FILE__)).path ))

    _snapshot options do
      block.call
    end
    return File.read(options[:filename])
  ensure
    File.unlink(tf_path) if tf_path
  end

  fill gradient(blue, '440000')

  def gray_square
    strokewidth 4
    stroke white 
    fill gray(50)
    rect 30,30,120,120
  end

  svg = snapshot{  gray_square  }
  puts
  puts 'the larger gray square looks like this:'
  puts
  puts svg
  puts
  gray_square  #  also put it on the screen
  stroke gradient(orange, blue)  #  smaller square inside it
  obj = rect(40,40,100,100)
end


