/** SGX

The   sss    gggg x   x   
     s      g      x x    Engine
      sss   g  gg   x
         s  g   g  x x          Copyright 1995-2009.
     ssss    gggg x   x         Steven Goodwin. All Rights Reserved.
    
This version has been released under the GNU Public License v2.0.

Please see the license files for details.

File: sgx/include/utils/imagelib/imageloader.hpp

*/

#ifndef SGX_IMAGELOADER_HPP
#define SGX_IMAGELOADER_HPP	1

class CSGXFile;

class CImageParser {
public:
	static	void	initialize();

	virtual tBOOL	isRecognised(CSGXFile &file) const;
	virtual tBOOL	open(CSGXFile &file, CImageData &properties) const;
	virtual tBOOL	close(CImageData &properties) const;

protected:
	static CImageParser	*m_pSingleton;
};

class CImageLoader {
public:
	static CImageLoader *create();
	static CImageLoader *get();

	virtual void	initialize();
	tBOOL			registerObject(const CImageParser *pCls);
	tBOOL			loadImageData(CImageData &data, CSGXFile &file);
	tBOOL			loadImageData(CImageData &data, const sgxString &filename);
	tBOOL			loadImageData(CImageData &data, const char *pFilename);

	CSGXSurface *	loadSurface(CSGXFile &file, const CImageData::Mask &mask=CImageData::Mask());
	CSGXSurface *	loadSurface(const sgxString &name, const CImageData::Mask &mask=CImageData::Mask());
	CSGXSurface *	loadSurface(const char *pFilename, const CImageData::Mask &mask=CImageData::Mask());
	CSGXSurface *	loadSurface(CSGXFile &file, CSGXFile &alpha_file);
	CSGXSurface *	loadSurface(const sgxString &name, const sgxString &alpha_name);

protected:
	CImageLoader();

	static CImageLoader	*m_pSingleton;

private:
	sgxVector<const CImageParser *>	m_Parsers;
};



#endif /* SGX_IMAGELOADER_HPP */

