using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace LibwebpSharp.Native
{
///
///
///
public static class WebPDecoder
{
///
/// Return the decoder's version number
///
/// Hexadecimal using 8bits for each of major/minor/revision. E.g: v2.5.7 is 0x020507
[DllImport("libwebp", CharSet = CharSet.Auto)]
public static extern int WebPGetDecoderVersion();
///
/// This function will validate the WebP image header and retrieve the image height and width. Pointers *width and *height can be passed NULL if deemed irrelevant
///
/// Pointer to WebP image data
/// This is the size of the memory block pointed to by data containing the image data
/// The range is limited currently from 1 to 16383
/// The range is limited currently from 1 to 16383
/// 1 if success, otherwise error code returned in the case of (a) formatting error(s).
[DllImport("libwebp", CharSet = CharSet.Auto)]
public static extern int WebPGetInfo(IntPtr data, UInt32 data_size, ref int width, ref int height);
///
/// Decodes WEBP images pointed to by *data and returns RGB samples into a pre-allocated buffer
///
/// Pointer to WebP image data
/// This is the size of the memory block pointed to by data containing the image data
/// Pointer to decoded WebP image
/// Size of allocated buffer
/// Specifies the distance between scanlines
/// output_buffer if function succeeds; NULL otherwise
[DllImport("libwebp", CharSet = CharSet.Auto)]
public static extern IntPtr WebPDecodeRGBInto(IntPtr data, UInt32 data_size, IntPtr output_buffer, int output_buffer_size, int output_stride);
///
/// Decodes WEBP images pointed to by *data and returns RGBA samples into a pre-allocated buffer
///
/// Pointer to WebP image data
/// This is the size of the memory block pointed to by data containing the image data
/// Pointer to decoded WebP image
/// Size of allocated buffer
/// Specifies the distance between scanlines
/// output_buffer if function succeeds; NULL otherwise
[DllImport("libwebp", CharSet = CharSet.Auto)]
public static extern IntPtr WebPDecodeRGBAInto(IntPtr data, UInt32 data_size, IntPtr output_buffer, int output_buffer_size, int output_stride);
///
/// Decodes WEBP images pointed to by *data and returns BGR samples into a pre-allocated buffer
///
/// Pointer to WebP image data
/// This is the size of the memory block pointed to by data containing the image data
/// Pointer to decoded WebP image
/// Size of allocated buffer
/// Specifies the distance between scanlines
/// output_buffer if function succeeds; NULL otherwise
[DllImport("libwebp", CharSet = CharSet.Auto)]
public static extern IntPtr WebPDecodeBGRInto(IntPtr data, UInt32 data_size, IntPtr output_buffer, int output_buffer_size, int output_stride);
///
/// Decodes WEBP images pointed to by *data and returns BGRA samples into a pre-allocated buffer
///
/// Pointer to WebP image data
/// This is the size of the memory block pointed to by data containing the image data
/// Pointer to decoded WebP image
/// Size of allocated buffer
/// Specifies the distance between scanlines
/// output_buffer if function succeeds; NULL otherwise
[DllImport("libwebp", CharSet = CharSet.Auto)]
public static extern IntPtr WebPDecodeBGRAInto(IntPtr data, UInt32 data_size, IntPtr output_buffer, int output_buffer_size, int output_stride);
}
}