09/05/04 20:05:28
>>708
前に画像ビューア作ってたとき、漏れはこんな感じで
PixbufLoaderとcairo使ってごにょごにょやってた
require "gtk2"
ploader = Gdk::PixbufLoader.new
ploader.write($stdin.read)
ploader.close
drawing_area = Gtk::DrawingArea.new
window = Gtk::Window.new
window.signal_connect("destroy") do
Gtk.main_quit
false
end
drawing_area.signal_connect("expose-event") do |w, e|
context = w.window.create_cairo_context
context.save do
context.set_source_pixbuf(ploader.pixbuf)
context.paint
end
true
end
window.add(drawing_area)
window.show_all
Gtk.main