Ruby GTK3移行後のメインリポジトリ
リビジョン | 50696d3cb1d8f1e17d899e19d89d707fa5e240af (tree) |
---|---|
日時 | 2014-03-22 19:28:50 |
作者 | Shyouzou Sugitani <shy@user...> |
コミッター | Shyouzou Sugitani |
update on the TEST of pix.rb
@@ -348,30 +348,27 @@ module Pix | ||
348 | 348 | return left, top, width, height |
349 | 349 | end |
350 | 350 | |
351 | -end | |
352 | - | |
353 | - | |
354 | -module TEST | |
355 | - | |
356 | - class Main < Pix::TransparentWindow | |
351 | + class TEST | |
357 | 352 | |
358 | 353 | def initialize(path) |
359 | - super() | |
360 | - signal_connect('destroy') do | |
354 | + @win = Pix::TransparentWindow.new | |
355 | + @win.signal_connect('destroy') do | |
361 | 356 | Gtk.main_quit |
362 | 357 | end |
363 | - @darea.signal_connect('draw') do |w, cr| | |
358 | + @win.darea.signal_connect('draw') do |w, cr| | |
364 | 359 | expose_cb(w, cr) |
365 | 360 | end |
366 | 361 | @surface = Pix.create_surface_from_file(path, true, true) |
367 | - set_default_size(@surface.width, @surface.height) | |
362 | + @win.set_default_size(@surface.width, @surface.height) | |
363 | + @win.show_all | |
364 | + Gtk.main | |
368 | 365 | end |
369 | 366 | |
370 | 367 | def expose_cb(widget, cr) |
371 | 368 | cr.set_source(@surface, 0, 0) |
372 | 369 | cr.set_operator(Cairo::OPERATOR_SOURCE) |
373 | 370 | cr.paint |
374 | - region = Cairo::Region.new()#cr.target) | |
371 | + region = Cairo::Region.new() | |
375 | 372 | data = @surface.data |
376 | 373 | for i in 0..(data.size / 4 - 1) |
377 | 374 | if (data[i * 4 + 3].ord) != 0 |
@@ -380,14 +377,12 @@ module TEST | ||
380 | 377 | region.union!(x, y, 1, 1) |
381 | 378 | end |
382 | 379 | end |
383 | - input_shape_combine_region(region) | |
380 | + @win.input_shape_combine_region(region) | |
384 | 381 | end |
385 | 382 | end |
386 | 383 | end |
387 | 384 | |
388 | -$:.unshift(File.dirname(__FILE__)) | |
389 | 385 | |
390 | -main = TEST::Main.new(ARGV.shift) | |
391 | -main.show_all | |
386 | +$:.unshift(File.dirname(__FILE__)) | |
392 | 387 | |
393 | -Gtk.main | |
388 | +Pix::TEST.new(ARGV.shift) |