pixbuf manipulation



Thanks Mr.Muthiah.

but as i am very new to pixbuf manipulation
can u provide me the simplified code of a loading a image 
and displaying it.
btw ur color programs were nice

Also can we include transparent images into pixbufs?

Thank You 


On 5/19/05, Muthiah Annamalai <dearestchum yahoo co in> wrote:

Like Ive been always yapping around my tutorial,
see this http://cybernetics.freewebspace.com/gtk/
for some tip on GdkPixbuf.



---------- Forwarded message ----------
From: Dehua Zhao <dzhao cs uno edu>
Date: May 9, 2005 7:32 PM
Subject: simple example of using gdk_pixbuf_new_from_file
To: gtk-app-devel-list gnome org
 
simple example of gdk_pixbuf
#include<gtk/gtk.h>
#include<gdk-pixbuf/gdk-pixbuf.h>
#include <stdlib.h>
#include<string.h>
#include<stdio.h> 

#include<string.h>

int main(int argc, char *argv[])
{
 GError *gerror;
 GdkPixbuf *originalpb, *pb;
 GdkPixbuf *rpb, *ipb;
 char filename[20];

 gtk_set_locale ();
 gtk_init (&argc, &argv); 

 strcpy(filename, argv[1]);

 originalpb = NULL;

 originalpb=gdk_pixbuf_new_from_file(inputimg,&gerror);
 if(!originalpb) {
 printf("error message: %s\n", gerror->message); 
 exit(1);
 }
 ....

 hei = gdk_pixbuf_get_height(originalpb)/downsampling;
 wid = gdk_pixbuf_get_width(originalpb)/downsampling;
 gdk_pixbuf_unref(originalpb);

 ....
 return 0; 
}

I got these errors after compiling it

pix-samp.c: In function `main':
pix-samp.c:43: error: `inputimg' undeclared (first use in this function) 
pix-samp.c:43: error: (Each undeclared identifier is reported only once
pix-samp.c:43: error: for each function it appears in.)
pix-samp.c:48: error: syntax error before '...' token
pix-samp.c:51: error: `downsampling' undeclared (first use in this function) 


and if i remove the downsampling and change inputimg to filename
it compiles but gives Segmentation Fault at runtime

can anyone help me out
Reply. 

Your problem might be to change this line 
gtk_init (&argc, &argv);
as
gtk_init (NULL,NULL);


Cheers
Muthu.



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