diagrams-hsqml-0.0.0.0: src/Diagrams/Backend/HsQML/GradientObj.hs
{-# OPTIONS_HADDOCK show-extensions #-}
{-# LANGUAGE
DeriveDataTypeable
, TypeFamilies
#-}
{-|
Module : Diagrams.Backend.HsQML.DiagramObj.GradientObj
Description : Rendering functions and instances.
Copyright : (c) Marcin Mrotek, 2015
License : BSD-3
Maintainer : marcin.jan.mrotek@gmail.com
Stability : experimental
A QML object controlling the gradient object.
-}
module Diagrams.Backend.HsQML.GradientObj where
import Data.Typeable
import Graphics.QML
import Graphics.QML.Objects.ParamNames
data AddColourStopSignal deriving Typeable
addColourStopSignal :: Proxy AddColourStopSignal
addColourStopSignal = Proxy
instance SignalKeyClass AddColourStopSignal where
type SignalParams AddColourStopSignal =
Double -> Double -> Double -> Double -> Double -> IO ()
data GradientObj = GradientObj deriving Typeable
instance DefaultClass GradientObj where
classMembers =
[ defSignalNamedParams "addStop" addColourStopSignal
$ fstName "r" `plusName` "g" `plusName` "b" `plusName` "a" `plusName` "offset"
]
addColourStop
:: ObjRef GradientObj -- ^Reference to a gradient object.
-> Double -- ^Red channel value.
-> Double -- ^Green channel value.
-> Double -- ^Blue channel value.
-> Double -- ^Alpha channel value.
-> Double -- ^Offset channel value.
-> IO ()
-- ^Adds a new colour stop to a gradient.
addColourStop this r g b a off = fireSignal addColourStopSignal this r g b a off
newGradient :: IO (ObjRef GradientObj)
-- ^Create a new gradient object.
newGradient = newObjectDC GradientObj