Changeset 666 for trunk/software
- Timestamp:
- 02/11/10 01:45:40 (2 years ago)
- Files:
-
- 1 modified
-
trunk/software/rb/gui/camera.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/software/rb/gui/camera.py
r626 r666 22 22 def __init__(self): 23 23 gtk.DrawingArea.__init__(self) 24 self.pipeline = gst.parse_launch('appsrc ! autovideosink') 24 self.pixbuf = None 25 #self.pipeline = gst.parse_launch('appsrc ! autovideosink') 25 26 26 27 self.connect("expose-event", self.expose_cb) 27 28 28 29 def push_frame(self, (source, ipl_image)): 29 self.pixbuf = ipl_image.to_gdk_pixbuf()30 31 30 @gobject.idle_add 32 31 def update_gui(): 32 self.pixbuf = ipl_image.to_gdk_pixbuf() 33 self.scaled_pixbuf = None 33 34 self.queue_draw() 34 35 return False … … 40 41 if not self.pixbuf: 41 42 return 42 drawable = da.window43 43 alloc = self.get_allocation() 44 new_w = alloc.width 45 new_h = alloc.height 46 scaled_pixbuf = self.pixbuf.scale_simple(new_w, new_h, gtk.gdk.INTERP_NEAREST) 44 if self.scaled_pixbuf is None or self.scale != (alloc.width, alloc.height): 45 drawable = da.window 46 self.scaled_pixbuf = self.pixbuf.scale_simple( 47 alloc.width, alloc.height, 48 gtk.gdk.INTERP_NEAREST) 49 self.scale = (alloc.width, alloc.height) 47 50 drawable.draw_pixbuf( 48 51 drawable.new_gc(), 49 s caled_pixbuf,50 0, 0, # src_x, src_y,51 0, 0, # dest_x, dest_y,52 alloc.width, alloc.height52 self.scaled_pixbuf, 53 0, 0, # src_x, src_y, 54 0, 0, # dest_x, dest_y, 55 alloc.width, alloc.height 53 56 ) 54 57

