{-# LINE 1 "FreeType/Cache.hsc" #-}
{-# LANGUAGE ForeignFunctionInterface #-}
module FreeType.Cache
(
FTC_Manager
, FTC_FaceID
, FTC_Face_Requester
, ftc_Manager_New
, ftc_Manager_With
, ftc_Manager_Reset
, ftc_Manager_Done
, ftc_Manager_LookupFace
, ftc_Manager_LookupSize
, ftc_Manager_RemoveFaceID
, FTC_Node
, ftc_Node_Unref
, FTC_ImageCache
, ftc_ImageCache_New
, ftc_ImageCache_Lookup
, FTC_SBit
, FTC_SBitCache
, ftc_SBitCache_New
, ftc_SBitCache_Lookup
, FTC_CMapCache
, ftc_CMapCache_New
, ftc_CMapCache_Lookup
, FTC_ScalerRec (..)
, FTC_Scaler
, FTC_ImageTypeRec (..)
, FTC_ImageType
, ftc_ImageCache_LookupScaler
, FTC_SBitRec (..)
, ftc_SBitCache_LookupScaler
) where
import FreeType.Cache.Internal
import FreeType.Cache.Types
import FreeType.Core.Base.Types
import FreeType.Core.Glyph.Types
import FreeType.Core.Types.Types
import FreeType.Exception.Internal
import Control.Exception
import Foreign.Marshal.Alloc
import Foreign.Ptr
import Foreign.Storable
ftc_Manager_New
:: FT_Library
-> FT_UInt
-> FT_UInt
-> FT_ULong
-> FTC_Face_Requester
-> FT_Pointer
-> IO FTC_Manager
ftc_Manager_New =
autoAllocaError "ftc_Manager_New" ftc_Manager_New'
ftc_Manager_With
:: FT_Library
-> FT_UInt
-> FT_UInt
-> FT_ULong
-> FTC_Face_Requester
-> FT_Pointer
-> (FTC_Manager -> IO a)
-> IO a
ftc_Manager_With lib faces sizes bytes req data_ =
bracket (ftc_Manager_New lib faces sizes bytes req data_) ftc_Manager_Done
foreign import ccall "FTC_Manager_Reset"
ftc_Manager_Reset
:: FTC_Manager
-> IO ()
foreign import ccall "FTC_Manager_Done"
ftc_Manager_Done
:: FTC_Manager
-> IO ()
ftc_Manager_LookupFace
:: FTC_Manager
-> FTC_FaceID
-> IO FT_Face
ftc_Manager_LookupFace =
autoAllocaError "ftc_Manager_LookupFace" ftc_Manager_LookupFace'
ftc_Manager_LookupSize
:: FTC_Manager
-> FTC_Scaler
-> IO FT_Size
ftc_Manager_LookupSize =
autoAllocaError "ftc_Manager_LookupSize" ftc_Manager_LookupSize'
foreign import ccall "FTC_Manager_RemoveFaceID"
ftc_Manager_RemoveFaceID
:: FTC_Manager
-> FTC_FaceID
-> IO ()
foreign import ccall "FTC_Node_Unref"
ftc_Node_Unref
:: FTC_Node
-> FTC_Manager
-> IO ()
ftc_ImageCache_New
:: FTC_Manager
-> IO FTC_ImageCache
ftc_ImageCache_New =
autoAllocaError "ftc_ImageCache_New" ftc_ImageCache_New'
anodize :: Storable a => String -> (Ptr a -> Ptr FTC_Node -> IO FT_Error) -> IO (a, Maybe FTC_Node)
anodize name f =
alloca $ \objPtr ->
alloca $ \anodePtr -> do
ftError name $ f objPtr anodePtr
(,)
<$> peek objPtr
<*> do anode <- peek anodePtr
return $ if anode == nullPtr
then Nothing
else Just anode
ftc_ImageCache_Lookup
:: FTC_ImageCache
-> FTC_ImageType
-> FT_UInt
-> IO (FT_Glyph, Maybe FTC_Node)
ftc_ImageCache_Lookup cache type_ gindex =
anodize "ftc_ImageCache_Lookup" $ ftc_ImageCache_Lookup' cache type_ gindex
ftc_SBitCache_New
:: FTC_Manager
-> IO FTC_SBitCache
ftc_SBitCache_New =
autoAllocaError "ftc_SBitCache_New" ftc_SBitCache_New'
ftc_SBitCache_Lookup
:: FTC_SBitCache
-> FTC_ImageType
-> FT_UInt
-> IO (FTC_SBit, Maybe FTC_Node)
ftc_SBitCache_Lookup cache type_ gindex =
anodize "ftc_SBitCache_Lookup" $ ftc_SBitCache_Lookup' cache type_ gindex
ftc_CMapCache_New
:: FTC_Manager
-> IO FTC_CMapCache
ftc_CMapCache_New =
autoAllocaError "ftc_CMapCache_New" ftc_CMapCache_New'
foreign import ccall "FTC_CMapCache_Lookup"
ftc_CMapCache_Lookup
:: FTC_CMapCache
-> FTC_FaceID
-> FT_Int
-> FT_UInt32
-> IO FT_UInt
ftc_ImageCache_LookupScaler
:: FTC_ImageCache
-> FTC_Scaler
-> FT_ULong
-> FT_UInt
-> IO (FT_Glyph, Maybe FTC_Node)
ftc_ImageCache_LookupScaler cache scaler flags gindex =
anodize "ftc_ImageCache_LookupScaler" $ ftc_ImageCache_LookupScaler' cache scaler flags gindex
ftc_SBitCache_LookupScaler
:: FTC_SBitCache
-> FTC_Scaler
-> FT_ULong
-> FT_UInt
-> IO (FTC_SBit, Maybe FTC_Node)
ftc_SBitCache_LookupScaler cache scaler flags gindex =
anodize "ftc_SBitCache_LookupScaler" $ ftc_SBitCache_LookupScaler' cache scaler flags gindex