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

Maintainerdiagrams-discuss@googlegroups.com
Safe HaskellNone

Diagrams.TwoD.Image

Description

Importing external images into diagrams. Usage: To create a diagram from an embedded image with width 1 and height set according to the aspect ratio: 'image img # scaleUToX 1` where img is a 'DImage Embedded'

Synopsis

Documentation

data DImage whereSource

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 heigh to the actual width and height of the image.

Constructors

DImage :: ImageData t -> Int -> Int -> T2 -> DImage t 

data ImageData whereSource

ImageData is either a JuicyPixels DynamicImage tagged as Embedded or a reference tagged as External.

image :: (Typeable a, Renderable (DImage a) b) => DImage a -> Diagram b R2Source

Make a DImage into a Diagram.

loadImageEmb :: FilePath -> IO (Either String (DImage Embedded))Source

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

loadImageExt :: FilePath -> IO (Either String (DImage External))Source

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 :: FilePath -> Int -> Int -> DImage ExternalSource

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 :: (Int -> Int -> AlphaColour Double) -> Int -> Int -> DImage EmbeddedSource

Create an image from scratch by specifying the pixel data

rasterDia :: Renderable (DImage Embedded) b => (Int -> Int -> AlphaColour Double) -> Int -> Int -> Diagram b R2Source

Crate a diagram from raw raster data.