ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/ImageDataSettings.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from html (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.ImageDataSettings
(js_newImageDataSettings, js_setColorSpace, js_getColorSpace, js_setPixelFormat, js_getPixelFormat, 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 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 "(() => { return ({}); })"
js_newImageDataSettings :: IO ImageDataSettings
-- | <https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagedatasettings ImageDataSettings specification>
newImageDataSettings :: (MonadDOM m) => m ImageDataSettings
newImageDataSettings = liftDOM ((js_newImageDataSettings))
foreign import javascript safe "(($1, $2) => { $1[\"colorSpace\"] = $2; })"
js_setColorSpace :: ImageDataSettings -> JSVal -> IO ()
-- | <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 (((toJSVal val) >>= \a2' -> js_setColorSpace (self) a2')))
foreign import javascript unsafe "(($1) => { return $1[\"colorSpace\"]; })"
js_getColorSpace :: ImageDataSettings -> IO JSVal
-- | <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 (((js_getColorSpace (self)) >>= 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 ((((js_getColorSpace (self)) >>= 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 ((pFromJSVal <$> (js_getColorSpace (self))))
foreign import javascript safe "(($1, $2) => { $1[\"pixelFormat\"] = $2; })"
js_setPixelFormat :: ImageDataSettings -> JSVal -> IO ()
-- | <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 (((toJSVal val) >>= \a2' -> js_setPixelFormat (self) a2')))
foreign import javascript unsafe "(($1) => { return $1[\"pixelFormat\"]; })"
js_getPixelFormat :: ImageDataSettings -> IO JSVal
-- | <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 (((js_getPixelFormat (self)) >>= 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 ((((js_getPixelFormat (self)) >>= 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 ((pFromJSVal <$> (js_getPixelFormat (self))))