Re: Type conversions
- From: turkaye dre vanderbilt edu (Emre Turkay)
- To: MERT TUGCU <merttugcu hotmail com>
- Cc: gtkmm-list gnome org
- Subject: Re: Type conversions
- Date: Fri, 22 Apr 2005 14:24:21 -0500
Hi Mert,
Using the X-lib, IMHO, generally not a good idea, because it
is too complex and platform dependent. Instead you can use gdk or
other performance sensitive approaches.
Excerpt from GTK+ FAQ at http://www.gtk.org/faq:
* How do I get the Window ID of a GtkWindow? [GTK 2.x]
The actual Gdk/X window will be created when the widget gets realized. You
can get the Window ID with:
#include <gdk/gdkx.h>
Window xwin = GDK_WINDOW_XWINDOW (GTK_WIDGET (my_window)->window);
* How do I render pixels (image data) to the screen?
There are several ways to approach this. The simplest way is to use
GdkRGB, see gdk/gdkrgb.h. You create an RGB buffer, render to your
RGB buffer, then use GdkRGB routines to copy your RGB buffer to a
drawing area or custom widget. The book "GTK+/Gnome Application
Development" gives some details; GdkRGB is also documented in the
GTK+ reference documentation.
If you're writing a game or other graphics-intensive application, you
might consider a more elaborate solution. OpenGL is the graphics
standard that will let you access hardware accelaration in future
versions of XFree86; so for maximum speed, you probably want to use
OpenGL. A GtkGLArea widget is available for using OpenGL with GTK+
(but GtkGLArea does not come with GTK+ itself). There are also
several open source game libraries, such as ClanLib and Loki's Simple
DirectMedia Layer library (SDL).
You do NOT want to use gdk_draw_point(), that will be extremely slow.
HTH,
Emre
On Thu, Apr 21, 2005 at 01:33:34AM -0500, MERT TUGCU wrote:
> Hi everyone,
>
> I am trying to use X11 library to draw incoming video frames to a drawing
> area. I have found out that Gdk::Pixbuf::render_to_drawable method is very
> slow to draw the incoming frames. The first thing to do is to query your
> video adapter in X11. The function prototype is:
> XvQueryAdaptors(Display*, Window*, int, XvAdaptorInfo). However, I don't
> know how to make the type conversions. I have created a class for my
> drawing area like as follows:
> class CustomDrawingArea : public Gtk::DrawingArea
> Next I've creat an object from this class and add it to my GUI. In order to
> get the display and the window I used:
> Window* window = (Window*)(drawingarea->get_window()); //drawingarea is the
> object from the above class
> Of course this didn't work out. get_window() method returns
> Glib::RefPtr<Gdk::Window> and this does not match to Window class in X11.
> Would you please tell me how to make this type conversion or am I
> completely doing something wrong? I really have to use the X11 library to
> draw fast. Thank you very much for your response and your time.
>
>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]