2009-04-16 14:14:13 +03:00
|
|
|
#ifndef __CBITMAPHANDLER_H__
|
|
|
|
#define __CBITMAPHANDLER_H__
|
|
|
|
|
|
|
|
|
|
|
|
#include "../global.h"
|
|
|
|
struct SDL_Surface;
|
|
|
|
class CLodHandler;
|
|
|
|
|
2009-04-15 17:03:31 +03:00
|
|
|
/*
|
|
|
|
* CBitmapHandler.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
2009-04-16 14:14:13 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
enum Epcxformat {PCX8B, PCX24B};
|
|
|
|
|
2011-02-22 13:52:36 +02:00
|
|
|
/// Struct which stands for a simple rgba palette
|
2009-04-16 14:14:13 +03:00
|
|
|
struct BMPPalette
|
|
|
|
{
|
|
|
|
unsigned char R,G,B,F;
|
|
|
|
};
|
2009-09-27 14:37:15 +03:00
|
|
|
|
2011-02-22 13:52:36 +02:00
|
|
|
/// Class which converts pcx to bmp images
|
2009-04-16 14:14:13 +03:00
|
|
|
class CPCXConv
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
unsigned char * pcx, *bmp;
|
|
|
|
int pcxs, bmps;
|
|
|
|
void fromFile(std::string path);
|
2009-10-25 16:36:11 +02:00
|
|
|
void saveBMP(std::string path) const;
|
2009-04-16 14:14:13 +03:00
|
|
|
void openPCX(char * PCX, int len);
|
2009-09-27 14:37:15 +03:00
|
|
|
SDL_Surface * getSurface() const; //for standard H3 PCX
|
2009-04-16 14:14:13 +03:00
|
|
|
//SDL_Surface * getSurfaceZ(); //for ZSoft PCX
|
2009-09-27 14:37:15 +03:00
|
|
|
CPCXConv() //c-tor
|
|
|
|
: pcx(NULL), bmp(NULL), pcxs(0), bmps(0)
|
|
|
|
{}
|
|
|
|
~CPCXConv() //d-tor
|
|
|
|
{
|
|
|
|
if (pcxs) delete[] pcx;
|
|
|
|
if (bmps) delete[] bmp;
|
|
|
|
}
|
2009-04-16 14:14:13 +03:00
|
|
|
};
|
2009-09-27 14:37:15 +03:00
|
|
|
|
2009-04-16 14:14:13 +03:00
|
|
|
namespace BitmapHandler
|
|
|
|
{
|
2011-07-18 18:21:16 +03:00
|
|
|
//Load file from specific LOD
|
|
|
|
SDL_Surface * loadBitmapFromLod(CLodHandler *lod, std::string fname, bool setKey=true);
|
|
|
|
//Load file from any LODs
|
2009-08-17 11:50:31 +03:00
|
|
|
SDL_Surface * loadBitmap(std::string fname, bool setKey=true);
|
2009-04-16 14:14:13 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __CBITMAPHANDLER_H__
|