module GI.Poppler.Structs.Point
(
Point(..) ,
noPoint ,
pointCopy ,
pointFree ,
pointNew ,
pointReadX ,
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'
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'
foreign import ccall "poppler_point_copy" poppler_point_copy ::
Ptr Point ->
IO (Ptr Point)
pointCopy ::
(MonadIO m) =>
Point ->
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'
foreign import ccall "poppler_point_free" poppler_point_free ::
Ptr Point ->
IO ()
pointFree ::
(MonadIO m) =>
Point ->
m ()
pointFree _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
poppler_point_free _obj'
touchManagedPtr _obj
return ()