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

Copyright(c) 2011 diagrams-lib team (see LICENSE)
LicenseBSD-style (see LICENSE)
Maintainerdiagrams-discuss@googlegroups.com
Safe HaskellNone
LanguageHaskell2010

Diagrams.Attributes

Contents

Description

Diagrams may have attributes which affect the way they are rendered. This module defines some common attributes; particular backends may also define more backend-specific attributes.

Every attribute type must have a semigroup structure, that is, an associative binary operation for combining two attributes into one. Unless otherwise noted, all the attributes defined here use the Last structure, that is, combining two attributes simply keeps the second one and throws away the first. This means that child attributes always override parent attributes.

Synopsis

Color

Diagrams outsources all things color-related to Russell O'Connor's very nice colour package (http://hackage.haskell.org/package/colour). For starters, it provides a large collection of standard color names. However, it also provides a rich set of combinators for combining and manipulating colors; see its documentation for more information.

class Color c where Source

The Color type class encompasses color representations which can be used by the Diagrams library. Instances are provided for both the Colour and AlphaColour types from the Data.Colour library.

Methods

toAlphaColour :: c -> AlphaColour Double Source

Convert a color to its standard representation, AlphaColour.

fromAlphaColour :: AlphaColour Double -> c Source

Convert from an AlphaColour Double. Note that this direction may lose some information. For example, the instance for Colour drops the alpha channel.

Instances

data SomeColor Source

An existential wrapper for instances of the Color class.

Constructors

forall c . Color c => SomeColor c 

Opacity

data Opacity Source

Although the individual colors in a diagram can have transparency, the opacity/transparency of a diagram as a whole can be specified with the Opacity attribute. The opacity is a value between 1 (completely opaque, the default) and 0 (completely transparent). Opacity is multiplicative, that is, opacity o1 . opacity o2 === opacity (o1 * o2). In other words, for example, opacity 0.8 means "decrease this diagram's opacity to 80% of its previous opacity".

opacity :: HasStyle a => Double -> a -> a Source

Multiply the opacity (see Opacity) by the given value. For example, opacity 0.8 means "decrease this diagram's opacity to 80% of its previous opacity".

Converting colors

colorToSRGBA :: Color c => c -> (Double, Double, Double, Double) Source

Convert to sRGBA.

colorToRGBA :: Color c => c -> (Double, Double, Double, Double) Source

Deprecated: Renamed to colorToSRGBA.

Convert to sRGBA.

Line stuff

Cap style

data LineCap Source

What sort of shape should be placed at the endpoints of lines?

Constructors

LineCapButt

Lines end precisely at their endpoints.

LineCapRound

Lines are capped with semicircles centered on endpoints.

LineCapSquare

Lines are capped with a squares centered on endpoints.

lineCap :: HasStyle a => LineCap -> a -> a Source

Set the line end cap attribute.

Join style

data LineJoin Source

How should the join points between line segments be drawn?

Constructors

LineJoinMiter

Use a "miter" shape (whatever that is).

LineJoinRound

Use rounded join points.

LineJoinBevel

Use a "bevel" shape (whatever that is). Are these... carpentry terms?

lineJoin :: HasStyle a => LineJoin -> a -> a Source

Set the segment join style.

Miter limit

newtype LineMiterLimit Source

Miter limit attribute affecting the LineJoinMiter joins. For some backends this value may have additional effects.

Constructors

LineMiterLimit (Last Double) 

lineMiterLimit :: HasStyle a => Double -> a -> a Source

Set the miter limit for joins with LineJoinMiter.

lineMiterLimitA :: HasStyle a => LineMiterLimit -> a -> a Source

Apply a LineMiterLimit attribute.