How to draw a rectangle onto an ximagesink?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to draw a rectangle onto an ximagesink?

Noe Nieto [http://percepcionunitaria.org]]

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


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel