packages feed

webp-0.1.0.0: src/WebP/Decode.chs

module WebP.Decode ( webPDecodeRGBA
                   , webPDecodeRGB
                   , UInt8
                   ) where

import Data.Coerce (coerce)
import Foreign.C.Types (CInt, CSize)
import Foreign.Marshal.Alloc (alloca)
import Foreign.Ptr (Ptr, castPtr)
import Foreign.Storable (peek)

#include <webp/decode.h>

type UInt8 = {# type uint8_t #}

-- see docs: https://developers.google.com/speed/webp/docs/api

{# fun WebPDecodeRGBA as ^ { castPtr `Ptr a', coerce `CSize', alloca- `CInt' peek*, alloca- `CInt' peek* } -> `Ptr UInt8' id #}
{# fun WebPDecodeRGB as ^ { castPtr `Ptr a', coerce `CSize', alloca- `CInt' peek*, alloca- `CInt' peek* } -> `Ptr UInt8' id #}

-- WebPDecodeYUV