/// <summary> /// Decodes the full data at once, taking 'config' into account. /// </summary> /// <param name="data">WebP raw data to decode</param> /// <param name="data_size">Size of WebP data </param> /// <param name="webPDecoderConfig">Configuration struct</param> /// <returns>VP8_STATUS_OK if the decoding was successful</returns> public static VP8StatusCode WebPDecode(IntPtr data, int data_size, ref WebPDecoderConfig webPDecoderConfig) { switch (IntPtr.Size) { case 4: return(WebPDecode_x86(data, (UIntPtr)data_size, ref webPDecoderConfig)); case 8: return(WebPDecode_x64(data, (UIntPtr)data_size, ref webPDecoderConfig)); default: throw new InvalidOperationException("Invalid platform. Can not find proper function"); } }
/// <summary> /// Initialize the configuration as empty. This function must always be called first, unless WebPGetFeatures() is to be called. /// </summary> /// <param name="webPDecoderConfig">Configuration struct</param> /// <returns>False in case of mismatched version.</returns> public static int WebPInitDecoderConfig(ref WebPDecoderConfig webPDecoderConfig) { switch (IntPtr.Size) { case 4: return(WebPInitDecoderConfigInternal_x86(ref webPDecoderConfig, WEBP_DECODER_ABI_VERSION)); case 8: return(WebPInitDecoderConfigInternal_x64(ref webPDecoderConfig, WEBP_DECODER_ABI_VERSION)); default: throw new InvalidOperationException("Invalid platform. Can not find proper function"); } }
private static extern VP8StatusCode WebPDecode_x64(IntPtr data, UIntPtr data_size, ref WebPDecoderConfig config);
private static extern int WebPInitDecoderConfigInternal_x64(ref WebPDecoderConfig webPDecoderConfig, int WEBP_DECODER_ABI_VERSION);