graphics-drawingcombinators 0.42 → 0.43
raw patch · 2 files changed
+19/−16 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
Graphics/DrawingCombinators.hs view
@@ -234,29 +234,32 @@ -- | Translate the given drawing by the given amount. translate :: Vec2 -> Draw a -> Draw a-translate (byx,byy) = TransformGL $ \d -> do- r <- ask- lift $ GL.preservingMatrix $ do- GL.translate (GL.Vector3 (convReal byx) (convReal byy) 0)- runReaderT d r+translate (byx,byy) = TransformGL $ + cong (lift $ GL.translate (GL.Vector3 (convReal byx) (convReal byy) 0))+ (lift $ GL.translate (GL.Vector3 (-convReal byx) (-convReal byy) 0)) -- | Rotate the given drawing counterclockwise by the -- given number of radians. rotate :: Double -> Draw a -> Draw a-rotate rad = TransformGL $ \d -> do- r <- ask- lift $ GL.preservingMatrix $ do- GL.rotate (180 * convReal rad / pi) (GL.Vector3 0 0 1)- runReaderT d r+rotate rad = TransformGL $ + cong (lift $ GL.rotate theta (GL.Vector3 0 0 1))+ (lift $ GL.rotate (-theta) (GL.Vector3 0 0 1))+ where+ theta = 180 * convReal rad / pi -- | @scale x y d@ scales @d@ by a factor of @x@ in the -- horizontal direction and @y@ in the vertical direction. scale :: Double -> Double -> Draw a -> Draw a-scale x y = TransformGL $ \d -> do- r <- ask- lift $ GL.preservingMatrix $ do- GL.scale (convReal x) (convReal y) 1- runReaderT d r+scale x y = TransformGL $ + cong (lift $ GL.scale (convReal x) (convReal y) 1)+ (lift $ GL.scale (1/convReal x) (1/convReal y) 1)++cong :: (Monad m) => m () -> m () -> m a -> m a+cong ma mb mx = do+ ma+ x <- mx+ mb+ return x {------------ Colors
graphics-drawingcombinators.cabal view
@@ -4,7 +4,7 @@ have to go into the deep, dark world of imperative stateful programming just to draw stuff. It supports 2D only (for now), with support drawing geometry, images, and text.-Version: 0.42+Version: 0.43 Stability: experimental Synopsis: A functional interface to 2D drawing in OpenGL License: BSD3