{-# OPTIONS_HADDOCK hide #-}

module Graphics.Gloss.Internals.Color where

import Graphics.Gloss.Data.Color
import qualified Graphics.Rendering.OpenGL.GL           as GL

import Unsafe.Coerce

-- | Convert one of our Colors to OpenGL's representation.
glColor4OfColor :: Color -> GL.Color4 a
glColor4OfColor :: Color -> Color4 a
glColor4OfColor Color
color
 = case Color -> (Float, Float, Float, Float)
rgbaOfColor Color
color of
        (Float
r, Float
g, Float
b, Float
a)
         -> let rF :: b
rF      = Float -> b
forall a b. a -> b
unsafeCoerce Float
r
                gF :: b
gF      = Float -> b
forall a b. a -> b
unsafeCoerce Float
g
                bF :: b
bF      = Float -> b
forall a b. a -> b
unsafeCoerce Float
b
                aF :: b
aF      = Float -> b
forall a b. a -> b
unsafeCoerce Float
a
            in  a -> a -> a -> a -> Color4 a
forall a. a -> a -> a -> a -> Color4 a
GL.Color4 a
forall b. b
rF a
forall b. b
gF a
forall b. b
bF a
forall b. b
aF