{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS_GHC -Wall -fno-warn-tabs #-}

module Control.Moffy.Samples.Viewable.Basic (
	Color(..), white, blue, colorToRgb, Position, LineWidth ) where

import Data.Word (Word8)

data Color =
	Color { Color -> Word8
colorRed :: Word8, Color -> Word8
colorGreen :: Word8, Color -> Word8
colorBlue :: Word8 }
	deriving Int -> Color -> ShowS
[Color] -> ShowS
Color -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Color] -> ShowS
$cshowList :: [Color] -> ShowS
show :: Color -> String
$cshow :: Color -> String
showsPrec :: Int -> Color -> ShowS
$cshowsPrec :: Int -> Color -> ShowS
Show

white, blue :: Color
white :: Color
white = Color { colorRed :: Word8
colorRed = Word8
0xff, colorGreen :: Word8
colorGreen = Word8
0xff, colorBlue :: Word8
colorBlue = Word8
0xff }
blue :: Color
blue = Color { colorRed :: Word8
colorRed = Word8
0x30, colorGreen :: Word8
colorGreen = Word8
0x66, colorBlue :: Word8
colorBlue = Word8
0xd6 }

colorToRgb :: Color -> (Double, Double, Double)
colorToRgb :: Color -> (Double, Double, Double)
colorToRgb (Color (forall a b. (Integral a, Num b) => a -> b
fromIntegral -> Double
r) (forall a b. (Integral a, Num b) => a -> b
fromIntegral -> Double
g) (forall a b. (Integral a, Num b) => a -> b
fromIntegral -> Double
b)) =
	(Double
r forall a. Fractional a => a -> a -> a
/ Double
0xff, Double
g forall a. Fractional a => a -> a -> a
/ Double
0xff, Double
b forall a. Fractional a => a -> a -> a
/ Double
0xff)

type Position = (Double, Double)
type LineWidth = Double