GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Tue Jul 29, 2014 10:43 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: gdk pixbuf composite
PostPosted: Wed Jun 13, 2012 5:30 pm 
Offline

Joined: Wed Jun 13, 2012 4:55 pm
Posts: 2
Hello

I have been writing a program in c that uses the gdk pixbuf composite function to overlap two PNG images.
The eventual aim is to have a base PNG image with another PNG that contains alot of transparent pixels on top meaning that only a portion of the original image is visible.

The code below displays the base image corrently but shows the second pixmap with the right dimensions but only contains a single color rather than the contents of the second PNG.
Interestingly the color coresponds to the first few pixels of the second PNG.

I'm not very experienced with GTK so i don't really understand if composite is even the right function to use.

any help with displaying the second PNG would be much apreciated


Thanks Nick


Code:
pixbuf1 = gdk_pixbuf_new_from_file("SA.PNG", NULL);
  pixbuf2 = gdk_pixbuf_new_from_file("RA2.PNG", NULL);
 
   gdk_pixbuf_composite(pixbuf2, pixbuf1,100, 100, 220, 210, 50, 300,440,   440,GDK_INTERP_BILINEAR,255);
   
   image = gtk_image_new_from_pixbuf(pixbuf1);

   gtk_container_add(GTK_CONTAINER(window), image);


Code:


Top
 Profile  
 
 Post subject: Re: gdk pixbuf composite
PostPosted: Thu Jun 14, 2012 6:41 am 
Offline

Joined: Wed Jun 13, 2012 4:55 pm
Posts: 2
Turns out the last values passed to composite function were way off, i though they were dimensions so they were set to 440 . setting it to '1' make the image display.


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 3 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