mirror of
https://github.com/reanimate/reanimate.git
synced 2026-09-11 16:12:20 +00:00
Fix orientation of embedded images.
Former-commit-id: 3960c99008abdb2f1798747844b2177feb2221c7
This commit is contained in:
parent
f1b73da398
commit
2a65cfb012
2 changed files with 4 additions and 2 deletions
|
|
@ -9,7 +9,7 @@ main :: IO ()
|
|||
main = reanimate $ mkAnimation 5 $ \t ->
|
||||
mkGroup
|
||||
[ mkBackground "black"
|
||||
, rotate (t*360) $ center $ scaleToWidth 6 $ embedImage img
|
||||
, rotate (t*360) $ scaleToWidth 6 $ embedImage img
|
||||
]
|
||||
where
|
||||
img = generateImage pixelRenderer 255 255
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import Graphics.SvgTree (Number (..), Tree (..),
|
|||
import qualified Graphics.SvgTree as Svg
|
||||
import Reanimate.Misc
|
||||
import Reanimate.Animation
|
||||
import Reanimate.Svg.Constructors
|
||||
import System.FilePath
|
||||
import System.IO
|
||||
import System.IO.Temp
|
||||
|
|
@ -30,8 +31,9 @@ embedImage img = embedPng width height (encodePng img)
|
|||
height = fromIntegral $ imageHeight img
|
||||
|
||||
embedPng :: Double -> Double -> LBS.ByteString -> Tree
|
||||
embedPng w h png =
|
||||
embedPng w h png = flipYAxis $
|
||||
ImageTree $ defaultSvg
|
||||
& Svg.imageCornerUpperLeft .~ (Svg.Num (-w/2), Svg.Num (-h/2))
|
||||
& Svg.imageWidth .~ Svg.Num w
|
||||
& Svg.imageHeight .~ Svg.Num h
|
||||
& Svg.imageHref .~ ("data:image/png;base64," ++ imgData)
|
||||
|
|
|
|||
Loading…
Reference in a new issue