layerh2bmp.cc

Go to the documentation of this file.
00001 //
00002 // Copyright 2002 Sony Corporation 
00003 //
00004 // Permission to use, copy, modify, and redistribute this software for
00005 // non-commercial use is hereby granted.
00006 //
00007 // This software is provided "as is" without warranty of any kind,
00008 // either expressed or implied, including but not limited to the
00009 // implied warranties of fitness for a particular purpose.
00010 //
00011 
00012 #include <stdio.h>
00013 #include <stdlib.h>
00014 #include "BMP.h"
00015 
00016 const size_t LAYER_H_WIDTH   = 176;
00017 const size_t LAYER_H_HEIGHT  = 144;
00018 const size_t LAYER_H_RAWSIZE = 3 * LAYER_H_WIDTH * LAYER_H_HEIGHT;
00019 
00020 main(int argc, char **argv)
00021 {
00022     if (argc != 3) {
00023         fprintf(stderr,
00024                 "Usage: layerh2bmp layerH.raw basepath \n");
00025         exit(1);
00026     }
00027 
00028     unsigned char* raw = (unsigned char*)malloc(LAYER_H_RAWSIZE);
00029     if (raw == 0) {
00030         fprintf(stderr, "layer2bmp : can't allocate memory.\n");
00031         exit(1);
00032     }
00033 
00034     FILE* fp = fopen(argv[1], "r");
00035     if (fp == 0) {
00036         fprintf(stderr, "layer2bmp : can't open %s\n", argv[1]);
00037         exit(1);
00038     }
00039     fread(raw, 1, LAYER_H_RAWSIZE, fp);
00040     fclose(fp);
00041 
00042     BMP bmp;
00043     bmp.SaveRawDataAsCDT(argv[2], raw, 176, 144);
00044 }

Generated on Sun Dec 2 23:04:28 2007 for openSDK by  doxygen 1.3.9.1