{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) Helper structure representing a rectangular area. -} module GI.GstVideo.Structs.VideoRectangle ( -- * Exported types VideoRectangle(..) , newZeroVideoRectangle , noVideoRectangle , -- * Properties -- ** H videoRectangleReadH , -- ** W videoRectangleReadW , -- ** X videoRectangleReadX , -- ** Y videoRectangleReadY , ) 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.GstVideo.Types import GI.GstVideo.Callbacks newtype VideoRectangle = VideoRectangle (ForeignPtr VideoRectangle) -- | Construct a `VideoRectangle` struct initialized to zero. newZeroVideoRectangle :: MonadIO m => m VideoRectangle newZeroVideoRectangle = liftIO $ callocBytes 16 >>= wrapPtr VideoRectangle noVideoRectangle :: Maybe VideoRectangle noVideoRectangle = Nothing videoRectangleReadX :: VideoRectangle -> IO Int32 videoRectangleReadX s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 0) :: IO Int32 return val videoRectangleReadY :: VideoRectangle -> IO Int32 videoRectangleReadY s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 4) :: IO Int32 return val videoRectangleReadW :: VideoRectangle -> IO Int32 videoRectangleReadW s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 8) :: IO Int32 return val videoRectangleReadH :: VideoRectangle -> IO Int32 videoRectangleReadH s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 12) :: IO Int32 return val type family ResolveVideoRectangleMethod (t :: Symbol) (o :: *) :: * where ResolveVideoRectangleMethod l o = MethodResolutionFailed l o instance (info ~ ResolveVideoRectangleMethod t VideoRectangle, MethodInfo info VideoRectangle p) => IsLabelProxy t (VideoRectangle -> p) where fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info) #if MIN_VERSION_base(4,9,0) instance (info ~ ResolveVideoRectangleMethod t VideoRectangle, MethodInfo info VideoRectangle p) => IsLabel t (VideoRectangle -> p) where fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info) #endif