Safe Haskell | None |
---|---|
Language | Haskell2010 |
Contains an stateful image type which can be modified inside a ST
monad.
- class Image (Freezed i) => MutableImage i where
- type Freezed i
- mShape :: i s -> Size
- new :: PrimMonad m => Size -> m (i (PrimState m))
- new' :: PrimMonad m => Size -> ImagePixel (Freezed i) -> m (i (PrimState m))
- read :: PrimMonad m => i (PrimState m) -> Point -> m (ImagePixel (Freezed i))
- linearRead :: PrimMonad m => i (PrimState m) -> Int -> m (ImagePixel (Freezed i))
- write :: PrimMonad m => i (PrimState m) -> Point -> ImagePixel (Freezed i) -> m ()
- linearWrite :: PrimMonad m => i (PrimState m) -> Int -> ImagePixel (Freezed i) -> m ()
- freeze :: PrimMonad m => i (PrimState m) -> m (Freezed i)
- unsafeFreeze :: PrimMonad m => i (PrimState m) -> m (Freezed i)
- thaw :: PrimMonad m => Freezed i -> m (i (PrimState m))
- create :: MutableImage i => (forall s. ST s (i s)) -> Freezed i
- data MutableManifest p s = MutableManifest {}
Documentation
class Image (Freezed i) => MutableImage i where Source
Class for images which can be constructed from a mutable image.
mShape, new, new', (read | linearRead), (write | linearWrite), freeze, thaw
mShape
doesn't run in a monad as the size of a mutable image is
constant.
new :: PrimMonad m => Size -> m (i (PrimState m)) Source
Creates a new mutable image of the given size. Pixels are initialized with an unknown value.
new' :: PrimMonad m => Size -> ImagePixel (Freezed i) -> m (i (PrimState m)) Source
Creates a new mutable image of the given size and fill it with the given value.
read :: PrimMonad m => i (PrimState m) -> Point -> m (ImagePixel (Freezed i)) Source
Returns the pixel value at Z :. y :. x
.
linearRead :: PrimMonad m => i (PrimState m) -> Int -> m (ImagePixel (Freezed i)) Source
Returns the pixel value as if the image was a single dimension vector (row-major representation).
write :: PrimMonad m => i (PrimState m) -> Point -> ImagePixel (Freezed i) -> m () Source
Overrides the value of the pixel at Z :. y :. x
.
linearWrite :: PrimMonad m => i (PrimState m) -> Int -> ImagePixel (Freezed i) -> m () Source
Overrides the value of the pixel at the given index as if the image was a single dimension vector (row-major representation).
freeze :: PrimMonad m => i (PrimState m) -> m (Freezed i) Source
Returns an immutable copy of the mutable image.
unsafeFreeze :: PrimMonad m => i (PrimState m) -> m (Freezed i) Source
Returns the immutable version of the mutable image. The mutable image should not be modified thereafter.
thaw :: PrimMonad m => Freezed i -> m (i (PrimState m)) Source
Returns a mutable copy of the immutable image.
Storable p => MutableImage (MutableManifest p) |
create :: MutableImage i => (forall s. ST s (i s)) -> Freezed i Source
Creates an immutable image from an ST
action creating a mutable image.
data MutableManifest p s Source
Storable p => MutableImage (MutableManifest p) | |
type Freezed (MutableManifest p) = Manifest p |