https://blog.csdn.net/wonxxx/article/details/44788249
#include
#include
#define dest_width 320
#define dest_height 240
void showPic(char *filename)
{
GtkWidget *window;
GtkWidget *image;
const GdkPixbuf *src_pixbuf;
GdkPixbuf *dest_pixbuf;
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
src_pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
dest_pixbuf = gdk_pixbuf_scale_simple(src_pixbuf, dest_width, dest_height, GDK_INTERP_HYPER);
image = gtk_image_new_from_pixbuf(dest_pixbuf);
gtk_window_set_default_size(GTK_WINDOW(window), dest_width, dest_height);
gtk_container_add(GTK_CONTAINER(window), image);
gtk_container_set_border_width(GTK_CONTAINER(window), 0);
gtk_widget_show_all(window);
}
int main(int argc, char *argv[])
{
gtk_init(&argc, &argv);
showPic(argv[1]);
gtk_main(); return 0;
}
阅读(3222) | 评论(0) | 转发(0) |