GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Drawing GtkImage in GtkDrawingArea

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
uliss



Joined: 11 May 2008
Posts: 1

PostPosted: Sun May 11, 2008 2:52 pm    Post subject: Drawing GtkImage in GtkDrawingArea Reply with quote

Hi!

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

Code: (C)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

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().
Back to top
openldev
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 386
Location: Fairfax, Virginia

PostPosted: Mon May 12, 2008 3:55 pm    Post subject: Reply with quote

You can draw a GdkImage onto a GtkDrawingArea. Why not just use that or GdkPixbuf?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP