示例#1
0
oexINT CImage::GetFileType( oexCSTR x_pFile )
{_STT();
#if !defined( OEX_ENABLE_XIMAGE )
	return -1;
#else

// Sanity check
	if ( !oexCHECK_PTR( x_pFile ) )
		return -1;

	oexINT type = -1;
	CStr sExt = CStr( x_pFile ).GetFileExtension();
	if ( !sExt.Length() )
		sExt = x_pFile;

	sExt.ToLower();

	if ( 0 );

	// Check for bitmap
#if defined( CXIMAGE_SUPPORT_JPG ) && CXIMAGE_SUPPORT_JPG
	else if ( sExt == oexT( "jpg" ) || sExt == oexT( "jpeg" ) ) type = CXIMAGE_FORMAT_JPG;
#endif
#if defined( CXIMAGE_SUPPORT_BMP ) && CXIMAGE_SUPPORT_BMP
	else if ( sExt == oexT( "bmp" ) || sExt == oexT( "dib" ) ) type = CXIMAGE_FORMAT_BMP;
#endif
#if defined( CXIMAGE_SUPPORT_PNG ) && CXIMAGE_SUPPORT_PNG
	else if ( sExt == oexT( "png" ) ) type = CXIMAGE_FORMAT_PNG;
#endif
#if defined( CXIMAGE_SUPPORT_WMF ) && CXIMAGE_SUPPORT_WMF
	else if ( sExt == oexT( "wmf" ) ) type = CXIMAGE_FORMAT_WMF;
	else if ( sExt == oexT( "emf" ) ) type = CXIMAGE_FORMAT_WMF;
#endif
#if defined( CXIMAGE_SUPPORT_GIF ) && CXIMAGE_SUPPORT_GIF
	else if ( sExt == oexT( "gif" ) ) type = CXIMAGE_FORMAT_GIF;
#endif
//#if defined( CXIMAGE_SUPPORT_MNG ) && CXIMAGE_SUPPORT_MNG
//	else if ( sExt == oexT( "mng" ) ) type = CXIMAGE_FORMAT_MNG;
//#endif
#if defined( CXIMAGE_SUPPORT_ICO ) && CXIMAGE_SUPPORT_ICO
	else if ( sExt == oexT( "ico" ) ) type = CXIMAGE_FORMAT_ICO;
#endif
#if defined( CXIMAGE_SUPPORT_TIF ) && CXIMAGE_SUPPORT_TIF
	else if ( sExt == oexT( "tif" ) || sExt == oexT( "tiff" ) ) type = CXIMAGE_FORMAT_TIF;
#endif
#if defined( CXIMAGE_SUPPORT_TGA ) && CXIMAGE_SUPPORT_TGA
	else if ( sExt == oexT( "tga" ) ) type = CXIMAGE_FORMAT_TGA;
#endif
#if defined( CXIMAGE_SUPPORT_PCX ) && CXIMAGE_SUPPORT_PCX
	else if ( sExt == oexT( "pcx" ) ) type = CXIMAGE_FORMAT_PCX;
#endif
//#if defined( CXIMAGE_SUPPORT_JP2 ) && CXIMAGE_SUPPORT_JP2
//	else if ( sExt == oexT( "jp2" ) ) type = CXIMAGE_FORMAT_JP2;
//#endif

	return type;

#endif
}