private void GetWebpInfo(IntPtr ptrRawWebP, int webpDataSize, out int width, out int height, out bool has_alpha, out bool has_animation, out string format)
        {
            VP8StatusCode         result;
            WebPBitstreamFeatures features = new WebPBitstreamFeatures();

            result = WebPWrapper.WebPGetFeatures(ptrRawWebP, webpDataSize, ref features);
            if (result == 0)
            {
                width         = features.Width;
                height        = features.Height;
                has_alpha     = (features.Has_alpha == 1);
                has_animation = (features.Has_animation == 1);
                switch (features.Format)
                {
                case 1:
                    format = "lossy";
                    break;

                case 2:
                    format = "lossless";
                    break;

                default:
                    format = "undefined";
                    break;
                }
            }
            else
            {
                throw new Exception(result.ToString());
            }
        }
Exemple #2
0
        public static VP8StatusCode WebPGetFeatures(IntPtr rawWebP, int data_size, ref WebPBitstreamFeatures features)
        {
            switch (IntPtr.Size)
            {
            case 4:
                return(WebPGetFeaturesInternal_x86(rawWebP, (UIntPtr)data_size, ref features, WEBP_DECODER_ABI_VERSION));

            case 8:
                return(WebPGetFeaturesInternal_x64(rawWebP, (UIntPtr)data_size, ref features, WEBP_DECODER_ABI_VERSION));

            default:
                throw new InvalidOperationException("Invalid platform. Can not find proper function");
            }
        }
Exemple #3
0
 private static extern VP8StatusCode WebPGetFeaturesInternal_x64([InAttribute()] IntPtr rawWebP, UIntPtr data_size, ref WebPBitstreamFeatures features, int WEBP_DECODER_ABI_VERSION);