Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

RAWLoader.cpp

00001 /*************************************************************************** 00002 * This file is part of OpenCAL: Open Computer Animation Library * 00003 * I created OpenCAL as my master's thesis Computer Science (multimedia) * 00004 * at the tUL university in Diepenbeek, Belgium * 00005 * * 00006 * Copyright (C) 2003-2004 by Jeroen Dierckx * 00007 * jeroen.dierckx@student.luc.ac.be * 00008 * * 00009 ***************************************************************************/ 00010 00011 // Includes 00012 #include "RAWLoader.h" 00013 #include <OpenCAL/Image.h> 00014 using namespace OpenCAL::Utils; 00015 00016 #include <fstream> 00017 using namespace std; 00018 00019 00020 /****************************** 00021 * Constructors and destructor * 00022 ******************************/ 00023 00024 RAWLoader::RAWLoader() 00025 { 00026 } 00027 00028 RAWLoader::~RAWLoader() 00029 { 00030 } 00031 00032 00033 /************************ 00034 * Get and set functions * 00035 ************************/ 00036 00037 00038 /****************** 00039 * Other functions * 00040 ******************/ 00041 00042 void RAWLoader::loadImage(Image *image, const string &filename) 00043 { 00044 static const unsigned int width = 256; 00045 static const unsigned int height = 256; 00046 static const unsigned int depth = 3; 00047 00048 // Open the file 00049 ifstream file(filename.c_str()); 00050 if(!file) 00051 { 00053 cerr << "The file couldn't be opened" << endl; 00054 return; 00055 } 00056 00057 // Resize the image 00058 image->resize(width, height, depth); 00059 00060 file.read((char *) image->getData(), width * height * depth); 00061 file.close(); 00062 } 00063 00064 00065 /********************** 00066 * Protected functions * 00067 **********************/

Generated on Sun Aug 15 19:19:23 2004 for OpenCAL: Open Computer Animation Library by doxygen 1.3.8