コード例 #1
0
 public void Dispose()
 {
     if (!_isDisposed && (Data != (byte *)0))
     {
         NativeImage.FreeImage(Data);
     }
     _isDisposed = true;
 }
コード例 #2
0
        public override ImageData Import(FileStream stream, ImporterContext ctx)
        {
            // Ensure it is a supported image type
            switch (ctx.FileExtension)
            {
            case ".png":
            case ".jpg":
            case ".jpeg":
            case ".bmp":
            case ".tga": break;

            default:
                ctx.Logger.Error($"unsupported image file format '{ctx.FileExtension.Substring(1)}'.");
                return(null);
            }

            // Load as a 4-channel rgba
            return(NativeImage.Load(ctx.FilePath));
        }