thumbnail.cpp File Reference

#include <cassert>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/time.h>
#include <time.h>
#include <gdk-pixbuf/gdk-pixbuf-transform.h>
Include dependency graph for thumbnail.cpp:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Copyright (C) 2008 iRex Technologies B.V. All rights reserved.

Definition at line 41 of file thumbnail.cpp.

00042 {
00043     if (argc != 4)
00044     {
00045         return -1;
00046     }
00047     
00048     g_type_init();
00049 
00050     GdkPixbuf * loader = gdk_pixbuf_new_from_file(argv[1], 0);
00051     if (loader)
00052     {
00053         printf("Do Scaling...");
00054         struct timeval tv_start, tv_end;
00055 
00056         gettimeofday(&tv_start, NULL);
00057 
00058         int w = atoi(argv[2]);
00059         int h = atoi(argv[3]);
00060         GdkPixbuf * tmp = gdk_pixbuf_scale_simple(loader, w, h,
00061                                                   GDK_INTERP_NEAREST);
00062         if (tmp)
00063         {
00064             g_object_unref(tmp);
00065         }
00066 
00067         gettimeofday(&tv_end, NULL);
00068 
00069         printf("%ld \n", 
00070                 (tv_end.tv_sec - tv_start.tv_sec) * 1000000
00071               + (tv_end.tv_usec - tv_start.tv_usec));
00072 
00073         g_object_unref(loader);
00074     }
00075 
00076     return 0;
00077 }

Generated by  doxygen 1.6.2-20100208