diagrams-lib-1.4.6: Embedded domain-specific language for declarative graphics
Copyright(c) 2011 diagrams-lib team (see LICENSE)
LicenseBSD-style (see LICENSE)
Maintainerdiagrams-discuss@googlegroups.com
Safe HaskellSafe-Inferred
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 :: Type -> Type -> Type where Source #

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

Instances details
Fractional n => HasOrigin (DImage n a) Source # 
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 => Transformable (DImage n a) Source # 
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 => Renderable (DImage n a) NullBackend Source # 
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 Source # 
Instance details

Defined in Diagrams.TwoD.Image

Methods

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

type N (DImage n a) Source # 
Instance details

Defined in Diagrams.TwoD.Image

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

Defined in Diagrams.TwoD.Image

type V (DImage n a) = V2

data ImageData :: Type -> Type where Source #

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 Native (t :: Type) Source #

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

Make a DImage into a Diagram.

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

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)) Source #

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)) 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 :: Num n => FilePath -> Int -> Int -> DImage n External Source #

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 Source #

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 Source #

Crate a diagram from raw raster data.