File: Color.hs

package info (click to toggle)
haskell-gloss-rendering 1.13.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 112 kB
  • sloc: haskell: 798; makefile: 4
file content (19 lines) | stat: -rw-r--r-- 604 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{-# OPTIONS_HADDOCK hide #-}

module Graphics.Gloss.Internals.Rendering.Color where
import Graphics.Gloss.Internals.Data.Color
import Unsafe.Coerce
import qualified Graphics.Rendering.OpenGL.GL           as GL


-- | Convert one of our Colors to OpenGL's representation.
glColor4OfColor :: Color -> GL.Color4 a
glColor4OfColor color
 = case color of
        RGBA r g b a
         -> let rF      = unsafeCoerce r
                gF      = unsafeCoerce g
                bF      = unsafeCoerce b
                aF      = unsafeCoerce a
            in  GL.Color4 rF gF bF aF
{-# INLINE glColor4OfColor #-}