#!ruby -Ks # -*- mode: ruby; encoding: sjis -*- # Last updated: <2013/12/30 22:16:27 +0900> # # 画像の難読化を解除して表示するRubyスクリプト # # DXRuby を使用 require 'dxruby' $next = 1 # 乱数生成器(C言語のソレを再現) def c_rand $next = ($next * 1103515245 + 12345) & 0xffffffff return (($next / 65536) % 32768).to_i end # 乱数初期化。種を渡す def c_srand(seed) $next = seed end # 画像の難読化を解除 def decrypt_image(img) w, h = img.width, img.height outimg = Image.new(w, h) c_srand(0) h.times do |y| rx = c_rand() w.times do |x| outimg[x, y] = img[(x - rx) % w, y] end end return outimg end img0 = Image.load("image0_out.png") img1 = Image.load("image1_out.png") img0 = decrypt_image(img0) img1 = decrypt_image(img1) Window.loop do break if Input.keyPush?(K_ESCAPE) Window.draw(0,0, img1) Window.draw(0,0, img0) end