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 ShapeColor = (StrokeColor, FillColor) 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 ShapeColor (Maybe Rotation) | CompositeShape [Shape] (Maybe Translation) (Maybe Rotation) -- ^Should contain atleast 1 shape deriving (Show, Eq) data Primitive = Rectangle { translation :: Translation , dimensions :: Dimensions } -- ^Translation is upperleftcorner | Circle { translation :: Translation , radius :: Radius } -- ^Translation is center | Polygon { amountOfPoints :: AmountOfPoints , translation :: Translation , radius :: Radius } -- ^Translation is center | Text { text :: [Char] , fontFamily :: FontFamily , fontSize :: FontSize , translation :: Translation } -- ^Translation is center, does not have a boundingbox due to technical limitations | 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 UpperLeft UpperRight LowerRight LowerLeft deriving (Show, Eq)