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 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
.
- data DImage :: * -> * -> * where
- data ImageData :: * -> * where
- ImageRaster :: DynamicImage -> ImageData Embedded
- ImageRef :: FilePath -> ImageData External
- ImageNative :: t -> ImageData (Native t)
- 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
- embeddedImage :: Num n => DynamicImage -> DImage n Embedded
- loadImageEmb :: Num n => FilePath -> IO (Either String (DImage n Embedded))
- loadImageEmbBS :: Num n => ByteString -> Either String (DImage n Embedded)
- loadImageExt :: Num n => FilePath -> IO (Either String (DImage n External))
- uncheckedImageRef :: Num n => FilePath -> Int -> Int -> DImage n External
- raster :: Num n => (Int -> Int -> AlphaColour Double) -> Int -> Int -> DImage n Embedded
- rasterDia :: (TypeableFloat n, Renderable (DImage n Embedded) b) => (Int -> Int -> AlphaColour Double) -> Int -> Int -> QDiagram b V2 n Any
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 height to the actual width and height
of the image.
Fractional n => Transformable (DImage n a) Source # | |
Fractional n => HasOrigin (DImage n a) Source # | |
Fractional n => Renderable (DImage n a) NullBackend Source # | |
RealFloat n => HasQuery (DImage n a) Any Source # | |
type V (DImage n a) Source # | |
type N (DImage n a) Source # | |
data ImageData :: * -> * 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.
ImageRaster :: DynamicImage -> ImageData Embedded | |
ImageRef :: FilePath -> ImageData External | |
ImageNative :: t -> ImageData (Native t) |
image :: (TypeableFloat n, Typeable a, Renderable (DImage n a) b) => DImage n a -> QDiagram b V2 n Any Source #
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.
loadImageEmbBS :: Num n => ByteString -> Either String (DImage n Embedded) Source #
A pure variant of loadImageEmb
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.