Sha256: c0f4a73d416b8451b9b043816696c91785412a3c22fd0f7f37620b59dc5865cb
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
require File.join(File.dirname(__FILE__), 'wxruby.rb') class MyApp WIDTH = 320 HEIGHT = 320 def on_init (1..1000).each do |file_number| file_name = sprintf("%05d_random.jpg", file_number) @f = create_factory frame = Wx::Frame.new(nil, :size => [WIDTH, HEIGHT]) bitmap = Wx::Bitmap.new(WIDTH, HEIGHT) bitmap.draw do |surface| surface.brush = Wx::BLACK_BRUSH surface.draw_rectangle(0, 0, WIDTH, HEIGHT) end 10000.times do bitmap.draw {|surface| render(surface)} end bitmap.draw do |surface| surface.text_foreground = Wx::Colour.new(255, 255, 255, 255) y = 0 @f.to_yaml.split("\n").each do |line| surface.draw_text(line, 0, y) y += 10 end end File.open(file_name + ".yml", "w") do |file| YAML.dump(@f, file) end bitmap.save_file(file_name, Wx::BITMAP_TYPE_JPEG) end exit end end app = MyApp.new app.main_loop
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubyonacid-0.2.0 | examples/random_yaml.rb |