• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Ruby GTK3移行後のメインリポジトリ


コミットメタ情報

リビジョン9d98778b26e76ea7b91168b6c82c8500e70aa66f (tree)
日時2015-03-18 22:56:55
作者Shyouzou Sugitani <shy@user...>
コミッターShyouzou Sugitani

ログメッセージ

update pix.rb

変更サマリ

差分

--- a/lib/ninix/balloon.rb
+++ b/lib/ninix/balloon.rb
@@ -1166,6 +1166,7 @@ module Balloon
11661166 end
11671167 redraw_arrow0(widget, cr)
11681168 redraw_arrow1(widget, cr)
1169+ @window.set_shape(cr)
11691170 return false
11701171 end
11711172
--- a/lib/ninix/kinoko.rb
+++ b/lib/ninix/kinoko.rb
@@ -416,6 +416,7 @@ module Kinoko
416416 cr.set_operator(Cairo::OPERATOR_SOURCE)
417417 cr.paint()
418418 print("REDRAW: ", cr, "\n")
419+ @window.set_shape(cr)
419420 end
420421
421422 def get_image_surface(surface_id)
--- a/lib/ninix/nekodorif.rb
+++ b/lib/ninix/nekodorif.rb
@@ -379,6 +379,7 @@ module Nekodorif
379379 cr.set_source(@image_surface, 0, 0)
380380 cr.set_operator(Cairo::OPERATOR_SOURCE)
381381 cr.paint()
382+ @window.set_shape(cr)
382383 end
383384
384385 def delete()#widget, event)
--- a/lib/ninix/pix.rb
+++ b/lib/ninix/pix.rb
@@ -94,6 +94,21 @@ module Pix
9494 new_y = ((y - (surface_y - window_y)) * 100 / scale).to_i
9595 return new_x, new_y
9696 end
97+
98+ def set_shape(cr)
99+ w, h = size
100+ image_surface = cr.target.map_to_image
101+ region = Cairo::Region.new()
102+ data = image_surface.data
103+ for i in 0..(data.size / 4 - 1)
104+ if (data[i * 4 + 3].ord) != 0
105+ x = i % image_surface.width
106+ y = i / image_surface.width
107+ region.union!(x, y, 1, 1)
108+ end
109+ end
110+ input_shape_combine_region(region)
111+ end
97112 end
98113
99114
--- a/lib/ninix/surface.rb
+++ b/lib/ninix/surface.rb
@@ -1321,12 +1321,12 @@ module Surface
13211321 end
13221322
13231323 def get_image_surface(surface_id, is_asis=false)
1324- if not @surfaces.include?(surface_id.to_s)
1324+ if not @surfaces.include?(surface_id)
13251325 # logging.debug('cannot load surface #{0}'.format(surface_id))
13261326 print('cannot load surface #' + surface_id.to_s, "\n")
13271327 return Pix.create_blank_surface(100, 100)
13281328 end
1329- return create_surface_from_file(surface_id.to_s, is_asis=is_asis)
1329+ return create_surface_from_file(surface_id, is_asis=is_asis)
13301330 end
13311331
13321332 def draw_region(cr)
@@ -1456,6 +1456,7 @@ module Surface
14561456 if @parent.handle_request('GET', 'get_preference', 'check_collision')
14571457 draw_region(cr)
14581458 end
1459+ @window.set_shape(cr)
14591460 end
14601461
14611462 def remove_overlay(actor)
--- a/test/test-pix.rb
+++ b/test/test-pix.rb
@@ -23,16 +23,7 @@ module NinixTest
2323 cr.set_source(@surface, 0, 0)
2424 cr.set_operator(Cairo::OPERATOR_SOURCE)
2525 cr.paint
26- region = Cairo::Region.new()
27- data = @surface.data
28- for i in 0..(data.size / 4 - 1)
29- if (data[i * 4 + 3].ord) != 0
30- x = i % @surface.width
31- y = i / @surface.width
32- region.union!(x, y, 1, 1)
33- end
34- end
35- @win.input_shape_combine_region(region)
26+ @win.set_shape(cr)
3627 end
3728 end
3829 end