packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/GPUCopyExternalImageDestInfo.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.GPUCopyExternalImageDestInfo
       (newGPUCopyExternalImageDestInfo, setColorSpace, getColorSpace, getColorSpaceUnsafe, getColorSpaceUnchecked, setPremultipliedAlpha, getPremultipliedAlpha, getPremultipliedAlphaUnsafe, getPremultipliedAlphaUnchecked, GPUCopyExternalImageDestInfo(..), gTypeGPUCopyExternalImageDestInfo)
       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/#gpucopyexternalimagedestinfo GPUCopyExternalImageDestInfo specification>
newGPUCopyExternalImageDestInfo :: (MonadDOM m) => GPUTexture -> m GPUCopyExternalImageDestInfo
newGPUCopyExternalImageDestInfo texture = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "texture" (toJSVal texture)) P.>> P.return o)) >>= fromJSValUnchecked))

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

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

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

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

-- | <https://gpuweb.github.io/gpuweb/#dom-gpucopyexternalimagedestinfo-premultipliedalpha GPUCopyExternalImageDestInfo.premultipliedAlpha specification>
setPremultipliedAlpha :: (MonadDOM m) => GPUCopyExternalImageDestInfo -> Bool -> m ()
setPremultipliedAlpha self val = liftDOM (void (self ^. jss "premultipliedAlpha" (toJSVal val)))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpucopyexternalimagedestinfo-premultipliedalpha GPUCopyExternalImageDestInfo.premultipliedAlpha specification>
getPremultipliedAlpha :: (MonadDOM m) => GPUCopyExternalImageDestInfo -> m (Maybe Bool)
getPremultipliedAlpha self = liftDOM (((self ^. js "premultipliedAlpha") >>= fromJSValUnchecked))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpucopyexternalimagedestinfo-premultipliedalpha GPUCopyExternalImageDestInfo.premultipliedAlpha specification>
getPremultipliedAlphaUnsafe :: (MonadDOM m, HasCallStack) => GPUCopyExternalImageDestInfo -> m Bool
getPremultipliedAlphaUnsafe self = liftDOM ((((self ^. js "premultipliedAlpha") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpucopyexternalimagedestinfo-premultipliedalpha GPUCopyExternalImageDestInfo.premultipliedAlpha specification>
getPremultipliedAlphaUnchecked :: (MonadDOM m) => GPUCopyExternalImageDestInfo -> m Bool
getPremultipliedAlphaUnchecked self = liftDOM (((self ^. js "premultipliedAlpha") >>= valToBool))