packages feed

lambdacube-engine-0.1.1: Graphics/LambdaCube/Image.hs

module Graphics.LambdaCube.Image where

import Data.Word
import Foreign.Ptr

import Data.ByteString.Lazy

import Graphics.LambdaCube.PixelFormat

-- | Image loader function
type ImageLoader = String -> ByteString -> IO (Maybe Image)

-- | Has information about the size and the pixel format of the image.
data Image
    = Image
    { imName        :: String
    , imHeight      :: Int
    , imWidth       :: Int
    , imDepth       :: Int
    , imSize        :: Int
    , imNumMipmaps  :: Int
--    uint flags;
    , imFormat      :: PixelFormat
    , imData        :: {-Maybe-} (Ptr Word8) -- ^ Image can be empty
    }

{-
    enum ImageFlags
    {
        IF_COMPRESSED = 0x00000001,
        IF_CUBEMAP    = 0x00000002,
        IF_3D_TEXTURE = 0x00000004
    };
-}