ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/GPUExternalTextureDescriptor.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webgpu (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.GPUExternalTextureDescriptor
(js_newGPUExternalTextureDescriptor, js_setSource, js_getSource, js_setColorSpace, js_getColorSpace, 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 GHCJS.Types (JSVal, JSString)
import GHCJS.Foreign (jsUndefined, jsNull)
import GHCJS.DOM.Types
import qualified GHCJS.DOM.Types as Types
import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import GHCJS.DOM.JSFFI.Generated.Enums
foreign import javascript safe "(($1) => { return ({\"source\": $1}); })"
js_newGPUExternalTextureDescriptor :: HTMLVideoElementOrVideoFrame -> IO GPUExternalTextureDescriptor
-- | <https://gpuweb.github.io/gpuweb/#dictdef-gpuexternaltexturedescriptor GPUExternalTextureDescriptor specification>
newGPUExternalTextureDescriptor :: (MonadDOM m, IsHTMLVideoElementOrVideoFrame source) => source -> m GPUExternalTextureDescriptor
newGPUExternalTextureDescriptor source = liftDOM ((js_newGPUExternalTextureDescriptor (Types.toHTMLVideoElementOrVideoFrame source)))
foreign import javascript safe "(($1, $2) => { $1[\"source\"] = $2; })"
js_setSource :: GPUExternalTextureDescriptor -> HTMLVideoElementOrVideoFrame -> IO ()
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuexternaltexturedescriptor-source GPUExternalTextureDescriptor.source specification>
setSource :: (MonadDOM m, IsHTMLVideoElementOrVideoFrame val) => GPUExternalTextureDescriptor -> val -> m ()
setSource self val = liftDOM (void ((js_setSource (self) (Types.toHTMLVideoElementOrVideoFrame val))))
foreign import javascript unsafe "(($1) => { return $1[\"source\"]; })"
js_getSource :: GPUExternalTextureDescriptor -> IO HTMLVideoElementOrVideoFrame
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuexternaltexturedescriptor-source GPUExternalTextureDescriptor.source specification>
getSource :: (MonadDOM m) => GPUExternalTextureDescriptor -> m HTMLVideoElementOrVideoFrame
getSource self = liftDOM ((js_getSource (self)))
foreign import javascript safe "(($1, $2) => { $1[\"colorSpace\"] = $2; })"
js_setColorSpace :: GPUExternalTextureDescriptor -> JSVal -> IO ()
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuexternaltexturedescriptor-colorspace GPUExternalTextureDescriptor.colorSpace specification>
setColorSpace :: (MonadDOM m) => GPUExternalTextureDescriptor -> PredefinedColorSpace -> m ()
setColorSpace self val = liftDOM (void (((toJSVal val) >>= \a2' -> js_setColorSpace (self) a2')))
foreign import javascript unsafe "(($1) => { return $1[\"colorSpace\"]; })"
js_getColorSpace :: GPUExternalTextureDescriptor -> IO JSVal
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuexternaltexturedescriptor-colorspace GPUExternalTextureDescriptor.colorSpace specification>
getColorSpace :: (MonadDOM m) => GPUExternalTextureDescriptor -> m (Maybe PredefinedColorSpace)
getColorSpace self = liftDOM (((js_getColorSpace (self)) >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuexternaltexturedescriptor-colorspace GPUExternalTextureDescriptor.colorSpace specification>
getColorSpaceUnsafe :: (MonadDOM m, HasCallStack) => GPUExternalTextureDescriptor -> m PredefinedColorSpace
getColorSpaceUnsafe self = liftDOM ((((js_getColorSpace (self)) >>= 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 ((pFromJSVal <$> (js_getColorSpace (self))))