htdp-image 1.1.0.0 → 1.1.0.1
raw patch · 3 files changed
+20/−15 lines, 3 filesdep ~base
Dependency ranges changed: base
Files
- CHANGELOG.md +5/−0
- htdp-image.cabal +3/−3
- src/Graphics/Htdp/Combinator.hs +12/−12
CHANGELOG.md view
@@ -1,5 +1,10 @@ # Revision history for htdp-image +## 1.1.0.1 -- 2021-08-23++* Update base++ ## 1.1.0.0 -- 2019-07-25 * Add "Htdp" to submodules
htdp-image.cabal view
@@ -1,5 +1,5 @@ name: htdp-image-version: 1.1.0.0+version: 1.1.0.1 license: BSD3 license-file: LICENSE author: Turab Jafri@@ -30,7 +30,7 @@ Graphics.Htdp.Shape other-modules: Graphics.Htdp.Util.Arithmetic build-depends: AC-Angle ^>=1.0,- base ^>=4.12,+ base >=4.12 && <4.14, gloss ^>=1.13.0 hs-source-dirs: src ghc-options: -Wall@@ -45,7 +45,7 @@ main-is: Main.hs other-modules: ShapeTest, CombinatorTest- build-depends: base ^>=4.12,+ build-depends: base >=4.12 && <4.14, gloss ^>=1.13.0, htdp-image, HUnit ^>=1.6.0,
src/Graphics/Htdp/Combinator.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE MultiWayIf, RecordWildCards #-}+{-# LANGUAGE MultiWayIf #-} -- | Utility to combine images. @@ -168,14 +168,14 @@ where -- width and height of new image newW = max (width i2) $ max (width i1) $ if incWCase- then (width i1 / 2) + (abs newX) + (width i2 / 2)+ then (width i1 / 2) + abs newX + (width i2 / 2) else 0 newH = max (height i2) $ max (height i1) $ if incHCase- then (height i1 / 2) + (abs newY) + (height i2 / 2)+ then (height i1 / 2) + abs newY + (height i2 / 2) else 0 -- whether i1's width/height lay outside of i2's width/height- incWCase = (abs newX) + (width i1 / 2) > (width i2 / 2)- incHCase = (abs newY) + (height i1 / 2) > (height i2 / 2)+ incWCase = abs newX + (width i1 / 2) > (width i2 / 2)+ incHCase = abs newY + (height i1 / 2) > (height i2 / 2) -- x/y position converted from screen coord to cartesian coord newX = convert 0 (negate $ width i2 / 2) (width i2) (width i2 / 2) x + xOffset@@ -202,8 +202,8 @@ -- shift magnitudes x2Shift = xDir * ((newW - width i2) / 2) y2Shift = yDir * ((newH - height i2) / 2)- x1Shift = (negate xDir) * ((newW - width i1) / 2)- y1Shift = (negate yDir) * ((newH - height i1) / 2)+ x1Shift = negate xDir * ((newW - width i1) / 2)+ y1Shift = negate yDir * ((newH - height i1) / 2) -- direction based on i1's location relative to i2 xDir = if | newX > 0 -> -1@@ -261,7 +261,7 @@ -> Float -- ^ @y@ -> Image -- ^ @i2@ -> Image-overlayXY i1 x y i2 = placeImage i1 (width i1 / 2 - x) (height i1 / 2 - y) i2+overlayXY i1 x y = placeImage i1 (width i1 / 2 - x) (height i1 / 2 - y) -- | Combination of `overlayAlign` and `overlayOffset`. overlayAlignOffset@@ -273,14 +273,14 @@ mid i2 where- newX = (width i2 / 2 - x)- newY = (height i2 / 2 - y)+ newX = width i2 / 2 - x+ newY = height i2 / 2 - y wDiff = (width i2 - width i1) / 2 hDiff = (height i2 - height i1) / 2 shiftedX = newX + (case xAl of- Low -> (-wDiff)+ Low -> -wDiff Mid -> 0 High -> wDiff )@@ -289,7 +289,7 @@ + (case yAl of Low -> hDiff Mid -> 0- High -> (-hDiff)+ High -> -hDiff ) -- | Same of `overlay`, but with image arguments flipped.