コード例 #1
0
ファイル: GetType.cpp プロジェクト: BackupTheBerlios/tap-svn
FREE_IMAGE_FORMAT DLL_CALLCONV
FreeImage_GetFileTypeFromHandle(FreeImageIO *io, fi_handle handle, int size) {
	if (handle != NULL) {
		int fif_count = FreeImage_GetFIFCount();

		for (int i = 0; i < fif_count; ++i)
			if (FreeImage_Validate((FREE_IMAGE_FORMAT)i, io, handle)) 
				return (FREE_IMAGE_FORMAT)i;
	}

	return FIF_UNKNOWN;
}
コード例 #2
0
ファイル: GetType.cpp プロジェクト: AntiMoron/YSLib
FREE_IMAGE_FORMAT DLL_CALLCONV
FreeImage_GetFileTypeFromHandle(FreeImageIO *io, fi_handle handle, int size) {
	if (handle != NULL) {
		int fif_count = FreeImage_GetFIFCount();

		for (int i = 0; i < fif_count; ++i) {
			FREE_IMAGE_FORMAT fif = (FREE_IMAGE_FORMAT)i;
			if (FreeImage_Validate(fif, io, handle)) {
				if(fif == FIF_TIFF) {
					// many camera raw files use a TIFF signature ...
					// ... try to revalidate against FIF_RAW (even if it breaks the code genericity)
					if (FreeImage_Validate(FIF_RAW, io, handle)) {
						return FIF_RAW;
					}
				}
				return fif;
			}
		}
	}

	return FIF_UNKNOWN;
}