hps-0.16: Haskell Postscript

Safe HaskellSafe
LanguageHaskell98

Graphics.PS.Paper

Contents

Description

Paper and BBox.

Synopsis

Documentation

data Units Source #

Enumeration type for Units.

Constructors

MM 
PT 

Instances

Eq Units Source # 

Methods

(==) :: Units -> Units -> Bool #

(/=) :: Units -> Units -> Bool #

Show Units Source # 

Methods

showsPrec :: Int -> Units -> ShowS #

show :: Units -> String #

showList :: [Units] -> ShowS #

data Paper Source #

Paper size data type, the units are specified in the type. The units in postscript are points, we often work in millimeters.

Constructors

Paper 

Fields

Instances

Eq Paper Source # 

Methods

(==) :: Paper -> Paper -> Bool #

(/=) :: Paper -> Paper -> Bool #

Show Paper Source # 

Methods

showsPrec :: Int -> Paper -> ShowS #

show :: Paper -> String #

showList :: [Paper] -> ShowS #

paper_size_pt :: Paper -> (Int, Int) Source #

Translate Paper from mm to points.

let a4 = Paper MM 210 297
paper_size_pt a4 == (595,841)

data BBox Source #

BoundingBox for an EPSF file with an optional HiResBoundingBox

Constructors

BBox 

Fields

  • llx :: Int

    lower left x (x-min)

  • lly :: Int

    lower left y (y-min)

  • urx :: Int

    upper right x (x-max)

  • ury :: Int

    upper right y (y-max)

HRBBox 

Fields

Instances

Eq BBox Source # 

Methods

(==) :: BBox -> BBox -> Bool #

(/=) :: BBox -> BBox -> Bool #

Show BBox Source # 

Methods

showsPrec :: Int -> BBox -> ShowS #

show :: BBox -> String #

showList :: [BBox] -> ShowS #

landscape :: Paper -> Paper Source #

Swap width and height of Paper.

proportion :: Paper -> Double Source #

Proportion of Paper.

import Graphics.PS.Paper.Names
proportion broadsheet == 1.25
map (round . (* 1e3) . proportion) [a0,b0,c0] == [1414,1414,1414]
map proportion [usLetter,berliner,tabloid]

inset_margin :: Paper -> Paper -> (Units, Int, Int) Source #

The margin given by placing paper size p within q.

BBox

bbox_sum :: BBox -> BBox -> BBox Source #

Sum of BBox.

bbox_sum (BBox 5 5 10 10) (BBox 0 0 2 20) == BBox 0 0 10 20

bbox_mm_to_pt :: BBox -> BBox Source #

Translate BBox from mm to points.

divRound :: Int -> Int -> Int Source #

A div variant that rounds rather than truncates.

let f (Paper _ h _) = h `div` 2 == h `divRound` 2
in all id (map f [b0,b1,b2,b3,b4,b5,b6,b7,b8,b9]) == False