diagrams-lib-1.4.2.3: 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.TwoD.Image

Description

Importing external images into diagrams. Usage example: To create a diagram from an embedded image with width 1 and height set according to the aspect ratio, use image img # scaleUToX 1, where img is a value of type DImage n e, created with a function like loadImageEmb, loadImageExt, or raster.

Synopsis

Documentation

data DImage :: * -> * -> * where #

An image primitive, the two ints are width followed by height. Will typically be created by loadImageEmb or loadImageExt which, will handle setting the width and height to the actual width and height of the image.

Constructors

DImage :: ImageData t -> Int -> Int -> Transformation V2 n -> DImage n t 
Instances
Fractional n => Transformable (DImage n a) # 
Instance details

Defined in Diagrams.TwoD.Image

Methods

transform :: Transformation (V (DImage n a)) (N (DImage n a)) -> DImage n a -> DImage n a #

Fractional n => HasOrigin (DImage n a) # 
Instance details

Defined in Diagrams.TwoD.Image

Methods

moveOriginTo :: Point (V (DImage n a)) (N (DImage n a)) -> DImage n a -> DImage n a #

Fractional n => Renderable (DImage n a) NullBackend # 
Instance details

Defined in Diagrams.TwoD.Image

Methods

render :: NullBackend -> DImage n a -> Render NullBackend (V (DImage n a)) (N (DImage n a)) #

RealFloat n => HasQuery (DImage n a) Any # 
Instance details

Defined in Diagrams.TwoD.Image

Methods

getQuery :: DImage n a -> Query (V (DImage n a)) (N (DImage n a)) Any #

type V (DImage n a) # 
Instance details

Defined in Diagrams.TwoD.Image

type V (DImage n a) = V2
type N (DImage n a) # 
Instance details

Defined in Diagrams.TwoD.Image

type N (DImage n a) = n

data ImageData :: * -> * where #

ImageData is either a JuicyPixels DynamicImage tagged as Embedded or a reference tagged as External. Additionally Native is provided for external libraries to hook into.

data Embedded #

data External #

data Native (t :: *) #

image :: (TypeableFloat n, Typeable a, Renderable (DImage n a) b) => DImage n a -> QDiagram b V2 n Any #

Make a DImage into a Diagram.

embeddedImage :: Num n => DynamicImage -> DImage n Embedded #

Read a JuicyPixels DynamicImage and wrap it in a DImage. The width and height of the image are set to their actual values.

loadImageEmb :: Num n => FilePath -> IO (Either String (DImage n Embedded)) #

Use JuicyPixels to read a file in any format and wrap it in a DImage. The width and height of the image are set to their actual values.

loadImageExt :: Num n => FilePath -> IO (Either String (DImage n External)) #

Check that a file exists, and use JuicyPixels to figure out the right size, but save a reference to the image instead of the raster data

uncheckedImageRef :: Num n => FilePath -> Int -> Int -> DImage n External #

Make an "unchecked" image reference; have to specify a width and height. Unless the aspect ratio of the external image is the w :: h, then the image will be distorted.

raster :: Num n => (Int -> Int -> AlphaColour Double) -> Int -> Int -> DImage n Embedded #

Create an image "from scratch" by specifying the pixel data

rasterDia :: (TypeableFloat n, Renderable (DImage n Embedded) b) => (Int -> Int -> AlphaColour Double) -> Int -> Int -> QDiagram b V2 n Any #

Crate a diagram from raw raster data.