def png(file, box, paint, trans)
      Squib.logger.debug {"RENDERING PNG: \n  file: #{file}\n  box: #{box}\n  paint: #{paint}\n  trans: #{trans}"}
      return if file.nil? or file.eql? ''
      png = Squib.cache_load_image(file)
      use_cairo do |cc|
        cc.translate(box.x, box.y)
        box.width    = png.width.to_f  if box.width  == :native
        box.height   = png.height.to_f if box.height == :native
        box.width    = png.width.to_f * box.height.to_f / png.height.to_f if box.width == :scale
        box.height   = png.height.to_f * box.width.to_f / png.width.to_f  if box.height == :scale

        scale_width  = box.width.to_f / png.width.to_f
        scale_height = box.height.to_f / png.height.to_f
        warn_png_scale(file, scale_width, scale_height)
        cc.scale(scale_width, scale_height)

        cc.rotate(trans.angle)
        cc.flip(trans.flip_vertical, trans.flip_horizontal, box.width / 2, box.height / 2)
        cc.translate(-box.x, -box.y)

        trans.crop_width  = png.width.to_f  if trans.crop_width  == :native
        trans.crop_height = png.height.to_f if trans.crop_height == :native
        cc.rounded_rectangle(box.x, box.y, trans.crop_width, trans.crop_height, trans.crop_corner_x_radius, trans.crop_corner_y_radius)
        cc.clip
        cc.translate(-trans.crop_x, -trans.crop_y)


        cc.set_source(png, box.x, box.y)
        cc.operator = paint.blend unless paint.blend == :none
        if paint.mask.empty?
          cc.paint(paint.alpha)
        else
          cc.set_source_squibcolor(paint.mask)
          cc.mask(png, box.x, box.y)
        end
      end
    end
def png(file, box, paint, trans)
      Squib.logger.debug {"RENDERING PNG: \n  file: #{file}\n  box: #{box}\n  paint: #{paint}\n  trans: #{trans}"}
      return if file.nil? or file.eql? ''
      png = Squib.cache_load_image(file)
      use_cairo do |cc|
        cc.translate(box.x, box.y)
        box.width    = png.width.to_f  if box.width  == :native
        box.height   = png.height.to_f if box.height == :native
        box.width    = png.width.to_f * box.height.to_f / png.height.to_f if box.width == :scale
        box.height   = png.height.to_f * box.width.to_f / png.width.to_f  if box.height == :scale

        scale_width  = box.width.to_f / png.width.to_f
        scale_height = box.height.to_f / png.height.to_f
        warn_png_scale(file, scale_width, scale_height)
        cc.scale(scale_width, scale_height)

        cc.rotate(trans.angle)
        cc.flip(trans.flip_vertical, trans.flip_horizontal, box.width / 2, box.height / 2)
        cc.translate(-box.x, -box.y)

        trans.crop_width  = png.width.to_f  if trans.crop_width  == :native
        trans.crop_height = png.height.to_f if trans.crop_height == :native
        cc.rounded_rectangle(box.x, box.y, trans.crop_width, trans.crop_height, trans.crop_corner_x_radius, trans.crop_corner_y_radius)
        cc.clip
        cc.translate(-trans.crop_x, -trans.crop_y)


        cc.set_source(png, box.x, box.y)
        cc.operator = paint.blend unless paint.blend == :none
        if paint.mask.empty?
          cc.paint(paint.alpha)
        else
          cc.set_source_squibcolor(paint.mask)
          cc.mask(png, box.x, box.y)
        end
      end
    end
:nodoc:
 @api private