| Copyright | (C) Richard Cook 2018 |
|---|---|
| License | MIT |
| Maintainer | rcook@rcook.org |
| Stability | stable |
| Portability | portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Codec.Picture.Drawing
Description
Functions for drawing and filling lines, rectangles and polygons directly onto a JuicyPixels mutable image
Synopsis
- drawLine :: (Pixel px, PrimMonad m) => MutableImage (PrimState m) px -> Int -> Int -> Int -> Int -> px -> m ()
- drawPolygon :: (Pixel px, PrimMonad m) => MutableImage (PrimState m) px -> [Point2D] -> px -> m ()
- drawRectangle :: (Pixel px, PrimMonad m) => MutableImage (PrimState m) px -> Int -> Int -> Int -> Int -> px -> m ()
- fillPolygon :: (Pixel px, PrimMonad m) => MutableImage (PrimState m) px -> [Point2D] -> px -> m ()
- fillRectangle :: (Pixel px, PrimMonad m) => MutableImage (PrimState m) px -> Int -> Int -> Int -> Int -> px -> m ()
- fillTriangle :: (Pixel px, PrimMonad m) => MutableImage (PrimState m) px -> Int -> Int -> Int -> Int -> Int -> Int -> px -> m ()
- withDefaultMutableImage :: (Pixel px, PrimMonad m) => Int -> Int -> (MutableImage (PrimState m) px -> m ()) -> m (Image px)
- withMutableImage :: (Pixel px, PrimMonad m) => Int -> Int -> px -> (MutableImage (PrimState m) px -> m ()) -> m (Image px)
Documentation
Arguments
| :: (Pixel px, PrimMonad m) | |
| => MutableImage (PrimState m) px | mutable image |
| -> Int | x-coordinate of starting point |
| -> Int | y-coordinate of starting point |
| -> Int | x-coordinate of end point |
| -> Int | y-coordinate of end point |
| -> px | colour |
| -> m () | action |
Draw a line in the specified colour
Arguments
| :: (Pixel px, PrimMonad m) | |
| => MutableImage (PrimState m) px | mutable image |
| -> [Point2D] | sequence of vertices |
| -> px | colour |
| -> m () | action |
Draw a polygon in the specified colour
Arguments
| :: (Pixel px, PrimMonad m) | |
| => MutableImage (PrimState m) px | mutable image |
| -> Int | x-coordinate of top-left corner |
| -> Int | y-coordinate of top-left corner |
| -> Int | x-coordinate of bottom-right corner |
| -> Int | y-coordinate of bottom-right corner |
| -> px | colour |
| -> m () | action |
Draw a rectangle in the specified colour
Arguments
| :: (Pixel px, PrimMonad m) | |
| => MutableImage (PrimState m) px | mutable image |
| -> [Point2D] | sequence of vertices |
| -> px | colour |
| -> m () | action |
Fill a polygon as a series of triangles with the specified colour
Arguments
| :: (Pixel px, PrimMonad m) | |
| => MutableImage (PrimState m) px | mutable image |
| -> Int | x-coordinate of top-left corner |
| -> Int | y-coordinate of top-left corner |
| -> Int | x-coordinate of bottom-right corner |
| -> Int | y-coordinate of bottom-right corner |
| -> px | colour |
| -> m () | action |
Fill a rectangle with the specified colour
Arguments
| :: (Pixel px, PrimMonad m) | |
| => MutableImage (PrimState m) px | mutable image |
| -> Int | x-coordinate of first vertex |
| -> Int | y-coordinate of first vertex |
| -> Int | x-coordinate of second vertex |
| -> Int | y-coordinate of second vertex |
| -> Int | x-coordinate of third vertex |
| -> Int | y-coordinate of third vertex |
| -> px | colour |
| -> m () | action |
Fill a triangle with the specified colour
withDefaultMutableImage Source #
Arguments
| :: (Pixel px, PrimMonad m) | |
| => Int | image width |
| -> Int | image height |
| -> (MutableImage (PrimState m) px -> m ()) | function to apply to mutable image |
| -> m (Image px) | immutable image result |
Create an image given a function to apply to a default empty mutable image