module Eventloop.Module.BasicShapes.Types
( module Eventloop.Module.BasicShapes.Types
, CT.CanvasId
) where
import qualified Eventloop.Module.Websocket.Canvas.Types as CT
import Eventloop.Utility.Vectors
type GraphicalNumeric = Float
type Translation = Point
type Width = GraphicalNumeric
type Height = GraphicalNumeric
type Dimensions = (Width, Height)
type Radius = GraphicalNumeric
type Red = GraphicalNumeric
type Green = GraphicalNumeric
type Blue = GraphicalNumeric
type Alpha = GraphicalNumeric
type Color = (Red, Green, Blue, Alpha)
type FillColor = Color
type StrokeColor = Color
type StrokeLineThickness = GraphicalNumeric
type UpperLeft = Point
type UpperRight = Point
type LowerLeft = Point
type LowerRight = Point
type AmountOfPoints = Int
type FontFamily = [Char]
type FontSize = GraphicalNumeric
data BasicShapesOut = DrawShapes CT.CanvasId [Shape]
deriving (Show, Eq)
data Shape = BaseShape { primitive :: Primitive
, strokeLineThickness :: StrokeLineThickness
, strokeColor :: StrokeColor
, rotationM :: (Maybe Rotation)
}
| CompositeShape { shapes :: [Shape]
, translationM :: (Maybe Translation)
, rotationM :: (Maybe Rotation)
}
deriving (Show, Eq)
data Primitive = Rectangle { translation :: Translation
, dimensions :: Dimensions
, fillColor :: FillColor
}
| Circle { translation :: Translation
, radius :: Radius
, fillColor :: FillColor
}
| Polygon { amountOfPoints :: AmountOfPoints
, translation :: Translation
, radius :: Radius
, fillColor :: FillColor
}
| Text { text :: [Char]
, fontFamily :: FontFamily
, fontSize :: FontSize
, translation :: Translation
, fillColor :: FillColor
}
| Line { point1 :: Point
, point2 :: Point
}
| MultiLine { point1 :: Point
, point2 :: Point
, otherPoints :: [Point]
}
deriving (Show, Eq)
data Rotation = Rotation RotatePoint Angle
deriving (Show, Eq)
data RotatePoint = AroundCenter
| AroundPoint Point
deriving (Show, Eq)
data BoundingBox = BoundingBox LowerLeft UpperLeft UpperRight LowerRight
deriving (Show, Eq)