{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
module Diagrams.TwoD.Size
(
width, height
, extentX, extentY
, mkSizeSpec2D
, mkWidth
, mkHeight
, dims2D
) where
import Diagrams.Core
import Diagrams.Core.Envelope
import Diagrams.Size
import Diagrams.TwoD.Types
import Diagrams.TwoD.Vector
width :: (InSpace V2 n a, Enveloped a) => a -> n
width :: forall n a. (InSpace V2 n a, Enveloped a) => a -> n
width = forall a (v :: * -> *) n.
(V a ~ v, N a ~ n, Enveloped a) =>
v n -> a -> n
diameter forall (v :: * -> *) n. (R1 v, Additive v, Num n) => v n
unitX
height :: (InSpace V2 n a, Enveloped a) => a -> n
height :: forall n a. (InSpace V2 n a, Enveloped a) => a -> n
height = forall a (v :: * -> *) n.
(V a ~ v, N a ~ n, Enveloped a) =>
v n -> a -> n
diameter forall (v :: * -> *) n. (R2 v, Additive v, Num n) => v n
unitY
extentX :: (InSpace v n a, R1 v, Enveloped a) => a -> Maybe (n, n)
extentX :: forall (v :: * -> *) n a.
(InSpace v n a, R1 v, Enveloped a) =>
a -> Maybe (n, n)
extentX = forall a (v :: * -> *) n.
(V a ~ v, N a ~ n, Enveloped a) =>
v n -> a -> Maybe (n, n)
extent forall (v :: * -> *) n. (R1 v, Additive v, Num n) => v n
unitX
extentY :: (InSpace v n a, R2 v, Enveloped a) => a -> Maybe (n, n)
extentY :: forall (v :: * -> *) n a.
(InSpace v n a, R2 v, Enveloped a) =>
a -> Maybe (n, n)
extentY = forall a (v :: * -> *) n.
(V a ~ v, N a ~ n, Enveloped a) =>
v n -> a -> Maybe (n, n)
extent forall (v :: * -> *) n. (R2 v, Additive v, Num n) => v n
unitY
mkSizeSpec2D :: Num n => Maybe n -> Maybe n -> SizeSpec V2 n
mkSizeSpec2D :: forall n. Num n => Maybe n -> Maybe n -> SizeSpec V2 n
mkSizeSpec2D Maybe n
x Maybe n
y = forall (v :: * -> *) n.
(Functor v, Num n) =>
v (Maybe n) -> SizeSpec v n
mkSizeSpec (forall a. a -> a -> V2 a
V2 Maybe n
x Maybe n
y)
dims2D :: n -> n -> SizeSpec V2 n
dims2D :: forall n. n -> n -> SizeSpec V2 n
dims2D n
x n
y = forall (v :: * -> *) n. v n -> SizeSpec v n
dims (forall a. a -> a -> V2 a
V2 n
x n
y)
mkWidth :: Num n => n -> SizeSpec V2 n
mkWidth :: forall n. Num n => n -> SizeSpec V2 n
mkWidth n
w = forall (v :: * -> *) n. v n -> SizeSpec v n
dims (forall a. a -> a -> V2 a
V2 n
w n
0)
mkHeight :: Num n => n -> SizeSpec V2 n
mkHeight :: forall n. Num n => n -> SizeSpec V2 n
mkHeight n
h = forall (v :: * -> *) n. v n -> SizeSpec v n
dims (forall a. a -> a -> V2 a
V2 n
0 n
h)