def trim(surface, trim, width, height)
      if trim > 0
        tmp = Cairo::ImageSurface.new(width - 2 * trim, height - 2 * trim)
        cc = Cairo::Context.new(tmp)
        cc.set_source(surface, -1 * trim, -1 * trim)
        cc.paint
        surface = tmp
      end
      surface
    end
def trim(surface, trim, width, height)
      if trim > 0
        tmp = Cairo::ImageSurface.new(width - 2 * trim, height - 2 * trim)
        cc = Cairo::Context.new(tmp)
        cc.set_source(surface, -1 * trim, -1 * trim)
        cc.paint
        surface = tmp
      end
      surface
    end
Return a new Cairo::ImageSurface that is trimmed from the original

 @param surface The surface to trim
 @param trim The number of pixels around the edge to trim
 @param width The width of the surface prior to the trim
 @param height The height of the surface prior to the trim
 :nodoc:
 @api private