Hi,

This is not entirely related, but if you are familiar with OpenGL
you could use GtkGLExt (http://gtkglext.sourceforge.net/) to create
a OpenGL drawable context and then display the images using simple
OpenGL textures or something... Just an idea though.

Daniel

On Sun, 2005-05-15 at 10:50 +0300, [EMAIL PROTECTED] wrote:
> Hi.
> In the past, I wrote a program ( in DOS), to display a
> signal collected from ADC. I use 2 video pages - 1 is
> visible, second is hidden (to draw), and switch they very
> fast. The result is very smooth animated graphic. Now i try
> to convert my program on Linux. But the picture isn't very
> good. The graphic start blinking. Becouse my program is too
> large, I write some little example to show my idea:
> 
> #include <gtk/gtk.h>
> 
> #define WIDTH   300
> #define HEIGHT  300
> 
> guchar buf[WIDTH * HEIGHT * 3];
> 
> gboolean on_expose(GtkWidget *widget, GdkEventExpose *event,
> gpointer user_data)
> {
>       gdk_draw_rgb_image (widget->window,
>                           widget->style->fg_gc[GTK_STATE_NORMAL],
>                           0, 0, WIDTH, HEIGHT, GDK_RGB_DITHER_NONE,
>                           buf, WIDTH * 3);
>       return FALSE;
> }
> 
> /* In real program this function collect data from ADC */
> gint timeout_func(gpointer data)
> {
>       int x, y;
>       gchar *pos;
>       int size = WIDTH * 3 * (HEIGHT - 1);
> 
>       memmove(buf,buf + WIDTH * 3, size);     /* move image 1
> line up */
>       pos = buf + (HEIGHT-1) * WIDTH * 3;     /* last line start
> position */
> 
>       for(x=0;x<WIDTH;x++)                    /* fill last line with random */
>       {
>               y = rand();                     /* simulate ADC
> reading - only to test */
>               *pos++ = y;
>               *pos++ = y;
>               *pos++ = y;
>       }
>       gtk_widget_queue_draw(GTK_WIDGET(data));  /* draw image on
> screen */
>       return TRUE;
> }
> 
> int main(int argc, char *argv[])
> {
>       guint handler;
>       GtkWidget *window;
>       GtkWidget *draw_area;
> 
>       gtk_init(&argc, &argv);
>       gdk_rgb_init();
> 
>       window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
>       gtk_widget_push_visual(gdk_rgb_get_visual());
>       gtk_widget_push_colormap(gdk_rgb_get_cmap());
>       draw_area = gtk_drawing_area_new();
>       gtk_widget_pop_visual();
>       gtk_widget_pop_colormap();
> 
>       gtk_drawing_area_size( GTK_DRAWING_AREA(draw_area),
>                               WIDTH, HEIGHT);
>       gtk_container_add(GTK_CONTAINER (window), draw_area);
>       gtk_signal_connect(GTK_OBJECT(window), "destroy",
> GTK_SIGNAL_FUNC(gtk_exit), NULL);
>       gtk_signal_connect(GTK_OBJECT(draw_area), "expose-event",
>                          GTK_SIGNAL_FUNC (on_expose), NULL);
>       gtk_widget_show_all (window);
> 
>       /* set timeout function - 20 times per second */
>       handler = g_timeout_add(1000/20, timeout_func, draw_area);
> 
>       gtk_main();
> 
>         g_source_remove(handler);
> }
> 
> Are someone idea what is wrong? My compter is 1Ghz Epia-M
> 10000 , and I thing - it's enought powerfull. I can see
> movies with totem with no problem (no blinking, no loss
> frames). Maybe gdk_draw_rbg_image isn't too fast? Or maybe
> there is another way to change a big picture on display?
> 
> 
> Thanks
> 
> -----------------------------
> 
> * ÐÐÐÐÐ ÐÐÐÑÑ ÑÐÐÐ, ÐÐÐÑÐ ÐÑÐÐÑÑ ÐÐÑÐ Ð 
> ÐÑÐÐÐÑÐ? (ÐÐÑÐ, ÐÐÐÑÐ ÐÐÐ ÐÐ ÐÐÐÐÑÐ ÐÐ 
> ÐÐÑÑÐÑÐ)
> * ÐÐÐ ÐÐÐ-ÐÑÑÐÐ ÐÐ ÐÑÐÐÑÑÐÐÐ ÑÐÐÑÐ ÑÐ Ð 
> ÐÐÑÐÐÐ ÐÐ ÐÐÑÐ? (ÐÐÐÑÐÐÐÑ ÐÐ ÐÐÐÐÑÑÐÐÐÐÐÑ 
> ÑÐÐÑ)
> * ÐÐÐÐÐÐÐ: ÐÐÐÐÐÐÐÐÐÐ ÑÑÐÐÑÐÐ ÐÑÑÑ "ÐÑÐÐÐÐ 
> ÐÐ Ð-ÐÐÐÐÐÑÐ"-ÑÐÑÑ 1 ( 21 ÐÐÐ, ÐÑ.ÐÐÑÐÑ, 
> ÐÐÑÐÐÐÑÐÐÐ ÐÐÑÑÐ)
> http://lifeconsult.info/?mbg_m
> 
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to