Class: Qt::Image
Class Method Summary collapse
-
.from_renderer(size, renderer, id = nil) ⇒ Object
Render an svg object onto a new image of the specified size.
-
.painted(size, &blk) ⇒ Object
Paint on an image using the given block.
Instance Method Summary collapse
-
#to_pix ⇒ Object
Convert this image to a pixmap.
Class Method Details
.from_renderer(size, renderer, id = nil) ⇒ Object
Render an svg object onto a new image of the specified size. If id is not specified, the whole svg file is rendered.
82 83 84 85 86 87 88 89 90 91 |
# 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) ⇒ Object
Paint on an image using the given block. The block is passed a painter to use for drawing.
71 72 73 74 75 76 |
# 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 |