public static void Initialize() { try { FI.FreeImage.ValidateAvailability(); } catch { LogManager.Instance.Write("[ Warning ] No Freeimage found."); return; } LogManager.Instance.Write("FreeImage Version: {0}", FI.FreeImage.GetVersion()); LogManager.Instance.Write(FI.FreeImage.GetCopyrightMessage()); // Register codecs var sb = new StringBuilder(); sb.Append(" Supported formats: "); var first = true; for (var i = 0; i < FI.FreeImage.GetFIFCount(); i++) { // Skip DDS codec since FreeImage does not have the option // to keep DXT data compressed, we'll use our own codec if ((FI.FREE_IMAGE_FORMAT)i == FI.FREE_IMAGE_FORMAT.FIF_DDS) { continue; } var exts = FI.FreeImage.GetFIFExtensionList((FI.FREE_IMAGE_FORMAT)i); if (!first) { sb.Append(","); } else { first = false; } sb.Append(exts); // Pull off individual formats (separated by comma by FI) var extensions = exts.Split(','); foreach (var ext in extensions) { // FreeImage 3.13 lists many formats twice: once under their own codec and // once under the "RAW" codec, which is listed last. Avoid letting the RAW override // the dedicated codec! if (!CodecManager.Instance.IsCodecRegistered(ext)) { var codec = new FreeImageCodec(ext, (FI.FREE_IMAGE_TYPE)i); _codecList.Add(codec); CodecManager.Instance.RegisterCodec(codec); } } } LogManager.Instance.Write(sb.ToString()); FI.FreeImageEngine.Message += new FI.OutputMessageFunction(_freeImageLoadErrorHandler); }
/// <summary> /// Called when the plugin is stopped. /// </summary> public void Shutdown() { FreeImageCodec.Shutdown(); }
/// <summary> /// Called when the plugin is started. /// </summary> public void Initialize() { NativeLibraryLoader.CopyNativeDll("FreeImage", "FreeImage"); FreeImageCodec.Initialize(); }
public static void Initialize() { if ( !FI.FreeImage.IsAvailable() ) { LogManager.Instance.Write( "[ Warning ] No Freeimage found." ); return; } LogManager.Instance.Write( "FreeImage Version: {0}", FI.FreeImage.GetVersion() ); LogManager.Instance.Write( FI.FreeImage.GetCopyrightMessage() ); // Register codecs var sb = new StringBuilder(); sb.Append( " Supported formats: " ); var first = true; for ( var i = 0; i < FI.FreeImage.GetFIFCount(); i++ ) { // Skip DDS codec since FreeImage does not have the option // to keep DXT data compressed, we'll use our own codec if ( (FI.FREE_IMAGE_FORMAT)i == FI.FREE_IMAGE_FORMAT.FIF_DDS ) { continue; } var exts = FI.FreeImage.GetFIFExtensionList( (FI.FREE_IMAGE_FORMAT)i ); if ( !first ) { sb.Append( "," ); } else { first = false; } sb.Append( exts ); // Pull off individual formats (separated by comma by FI) var extensions = exts.Split( ',' ); foreach ( var ext in extensions ) { // FreeImage 3.13 lists many formats twice: once under their own codec and // once under the "RAW" codec, which is listed last. Avoid letting the RAW override // the dedicated codec! if ( !CodecManager.Instance.IsCodecRegistered( ext ) ) { var codec = new FreeImageCodec( ext, (FI.FREE_IMAGE_TYPE)i ); _codecList.Add( codec ); CodecManager.Instance.RegisterCodec( codec ); } } } LogManager.Instance.Write( sb.ToString() ); FI.FreeImageEngine.Message += new FI.OutputMessageFunction( _freeImageLoadErrorHandler ); }
/// <summary> /// Called when the plugin is started. /// </summary> public void Initialize() { FreeImageCodec.Initialize(); }
public static void Initialize() { if ( !FI.FreeImage.IsAvailable() ) { LogManager.Instance.Write( "[ Warning ] No Freeimage found." ); return; } LogManager.Instance.Write( "FreeImage Version: {0}", FI.FreeImage.GetVersion() ); LogManager.Instance.Write( FI.FreeImage.GetCopyrightMessage() ); StringBuilder sb = new StringBuilder(); sb.Append( " Supported formats: " ); bool first = true; for ( int i = 0; i < FI.FreeImage.GetFIFCount(); i++ ) { if ( (FI.FREE_IMAGE_FORMAT)i == FI.FREE_IMAGE_FORMAT.FIF_DDS ) continue; string exts = FI.FreeImage.GetFIFExtensionList( (FI.FREE_IMAGE_FORMAT)i ); if ( !first ) { sb.Append( "," ); } else first = false; sb.Append( exts ); // Pull off individual formats (separated by comma by FI) string[] extensions = exts.Split( ',' ); foreach ( string extension in extensions ) { // FreeImage 3.13 lists many formats twice: once under their own codec and // once under the "RAW" codec, which is listed last. Avoid letting the RAW override // the dedicated codec! if ( !CodecManager.Instance.IsCodecAviable( extension ) ) { ImageCodec codec = new FreeImageCodec( extension, (FI.FREE_IMAGE_TYPE)i ); _codecList.Add( codec ); CodecManager.Instance.RegisterCodec( codec ); } } } LogManager.Instance.Write( sb.ToString() ); FI.FreeImageEngine.Message += new FI.OutputMessageFunction( FreeImageLoadErrorHandler ); }