Copyright | (c) 2011 diagrams-lib team (see LICENSE) |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | diagrams-discuss@googlegroups.com |
Safe Haskell | None |
Language | Haskell2010 |
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'
- data DImage :: * -> * where
- data ImageData :: * -> * where
- data Embedded
- data External
- image :: (Typeable a, Renderable (DImage a) b) => DImage a -> Diagram b R2
- loadImageEmb :: FilePath -> IO (Either String (DImage Embedded))
- loadImageExt :: FilePath -> IO (Either String (DImage External))
- uncheckedImageRef :: FilePath -> Int -> Int -> DImage External
- raster :: (Int -> Int -> AlphaColour Double) -> Int -> Int -> DImage Embedded
- rasterDia :: Renderable (DImage Embedded) b => (Int -> Int -> AlphaColour Double) -> Int -> Int -> Diagram b R2
Documentation
data DImage :: * -> * 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 heigh to the actual width and height
of the image.
Transformable (DImage a) | |
HasOrigin (DImage a) | |
Renderable (DImage a) NullBackend | |
Typeable (* -> *) DImage | |
type V (DImage a) = R2 |
data ImageData :: * -> * where Source
ImageData
is either a JuicyPixels DynamicImage
tagged as Embedded
or
a reference tagged as External
.
ImageRaster :: DynamicImage -> ImageData Embedded | |
ImageRef :: FilePath -> ImageData External |
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 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.