leocad/common/image.h

48 lines
743 B
C
Raw Normal View History

2011-09-07 23:06:51 +02:00
#ifndef _IMAGE_H_
#define _IMAGE_H_
2013-08-09 06:57:18 +02:00
// Image Options
#define LC_IMAGE_TRANSPARENT 0x2000
#define LC_IMAGE_MASK 0x7000
enum LC_IMAGE_FORMAT
{
LC_IMAGE_BMP,
LC_IMAGE_JPG,
LC_IMAGE_PNG
};
2011-09-07 23:06:51 +02:00
enum lcPixelFormat
{
LC_PIXEL_FORMAT_INVALID,
LC_PIXEL_FORMAT_A8,
LC_PIXEL_FORMAT_L8A8,
LC_PIXEL_FORMAT_R8G8B8,
LC_PIXEL_FORMAT_R8G8B8A8
};
2011-09-07 23:06:51 +02:00
class Image
{
public:
2012-03-23 00:44:56 +01:00
Image();
virtual ~Image();
int GetBPP() const;
bool HasAlpha() const;
2013-08-09 06:57:18 +02:00
bool FileLoad(lcMemFile& File);
bool FileLoad(const char* FileName);
2012-03-23 00:44:56 +01:00
2013-08-09 06:57:18 +02:00
void Resize(int Width, int Height);
2012-03-23 00:44:56 +01:00
void ResizePow2();
void Allocate(int Width, int Height, lcPixelFormat Format);
2012-03-23 00:44:56 +01:00
void FreeData();
2013-08-09 06:57:18 +02:00
int mWidth;
int mHeight;
lcPixelFormat mFormat;
2013-08-09 06:57:18 +02:00
unsigned char* mData;
2011-09-07 23:06:51 +02:00
};
#endif // _IMAGE_H_