I'm trying to display an image multiple times on the desktop in different positions but I'm not sure how to go about it. Right now I'm trying out Wxruby but I'm wondering if there is another way to do it that I'm missing.
So far I'm able to display one image at one position with wxruby pretty much from one of the samples:
require 'wx'
include Wx
class Warning < Wx::App
include Wx
def on_init(x = 300, y = 300)
@frame = Frame.new( nil, -1, "Application", Point.new(x,y), Size.new(50,50), FRAME_SHAPED|SIMPLE_BORDER|FRAME_NO_TASKBAR|STAY_ON_TOP)
@frame.show
@has_shape = false
@delta = [0,0]
evt_paint {on_paint}
shape = File.join( 'pathToImage' )
@bmp = Bitmap.new( Image.new(shape) )
@frame.set_client_size(@bmp.width, @bmp.height)
if PLATFORM == 'WXGTK'
# wxGTK requires that the window be created before you can
# set its shape, so delay the call to SetWindowShape until
# this event.
evt_window_create { set_window_shape }
else
# On wxMSW and wxMac the window has already been created, so go for it.
set_window_shape
end
#@frame.paint { | dc | dc.draw_bitmap(@bmp, 0, 0, true) }
end
def set_window_shape
r = Region.new(@bmp)
@has_shape = @frame.set_shape(r)
end
def on_paint
@frame.paint { | dc | dc.draw_bitmap(@bmp, 0, 0, true) }
end
end
app = Warning.new
app.main_loop