packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/VideoFrameCopyToOptions.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webcodecs (webref). Do not edit.
module JSDOM.Generated.VideoFrameCopyToOptions
       (newVideoFrameCopyToOptions, setRect, getRect, getRectUnsafe, getRectUnchecked, setLayout, getLayout, getLayoutUnsafe, getLayoutUnchecked, setFormat, getFormat, getFormatUnsafe, getFormatUnchecked, setColorSpace, getColorSpace, getColorSpaceUnsafe, getColorSpaceUnchecked, VideoFrameCopyToOptions(..), gTypeVideoFrameCopyToOptions)
       where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import Language.Javascript.JSaddle (JSM, JSVal, JSString, toJSVal, valToBool, valToNumber, js, jss, jsf, jsg, new, function, asyncFunction, jsUndefined, jsNull)
import JSDOM.Types
import qualified JSDOM.Types as Types
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Generated.Enums

-- | <https://w3c.github.io/webcodecs/#dictdef-videoframecopytooptions VideoFrameCopyToOptions specification>
newVideoFrameCopyToOptions :: (MonadDOM m) => m VideoFrameCopyToOptions
newVideoFrameCopyToOptions = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videoframecopytooptions-rect VideoFrameCopyToOptions.rect specification>
setRect :: (MonadDOM m) => VideoFrameCopyToOptions -> DOMRectInit -> m ()
setRect self val = liftDOM (void (self ^. jss "rect" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videoframecopytooptions-rect VideoFrameCopyToOptions.rect specification>
getRect :: (MonadDOM m) => VideoFrameCopyToOptions -> m (Maybe DOMRectInit)
getRect self = liftDOM (((self ^. js "rect") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videoframecopytooptions-rect VideoFrameCopyToOptions.rect specification>
getRectUnsafe :: (MonadDOM m, HasCallStack) => VideoFrameCopyToOptions -> m DOMRectInit
getRectUnsafe self = liftDOM ((((self ^. js "rect") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videoframecopytooptions-rect VideoFrameCopyToOptions.rect specification>
getRectUnchecked :: (MonadDOM m) => VideoFrameCopyToOptions -> m DOMRectInit
getRectUnchecked self = liftDOM (((self ^. js "rect") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videoframecopytooptions-layout VideoFrameCopyToOptions.layout specification>
setLayout :: (MonadDOM m) => VideoFrameCopyToOptions -> [PlaneLayout] -> m ()
setLayout self val = liftDOM (void (self ^. jss "layout" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videoframecopytooptions-layout VideoFrameCopyToOptions.layout specification>
getLayout :: (MonadDOM m) => VideoFrameCopyToOptions -> m (Maybe [PlaneLayout])
getLayout self = liftDOM (((self ^. js "layout") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videoframecopytooptions-layout VideoFrameCopyToOptions.layout specification>
getLayoutUnsafe :: (MonadDOM m, HasCallStack) => VideoFrameCopyToOptions -> m [PlaneLayout]
getLayoutUnsafe self = liftDOM ((((self ^. js "layout") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videoframecopytooptions-layout VideoFrameCopyToOptions.layout specification>
getLayoutUnchecked :: (MonadDOM m) => VideoFrameCopyToOptions -> m [PlaneLayout]
getLayoutUnchecked self = liftDOM (((self ^. js "layout") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videoframecopytooptions-format VideoFrameCopyToOptions.format specification>
setFormat :: (MonadDOM m) => VideoFrameCopyToOptions -> VideoPixelFormat -> m ()
setFormat self val = liftDOM (void (self ^. jss "format" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videoframecopytooptions-format VideoFrameCopyToOptions.format specification>
getFormat :: (MonadDOM m) => VideoFrameCopyToOptions -> m (Maybe VideoPixelFormat)
getFormat self = liftDOM (((self ^. js "format") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videoframecopytooptions-format VideoFrameCopyToOptions.format specification>
getFormatUnsafe :: (MonadDOM m, HasCallStack) => VideoFrameCopyToOptions -> m VideoPixelFormat
getFormatUnsafe self = liftDOM ((((self ^. js "format") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videoframecopytooptions-format VideoFrameCopyToOptions.format specification>
getFormatUnchecked :: (MonadDOM m) => VideoFrameCopyToOptions -> m VideoPixelFormat
getFormatUnchecked self = liftDOM (((self ^. js "format") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videoframecopytooptions-colorspace VideoFrameCopyToOptions.colorSpace specification>
setColorSpace :: (MonadDOM m) => VideoFrameCopyToOptions -> PredefinedColorSpace -> m ()
setColorSpace self val = liftDOM (void (self ^. jss "colorSpace" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videoframecopytooptions-colorspace VideoFrameCopyToOptions.colorSpace specification>
getColorSpace :: (MonadDOM m) => VideoFrameCopyToOptions -> m (Maybe PredefinedColorSpace)
getColorSpace self = liftDOM (((self ^. js "colorSpace") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videoframecopytooptions-colorspace VideoFrameCopyToOptions.colorSpace specification>
getColorSpaceUnsafe :: (MonadDOM m, HasCallStack) => VideoFrameCopyToOptions -> m PredefinedColorSpace
getColorSpaceUnsafe self = liftDOM ((((self ^. js "colorSpace") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videoframecopytooptions-colorspace VideoFrameCopyToOptions.colorSpace specification>
getColorSpaceUnchecked :: (MonadDOM m) => VideoFrameCopyToOptions -> m PredefinedColorSpace
getColorSpaceUnchecked self = liftDOM (((self ^. js "colorSpace") >>= fromJSValUnchecked))