{- | 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 #PopplerImageMapping structure represents the location of an image on the page -} module GI.Poppler.Structs.ImageMapping ( -- * Exported types ImageMapping(..) , noImageMapping , -- * Methods -- ** imageMappingCopy imageMappingCopy , -- ** imageMappingFree imageMappingFree , -- ** imageMappingNew imageMappingNew , -- * Properties -- ** Area imageMappingReadArea , -- ** ImageId imageMappingReadImageId , ) 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 ImageMapping = ImageMapping (ForeignPtr ImageMapping) foreign import ccall "poppler_image_mapping_get_type" c_poppler_image_mapping_get_type :: IO GType instance BoxedObject ImageMapping where boxedType _ = c_poppler_image_mapping_get_type noImageMapping :: Maybe ImageMapping noImageMapping = Nothing imageMappingReadArea :: ImageMapping -> IO Rectangle imageMappingReadArea s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 0) :: IO (Ptr Rectangle) val' <- (newBoxed Rectangle) val return val' imageMappingReadImageId :: ImageMapping -> IO Int32 imageMappingReadImageId s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 32) :: IO Int32 return val -- method ImageMapping::new -- method type : Constructor -- Args : [] -- Lengths : [] -- hInArgs : [] -- returnType : TInterface "Poppler" "ImageMapping" -- throws : False -- Skip return : False foreign import ccall "poppler_image_mapping_new" poppler_image_mapping_new :: IO (Ptr ImageMapping) imageMappingNew :: (MonadIO m) => m ImageMapping imageMappingNew = liftIO $ do result <- poppler_image_mapping_new checkUnexpectedReturnNULL "poppler_image_mapping_new" result result' <- (wrapBoxed ImageMapping) result return result' -- method ImageMapping::copy -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "ImageMapping", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "ImageMapping", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Poppler" "ImageMapping" -- throws : False -- Skip return : False foreign import ccall "poppler_image_mapping_copy" poppler_image_mapping_copy :: Ptr ImageMapping -> -- _obj : TInterface "Poppler" "ImageMapping" IO (Ptr ImageMapping) imageMappingCopy :: (MonadIO m) => ImageMapping -> -- _obj m ImageMapping imageMappingCopy _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- poppler_image_mapping_copy _obj' checkUnexpectedReturnNULL "poppler_image_mapping_copy" result result' <- (wrapBoxed ImageMapping) result touchManagedPtr _obj return result' -- method ImageMapping::free -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "ImageMapping", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "ImageMapping", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "poppler_image_mapping_free" poppler_image_mapping_free :: Ptr ImageMapping -> -- _obj : TInterface "Poppler" "ImageMapping" IO () imageMappingFree :: (MonadIO m) => ImageMapping -> -- _obj m () imageMappingFree _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj poppler_image_mapping_free _obj' touchManagedPtr _obj return ()