search for: buffer_dc

Displaying 2 results from an estimated 2 matches for "buffer_dc".

2007 Oct 04
1
wxRuby: MemoryDC problems...
...view = Wx::Window.new(frame) buffer = Wx::Bitmap.new(300, 300) @x = 0 #Set up a handler for paint events. view.evt_paint do |event| #Wx::Window#paint takes a block. #This will later be called with a device context to paint on. view.paint do |dc| buffer.draw do |buffer_dc| buffer_dc.clear buffer_dc.pen = Wx::Pen.new(Wx::Colour.new(128, 128, 128), 5) buffer_dc.draw_line(@x, 0, @x + 100, 100) end dc.draw_bitmap(buffer, 0, 0, false) end @x += 1 end #Show the window. frame.show return true end end app = MyApp.new app.main_loop
2007 Dec 01
5
Tearing in my buffered animation test script...
...frame.show #Offscreen drawing buffer. buffer = Wx::Bitmap.new(300, 300) #Displays drawing. window = Wx::Window.new(frame, :size => [300, 300]) window.evt_paint do |event| window.paint do |dc| #Copy the buffer to the viewable window. buffer.draw do |buffer_dc| dc.blit(0, 0, 300, 300, buffer_dc, 0, 0) end end end #Animate. (1..40).each do |i| #Clear screen. buffer.draw do |surface| surface.pen = Wx::Pen.new(Wx::Colour.new(0, 0, 0), 0) surface.brush = Wx::BLACK_BRUSH surface.draw_rec...