[gst-devel] How to draw a rectangle onto an ximagesink?
Nieto, Noe M
Noe.Nieto at Honeywell.com
Thu Jun 12 20:19:21 CEST 2008
Hi everybody,
I am writing an application where the user should be able to draw (with
the mouse) a rectangle on a playing video window (for now it is an
ximagesink).
I try the following but I see nothing drawing on the screen...
### CONFIGURE PIPELINE TO CATCH SYNC MESSAGES
bus = self.Pipeline.get_bus()
bus.add_signal_watch()
bus.enable_sync_message_emission()
bus.connect('message', self.on_message)
bus.connect('sync-message::element', self.on_sync_message)
#############
## Tell ximagesink to draw into the draw area that I give it, not in
it's own ...
def on_sync_message(self, bus, message):
if message.structure is None:
return
message_name = message.structure.get_name()
if message_name == "prepare-xwindow-id":
imagesink = message.src
imagesink.set_property("force-aspect-ratio", True)
imagesink.set_xwindow_id(self.DrawingArea.window.xid)
#############
## Now, on the expose event of the drawing area, paint the rectangle
according to user input (mouse)
#############
def on_DrawingAreaCamera_expose_event(self,widget,event):
#if self.area_selection_now is True:
context = widget.window.cairo_create()
#widget.window.draw(context)
context.rectangle(self.area_selection)
context.set_source_rgb(1,0,0)
context.stroke()
What is the right way to interact with ximagesink, so I can also draw
things on it's drawable??
Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20080612/f2ac65ea/attachment.htm>
More information about the gstreamer-devel
mailing list