Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Dec 7th, 2018 66 in 168 days
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #include <gtk/gtk.h>
  2.  
  3. gboolean drawCallback(GtkWidget* widget, cairo_t* cr, gpointer data) {
  4.     gdk_cairo_set_source_pixbuf(cr, data, 0, 0);
  5.     cairo_paint(cr);
  6.    
  7.     return FALSE;
  8. }
  9.  
  10. int main(int argc, char** argv) {
  11.     gtk_init(&argc, &argv);
  12.    
  13.     GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);;
  14.     GtkWidget* drawingArea = gtk_drawing_area_new();
  15.     gtk_widget_set_size_request(window, 407, 235);
  16.    
  17.     GdkPixbuf* pix = gdk_pixbuf_new_from_file("/home/isolo/tst.png", NULL);
  18.    
  19.     gtk_container_add(GTK_CONTAINER(window), drawingArea);
  20.     g_signal_connect(window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
  21.     g_signal_connect(G_OBJECT(drawingArea), "draw", G_CALLBACK(drawCallback), pix);
  22.    
  23.     gtk_widget_show_all(window);
  24.     gtk_main();
  25.    
  26.     return 0;
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top