jsaddle-dom-0.10.0.0: src/JSDOM/Generated/ImageDataSettings.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from html (webref). Do not edit.
module JSDOM.Generated.ImageDataSettings
(newImageDataSettings, setColorSpace, getColorSpace, getColorSpaceUnsafe, getColorSpaceUnchecked, setPixelFormat, getPixelFormat, getPixelFormatUnsafe, getPixelFormatUnchecked, ImageDataSettings(..), gTypeImageDataSettings)
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://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagedatasettings ImageDataSettings specification>
newImageDataSettings :: (MonadDOM m) => m ImageDataSettings
newImageDataSettings = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))
-- | <https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-imagedatasettings-colorspace ImageDataSettings.colorSpace specification>
setColorSpace :: (MonadDOM m) => ImageDataSettings -> PredefinedColorSpace -> m ()
setColorSpace self val = liftDOM (void (self ^. jss "colorSpace" (toJSVal val)))
-- | <https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-imagedatasettings-colorspace ImageDataSettings.colorSpace specification>
getColorSpace :: (MonadDOM m) => ImageDataSettings -> m (Maybe PredefinedColorSpace)
getColorSpace self = liftDOM (((self ^. js "colorSpace") >>= fromJSValUnchecked))
-- | <https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-imagedatasettings-colorspace ImageDataSettings.colorSpace specification>
getColorSpaceUnsafe :: (MonadDOM m, HasCallStack) => ImageDataSettings -> m PredefinedColorSpace
getColorSpaceUnsafe self = liftDOM ((((self ^. js "colorSpace") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-imagedatasettings-colorspace ImageDataSettings.colorSpace specification>
getColorSpaceUnchecked :: (MonadDOM m) => ImageDataSettings -> m PredefinedColorSpace
getColorSpaceUnchecked self = liftDOM (((self ^. js "colorSpace") >>= fromJSValUnchecked))
-- | <https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-imagedatasettings-pixelformat ImageDataSettings.pixelFormat specification>
setPixelFormat :: (MonadDOM m) => ImageDataSettings -> ImageDataPixelFormat -> m ()
setPixelFormat self val = liftDOM (void (self ^. jss "pixelFormat" (toJSVal val)))
-- | <https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-imagedatasettings-pixelformat ImageDataSettings.pixelFormat specification>
getPixelFormat :: (MonadDOM m) => ImageDataSettings -> m (Maybe ImageDataPixelFormat)
getPixelFormat self = liftDOM (((self ^. js "pixelFormat") >>= fromJSValUnchecked))
-- | <https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-imagedatasettings-pixelformat ImageDataSettings.pixelFormat specification>
getPixelFormatUnsafe :: (MonadDOM m, HasCallStack) => ImageDataSettings -> m ImageDataPixelFormat
getPixelFormatUnsafe self = liftDOM ((((self ^. js "pixelFormat") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-imagedatasettings-pixelformat ImageDataSettings.pixelFormat specification>
getPixelFormatUnchecked :: (MonadDOM m) => ImageDataSettings -> m ImageDataPixelFormat
getPixelFormatUnchecked self = liftDOM (((self ^. js "pixelFormat") >>= fromJSValUnchecked))