diagrams-cairo-1.4.1.1: Cairo backend for diagrams drawing EDSL
Copyright(c) 2011 Diagrams-cairo team (see LICENSE)
LicenseBSD-style (see LICENSE)
Maintainerdiagrams-discuss@googlegroups.com
Safe HaskellNone
LanguageHaskell2010

Diagrams.Backend.Cairo.Internal

Description

This module contains the internal implementation guts of the diagrams cairo backend. If you want to see how the cairo backend works under the hood, you are in the right place (try clicking on the "Source" links). (Guts under the hood, what an awful mixed metaphor.) If you know what you are doing and really want access to the internals of the implementation, you are also in the right place. Otherwise, you should have no need of this module; import Diagrams.Backend.Cairo.CmdLine or Diagrams.Backend.Cairo instead.

The one exception is that this module may have to be imported sometimes to work around an apparent bug in certain versions of GHC, which results in a "not in scope" error for CairoOptions.

The types of all the fromX functions look funny in the Haddock output, which displays them like Type -> Type. In fact they are all of the form Type -> Graphics.Rendering.Cairo.Type, i.e. they convert from a diagrams type to a cairo type of the same name.

Synopsis

Documentation

data Cairo Source #

This data declaration is simply used as a token to distinguish the cairo backend: (1) when calling functions where the type inference engine would otherwise have no way to know which backend you wanted to use, and (2) as an argument to the Backend and Renderable type classes.

Constructors

Cairo 

Instances

Instances details
Eq Cairo Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Methods

(==) :: Cairo -> Cairo -> Bool

(/=) :: Cairo -> Cairo -> Bool

Ord Cairo Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Methods

compare :: Cairo -> Cairo -> Ordering

(<) :: Cairo -> Cairo -> Bool

(<=) :: Cairo -> Cairo -> Bool

(>) :: Cairo -> Cairo -> Bool

(>=) :: Cairo -> Cairo -> Bool

max :: Cairo -> Cairo -> Cairo

min :: Cairo -> Cairo -> Cairo

Read Cairo Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Methods

readsPrec :: Int -> ReadS Cairo

readList :: ReadS [Cairo]

readPrec :: ReadPrec Cairo

readListPrec :: ReadPrec [Cairo]

Show Cairo Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Methods

showsPrec :: Int -> Cairo -> ShowS

show :: Cairo -> String

showList :: [Cairo] -> ShowS

Backend Cairo V2 Double Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Associated Types

data Render Cairo V2 Double Source #

type Result Cairo V2 Double Source #

data Options Cairo V2 Double Source #

Methods

