module Graphics.Diagrams.Types where
import Data.Data (Data, Typeable, dataTypeOf, mkDataType, gunfold, toConstr)
import Control.DeepSeq (NFData, rnf)
type Point = (Double, Double)
data Diagram
= EmptyDiagram
| Circle Double
| Rect Double Double
| Polyline Bool [Point]
| Text Position String
| Move Point Diagram
| Scale Double Diagram
| ScaleXY Double Double Diagram
| Rotate Double Diagram
| TransformMatrix Double Double Double Double Double Double Diagram
| Clip Point Point Diagram
| Fill Color Diagram
| Stroke Color Diagram
| StrokeWidth Double Diagram
| FontFamily String Diagram
| Link String Diagram
| Overlay Diagram Diagram
| Pack Diagram (Diagram -> Diagram)
| Group Diagram Int Diagram
| Ref Int
| Error String Diagram
deriving (Typeable)
instance Data Diagram where
dataTypeOf _ = mkDataType "Diagram" []
gunfold _ _ = error "gunfold is not defined on the Diagram datatype"
toConstr _ = error "toConstr is not defined on the Diagram datatype"
data Position
= Start
| Middle
| End
deriving (Eq, Ord, Show, Data, Typeable)
instance NFData Position where
rnf x = x `seq` ()
data Color
= Color String
| RGB Double Double Double
deriving (Eq, Ord, Show, Data, Typeable)
instance NFData Color where
rnf (Color s) = rnf s
rnf (RGB r g b) = rnf (r, g, b)