{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ConstraintKinds #-}
module Graphics.Rasterific.Texture
( Texture
, Gradient
, withSampler
, uniformTexture
, linearGradientTexture
, radialGradientTexture
, radialGradientWithFocusTexture
, sampledImageTexture
, patternTexture
, meshPatchTexture
, modulateTexture
, transformTexture
) where
import Codec.Picture.Types( Pixel( .. ), Image( .. ) )
import Graphics.Text.TrueType( Dpi )
import Graphics.Rasterific
import Graphics.Rasterific.MeshPatch
import Graphics.Rasterific.Command
import Graphics.Rasterific.Transformations
withSampler :: SamplerRepeat -> Texture px -> Texture px
withSampler :: SamplerRepeat -> Texture px -> Texture px
withSampler = SamplerRepeat -> Texture px -> Texture px
forall px. SamplerRepeat -> Texture px -> Texture px
WithSampler
transformTexture :: Transformation -> Texture px -> Texture px
transformTexture :: Transformation -> Texture px -> Texture px
transformTexture = Transformation -> Texture px -> Texture px
forall px. Transformation -> Texture px -> Texture px
WithTextureTransform
uniformTexture :: px
-> Texture px
uniformTexture :: px -> Texture px
uniformTexture = px -> Texture px
forall px. px -> Texture px
SolidTexture
meshPatchTexture :: PatchInterpolation -> MeshPatch px -> Texture px
meshPatchTexture :: PatchInterpolation -> MeshPatch px -> Texture px
meshPatchTexture = PatchInterpolation -> MeshPatch px -> Texture px
forall px. PatchInterpolation -> MeshPatch px -> Texture px
MeshPatchTexture
linearGradientTexture :: Gradient px
-> Point
-> Point
-> Texture px
linearGradientTexture :: Gradient px -> Point -> Point -> Texture px
linearGradientTexture Gradient px
gradient Point
start Point
end =
Gradient px -> Line -> Texture px
forall px. Gradient px -> Line -> Texture px
LinearGradientTexture Gradient px
gradient (Point -> Point -> Line
Line Point
start Point
end)
sampledImageTexture :: Image px -> Texture px
sampledImageTexture :: Image px -> Texture px
sampledImageTexture = Image px -> Texture px
forall px. Image px -> Texture px
SampledTexture
radialGradientTexture :: Gradient px
-> Point
-> Float
-> Texture px
radialGradientTexture :: Gradient px -> Point -> Float -> Texture px
radialGradientTexture = Gradient px -> Point -> Float -> Texture px
forall px. Gradient px -> Point -> Float -> Texture px
RadialGradientTexture
radialGradientWithFocusTexture
:: Gradient px
-> Point
-> Float
-> Point
-> Texture px
radialGradientWithFocusTexture :: Gradient px -> Point -> Float -> Point -> Texture px
radialGradientWithFocusTexture = Gradient px -> Point -> Float -> Point -> Texture px
forall px. Gradient px -> Point -> Float -> Point -> Texture px
RadialGradientWithFocusTexture
modulateTexture :: Texture px
-> Texture (PixelBaseComponent px)
-> Texture px
modulateTexture :: Texture px -> Texture (PixelBaseComponent px) -> Texture px
modulateTexture = Texture px -> Texture (PixelBaseComponent px) -> Texture px
forall px.
Texture px -> Texture (PixelBaseComponent px) -> Texture px
ModulateTexture
patternTexture :: RenderablePixel px
=> Int
-> Int
-> Dpi
-> px
-> Drawing px ()
-> Texture px
patternTexture :: Int -> Int -> Int -> px -> Drawing px () -> Texture px
patternTexture Int
w Int
h Int
dpi px
back Drawing px ()
drawing =
Int -> Int -> px -> Drawing px () -> Image px -> Texture px
forall px.
Int -> Int -> px -> Drawing px () -> Image px -> Texture px
PatternTexture Int
w Int
h px
back Drawing px ()
drawing (Image px -> Texture px) -> Image px -> Texture px
forall a b. (a -> b) -> a -> b
$
Int -> Int -> Int -> px -> Drawing px () -> Image px
forall px.
RenderablePixel px =>
Int -> Int -> Int -> px -> Drawing px () -> Image px
renderDrawingAtDpi Int
w Int
h Int
dpi px
back Drawing px ()
drawing