diagrams-pdf-0.3.1: PDF backend for diagrams drawing EDSL

Safe HaskellNone

Diagrams.Backend.Pdf

Contents

Description

A Pdf rendering backend for diagrams.

To build diagrams for Pdf rendering use the Pdf type in the diagram type construction

 d :: Diagram Pdf R2
 d = ...

and render giving the Pdf token

 renderDia Pdf (PdfOptions (Width 400)) d

This IO action will write the specified file.

Specific HPDF primitives

For details about the use of the HPDF specific primitives, the file test.hs in this package can be used. You'll have to unpack the archive for this package.

Synopsis

PDF Backend

Backend token

data Pdf Source

This data declaration is simply used as a token to distinguish this rendering engine.

Constructors

Pdf 

Backend options

data family Options b1 v1

Backend-specific rendering options.

HPDF Specific primitives

Text

data LabelStyle Source

Style for a label. It is not considered as an attribute but as a different primitive because internaly it is a complex text which can support several styles in the same paragraph. Label is just a convenience wrapper when the full features are not needed

pdfLabelWithSuggestedSizeSource

Arguments

:: (Renderable PdfTextBox Pdf, Renderable (Path R2) Pdf) 
=> LabelStyle

Style of the label

-> String

String to display with this style

-> Double

Suggested width

-> Double

Suggested height

-> (Diagram Pdf R2, Diagram Pdf R2)

Text and bounding rect of the typeset text

Typeset a text with a given style in a suggested box. The function is returning a diagram for the text and a diagram for the bounding box which may be smaller than the suggested size : smaller width when the algorithm has done some line justification. The text may also be bigger than the suggested width in case of overflow (similar to the way TeX is doing thing. There are settings in HPDF to control the elegance of the line cuts but those settings are not accessible from this simple API). The text will not be longer than the suggested height. In that case the additional text is not displayed except perhaps partially the last line since no clipping is done.

pdfTextWithSuggestedSizeSource

Arguments

:: (ParagraphStyle ps s, Style s, Renderable PdfTextBox Pdf, Renderable (Path R2) Pdf) 
=> TextOrigin

Text origin

-> Double

Suggested width

-> Double

Suggested height

-> ps

Paragraph (vertical) style

-> s

Horizontal style

-> TM ps s ()

Text

-> (Diagram Pdf R2, Diagram Pdf R2)

Text and bounding rect of the typeset text

Similar to the pdfLabelWithSuggestedSize but supporting the full features of HPDF

pdfLabelWithSizeSource

Arguments

:: (Renderable PdfTextBox Pdf, Renderable (Path R2) Pdf) 
=> LabelStyle

Style of the label

-> String

String to display with this style

-> Double

Suggested width

-> Double

Suggested height

-> Diagram Pdf R2

Text

Similar to the pdfLabelWithSuggestedSize but here the size is forced and even if the bounding box of the text is smaller it will not be taken into account for the diagram envelope.

pdfTextWithSizeSource

Arguments

:: (ParagraphStyle ps s, Style s, Renderable PdfTextBox Pdf, Renderable (Path R2) Pdf) 
=> TextOrigin

Text origin

-> Double

Suggested width

-> Double

Suggested height

-> ps

Paragraph (vertical) style

-> s

Horizontal style

-> TM ps s ()

Text

-> Diagram Pdf R2

Text

Similar to pdfTextWithSuggestedSize but the size if forced and not just suggested

Image

pdfImageSource

Arguments

:: (Monad m, PDFGlobals m) 
=> PDFReference PDFJpeg

Reference to the Jpeg image in the PDF resources

-> m (Diagram Pdf R2) 

Create an image diagram

URL

pdfURLSource

Arguments

:: String

URL (in a next version it should be URI)

-> Double

Width of active area

-> Double

Height of active area

-> Diagram Pdf R2 

Create an URL diagram

Shading

pdfAxialShading :: HasStyle a => P2 -> P2 -> Colour Double -> Colour Double -> a -> aSource

Define Axial shading for a diagram

pdfRadialShadingSource

Arguments

:: HasStyle a 
=> P2

Center of inner circle

-> Double

Radius of inner circle

-> P2

Center of outer circle

-> Double

Radius of outer circle

-> Colour Double

Inner colour

-> Colour Double

Outer colour

-> a 
-> a 

Define Radial shading for a diagram