00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include <fvwidgets/image_display.h>
00027 #include <fvwidgets/sdl_keeper.h>
00028 #include <fvutils/readers/fvraw.h>
00029
00030 #include <cstdio>
00031 #include <cstdlib>
00032 #include <unistd.h>
00033
00034 #include <SDL.h>
00035
00036 using namespace firevision;
00037
00038 int
00039 main(int argc, char **argv)
00040 {
00041 const char *img_file;
00042 if ( argc > 1 ) {
00043 img_file = argv[1];
00044 } else {
00045 printf("Usage: %s <raw image file>\n", argv[0]);
00046 exit(-1);
00047 }
00048
00049
00050 FvRawReader *fvraw = new FvRawReader(img_file);
00051 unsigned char *buffer = malloc_buffer(fvraw->colorspace(),
00052 fvraw->pixel_width(), fvraw->pixel_height());
00053
00054 fvraw->set_buffer(buffer);
00055 fvraw->read();
00056
00057 ImageDisplay *display = new ImageDisplay(fvraw->pixel_width(), fvraw->pixel_height());
00058 display->show(fvraw->colorspace(), buffer);
00059
00060 SDLKeeper::init(SDL_INIT_EVENTTHREAD);
00061
00062 bool quit = false;
00063 while (! quit) {
00064 SDL_Event event;
00065 if ( SDL_WaitEvent(&event) ) {
00066 switch (event.type) {
00067 case SDL_QUIT:
00068 quit = true;
00069 break;
00070 default:
00071 break;
00072 }
00073 }
00074 }
00075
00076 delete display;
00077 free(buffer);
00078 delete(fvraw);
00079
00080 SDLKeeper::quit();
00081
00082 return 0;
00083 }
00084
00085
00086
00087