Hi

could you please provide a working version of this application?

many thanks

Attilio

Dennis Hall ha scritto:
> I'm having trouble with refresh when I used either Pango or Cairo calls with 
> GTK over Direct FB.  I've modified the scribble.c sample so that some test 
> text is drawn using pango when a button pressed or a movement event occurs 
> but I don't see the text unless I press the meta key (or windows key 
> depending on the keyboard) and move the entire region.  It looks like this 
> causes the whole drawing area to be refreshed.
> 
> Can anyone explain the concepts or have documentation pointers or better yet 
> a fix for this problem?
> 
> gint col_select = 0;
> char *szText = "Test String";
> int lenText = 11;
> 
> /* Draw a rectangle on the screen */
> static void draw_brush( GtkWidget *widget,
>                         gdouble    x,
>                         gdouble    y)
> {
>   GdkRectangle update_rect;
>   GdkColor fgColor;
> 
>   update_rect.x = x - 5;
>   update_rect.y = y - 5;
>   update_rect.width = RECT_WIDTH;
>   update_rect.height = RECT_HEIGHT;
> 
>   gdk_color_parse(colorStrings[col_select], &fgColor);
> 
>  gint col_select = 0;
>  char *szText = "Test String"; 
>  int lenText = 11;
> 
> /* Draw a rectangle on the screen */
> static void draw_brush( GtkWidget *widget,
>                         gdouble    x,
>                         gdouble    y)
> {
>   GdkRectangle update_rect;
>   GdkColor fgColor;
> 
>   update_rect.x = x - 5;
>   update_rect.y = y - 5;
>   update_rect.width = RECT_WIDTH;
>   update_rect.height = RECT_HEIGHT;
> 
>   gdk_color_parse(colorStrings[col_select], &fgColor);
> 
> 
> 
>   GdkWindow* root = gdk_get_default_root_window();
>   GdkGC* cg = gdk_gc_new(root);
>   
>   PangoLayout *pLayout = gtk_widget_create_pango_layout( widget, 0); 
>   pango_layout_set_text(pLayout, szText, /* lenText */ -1);
> 
>   if (!gdk_colormap_alloc_color(
>        gdk_colormap_get_system (),
>        &fgColor, TRUE, TRUE)
>   ) {/*ERROR: NO gdk_colormap_alloc_color*/}
> 
>   gdk_draw_layout_with_colors( widget->window ,
>         cg, 
>         x+2, y+2,
>         pLayout,
>         &fgColor /* NULL */,
>         NULL
>         );
> 
>   g_object_unref(pLayout);
> 
>   gdk_draw_rectangle (pixmap,
>                       widget->style->black_gc,
>                       TRUE,
>                       update_rect.x, update_rect.y,
>                       update_rect.width, update_rect.height);
> 
>   gtk_widget_queue_draw_area (widget,
>                               update_rect.x, update_rect.y,
>                               update_rect.width, update_rect.height);
> 
>   if (col_select==MAX_COL_STRINGS)
>       col_select = 0;
>   else
>       col_select++;
> 
> }
> 
> static gboolean button_press_event( GtkWidget      *widget,
>                                     GdkEventButton *event )
> {
>   if (event->button == 1 && pixmap != NULL)
>     draw_brush (widget, event->x, event->y);
> 
>   return TRUE;
> }
> 
> 
> _______________________________________________
> 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