File: GraphicsTypes.hs

package info (click to toggle)
hugs 1.4.199801-1
  • links: PTS
  • area: non-free
  • in suites: slink
  • size: 7,220 kB
  • ctags: 5,609
  • sloc: ansic: 32,083; haskell: 12,143; yacc: 949; perl: 823; sh: 602; makefile: 236
file content (53 lines) | stat: -rw-r--r-- 1,561 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
module GraphicsTypes
	( Angle
	, Dimension, toDimension, fromDimension
	, Point,     toPoint,     fromPoint
	, RGB(RGB)
	, Picture
	) where

import qualified Win32
import Word( Word8 )  -- GHC extension

-- Hugs does not allow operators to have different fixities in 
-- different modules (this is a known deviation from Standard Haskell).
-- In consequence, we don't declare any fixities in any non-standard
-- library because it would prevent the programmer from using the same
-- operator name at a different fixity.
--
-- infixr 9 `over`

----------------------------------------------------------------
-- Units
----------------------------------------------------------------

type Angle     = Double

type Dimension = Int
type Point     = (Dimension,Dimension)

-- These functions are used when implementing Pictures
toPoint        :: Win32.POINT -> Point
fromPoint      :: Point -> Win32.POINT

toDimension    :: Win32.INT -> Dimension
fromDimension  :: Dimension -> Win32.INT

toPoint       (x,y) = (toDimension x, toDimension y)
fromPoint     (x,y) = (fromDimension x, fromDimension y)
toDimension   = toInt 
fromDimension = fromInt

---------------------------------------------------------------
-- Colors
----------------------------------------------------------------

data RGB = RGB Word8 Word8 Word8

----------------------------------------------------------------
-- Pictures
----------------------------------------------------------------

type Picture = Win32.HDC -> IO ()

----------------------------------------------------------------