Hello, i am write a application like a tv watch soft,using em28xx capture video as yuyv format,and converted to rgb24 when recived.
here ,some code to draw video frame to drawingarea. gdk_threads_enter(); gdk_draw_rgb_image(wbus->drawingarea->window, wbus->drawingarea->style->fg_gc[GTK_STATE_NORMAL], 0,0,vidin->width, vidin->height, GDK_RGB_DITHER_NORMAL, frame->data, vidin->width * 3); gdk_display_flush(gdk_display_get_default()); gdk_threads_leave(); i want to draw some string ,image on the drawingare,i call below function after drawing frame,but there will blinking. static void show_text_on_video(void) { cairo_t *cr; PangoLayout *layout; PangoFontDescription *desc; cr = gdk_cairo_create(wbus->drawingarea->window); layout = pango_cairo_create_layout(cr); pango_layout_set_text(layout, "wbuscanner\n阿哈哈", -1); //desc = pango_font_description_from_string("SimSun Bold 60"); //pango_layout_set_font_description(layout, desc); //pango_font_description_free(desc); cairo_select_font_face (cr, "Sans", CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_BOLD); cairo_set_font_size (cr, 70.0); cairo_move_to (cr, 70.0, 165.0); cairo_set_source_rgb(cr, 0.5, 0.5, 1); cairo_text_path(cr,"wbuscanner"); //cairo_show_text(cr,"阿所发"); pango_cairo_update_layout(cr, layout); pango_cairo_show_layout(cr, layout); cairo_stroke(cr); cairo_destroy(cr); } then i used gdkpixmap create from rgb data and draw something on it ,and draw to drawingarea,but this method was slower.(data is frame->data,720*576,PAL) gdk_threads_enter(); gdk_draw_rgb_image(wbus->pixmap, wbus->drawingarea->style->bg_gc[GTK_STATE_NORMAL], 0,0,vidin->width,vidin->height, GDK_RGB_DITHER_NONE, frame->data, vidin->width *3); cr = wbus->cr; //cairo_select_font_face (cr, "Sans", CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_BOLD); //cairo_set_font_size (cr, 70.0); cairo_move_to (cr, 70.0, 165.0); cairo_set_source_rgb(cr, 0.5, 0.5, 1); cairo_text_path(cr,"wbuscanner"); cairo_stroke(cr); gdk_draw_pixmap(wbus->drawingarea->window, wbus->drawingarea->style->fg_gc[GTK_STATE_NORMAL], wbus->pixmap,0,0,0,0,vidin->width,vidin->height); gdk_display_flush(gdk_display_get_default()); gdk_threads_leave(); how can i draw strings ,image on the raw rgb24 ,and draw to drawingarea? thanks. _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list