module NanoVG.Internal.Context
  (Context(..)
  , toPointer
  , fromPointer
  ) where

import Foreign.Ptr

-- | Opaque context that needs to be passed around
newtype Context = Context (Ptr Context)

-- | In marshaller for c2hs
toPointer :: Context -> Ptr ()
toPointer :: Context -> Ptr ()
toPointer (Context Ptr Context
p) = Ptr Context -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr Context
p

-- | out marshaller for c2hs
fromPointer :: Ptr () -> Context
fromPointer :: Ptr () -> Context
fromPointer Ptr ()
p = Ptr Context -> Context
Context (Ptr () -> Ptr Context
forall a b. Ptr a -> Ptr b
castPtr Ptr ()
p)