jsaddle-dom-0.10.0.0: src/JSDOM/Generated/GPUCanvasConfiguration.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.GPUCanvasConfiguration
(newGPUCanvasConfiguration, setDevice, getDevice, setFormat, getFormat, setUsage, getUsage, getUsageUnsafe, getUsageUnchecked, setViewFormats, getViewFormats, getViewFormatsUnsafe, getViewFormatsUnchecked, setColorSpace, getColorSpace, getColorSpaceUnsafe, getColorSpaceUnchecked, setToneMapping, getToneMapping, getToneMappingUnsafe, getToneMappingUnchecked, setAlphaMode, getAlphaMode, getAlphaModeUnsafe, getAlphaModeUnchecked, GPUCanvasConfiguration(..), gTypeGPUCanvasConfiguration)
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-gpucanvasconfiguration GPUCanvasConfiguration specification>
newGPUCanvasConfiguration :: (MonadDOM m) => GPUDevice -> GPUTextureFormat -> m GPUCanvasConfiguration
newGPUCanvasConfiguration device format = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "device" (toJSVal device)) P.>> (o ^. jss "format" (toJSVal format)) P.>> P.return o)) >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-device GPUCanvasConfiguration.device specification>
setDevice :: (MonadDOM m) => GPUCanvasConfiguration -> GPUDevice -> m ()
setDevice self val = liftDOM (void (self ^. jss "device" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-device GPUCanvasConfiguration.device specification>
getDevice :: (MonadDOM m) => GPUCanvasConfiguration -> m GPUDevice
getDevice self = liftDOM (((self ^. js "device") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-format GPUCanvasConfiguration.format specification>
setFormat :: (MonadDOM m) => GPUCanvasConfiguration -> GPUTextureFormat -> m ()
setFormat self val = liftDOM (void (self ^. jss "format" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-format GPUCanvasConfiguration.format specification>
getFormat :: (MonadDOM m) => GPUCanvasConfiguration -> m GPUTextureFormat
getFormat self = liftDOM (((self ^. js "format") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-usage GPUCanvasConfiguration.usage specification>
setUsage :: (MonadDOM m) => GPUCanvasConfiguration -> Word -> m ()
setUsage self val = liftDOM (void (self ^. jss "usage" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-usage GPUCanvasConfiguration.usage specification>
getUsage :: (MonadDOM m) => GPUCanvasConfiguration -> m (Maybe Word)
getUsage self = liftDOM (((self ^. js "usage") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-usage GPUCanvasConfiguration.usage specification>
getUsageUnsafe :: (MonadDOM m, HasCallStack) => GPUCanvasConfiguration -> m Word
getUsageUnsafe self = liftDOM ((((self ^. js "usage") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-usage GPUCanvasConfiguration.usage specification>
getUsageUnchecked :: (MonadDOM m) => GPUCanvasConfiguration -> m Word
getUsageUnchecked self = liftDOM ((P.round <$> ((self ^. js "usage") >>= valToNumber)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-viewformats GPUCanvasConfiguration.viewFormats specification>
setViewFormats :: (MonadDOM m) => GPUCanvasConfiguration -> [GPUTextureFormat] -> m ()
setViewFormats self val = liftDOM (void (self ^. jss "viewFormats" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-viewformats GPUCanvasConfiguration.viewFormats specification>
getViewFormats :: (MonadDOM m) => GPUCanvasConfiguration -> m (Maybe [GPUTextureFormat])
getViewFormats self = liftDOM (((self ^. js "viewFormats") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-viewformats GPUCanvasConfiguration.viewFormats specification>
getViewFormatsUnsafe :: (MonadDOM m, HasCallStack) => GPUCanvasConfiguration -> m [GPUTextureFormat]
getViewFormatsUnsafe self = liftDOM ((((self ^. js "viewFormats") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-viewformats GPUCanvasConfiguration.viewFormats specification>
getViewFormatsUnchecked :: (MonadDOM m) => GPUCanvasConfiguration -> m [GPUTextureFormat]
getViewFormatsUnchecked self = liftDOM (((self ^. js "viewFormats") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-colorspace GPUCanvasConfiguration.colorSpace specification>
setColorSpace :: (MonadDOM m) => GPUCanvasConfiguration -> PredefinedColorSpace -> m ()
setColorSpace self val = liftDOM (void (self ^. jss "colorSpace" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-colorspace GPUCanvasConfiguration.colorSpace specification>
getColorSpace :: (MonadDOM m) => GPUCanvasConfiguration -> m (Maybe PredefinedColorSpace)
getColorSpace self = liftDOM (((self ^. js "colorSpace") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-colorspace GPUCanvasConfiguration.colorSpace specification>
getColorSpaceUnsafe :: (MonadDOM m, HasCallStack) => GPUCanvasConfiguration -> m PredefinedColorSpace
getColorSpaceUnsafe self = liftDOM ((((self ^. js "colorSpace") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-colorspace GPUCanvasConfiguration.colorSpace specification>
getColorSpaceUnchecked :: (MonadDOM m) => GPUCanvasConfiguration -> m PredefinedColorSpace
getColorSpaceUnchecked self = liftDOM (((self ^. js "colorSpace") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-tonemapping GPUCanvasConfiguration.toneMapping specification>
setToneMapping :: (MonadDOM m) => GPUCanvasConfiguration -> GPUCanvasToneMapping -> m ()
setToneMapping self val = liftDOM (void (self ^. jss "toneMapping" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-tonemapping GPUCanvasConfiguration.toneMapping specification>
getToneMapping :: (MonadDOM m) => GPUCanvasConfiguration -> m (Maybe GPUCanvasToneMapping)
getToneMapping self = liftDOM (((self ^. js "toneMapping") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-tonemapping GPUCanvasConfiguration.toneMapping specification>
getToneMappingUnsafe :: (MonadDOM m, HasCallStack) => GPUCanvasConfiguration -> m GPUCanvasToneMapping
getToneMappingUnsafe self = liftDOM ((((self ^. js "toneMapping") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-tonemapping GPUCanvasConfiguration.toneMapping specification>
getToneMappingUnchecked :: (MonadDOM m) => GPUCanvasConfiguration -> m GPUCanvasToneMapping
getToneMappingUnchecked self = liftDOM (((self ^. js "toneMapping") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-alphamode GPUCanvasConfiguration.alphaMode specification>
setAlphaMode :: (MonadDOM m) => GPUCanvasConfiguration -> GPUCanvasAlphaMode -> m ()
setAlphaMode self val = liftDOM (void (self ^. jss "alphaMode" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-alphamode GPUCanvasConfiguration.alphaMode specification>
getAlphaMode :: (MonadDOM m) => GPUCanvasConfiguration -> m (Maybe GPUCanvasAlphaMode)
getAlphaMode self = liftDOM (((self ^. js "alphaMode") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-alphamode GPUCanvasConfiguration.alphaMode specification>
getAlphaModeUnsafe :: (MonadDOM m, HasCallStack) => GPUCanvasConfiguration -> m GPUCanvasAlphaMode
getAlphaModeUnsafe self = liftDOM ((((self ^. js "alphaMode") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-alphamode GPUCanvasConfiguration.alphaMode specification>
getAlphaModeUnchecked :: (MonadDOM m) => GPUCanvasConfiguration -> m GPUCanvasAlphaMode
getAlphaModeUnchecked self = liftDOM (((self ^. js "alphaMode") >>= fromJSValUnchecked))