Re: xpm with transparency to a button



Ah yes ... I am using the incorrect x and y below,

should be using the following :

gdk_cairo_set_source_pixbuf(cr, tipGDKPixBuf, widget->allocation.x, widget->allocation.y);

Matt

On 04/10/2012 05:02 PM, Matt Flax wrote:
I have started using cairo on this topic,

With the following code, the image is not produced at the desired location .. can anyone point out what I am doing wrong ?

Is it something to do with the locations x and y ?

#include "T6.xpm"

gboolean on_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data){

    int width, height, x, y;
    GdkPixbuf *tipGDKPixBuf = gdk_pixbuf_new_from_xpm_data(T6);
    width=gdk_pixbuf_get_width(tipGDKPixBuf);
    height=gdk_pixbuf_get_height(tipGDKPixBuf);

    gtk_widget_set_size_request(widget, width, height);

    gdk_window_get_position(widget->window,&x,&y);

    cairo_t  *cr=gdk_cairo_create(widget->window);
    gdk_cairo_set_source_pixbuf(cr, tipGDKPixBuf, x, y);
    cairo_paint(cr);
    cairo_destroy(cr);

    return FALSE;
}


On 04/10/2012 11:34 AM, Matt Flax wrote:
Hi there,

Does anyone have any example code on how to render an XPM with transparent sections to a button ?

thanks
Matt
_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list

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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]