gi-poppler-0.0.30.12: GI/Poppler/Structs/Point.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
A #PopplerPoint is used to describe a location point on a page
-}
module GI.Poppler.Structs.Point
(
-- * Exported types
Point(..) ,
noPoint ,
-- * Methods
-- ** pointCopy
pointCopy ,
-- ** pointFree
pointFree ,
-- ** pointNew
pointNew ,
-- * Properties
-- ** X
pointReadX ,
-- ** Y
pointReadY ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.Poppler.Types
import GI.Poppler.Callbacks
newtype Point = Point (ForeignPtr Point)
foreign import ccall "poppler_point_get_type" c_poppler_point_get_type ::
IO GType
instance BoxedObject Point where
boxedType _ = c_poppler_point_get_type
noPoint :: Maybe Point
noPoint = Nothing
pointReadX :: Point -> IO Double
pointReadX s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO CDouble
let val' = realToFrac val
return val'
pointReadY :: Point -> IO Double
pointReadY s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO CDouble
let val' = realToFrac val
return val'
-- method Point::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Poppler" "Point"
-- throws : False
-- Skip return : False
foreign import ccall "poppler_point_new" poppler_point_new ::
IO (Ptr Point)
pointNew ::
(MonadIO m) =>
m Point
pointNew = liftIO $ do
result <- poppler_point_new
checkUnexpectedReturnNULL "poppler_point_new" result
result' <- (wrapBoxed Point) result
return result'
-- method Point::copy
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Point", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Point", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Poppler" "Point"
-- throws : False
-- Skip return : False
foreign import ccall "poppler_point_copy" poppler_point_copy ::
Ptr Point -> -- _obj : TInterface "Poppler" "Point"
IO (Ptr Point)
pointCopy ::
(MonadIO m) =>
Point -> -- _obj
m Point
pointCopy _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- poppler_point_copy _obj'
checkUnexpectedReturnNULL "poppler_point_copy" result
result' <- (wrapBoxed Point) result
touchManagedPtr _obj
return result'
-- method Point::free
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Point", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Point", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "poppler_point_free" poppler_point_free ::
Ptr Point -> -- _obj : TInterface "Poppler" "Point"
IO ()
pointFree ::
(MonadIO m) =>
Point -> -- _obj
m ()
pointFree _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
poppler_point_free _obj'
touchManagedPtr _obj
return ()