[Gtk-sharp-list] Gtk.Image "refresh" image area

Mauricio Henriquez mhenriquezs at terra.cl
Tue Apr 15 11:20:47 EDT 2008


Hi Guys:

My name is Mauricio and this is my first post to the list, so hi to all!!.

I'm playing around  a lot with the Gtk.Image + Pixmap and Pixbuf types 
in mono/gtk-sharp to build a VideoPlayer widget with the ISE.Video 
library from the Icarus project (http://icarus.sourceforge.net/), but 
now I'm a little confuse about the pixmap and pixbuf and convertions 
between both and also about the gtk.image :-S , let me explain the 
situation and please be pattience with my poor English:

The ise.video library works as a wrapper for Tao.FFmpeg and let us to 
work with a "Decoder" that can be used to decode a video file, images 
from URLs or even from v4l source, the ise.video library expose a number 
of "video handlers" for different scenarios, like a "texture" one to be 
used in opengl scenes, a "Bitmap handler" to work in winforms scenarios 
(I allready have a primary working version of the videoplayer for 
WinForms and run nice in mono/linux in a winform app showing videos and 
also my webcam!!, very cool!!), and also a "Pixbuf handler" to use in 
Gtk# scenarios. Right now I have a simple "pixbuf handler" in a Gtk# app 
with a Gtk.Image widget, this example app is capable of show a video 
file or a v4l source in a gtk.image widget allmost without problems...
Rigth now, the idea is have a custom widget capable of do all the needed 
configuration "internally" (decoder configuration, etc..), for the 
winform videoplayer version we do that creating a class the inherit from 
a simple PictureBox control, so the idea is to do something simillar 
here (I know that may be you are goin to recomned to use some kind of 
opengl widget for intensive graphic things, but the current state of 
gtkopenglarea is not somehting that we whant right now and can be used 
in a "version 2" of the gtk-videoplayer).
My problem right now is that I have a VideoPlayer class that inherit 
from Gtk.Image and add a public "Play" method, the "play" method do all 
the configuration needed by the decoder and begin the "frame reading 
loop" (I know that I can have problems related to block the main gtk app 
loop, but right now that is my second concern :-) , then in each 
"reading" the "Pixbuf handler" return a updated "frame" (of pixbuf type) 
and I need to set the "frame" to the internall Pixbuf member of the 
widget, I do that with a simple: this.Pixbuf = PixbufHandler.frame; but 
then I need to force for a "update" or "refresh" of the widget to 
actually see the image displayed and that is the beggining of my 
problems. How can I do that in a simple way?

Previously in the simple pixbuf handler test (the one with a simple 
gtk.image widget in a gtk# window) I be able to call to the 
this.GdkWindow.ProcessUpdates(true); becouse the gtk.image was in the 
gtk# window, so calling to the ProcessUpdates refresh all the childs and 
with that all OK...but right now is more dificult to me, becouse inside 
my custom widget the GdkWindow return "null" (I don't know way...). I 
also try with the this.QueueDrawArea(0, 0, 800, 340); inside my custom 
widget but to work witht the "Queue" methods I need to also use the 
Configure and Expose events and that force me to do some type 
convertions between PixBuf and pixmap...and is kind of confuse to me, so 
probably exist a more "direct"way to update the widget screen...I also 
try to inherit from the DrawingArea widget but also force me to do some 
convertions...

Sorry for the long explanation but i think that is needed to understed 
what I'm trying to do..

Any sugestion is apreciated...

In advance thank you..

Mauricio





More information about the Gtk-sharp-list mailing list