Displaying 8 results from an estimated 8 matches for "draw_rectangle".
2007 Dec 30
4
Drawing thread not getting enough time from scheduler?
...dow.new(frame, :size => [300, 300])
#Animate.
thread = Thread.new do
300.times 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_rectangle(0, 0, 300, 300)
end
#Draw lines.
30.times do |j|
x = i + j
buffer.draw do |surface|
surface.pen = Wx::Pen.new(
Wx::Colour.new(128, 255, 128),
3
)
surface.pen.cap = Wx::CAP...
2007 Apr 28
0
[976] branches/wxruby2/wxwidgets_282/samples/bigdemo/wxScrolledWindow.rbw: Remove deprecated begin_drawing and end_drawing calls
...do_drawing(dc, printing=false)
</span><del>- dc.begin_drawing()
</del><span class="cx"> dc.set_pen(Wx::Pen.new("RED", 1, Wx::SOLID)) # Pen constructor requires (color, width, style)
</span><span class="cx"> dc.draw_rectangle(5,5,50,50)
</span><span class="cx">
</span><span class="lines">@@ -115,8 +114,6 @@
</span><span class="cx"> dc.draw_rectangle(490, 90, 20, 20)
</span><span class="cx">
</span><...
2005 Jan 22
9
Dragging images across the canvas
...end
def move_region(nx,ny)
ox,oy,w,h = @reg.get_box
@reg.clear
@reg = Wx::Region.new(nx,ny,nx+w,ny+h)
dc = Wx::ClientDC.new(self)
# Erase from the existing location
#
wb = Wx::WHITE_BRUSH
dc.set_brush(wb)
dc.set_pen(Wx::WHITE_PEN)
dc.draw_rectangle(ox,oy,ox+w,oy+h)
# Draw at the new location
#
dc.draw_bitmap(@bitmap,nx,ny,false)
dc.free
end
def on_motion(event)
x = event.get_x
y = event.get_y
move_region(x,y) if (@left_dn and (@reg.contains(x,y) == 0))
end
def on_paint
paint{|dc|...
2008 Jan 19
5
No joy from Wx::App.dispatch, Wx::App.yield...
...nd
def animate(window, buffer)
green_pen = Wx::Pen.new(Wx::Colour.new(128, 255, 128), 3)
black_pen = Wx::Pen.new(Wx::Colour.new(0, 0, 0), 0)
buffer.draw do |surface|
#Clear screen.
surface.pen = black_pen
surface.brush = Wx::BLACK_BRUSH
surface.draw_rectangle(0, 0, 300, 300)
#Draw lines.
surface.pen = green_pen
surface.pen.cap = Wx::CAP_ROUND
30000.times do |j|
x = @i + j
surface.draw_line(x, 0, x+100, 100)
end
end
#Update screen.
update_window(window, buffer)
@i += 1...
2007 Dec 01
5
Tearing in my buffered animation test script...
...uffer_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_rectangle(0, 0, 300, 300)
end
#Draw line.
buffer.draw do |surface|
surface.pen = Wx::Pen.new(
Wx::Colour.new(128, 255, 128),
3
)
surface.pen.cap = Wx::CAP_ROUND
surface.draw_line(i, 0, i+100, 100)
end
#Update screen.
wind...
2007 Mar 04
8
0.0.39 etc
Hi
I''d like to tag and release 0.0.39 some time in the next couple of days.
Bit short of time over the next few weeks so would like to get our
recent bug fixes out there.
I''ll update the Changelog and run through the samples, but please shout
if anything else should get some attetnion before we release.
Hopefully this could be our last preview release - also going to try
2007 Apr 28
0
[978] branches/wxruby2/wxwidgets_282/samples/bigdemo/wxScrolledWindow.rbw: Fix crazy crashers on MSW; fix scrolling/drawing position; safe path to bitmap
...# Pen constructor requires (color, width, style)
</del><ins>+ # Reset the origin co-ordinates of the DC to reflect current scrolling
+ do_prepare_dc(dc)
+ dc.set_pen(Wx::Pen.new("RED", 1, Wx::SOLID))
</ins><span class="cx"> dc.draw_rectangle(5,5,50,50)
</span><span class="cx">
</span><span class="cx"> dc.set_brush(Wx::LIGHT_GREY_BRUSH)
</span><span class="lines">@@ -161,11 +160,9 @@
</span><span class="cx"> # If doin...
2007 Mar 22
0
[916] branches/wxruby2/wxwidgets_282: More Wx::AUI classes, event hooks and sample
...)
+ super(parent, id, pos, size)
+ @mgr = mgr
+ evt_paint { on_paint }
+ evt_size { on_size }
+ end
+
+ def on_paint
+ paint do | dc |
+ size = get_client_size
+
+ dc.set_font Wx::NORMAL_FONT
+ dc.set_brush Wx::WHITE_BRUSH
+ dc.set_pen Wx::WHITE_PEN
+ dc.draw_rectangle(0, 0, size.x, size.y)
+ dc.set_pen Wx::LIGHT_GREY_PEN
+ dc.set_pen Wx::LIGHT_GREY_PEN
+ dc.draw_line(0, 0, size.x, size.y)
+ dc.draw_line(0, size.y, size.x, 0)
+
+ msg = "Size: %d x %d" % [ size.x, size.y ]
+ width, height = dc.get_text_extent(msg)
+ hei...