module Graphics.Gloss.Data.Picture
( Picture (..)
, Point, Vector, Path
, blank
, polygon
, line
, circle, thickCircle
, arc, thickArc
, text
, bitmap
, bitmapSection
, color
, translate, rotate, scale
, pictures
, lineLoop
, circleSolid
, arcSolid
, sectorWire
, rectanglePath
, rectangleWire
, rectangleSolid
, rectangleUpperPath
, rectangleUpperWire
, rectangleUpperSolid)
where
import Graphics.Gloss.Rendering
import Graphics.Gloss.Geometry.Angle
blank :: Picture
blank :: Picture
blank = Picture
Blank
polygon :: Path -> Picture
polygon :: Path -> Picture
polygon = Path -> Picture
Polygon
line :: Path -> Picture
line :: Path -> Picture
line = Path -> Picture
Line
circle :: Float -> Picture
circle :: Float -> Picture
circle = Float -> Picture
Circle
thickCircle :: Float -> Float -> Picture
thickCircle :: Float -> Float -> Picture
thickCircle = Float -> Float -> Picture
ThickCircle
arc :: Float -> Float -> Float -> Picture
arc :: Float -> Float -> Float -> Picture
arc = Float -> Float -> Float -> Picture
Arc
thickArc :: Float -> Float -> Float -> Float -> Picture
thickArc :: Float -> Float -> Float -> Float -> Picture
thickArc = Float -> Float -> Float -> Float -> Picture
ThickArc
text :: String -> Picture
text :: String -> Picture
text = String -> Picture
Text
bitmap :: BitmapData -> Picture
bitmap :: BitmapData -> Picture
bitmap BitmapData
bitmapData = BitmapData -> Picture
Bitmap BitmapData
bitmapData
bitmapSection :: Rectangle -> BitmapData -> Picture
bitmapSection :: Rectangle -> BitmapData -> Picture
bitmapSection = Rectangle -> BitmapData -> Picture
BitmapSection
color :: Color -> Picture -> Picture
color :: Color -> Picture -> Picture
color = Color -> Picture -> Picture
Color
translate :: Float -> Float -> Picture -> Picture
translate :: Float -> Float -> Picture -> Picture
translate = Float -> Float -> Picture -> Picture
Translate
rotate :: Float -> Picture -> Picture
rotate :: Float -> Picture -> Picture
rotate = Float -> Picture -> Picture
Rotate
scale :: Float -> Float -> Picture -> Picture
scale :: Float -> Float -> Picture -> Picture
scale = Float -> Float -> Picture -> Picture
Scale
pictures :: [Picture] -> Picture
pictures :: [Picture] -> Picture
pictures = [Picture] -> Picture
Pictures
lineLoop :: Path -> Picture
lineLoop :: Path -> Picture
lineLoop [] = Path -> Picture
Line []
lineLoop (Point
x:Path
xs) = Path -> Picture
Line ((Point
xPoint -> Path -> Path
forall a. a -> [a] -> [a]
:Path
xs) Path -> Path -> Path
forall a. [a] -> [a] -> [a]
++ [Point
x])
circleSolid :: Float -> Picture
circleSolid :: Float -> Picture
circleSolid Float
r
= Float -> Float -> Picture
thickCircle (Float
rFloat -> Float -> Float
forall a. Fractional a => a -> a -> a
/Float
2) Float
r
arcSolid :: Float -> Float -> Float -> Picture
arcSolid :: Float -> Float -> Float -> Picture
arcSolid Float
a1 Float
a2 Float
r
= Float -> Float -> Float -> Float -> Picture
thickArc Float
a1 Float
a2 (Float
rFloat -> Float -> Float
forall a. Fractional a => a -> a -> a
/Float
2) Float
r
sectorWire :: Float -> Float -> Float -> Picture
sectorWire :: Float -> Float -> Float -> Picture
sectorWire Float
a1 Float
a2 Float
r_
= let r :: Float
r = Float -> Float
forall a. Num a => a -> a
abs Float
r_
in [Picture] -> Picture
Pictures
[ Float -> Float -> Float -> Picture
Arc Float
a1 Float
a2 Float
r
, Path -> Picture
Line [(Float
0, Float
0), (Float
r Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float -> Float
forall a. Floating a => a -> a
cos (Float -> Float
degToRad Float
a1), Float
r Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float -> Float
forall a. Floating a => a -> a
sin (Float -> Float
degToRad Float
a1))]
, Path -> Picture
Line [(Float
0, Float
0), (Float
r Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float -> Float
forall a. Floating a => a -> a
cos (Float -> Float
degToRad Float
a2), Float
r Float -> Float -> Float
forall a. Num a => a -> a -> a
* Float -> Float
forall a. Floating a => a -> a
sin (Float -> Float
degToRad Float
a2))] ]
rectanglePath
:: Float
-> Float
-> Path
rectanglePath :: Float -> Float -> Path
rectanglePath Float
sizeX Float
sizeY
= let sx :: Float
sx = Float
sizeX Float -> Float -> Float
forall a. Fractional a => a -> a -> a
/ Float
2
sy :: Float
sy = Float
sizeY Float -> Float -> Float
forall a. Fractional a => a -> a -> a
/ Float
2
in [(-Float
sx, -Float
sy), (-Float
sx, Float
sy), (Float
sx, Float
sy), (Float
sx, -Float
sy)]
rectangleWire :: Float -> Float -> Picture
rectangleWire :: Float -> Float -> Picture
rectangleWire Float
sizeX Float
sizeY
= Path -> Picture
lineLoop (Path -> Picture) -> Path -> Picture
forall a b. (a -> b) -> a -> b
$ Float -> Float -> Path
rectanglePath Float
sizeX Float
sizeY
rectangleUpperWire :: Float -> Float -> Picture
rectangleUpperWire :: Float -> Float -> Picture
rectangleUpperWire Float
sizeX Float
sizeY
= Path -> Picture
lineLoop (Path -> Picture) -> Path -> Picture
forall a b. (a -> b) -> a -> b
$ Float -> Float -> Path
rectangleUpperPath Float
sizeX Float
sizeY
rectangleUpperPath :: Float -> Float -> Path
rectangleUpperPath :: Float -> Float -> Path
rectangleUpperPath Float
sizeX Float
sy
= let sx :: Float
sx = Float
sizeX Float -> Float -> Float
forall a. Fractional a => a -> a -> a
/ Float
2
in [(-Float
sx, Float
0), (-Float
sx, Float
sy), (Float
sx, Float
sy), (Float
sx, Float
0)]
rectangleSolid :: Float -> Float -> Picture
rectangleSolid :: Float -> Float -> Picture
rectangleSolid Float
sizeX Float
sizeY
= Path -> Picture
Polygon (Path -> Picture) -> Path -> Picture
forall a b. (a -> b) -> a -> b
$ Float -> Float -> Path
rectanglePath Float
sizeX Float
sizeY
rectangleUpperSolid :: Float -> Float -> Picture
rectangleUpperSolid :: Float -> Float -> Picture
rectangleUpperSolid Float
sizeX Float
sizeY
= Path -> Picture
Polygon (Path -> Picture) -> Path -> Picture
forall a b. (a -> b) -> a -> b
$ Float -> Float -> Path
rectangleUpperPath Float
sizeX Float
sizeY