adjustDia :: (Additive V2, Monoid' m, Num Double) => Cairo -> Options Cairo V2 Double -> QDiagram Cairo V2 Double m -> (Options Cairo V2 Double, Transformation V2 Double, QDiagram Cairo V2 Double m) Source #

renderRTree :: Cairo -> Options Cairo V2 Double -> RTree Cairo V2 Double Annotation -> Result Cairo V2 Double Source #

Mainable [(QDiagram Cairo V2 Double Any, GifDelay)] Source # 
Instance details

Defined in Diagrams.Backend.Cairo.CmdLine

Associated Types

type MainOpts [(QDiagram Cairo V2 Double Any, GifDelay)] Source #

Methods

mainArgs :: Parseable (MainOpts [(QDiagram Cairo V2 Double Any, GifDelay)]) => proxy [(QDiagram Cairo V2 Double Any, GifDelay)] -> IO (MainOpts [(QDiagram Cairo V2 Double Any, GifDelay)]) Source #

mainRender :: MainOpts [(QDiagram Cairo V2 Double Any, GifDelay)] -> [(QDiagram Cairo V2 Double Any, GifDelay)] -> IO () Source #

mainWith :: [(QDiagram Cairo V2 Double Any, GifDelay)] -> IO () Source #

Mainable [(String, QDiagram Cairo V2 Double Any)] Source # 
Instance details

Defined in Diagrams.Backend.Cairo.CmdLine

Associated Types

type MainOpts [(String, QDiagram Cairo V2 Double Any)] Source #

Methods

mainArgs :: Parseable (MainOpts [(String, QDiagram Cairo V2 Double Any)]) => proxy [(String, QDiagram Cairo V2 Double Any)] -> IO (MainOpts [(String, QDiagram Cairo V2 Double Any)]) Source #

mainRender :: MainOpts [(String, QDiagram Cairo V2 Double Any)] -> [(String, QDiagram Cairo V2 Double Any)] -> IO () Source #

mainWith :: [(String, QDiagram Cairo V2 Double Any)] -> IO () Source #

Renderable (Text Double) Cairo Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Methods

render :: Cairo -> Text Double -> Render Cairo (V (Text Double)) (N (Text Double)) Source #

Renderable (DImage Double Embedded) Cairo Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Methods

render :: Cairo -> DImage Double Embedded -> Render Cairo (V (DImage Double Embedded)) (N (DImage Double Embedded)) Source #

Renderable (DImage Double External) Cairo Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Methods

render :: Cairo -> DImage Double External -> Render Cairo (V (DImage Double External)) (N (DImage Double External)) Source #

Renderable (Path V2 Double) Cairo Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Methods

render :: Cairo -> Path V2 Double -> Render Cairo (V (Path V2 Double)) (N (Path V2 Double)) Source #

Renderable (Trail V2 Double) Cairo Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Methods

render :: Cairo -> Trail V2 Double -> Render Cairo (V (Trail V2 Double)) (N (Trail V2 Double)) Source #

Show (Options Cairo V2 Double) Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Methods

showsPrec :: Int -> Options Cairo V2 Double -> ShowS

show :: Options Cairo V2 Double -> String

showList :: [Options Cairo V2 Double] -> ShowS

Semigroup (Render Cairo V2 Double) Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Methods

(<>) :: Render Cairo V2 Double -> Render Cairo V2 Double -> Render Cairo V2 Double

sconcat :: NonEmpty (Render Cairo V2 Double) -> Render Cairo V2 Double

stimes :: Integral b => b -> Render Cairo V2 Double -> Render Cairo V2 Double

Monoid (Render Cairo V2 Double) Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Methods

mempty :: Render Cairo V2 Double

mappend :: Render Cairo V2 Double -> Render Cairo V2 Double -> Render Cairo V2 Double #

mconcat :: [Render Cairo V2 Double] -> Render Cairo V2 Double

Mainable (Animation Cairo V2 Double) Source # 
Instance details

Defined in Diagrams.Backend.Cairo.CmdLine

Associated Types

type MainOpts (Animation Cairo V2 Double) Source #

Methods

mainArgs :: Parseable (MainOpts (Animation Cairo V2 Double)) => proxy (Animation Cairo V2 Double) -> IO (MainOpts (Animation Cairo V2 Double)) Source #

mainRender :: MainOpts (Animation Cairo V2 Double) -> Animation Cairo V2 Double -> IO () Source #

mainWith :: Animation Cairo V2 Double -> IO () Source #

Hashable (Options Cairo V2 Double) Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Methods

hashWithSalt :: Int -> Options Cairo V2 Double -> Int Source #

hash :: Options Cairo V2 Double -> Int Source #

Renderable (Segment Closed V2 Double) Cairo Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Methods

render :: Cairo -> Segment Closed V2 Double -> Render Cairo (V (Segment Closed V2 Double)) (N (Segment Closed V2 Double)) Source #

Mainable (QDiagram Cairo V2 Double Any) Source # 
Instance details

Defined in Diagrams.Backend.Cairo.CmdLine

Associated Types

type MainOpts (QDiagram Cairo V2 Double Any) Source #

Methods

mainArgs :: Parseable (MainOpts (QDiagram Cairo V2 Double Any)) => proxy (QDiagram Cairo V2 Double Any) -> IO (MainOpts (QDiagram Cairo V2 Double Any)) Source #

mainRender :: MainOpts (QDiagram Cairo V2 Double Any) -> QDiagram Cairo V2 Double Any -> IO () Source #

mainWith :: QDiagram Cairo V2 Double Any -> IO () Source #

type V Cairo Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

type V Cairo = V2
type N Cairo Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

type N Cairo = Double
data Options Cairo V2 Double Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

type Result Cairo V2 Double Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

type Result Cairo V2 Double = (IO (), Render ())
data Render Cairo V2 Double Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

data Render Cairo V2 Double = C (RenderM ())
type MainOpts [(QDiagram Cairo V2 Double Any, GifDelay)] Source # 
Instance details

Defined in Diagrams.Backend.Cairo.CmdLine

type MainOpts [(String, QDiagram Cairo V2 Double Any)] Source # 
Instance details

Defined in Diagrams.Backend.Cairo.CmdLine

type MainOpts [(String, QDiagram Cairo V2 Double Any)] = (MainOpts (QDiagram Cairo V2 Double Any), DiagramMultiOpts)
type MainOpts (Animation Cairo V2 Double) Source # 
Instance details

Defined in Diagrams.Backend.Cairo.CmdLine

type MainOpts (QDiagram Cairo V2 Double Any) Source # 
Instance details

Defined in Diagrams.Backend.Cairo.CmdLine

type B = Cairo Source #

data OutputType Source #

Output types supported by cairo, including four different file types (PNG, PS, PDF, SVG). If you want to output directly to GTK windows, see the diagrams-gtk package.

Constructors

PNG

Portable Network Graphics output.

PS

PostScript output

PDF

Portable Document Format output.

SVG

Scalable Vector Graphics output.

RenderOnly

Don't output any file; the returned IO () action will do nothing, but the Render () action can be used (e.g. to draw to a Gtk window; see the diagrams-gtk package).

Instances

Instances details
Bounded OutputType Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Enum OutputType Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Eq OutputType Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Methods

(==) :: OutputType -> OutputType -> Bool

(/=) :: OutputType -> OutputType -> Bool

Ord OutputType Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Read OutputType Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Methods

readsPrec :: Int -> ReadS OutputType

readList :: ReadS [OutputType]

readPrec :: ReadPrec OutputType

readListPrec :: ReadPrec [OutputType]

Show OutputType Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Methods

showsPrec :: Int -> OutputType -> ShowS

show :: OutputType -> String

showList :: [OutputType] -> ShowS

Generic OutputType Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Associated Types

type Rep OutputType :: Type -> Type

Methods

from :: OutputType -> Rep OutputType x

to :: Rep OutputType x -> OutputType

Hashable OutputType Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

Methods

hashWithSalt :: Int -> OutputType -> Int Source #

hash :: OutputType -> Int Source #

type Rep OutputType Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

type Rep OutputType = D1 ('MetaData "OutputType" "Diagrams.Backend.Cairo.Internal" "diagrams-cairo-1.4.1.1-HIkXZafst57BEW2zNRUXHP" 'False) ((C1 ('MetaCons "PNG" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PS" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "PDF" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "SVG" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "RenderOnly" 'PrefixI 'False) (U1 :: Type -> Type))))

data CairoState Source #

Custom state tracked in the RenderM monad.

Constructors

CairoState 

Fields

  • _accumStyle :: Style V2 Double

    The current accumulated style.

  • _ignoreFill :: Bool

    Whether or not we saw any lines in the most recent path (as opposed to loops). If we did, we should ignore any fill attribute. diagrams-lib separates lines and loops into separate path primitives so we don't have to worry about seeing them together in the same path.

Instances

Instances details
Default CairoState Source # 
Instance details

Defined in Diagrams.Backend.Cairo.Internal

type RenderM a = StateStackT CairoState Render a Source #

The custom monad in which intermediate drawing options take place; Render is cairo's own rendering monad.

save :: RenderM () Source #

Push the current context onto a stack.

restore :: RenderM () Source #

Restore the context from a stack.

runC :: Render Cairo V2 Double -> RenderM () Source #

toRender :: RTree Cairo V2 Double a -> Render Cairo V2 Double Source #

renderC :: (Renderable a Cairo, V a ~ V2, N a ~ Double) => a -> RenderM () Source #

Render an object that the cairo backend knows how to render.

getStyleAttrib :: AttributeClass a => (a -> b) -> RenderM (Maybe b) Source #

Get an accumulated style attribute from the render monad state.

cairoStyle :: Style v Double -> RenderM () Source #

Handle those style attributes for which we can immediately emit cairo instructions as we encounter them in the tree (clip, font size, fill rule, line width, cap, join, and dashing). Other attributes (font face, slant, weight; fill color, stroke color, opacity) must be accumulated.

cairoTransf :: T2 Double -> Render () Source #

Multiply the current transformation matrix by the given 2D transformation.

cairoPath :: Path V2 Double -> RenderM () Source #

addStop :: MonadIO m => Pattern -> GradientStop Double -> m () Source #

setTexture :: Maybe (Texture Double) -> RenderM () Source #

toARGB :: PixelRGBA8 -> Word32 Source #

if' :: Monad m => (a -> m ()) -> Maybe a -> m () Source #