packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webgpu (webref). Do not edit.
module JSDOM.Generated.GPUExternalTextureDescriptor
       (newGPUExternalTextureDescriptor, setSource, getSource, setColorSpace, getColorSpace, getColorSpaceUnsafe, getColorSpaceUnchecked, GPUExternalTextureDescriptor(..), gTypeGPUExternalTextureDescriptor)
       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://gpuweb.github.io/gpuweb/#dictdef-gpuexternaltexturedescriptor GPUExternalTextureDescriptor specification>
newGPUExternalTextureDescriptor :: (MonadDOM m, IsHTMLVideoElementOrVideoFrame source) => source -> m GPUExternalTextureDescriptor
newGPUExternalTextureDescriptor source = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "source" (toJSVal source)) P.>> P.return o)) >>= fromJSValUnchecked))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpuexternaltexturedescriptor-source GPUExternalTextureDescriptor.source specification>
setSource :: (MonadDOM m, IsHTMLVideoElementOrVideoFrame val) => GPUExternalTextureDescriptor -> val -> m ()
setSource self val = liftDOM (void (self ^. jss "source" (toJSVal val)))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpuexternaltexturedescriptor-source GPUExternalTextureDescriptor.source specification>
getSource :: (MonadDOM m) => GPUExternalTextureDescriptor -> m HTMLVideoElementOrVideoFrame
getSource self = liftDOM (((self ^. js "source") >>= fromJSValUnchecked))

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

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

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

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