GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sun Apr 20, 2014 11:30 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Drawing GtkImage in GtkDrawingArea
PostPosted: Sun May 11, 2008 2:52 pm 
Offline

Joined: Sun May 11, 2008 2:47 pm
Posts: 1
Hi!

I try to draw part of image in drawing area, but all I get is access violation:

Code:
static gboolean
expose_event( GtkWidget *widget, GdkEventExpose *event )
{

   gdk_draw_drawable(widget->window,
          widget->style->white_gc,
          pixmap,
          event->area.x, event->area.y,
          event->area.x, event->area.y,
          event->area.width, event->area.height);

   gdk_draw_image(widget->window,
      widget->style->white_gc,
      img1,         
      0,0,
      0,0,
      50,50);
 
   return FALSE;
}


First function, where I copy portion of hand-made pixmap works fine, but img1 loaded with gtk_image_new_from_file() fails. Image loaded correcrtly, I can show it, if I use gtk_container_add().

Image is simply 128x128 bmp file.

Can anyone help me?

PS: Yes, I saw demos like images.c, but they use gtk_container_add() instead of gdk_draw_image().


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 12, 2008 3:55 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
You can draw a GdkImage onto a GtkDrawingArea. Why not just use that or GdkPixbuf?

_________________
Andrew Krause

Foundations of GTK+ Development: Buy now for only $31.49!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group