Safe Haskell | None |
---|---|
Language | Haskell2010 |
Module defining the type of mesh patch grid.
Synopsis
- data InterBezier = InterBezier {}
- data Derivatives = Derivatives {
- _interNorthWest :: !Point
- _interNorthEast :: !Point
- _interSouthWest :: !Point
- _interSouthEast :: !Point
- data MeshPatch px = MeshPatch {
- _meshPatchWidth :: !Int
- _meshPatchHeight :: !Int
- _meshPrimaryVertices :: !(Vector Point)
- _meshHorizontalSecondary :: !(Vector InterBezier)
- _meshVerticalSecondary :: !(Vector InterBezier)
- _meshColors :: !(Vector px)
- _meshTensorDerivatives :: !(Maybe (Vector Derivatives))
- newtype CubicCoefficient px = CubicCoefficient {
- getCubicCoefficients :: ParametricValues (V4 (Holder px Float))
- calculateMeshColorDerivative :: forall px. InterpolablePixel px => MeshPatch px -> MeshPatch (Derivative px)
- verticeAt :: MeshPatch px -> Int -> Int -> Point
- generateLinearGrid :: Int -> Int -> Point -> V2 Float -> Vector px -> MeshPatch px
- generateImageMesh :: Int -> Int -> Point -> Image px -> MeshPatch (ImageMesh px)
- coonPatchAt :: MeshPatch px -> Int -> Int -> CoonPatch (ParametricValues px)
- tensorPatchAt :: MeshPatch px -> Int -> Int -> TensorPatch (ParametricValues px)
- coonImagePatchAt :: MeshPatch (ImageMesh px) -> Int -> Int -> CoonPatch (ImageMesh px)
- tensorImagePatchAt :: MeshPatch (ImageMesh px) -> Int -> Int -> TensorPatch (ImageMesh px)
- coonPatchAtWithDerivative :: InterpolablePixel px => MeshPatch (Derivative px) -> Int -> Int -> CoonPatch (CubicCoefficient px)
- tensorPatchAtWithDerivative :: InterpolablePixel px => MeshPatch (Derivative px) -> Int -> Int -> TensorPatch (CubicCoefficient px)
- coonPatchesOf :: MeshPatch px -> [CoonPatch (ParametricValues px)]
- tensorPatchesOf :: MeshPatch px -> [TensorPatch (ParametricValues px)]
- imagePatchesOf :: MeshPatch (ImageMesh px) -> [CoonPatch (ImageMesh px)]
- tensorImagePatchesOf :: MeshPatch (ImageMesh px) -> [TensorPatch (ImageMesh px)]
- cubicCoonPatchesOf :: InterpolablePixel px => MeshPatch (Derivative px) -> [CoonPatch (CubicCoefficient px)]
- cubicTensorPatchesOf :: InterpolablePixel px => MeshPatch (Derivative px) -> [TensorPatch (CubicCoefficient px)]
- data MutableMesh s px
- thawMesh :: PrimMonad m => MeshPatch px -> m (MutableMesh (PrimState m) px)
- freezeMesh :: PrimMonad m => MutableMesh (PrimState m) px -> m (MeshPatch px)
- withMesh :: MeshPatch px -> (forall m. (MonadReader (MutableMesh (PrimState m) px) m, PrimMonad m) => m a) -> (a, MeshPatch px)
- setVertice :: (MonadReader (MutableMesh (PrimState m) px) m, PrimMonad m) => Int -> Int -> Point -> m ()
- getVertice :: (MonadReader (MutableMesh (PrimState m) px) m, PrimMonad m) => Int -> Int -> m Point
- setHorizPoints :: (MonadReader (MutableMesh (PrimState m) px) m, PrimMonad m) => Int -> Int -> InterBezier -> m ()
- setVertPoints :: (MonadReader (MutableMesh (PrimState m) px) m, PrimMonad m) => Int -> Int -> InterBezier -> m ()
- setColor :: (MonadReader (MutableMesh (PrimState m) px) m, PrimMonad m) => Int -> Int -> px -> m ()
Types
data InterBezier Source #
Store the two bezier control points of a bezier.
Instances
Eq InterBezier Source # | |
Defined in Graphics.Rasterific.PatchTypes (==) :: InterBezier -> InterBezier -> Bool # (/=) :: InterBezier -> InterBezier -> Bool # | |
Show InterBezier Source # | |
Defined in Graphics.Rasterific.PatchTypes showsPrec :: Int -> InterBezier -> ShowS # show :: InterBezier -> String # showList :: [InterBezier] -> ShowS # | |
PointFoldable InterBezier Source # | |
Defined in Graphics.Rasterific.PatchTypes foldPoints :: (b -> Point -> b) -> b -> InterBezier -> b Source # | |
Transformable InterBezier Source # | |
Defined in Graphics.Rasterific.PatchTypes transform :: (Point -> Point) -> InterBezier -> InterBezier Source # transformM :: Monad m => (Point -> m Point) -> InterBezier -> m InterBezier Source # |
data Derivatives Source #
Store the inner points of a tensor patch.
Derivatives | |
|
Instances
Eq Derivatives Source # | |
Defined in Graphics.Rasterific.PatchTypes (==) :: Derivatives -> Derivatives -> Bool # (/=) :: Derivatives -> Derivatives -> Bool # | |
Show Derivatives Source # | |
Defined in Graphics.Rasterific.PatchTypes showsPrec :: Int -> Derivatives -> ShowS # show :: Derivatives -> String # showList :: [Derivatives] -> ShowS # | |
PointFoldable Derivatives Source # | |
Defined in Graphics.Rasterific.PatchTypes foldPoints :: (b -> Point -> b) -> b -> Derivatives -> b Source # | |
Transformable Derivatives Source # | |
Defined in Graphics.Rasterific.PatchTypes transform :: (Point -> Point) -> Derivatives -> Derivatives Source # transformM :: Monad m => (Point -> m Point) -> Derivatives -> m Derivatives Source # |
Define a mesh patch grid, the grid is conceptually a regular grid of _meshPatchWidth * _meshPatchHeight patches but with shared edges
MeshPatch | |
|
newtype CubicCoefficient px Source #
Store information for cubic interpolation in a patch.
CubicCoefficient | |
|
Instances
(InterpolablePixel px, Num (Holder px Float)) => BiSampleable (CubicCoefficient px) px Source # | Bicubic interpolator |
Defined in Graphics.Rasterific.BiSampleable interpolate :: CubicCoefficient px -> Float -> Float -> px Source # |
Functions
calculateMeshColorDerivative :: forall px. InterpolablePixel px => MeshPatch px -> MeshPatch (Derivative px) Source #
Prepare a gradient mesh to use cubic color interpolation, see renderCubicMesh documentation to see the global use of this function.
:: MeshPatch px | |
-> Int | Between 0 and _meshPatchWidth + 1 (excluded) |
-> Int | Between 0 and _meshPatchHeight + 1 (excluded) |
-> Point |
Retrieve a mesh primary vertice purely
:: Int | Width in patch |
-> Int | Height in patch |
-> Point | Position of the upper left corner |
-> V2 Float | Size of each patch in x adn y |
-> Vector px | Vector of values, size must be (width + 1) * (height + 1) |
-> MeshPatch px |
Generate a valid gradient with the shape of a simple grid
using some simple information. You can use thawMesh
and freezeMesh
to mutate it.
:: Int | Horizontal cell count |
-> Int | Vertical cell count |
-> Point | Position of the corner upper left |
-> Image px | Image to transform through a mesh |
-> MeshPatch (ImageMesh px) |
Generate a meshpatch at the size given by the image and a number of cell in a mesh
Extraction functions
Simple
:: MeshPatch px | |
-> Int | x |
-> Int | y |
-> CoonPatch (ParametricValues px) |
Extract a coon patch at a given position.
:: MeshPatch px | |
-> Int | x |
-> Int | y |
-> TensorPatch (ParametricValues px) |
Extract a tensor patch at a given position
Extract an image patch out of a mesh at a given position.
:: MeshPatch (ImageMesh px) | |
-> Int | x |
-> Int | y |
-> TensorPatch (ImageMesh px) |
Extract a tensor image patch out of a mesh at a given position.
coonPatchAtWithDerivative Source #
:: InterpolablePixel px | |
=> MeshPatch (Derivative px) | |
-> Int | x |
-> Int | y |
-> CoonPatch (CubicCoefficient px) |
Extract a coon patch for cubic interpolation at a given position
see calculateMeshColorDerivative
tensorPatchAtWithDerivative Source #
:: InterpolablePixel px | |
=> MeshPatch (Derivative px) | |
-> Int | x |
-> Int | y |
-> TensorPatch (CubicCoefficient px) |
Extract a tensor patch for cubic interpolation at a given position
see calculateMeshColorDerivative
Multiple
coonPatchesOf :: MeshPatch px -> [CoonPatch (ParametricValues px)] Source #
Extract a list of all the coon patches of the mesh.
tensorPatchesOf :: MeshPatch px -> [TensorPatch (ParametricValues px)] Source #
Extract a list of all the tensor patches of the mesh.
imagePatchesOf :: MeshPatch (ImageMesh px) -> [CoonPatch (ImageMesh px)] Source #
Extract all the coon patch of a mesh using an image interpolation.
tensorImagePatchesOf :: MeshPatch (ImageMesh px) -> [TensorPatch (ImageMesh px)] Source #
Extract all the tensor patch of a mesh using an image interpolation.
cubicCoonPatchesOf :: InterpolablePixel px => MeshPatch (Derivative px) -> [CoonPatch (CubicCoefficient px)] Source #
Extract all the coon patch of a mesh using cubic interpolation.
cubicTensorPatchesOf :: InterpolablePixel px => MeshPatch (Derivative px) -> [TensorPatch (CubicCoefficient px)] Source #
Extract all the tensor patch of a mesh using cubic interpolation.
Mutable mesh
data MutableMesh s px Source #
Mutable version of a MeshPatch
thawMesh :: PrimMonad m => MeshPatch px -> m (MutableMesh (PrimState m) px) Source #
Normal mesh to mutable mesh
freezeMesh :: PrimMonad m => MutableMesh (PrimState m) px -> m (MeshPatch px) Source #
Mutable mesh to freezed mesh.
Monadic mesh creation
withMesh :: MeshPatch px -> (forall m. (MonadReader (MutableMesh (PrimState m) px) m, PrimMonad m) => m a) -> (a, MeshPatch px) Source #
Given an original MeshPatch, provide context to mutate it through modification functions.
:: (MonadReader (MutableMesh (PrimState m) px) m, PrimMonad m) | |
=> Int | x coordinate in [0, w] |
-> Int | y coordinate in [0, h] |
-> Point | new point value |
-> m () |
Set the vertice of a mesh at a given coordinate
getVertice :: (MonadReader (MutableMesh (PrimState m) px) m, PrimMonad m) => Int -> Int -> m Point Source #
Get the position of vertice
setHorizPoints :: (MonadReader (MutableMesh (PrimState m) px) m, PrimMonad m) => Int -> Int -> InterBezier -> m () Source #
Set the two control bezier points horizontally
setVertPoints :: (MonadReader (MutableMesh (PrimState m) px) m, PrimMonad m) => Int -> Int -> InterBezier -> m () Source #
Set the two control bezier points vertically
setColor :: (MonadReader (MutableMesh (PrimState m) px) m, PrimMonad m) => Int -> Int -> px -> m () Source #
Set the value associated to a vertex