class Qt::Image

Public Class Methods

from_renderer(size, renderer, id = nil) click to toggle source

Render an svg object onto a new image of the specified size. If id is not specified, the whole svg file is rendered.

# File lib/rui/toolkits/qtbase/qt.rb, line 82
def self.from_renderer(size, renderer, id = nil)
  img = Qt::Image.painted(size) do |p| 
    if id
      renderer.render(p, id)
    else
      renderer.render(p)
    end
  end
  img
end
painted(size, &blk) click to toggle source

Paint on an image using the given block. The block is passed a painter to use for drawing.

# File lib/rui/toolkits/qtbase/qt.rb, line 71
def self.painted(size, &blk)
  img = Qt::Image.new(size.x, size.y, Qt::Image::Format_ARGB32_Premultiplied)
  img.fill(0)
  Qt::Painter.new(img).paint(&blk)
  img
end

Public Instance Methods

to_pix() click to toggle source

Convert this image to a pixmap.

# File lib/rui/toolkits/qtbase/qt.rb, line 63
def to_pix
  Qt::Pixmap.from_image self
end