Added a few more structural preparations

This commit is contained in:
Pavel Krajcevski 2012-08-26 16:37:10 -04:00
parent 1bdc0dafb9
commit ff5cab75ee
4 changed files with 56 additions and 20 deletions

View file

@ -2,3 +2,4 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(TexC)
ADD_SUBDIRECTORY(BPTCEncoder)
ADD_SUBDIRECTORY(IO)

0
IO/CMakeLists.txt Normal file
View file

View file

@ -1,28 +1,48 @@
#include "ImageFile.h"
ImageFile::ImageFile(const char *filename) :
m_PixelData(0)
{
unsigned char *rawData = ReadFileData(filename);
DetectFileFormat(filename);
LoadImage(rawData);
delete [] rawData;
}
ImageFile::ImageFile(const char *filename, EImageFileFormat format) :
m_FileFormat(format),
m_PixelData(0)
{
unsigned char *rawData = ReadFileData(filename);
LoadImage(rawData);
delete [] rawData;
}
ImageFile::~ImageFile() {
if(m_PixelData) {
delete [] m_PixelData;
}
}
void ImageFile::GetPixels() const {
}
EImageFileFormat ImageFile::DetectFileFormat() {
}
void ImageFile::LoadImage(const unsigend char *rawImageData) {
}
void ImageFile::LoadPNGImage(const unsigned char *rawImageData) {
}
#ifdef _MSC_VER
ImageFile::ImageFile(const char *filename) {
}
ImageFile::~ImageFile() {
}
void ImageFile::GetPixels() const {
unsigned char *ImageFile::ReadFileData(const char *filename) {
}
#else
#include <stdlib.h>
ImageFile::ImageFile(const char *filename) {
}
ImageFile::~ImageFile() {
}
void ImageFile::GetPixels() const {
unsigned char *ImageFile::ReadFileData(const char *filename) {
}
#endif

View file

@ -1,21 +1,36 @@
#ifedef _IMAGE_FILE_H_
#define _IMAGE_FILE_H_
enum EImageFileFormat {
eFileFormat_PNG,
kNumImageFileFormats
};
class ImageFile {
public:
ImageFile(const char *filename);
ImageFile(const char *filename, EImageFileFormat format);
~ImageFile();
void GetWidth() const { return m_Width; }
void GetHeight() const { return m_Height; }
void GetPixels() const;
const unsigned char *GetPixels() const { return m_PixelData; }
private:
unsigned int m_Handle;
unsigned int m_Width;
unsigned int m_Height;
unsigned char *m_PixelData;
const EImageFileFormat m_FileFormat;
static unsigned char *ReadFileData(const char *filename);
static EFileFormat DetectFileFormat(const char *filename);
bool LoadImage(const unsigned char *rawImageData);
bool LoadPNGImage(const unsigned char *rawImageData);
};