diagrams-lib-1.4.2: Embedded domain-specific language for declarative graphics

Copyright | (c) 2011 diagrams-lib team (see LICENSE)
License | BSD-style (see LICENSE)
Maintainer | diagrams-discuss@googlegroups.com
Safe Haskell | None
Language | Haskell2010

Diagrams.TwoD.Size

Contents

- Computing sizes
- Specifying sizes

Description

Utilities for working with sizes of two-dimensional objects.

Synopsis

- width :: (InSpace V2 n a, Enveloped a) => a -> n
- height :: (InSpace V2 n a, Enveloped a) => a -> n
- extentX :: (InSpace v n a, R1 v, Enveloped a) => a -> Maybe (n, n)
- extentY :: (InSpace v n a, R2 v, Enveloped a) => a -> Maybe (n, n)
- mkSizeSpec2D :: Num n => Maybe n -> Maybe n -> SizeSpec V2 n
- mkWidth :: Num n => n -> SizeSpec V2 n
- mkHeight :: Num n => n -> SizeSpec V2 n
- dims2D :: n -> n -> SizeSpec V2 n

## Computing sizes

width :: (InSpace V2 n a, Enveloped a) => a -> n Source #

Compute the width of an enveloped object.

Note this is just `diameter unitX`.

height :: (InSpace V2 n a, Enveloped a) => a -> n Source #

Compute the height of an enveloped object.

extentX :: (InSpace v n a, R1 v, Enveloped a) => a -> Maybe (n, n) Source #

Compute the absolute x-coordinate range of an enveloped object in the form `(lo,hi)`. Return `Nothing` for objects with an empty envelope.

Note this is just `extent unitX`.

extentY :: (InSpace v n a, R2 v, Enveloped a) => a -> Maybe (n, n) Source #

Compute the absolute y-coordinate range of an enveloped object in the form `(lo,hi)`. Return `Nothing` for objects with an empty envelope.

## Specifying sizes

mkSizeSpec2D :: Num n => Maybe n -> Maybe n -> SizeSpec V2 n Source #

Make a `SizeSpec` from possibly-specified width and height.

mkWidth :: Num n => n -> SizeSpec V2 n Source #

Make a `SizeSpec` with only width defined.

mkHeight :: Num n => n -> SizeSpec V2 n Source #

Make a `SizeSpec` with only height defined.

dims2D :: n -> n -> SizeSpec V2 n Source #

Make a `SizeSpec` from a width and height.