-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell Postscript -- -- Haskell library partially implementing the postscript drawing model. @package hps @version 0.16 module Graphics.PS.Util type Cmd = (String, [String]) run_cmd :: Cmd -> IO () eps_to_pdf_cmd :: FilePath -> Cmd -- | Run ps2pdf to translate an EPS file to a PDF file. -- --
--   eps_to_pdf "/tmp/t.0.eps"
--   
eps_to_pdf :: FilePath -> IO () -- | Unit definitions and conversions. module Graphics.PS.Unit -- | Convert degrees to radians. radians :: Floating a => a -> a -- | Convert millimeters to PS points. mm_pt :: Floating a => a -> a -- | Type specialised fromIntegral. i_to_d :: Int -> Double -- | Int variant of mm_pt. mm_pt_int :: Int -> Int -- | Paper and BBox. module Graphics.PS.Paper -- | Enumeration type for Units. data Units MM :: Units PT :: Units -- | Paper size data type, the units are specified in the type. The units -- in postscript are points, we often work in millimeters. data Paper Paper :: Units -> Int -> Int -> Paper [units] :: Paper -> Units [width] :: Paper -> Int [height] :: Paper -> Int -- | Translate Paper from mm to points. -- --
--   let a4 = Paper MM 210 297
--   paper_size_pt a4 == (595,841)
--   
paper_size_pt :: Paper -> (Int, Int) -- | BoundingBox for an EPSF file with an optional HiResBoundingBox data BBox BBox :: Int -> Int -> Int -> Int -> BBox -- | lower left x (x-min) [llx] :: BBox -> Int -- | lower left y (y-min) [lly] :: BBox -> Int -- | upper right x (x-max) [urx] :: BBox -> Int -- | upper right y (y-max) [ury] :: BBox -> Int HRBBox :: Int -> Int -> Int -> Int -> Double -> Double -> Double -> Double -> BBox -- | lower left x (x-min) [llx] :: BBox -> Int -- | lower left y (y-min) [lly] :: BBox -> Int -- | upper right x (x-max) [urx] :: BBox -> Int -- | upper right y (y-max) [ury] :: BBox -> Int -- | high resolution llx [hrllx] :: BBox -> Double -- | high resolution lly [hrlly] :: BBox -> Double -- | high resolution urx [hrurx] :: BBox -> Double -- | high resolution ury [hrury] :: BBox -> Double -- | Swap width and height of Paper. landscape :: Paper -> Paper -- | 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]
--   
proportion :: Paper -> Double -- | The margin given by placing paper size p within q. inset_margin :: Paper -> Paper -> (Units, Int, Int) -- | Sum of BBox. -- --
--   bbox_sum (BBox 5 5 10 10) (BBox 0 0 2 20) == BBox 0 0 10 20
--   
bbox_sum :: BBox -> BBox -> BBox -- | Translate BBox from mm to points. bbox_mm_to_pt :: BBox -> BBox -- | 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
--   
divRound :: Int -> Int -> Int instance GHC.Show.Show Graphics.PS.Paper.BBox instance GHC.Classes.Eq Graphics.PS.Paper.BBox instance GHC.Show.Show Graphics.PS.Paper.Paper instance GHC.Classes.Eq Graphics.PS.Paper.Paper instance GHC.Show.Show Graphics.PS.Paper.Units instance GHC.Classes.Eq Graphics.PS.Paper.Units -- | Names of paper sizes. For ISO sizes see -- http://www.cl.cam.ac.uk/~mgk25/iso-paper.html. module Graphics.PS.Paper.Names -- | ISO size downscaling, ie. from A0 to A1. -- --
--   iso_down_scale a4 == a5
--   
iso_down_scale :: Paper -> Paper -- | JIS size downscaling, truncates instead of rounding. jis_down_scale :: Paper -> Paper -- | ISO A sizes in millimeters. -- --
--   a4 == Paper 210 297
--   
a0 :: Paper -- | ISO A sizes in millimeters. -- --
--   a4 == Paper 210 297
--   
a1 :: Paper -- | ISO A sizes in millimeters. -- --
--   a4 == Paper 210 297
--   
a2 :: Paper -- | ISO A sizes in millimeters. -- --
--   a4 == Paper 210 297
--   
a3 :: Paper -- | ISO A sizes in millimeters. -- --
--   a4 == Paper 210 297
--   
a4 :: Paper -- | ISO A sizes in millimeters. -- --
--   a4 == Paper 210 297
--   
a5 :: Paper -- | ISO A sizes in millimeters. -- --
--   a4 == Paper 210 297
--   
a6 :: Paper -- | ISO A sizes in millimeters. -- --
--   a4 == Paper 210 297
--   
a7 :: Paper -- | ISO A sizes in millimeters. -- --
--   a4 == Paper 210 297
--   
a8 :: Paper -- | ISO A sizes in millimeters. -- --
--   a4 == Paper 210 297
--   
a9 :: Paper -- | ISO A sizes in millimeters. -- --
--   a4 == Paper 210 297
--   
a10 :: Paper -- | ISO B sizes in millimeters. -- --
--   b4 == Paper 250 354
--   inset_margin b4 a3 == (23,33)
--   
b0 :: Paper -- | ISO B sizes in millimeters. -- --
--   b4 == Paper 250 354
--   inset_margin b4 a3 == (23,33)
--   
b1 :: Paper -- | ISO B sizes in millimeters. -- --
--   b4 == Paper 250 354
--   inset_margin b4 a3 == (23,33)
--   
b2 :: Paper -- | ISO B sizes in millimeters. -- --
--   b4 == Paper 250 354
--   inset_margin b4 a3 == (23,33)
--   
b3 :: Paper -- | ISO B sizes in millimeters. -- --
--   b4 == Paper 250 354
--   inset_margin b4 a3 == (23,33)
--   
b4 :: Paper -- | ISO B sizes in millimeters. -- --
--   b4 == Paper 250 354
--   inset_margin b4 a3 == (23,33)
--   
b5 :: Paper -- | ISO B sizes in millimeters. -- --
--   b4 == Paper 250 354
--   inset_margin b4 a3 == (23,33)
--   
b6 :: Paper -- | ISO B sizes in millimeters. -- --
--   b4 == Paper 250 354
--   inset_margin b4 a3 == (23,33)
--   
b7 :: Paper -- | ISO B sizes in millimeters. -- --
--   b4 == Paper 250 354
--   inset_margin b4 a3 == (23,33)
--   
b8 :: Paper -- | ISO B sizes in millimeters. -- --
--   b4 == Paper 250 354
--   inset_margin b4 a3 == (23,33)
--   
b9 :: Paper -- | ISO B sizes in millimeters. -- --
--   b4 == Paper 250 354
--   inset_margin b4 a3 == (23,33)
--   
b10 :: Paper -- | JIS B sizes -- --
--   jis_b4 == Paper 257 364
--   (proportion b0,proportion jis_b0) == (1.414,1.4135922330097088)
--   
-- --
--   inset_margin jis_b4 a3 == (20,28)
--   
jis_b0 :: Paper -- | JIS B sizes -- --
--   jis_b4 == Paper 257 364
--   (proportion b0,proportion jis_b0) == (1.414,1.4135922330097088)
--   
-- --
--   inset_margin jis_b4 a3 == (20,28)
--   
jis_b1 :: Paper -- | JIS B sizes -- --
--   jis_b4 == Paper 257 364
--   (proportion b0,proportion jis_b0) == (1.414,1.4135922330097088)
--   
-- --
--   inset_margin jis_b4 a3 == (20,28)
--   
jis_b2 :: Paper -- | JIS B sizes -- --
--   jis_b4 == Paper 257 364
--   (proportion b0,proportion jis_b0) == (1.414,1.4135922330097088)
--   
-- --
--   inset_margin jis_b4 a3 == (20,28)
--   
jis_b3 :: Paper -- | JIS B sizes -- --
--   jis_b4 == Paper 257 364
--   (proportion b0,proportion jis_b0) == (1.414,1.4135922330097088)
--   
-- --
--   inset_margin jis_b4 a3 == (20,28)
--   
jis_b4 :: Paper -- | JIS B sizes -- --
--   jis_b4 == Paper 257 364
--   (proportion b0,proportion jis_b0) == (1.414,1.4135922330097088)
--   
-- --
--   inset_margin jis_b4 a3 == (20,28)
--   
jis_b5 :: Paper -- | JIS B sizes -- --
--   jis_b4 == Paper 257 364
--   (proportion b0,proportion jis_b0) == (1.414,1.4135922330097088)
--   
-- --
--   inset_margin jis_b4 a3 == (20,28)
--   
jis_b6 :: Paper -- | JIS B sizes -- --
--   jis_b4 == Paper 257 364
--   (proportion b0,proportion jis_b0) == (1.414,1.4135922330097088)
--   
-- --
--   inset_margin jis_b4 a3 == (20,28)
--   
jis_b7 :: Paper -- | JIS B sizes -- --
--   jis_b4 == Paper 257 364
--   (proportion b0,proportion jis_b0) == (1.414,1.4135922330097088)
--   
-- --
--   inset_margin jis_b4 a3 == (20,28)
--   
jis_b8 :: Paper -- | JIS B sizes -- --
--   jis_b4 == Paper 257 364
--   (proportion b0,proportion jis_b0) == (1.414,1.4135922330097088)
--   
-- --
--   inset_margin jis_b4 a3 == (20,28)
--   
jis_b9 :: Paper -- | JIS B sizes -- --
--   jis_b4 == Paper 257 364
--   (proportion b0,proportion jis_b0) == (1.414,1.4135922330097088)
--   
-- --
--   inset_margin jis_b4 a3 == (20,28)
--   
jis_b10 :: Paper -- | ISO C sizes in millimeters. -- --
--   c4 == Paper 229 324
--   
c0 :: Paper -- | ISO C sizes in millimeters. -- --
--   c4 == Paper 229 324
--   
c1 :: Paper -- | ISO C sizes in millimeters. -- --
--   c4 == Paper 229 324
--   
c2 :: Paper -- | ISO C sizes in millimeters. -- --
--   c4 == Paper 229 324
--   
c3 :: Paper -- | ISO C sizes in millimeters. -- --
--   c4 == Paper 229 324
--   
c4 :: Paper -- | ISO C sizes in millimeters. -- --
--   c4 == Paper 229 324
--   
c5 :: Paper -- | ISO C sizes in millimeters. -- --
--   c4 == Paper 229 324
--   
c6 :: Paper -- | ISO C sizes in millimeters. -- --
--   c4 == Paper 229 324
--   
c7 :: Paper -- | ISO C sizes in millimeters. -- --
--   c4 == Paper 229 324
--   
c8 :: Paper -- | ISO C sizes in millimeters. -- --
--   c4 == Paper 229 324
--   
c9 :: Paper -- | ISO C sizes in millimeters. -- --
--   c4 == Paper 229 324
--   
c10 :: Paper -- | US Letter size in millimeters (ie Paper 216 279). usLetter :: Paper -- | Newspaper sizes in millimeters. See -- http://www.papersizes.org/newspaper-sizes.htm. broadsheet :: Paper -- | Newspaper sizes in millimeters. See -- http://www.papersizes.org/newspaper-sizes.htm. berliner :: Paper -- | Newspaper sizes in millimeters. See -- http://www.papersizes.org/newspaper-sizes.htm. tabloid :: Paper -- | Glyph data type. module Graphics.PS.Glyph -- | Character data type. type Glyph = Char -- | PS graphics state. module Graphics.PS.GS -- | Line cap enumeration. data LineCap ButtCap :: LineCap RoundCap :: LineCap ProjectingSquareCap :: LineCap -- | Line width (real). type LineWidth = Double -- | Line join enumeration. data LineJoin MiterJoin :: LineJoin RoundJoin :: LineJoin BevelJoin :: LineJoin -- | Colour model. Postscript doesn't support alpha, but store it for PDF -- rendering etc. data Color RGBA :: Double -> Double -> Double -> Double -> Color -- | Graphics state. data GS GS :: Color -> LineWidth -> LineCap -> LineJoin -> ([Int], Int) -> Double -> GS [gs_color] :: GS -> Color [gs_line_width] :: GS -> LineWidth [gs_line_cap] :: GS -> LineCap [gs_line_join] :: GS -> LineJoin [gs_dash] :: GS -> ([Int], Int) [gs_miter_limit] :: GS -> Double -- | Default GS of indicated Color. defaultGS :: Color -> GS -- | Default GS of indicated shade of grey. greyGS :: Double -> GS instance GHC.Show.Show Graphics.PS.GS.GS instance GHC.Classes.Eq Graphics.PS.GS.GS instance GHC.Show.Show Graphics.PS.GS.Color instance GHC.Classes.Eq Graphics.PS.GS.Color instance GHC.Enum.Enum Graphics.PS.GS.LineJoin instance GHC.Show.Show Graphics.PS.GS.LineJoin instance GHC.Classes.Eq Graphics.PS.GS.LineJoin instance GHC.Enum.Enum Graphics.PS.GS.LineCap instance GHC.Show.Show Graphics.PS.GS.LineCap instance GHC.Classes.Eq Graphics.PS.GS.LineCap -- | Font type and functions. module Graphics.PS.Font -- | Font data type. data Font Font :: String -> Double -> Font [fontName] :: Font -> String [fontSize] :: Font -> Double instance GHC.Show.Show Graphics.PS.Font.Font instance GHC.Classes.Eq Graphics.PS.Font.Font -- | Path type and functions. module Graphics.PS.Path -- | Path data type,in cartesian space. data Path MoveTo :: (Pt Double) -> Path LineTo :: (Pt Double) -> Path CurveTo :: (Pt Double) -> (Pt Double) -> (Pt Double) -> Path ClosePath :: (Pt Double) -> Path Text :: Font -> [Glyph] -> Path PTransform :: (Matrix Double) -> Path -> Path Join :: Path -> Path -> Path -- | Infix notation for Join. (+++) :: Path -> Path -> Path -- | Left fold of Join. combine :: [Path] -> Path -- | Line segments though list of Pt. line :: [Pt Double] -> Path -- | Variant of line connecting the last Pt to the first. polygon :: [Pt Double] -> Path -- | Rectangle with lower left at Pt and of specified width and -- height. Polygon is ordered anticlockwise from lower left. rectangle :: Pt Double -> Double -> Double -> Path -- | An arc segment, as starting point and values for the curveto operator. type Arc_Seg n = (Pt n, Pt n, Pt n, Pt n) -- | An arc, given as either one or two segments. data Arc n Arc1 :: (Arc_Seg n) -> Arc n Arc2 :: (Arc_Seg n) -> (Arc_Seg n) -> Arc n -- | Arc segment, (x,y) = center,r = radius,a = start angle,b = end angle. arcp :: Pt Double -> Double -> Double -> Double -> Arc_Seg Double -- | Arc, c = center,r = radius,a = start angle,b = end angle -- -- If the arc angle is greater than pi the arc must be drawn in two -- segments. arca :: Pt Double -> Double -> Double -> Double -> Arc Double -- | Path of Arc. arc_to_path :: Arc Double -> Path -- | Variant of arca allowing b to be less than a. arca_udir :: Pt Double -> Double -> Double -> Double -> Arc Double -- | arca_udir with a and b reversed. arcNegative_udir :: Pt Double -> Double -> Double -> Double -> Arc Double -- | Arc given by a central point,a radius,and start and end angles. arc :: Pt Double -> Double -> Double -> Double -> Path -- | Negative arc. arcNegative :: Pt Double -> Double -> Double -> Double -> Path type Annular n = (Pt n, Pt n, Arc n, Pt n, Arc n) -- | (x,y) = center,ir = inner radius,xr = outer radius,sa = start angle,a -- = angle,ea = end angle annular_f :: Pt Double -> Double -> Double -> Double -> Double -> Annular Double -- | Annular segment. annular :: Pt Double -> Double -> Double -> Double -> Double -> Path flatten_f :: Matrix Double -> Path -> Path -- | Apply any transformations at path. The resulting path will not have -- any PTransform nodes. flatten :: Path -> Path -- | Render each (p1,p2) as a distinct line. renderLines :: [Ln Double] -> Path -- | Collapse line sequences into a single line. renderLines_jn :: [Ln Double] -> Path instance GHC.Show.Show Graphics.PS.Path.Path instance GHC.Classes.Eq Graphics.PS.Path.Path instance GHC.Base.Monoid Graphics.PS.Path.Path -- | Image type and functions. module Graphics.PS.Image -- | An image is a rendering of a graph of Paths. data Image Stroke :: GS -> Path -> Image Fill :: GS -> Path -> Image ITransform :: (Matrix Double) -> Image -> Image Over :: Image -> Image -> Image Empty :: Image -- | Layer one Image over another. over :: Image -> Image -> Image -- | List of Paths at Image. paths :: Image -> [Path] instance GHC.Show.Show Graphics.PS.Image.Image instance GHC.Classes.Eq Graphics.PS.Image.Image instance GHC.Base.Monoid Graphics.PS.Image.Image -- | Postscript generator. module Graphics.PS.PS data PS Name :: String -> PS LName :: String -> PS Op :: String -> PS Comment :: String -> PS Int :: Int -> PS Double :: Double -> PS String :: String -> PS Transform :: (Matrix Double) -> PS Array :: [PS] -> PS Proc :: [PS] -> PS Dict :: [(PS, PS)] -> PS Seq :: [PS] -> PS dscPS :: String -> [String] -> PS headerPS :: PS headerEPS :: PS titlePS :: String -> PS creatorPS :: String -> PS languageLevelPS :: Int -> PS pagesPS :: Int -> PS bboxPS :: BBox -> PS endCommentsPS :: PS pagePS :: (Show a) => String -> a -> PS trailerPS :: PS eofPS :: PS documentMediaPS :: String -> Int -> Int -> PS aliasPS :: String -> String -> PS pdfCompat :: [(String, String)] prologPS :: PS strokePS :: PS fillPS :: PS falsePS :: PS savePS :: PS restorePS :: PS showPagePS :: PS rgbaPS :: Color -> PS lineWidthPS :: Double -> PS lineCapPS :: (Enum a) => a -> PS lineJoinPS :: (Enum a) => a -> PS dashPS :: [Int] -> Int -> PS miterLimitPS :: Double -> PS moveToPS :: Pt Double -> PS lineToPS :: Pt Double -> PS transformPS :: Matrix Double -> PS curveToPS :: Pt Double -> Pt Double -> Pt Double -> PS closePathPS :: Pt Double -> PS selectFontPS :: Font -> PS charPathPS :: String -> PS gsPS :: GS -> PS pathPS :: Path -> PS imagePS :: Image -> PS (>+>) :: Monoid m => m -> m -> m infixl 1 >+> ps_bracket :: (Monoid m) => (String -> m) -> String -> String -> [a] -> (a -> m) -> m ps_escape :: String -> String ps_put :: (Monoid m) => (String -> m) -> PS -> m to_page_seq :: (Image, Int) -> PS -- | Write a postscript file. The list of images are written one per page. ps :: FilePath -> Paper -> [Image] -> IO () -- | Variant with page (paper) size in points. stringFromPS_pt :: String -> (Int, Int) -> [Image] -> String -- | Generate postscript data given title, page size, and a set of -- page Images. stringFromPS :: String -> Paper -> [Image] -> String newtype MonadMonoid m MonadMonoid :: m () -> MonadMonoid m [appMonadMonoid] :: MonadMonoid m -> m () -- | Write an encapsulated postscript file. The BBox is in points. -- The single image is written. eps :: FilePath -> BBox -> Image -> IO () instance GHC.Base.Monad m => GHC.Base.Monoid (Graphics.PS.PS.MonadMonoid m) -- | Path query functions and related operations. module Graphics.PS.Query -- | Locate the starting point of the path, which must begin with a -- MoveTo node. startPt :: Path -> Maybe (Pt Double) -- | Variant that allows the initial node to be a LineTo or -- CurveTo node. startPt' :: Path -> Maybe (Pt Double) -- | Ensure path begins with a MoveTo node. mkValid :: Path -> Path -- | Locate the end point of the path. endPt :: Path -> Maybe (Pt Double) -- | Append a LineTo the start point of Path. close :: Path -> Path -- | Approximate curves as n straight line segments. That is replace -- CurveTo nodes with n LineTo nodes calculated -- using bezier4. approx :: Double -> Path -> Path -- | Rectangle, given as lower left and upper right points. data Rect a Rect :: Pt a -> Pt a -> Rect a [rect_ll] :: Rect a -> Pt a [rect_ur] :: Rect a -> Pt a -- | Sum (join) of two Rect. rect_sum :: Ord a => Rect a -> Rect a -> Rect a -- | Rectangle bounding a (simple) Path. path_rect :: Path -> Rect Double -- | Translate Rect to BBox. rect_to_bbox :: RealFrac a => Rect a -> BBox path_to_bbox :: Path -> BBox instance GHC.Show.Show a => GHC.Show.Show (Graphics.PS.Query.Rect a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Graphics.PS.Query.Rect a) -- | Path statistics. module Graphics.PS.Statistics -- | Path statistics data type. data Statistics Statistics :: Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Statistics [nMoveTo] :: Statistics -> Integer [nLineTo] :: Statistics -> Integer [nCurveTo] :: Statistics -> Integer [nClosePath] :: Statistics -> Integer [nGlyph] :: Statistics -> Integer [nTransform] :: Statistics -> Integer -- | Determine number of path components of each type. pathStatistics :: Path -> Statistics -- | Statistics for all paths at Image. imageStatistics :: Image -> Statistics instance GHC.Show.Show Graphics.PS.Statistics.Statistics instance GHC.Classes.Eq Graphics.PS.Statistics.Statistics instance GHC.Base.Monoid Graphics.PS.Statistics.Statistics -- | Class and associated functions for Matrix transformations. module Graphics.PS.Transform -- | Values that can be transformed in relation to a Matrix. class Transformable t mtransform :: Transformable t => Matrix Double -> t -> t -- | Translation in x and y. translate :: Transformable t => Double -> Double -> t -> t -- | Scaling in x and y. scale :: Transformable t => Double -> Double -> t -> t -- | Rotation, in radians. rotate :: Transformable t => Double -> t -> t instance Graphics.PS.Transform.Transformable Graphics.PS.Image.Image instance Graphics.PS.Transform.Transformable Graphics.PS.Path.Path instance Graphics.PS.Transform.Transformable (Data.CG.Minus.Types.Pt GHC.Types.Double) -- | Set of predefined Paths. module Graphics.PS.Path.Graphs -- | See -- ftp.scsh.net/pub/scsh/contrib/fps/doc/examples/fractal-sqr.html fractal_sqr_pt :: Pt Double -> Pt Double -> Int -> [Ln Double] -- | Path of fractal_sqr_pt with inputs (250,250), -- (175,175), 12. fractal_sqr :: Path -- | renderLines_jn variant of fractal_sqr. fractal_sqr' :: Path -- | A unit arrow. unitArrow :: Int -> Path -- | See -- ftp.scsh.net/pub/scsh/contrib/fps/doc/examples/fractal-arrow.html fractalArrow :: Double -> Int -> Path -- | Isosceles right angled triangle erat :: Pt Double -> Double -> Path -- | Sierpinski triangle. sierpinski :: Pt Double -> Double -> Double -> Path -- | Top-level module for hps. module Graphics.PS