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

Diagrams.Size

Description

Utilities for working with sizes of objects.

Synopsis

# Size spec

data SizeSpec v n Source #

A SizeSpec is a way of specifying a size without needed lengths for all the dimensions.

Instances

 Functor v => Functor (SizeSpec v) Source # Methodsfmap :: (a -> b) -> SizeSpec v a -> SizeSpec v b #(<\$) :: a -> SizeSpec v b -> SizeSpec v a # Show (v n) => Show (SizeSpec v n) Source # MethodsshowsPrec :: Int -> SizeSpec v n -> ShowS #show :: SizeSpec v n -> String #showList :: [SizeSpec v n] -> ShowS # Generic (SizeSpec v n) Source # Associated Typestype Rep (SizeSpec v n) :: * -> * # Methodsfrom :: SizeSpec v n -> Rep (SizeSpec v n) x #to :: Rep (SizeSpec v n) x -> SizeSpec v n # Hashable (v n) => Hashable (SizeSpec v n) Source # MethodshashWithSalt :: Int -> SizeSpec v n -> Int #hash :: SizeSpec v n -> Int # type Rep (SizeSpec v n) Source # type Rep (SizeSpec v n) = D1 * (MetaData "SizeSpec" "Diagrams.Size" "diagrams-lib-1.4.2-4PoAKfVuNFkAKgbuQfbiaW" True) (C1 * (MetaCons "SizeSpec" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * (v n)))) type V (SizeSpec v n) Source # type V (SizeSpec v n) = v type N (SizeSpec v n) Source # type N (SizeSpec v n) = n

## Making size spec

mkSizeSpec :: (Functor v, Num n) => v (Maybe n) -> SizeSpec v n Source #

Make a SizeSpec from a vector of maybe values. Any negative values will be ignored. For 2D SizeSpecs see mkWidth and mkHeight from Diagrams.TwoD.Size.

dims :: v n -> SizeSpec v n Source #

Make a SizeSpec from a vector. Any negative values will be ignored.

absolute :: (Additive v, Num n) => SizeSpec v n Source #

A size spec with no hints to the size.

## Extracting size specs

getSpec :: (Functor v, Num n, Ord n) => SizeSpec v n -> v (Maybe n) Source #

Retrieve a size spec as a vector of maybe values. Only positive sizes are returned.

specToSize :: (Foldable v, Functor v, Num n, Ord n) => n -> SizeSpec v n -> v n Source #

specToSize n spec extracts a size from a SizeSpec sz. Any values not specified in the spec are replaced by the smallest of the values that are specified. If there are no specified values (i.e. absolute) then n is used.

## Functions on size specs

requiredScale :: (Additive v, Foldable v, Fractional n, Ord n) => SizeSpec v n -> v n -> n Source #

requiredScale spec sz returns the largest scaling factor to make something of size sz fit the requested size spec without changing the aspect ratio. sz should be non-zero (otherwise a scale of 1 is returned). For non-uniform scaling see boxFit.

requiredScaling :: (Additive v, Foldable v, Fractional n, Ord n) => SizeSpec v n -> v n -> Transformation v n Source #

Return the Transformation calcuated from requiredScale.

sized :: (InSpace v n a, HasLinearMap v, Transformable a, Enveloped a) => SizeSpec v n -> a -> a Source #

Uniformly scale any enveloped object so that it fits within the given size. For non-uniform scaling see boxFit.

sizedAs :: (InSpace v n a, SameSpace a b, HasLinearMap v, Transformable a, Enveloped a, Enveloped b) => b -> a -> a Source #

Uniformly scale an enveloped object so that it "has the same size as" (fits within the width and height of) some other object.

sizeAdjustment :: (Additive v, Foldable v, OrderedField n) => SizeSpec v n -> BoundingBox v n -> (v n, Transformation v n) Source #

Get the adjustment to fit a BoundingBox in the given SizeSpec. The vector is the new size and the transformation to position the lower corner at the origin and scale to the size spec.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.3389742076396942, "perplexity": 14709.903026911075}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-26/segments/1560627998509.15/warc/CC-MAIN-20190617143050-20190617165050-00404.warc.gz"}