rasterific-svg 0.1.0.2 → 0.1.0.3
raw patch · 3 files changed
+6/−145 lines, 3 filesdep −attoparsecdep −blaze-htmldep ~FontyFruitydep ~JuicyPixelsdep ~RasterificPVP ok
version bump matches the API change (PVP)
Dependencies removed: attoparsec, blaze-html
Dependency ranges changed: FontyFruity, JuicyPixels, Rasterific, base, binary, bytestring, lens, linear, svg-tree, text
API changes (from Hackage documentation)
Files
- changelog +3/−0
- exec-src/svgtest.hs +0/−119
- rasterific-svg.cabal +3/−26
changelog view
@@ -1,5 +1,8 @@ -*-change-log-*- +v0.1.0.3 March 2015 + * Fix: Bumping lens dependency + v0.1.0.2 February 2015 * Fix: Removing all test suites from distribution package. * Fix: Lowering some low version bounds.
− exec-src/svgtest.hs
@@ -1,119 +0,0 @@-{-# LANGUAGE CPP #-} -#if !MIN_VERSION_base(4,8,0) -import Data.Foldable( foldMap ) -#endif - -import Control.Applicative( (<$>) ) -import Control.Monad( forM_ ) -import Data.Monoid( (<>) ) -import Data.List( isSuffixOf, sort ) -import System.Environment( getArgs ) -import System.Directory( createDirectoryIfMissing - , getDirectoryContents - ) -import qualified Text.Blaze.Html5 as HT -import qualified Text.Blaze.Html5 as H -import qualified Text.Blaze.Html5.Attributes as H -import qualified Text.Blaze.Html.Renderer.String as H -import System.FilePath( dropExtension, (</>), (<.>), splitFileName ) - -import Codec.Picture( writePng ) - -import Graphics.Text.TrueType( FontCache ) -import Graphics.Rasterific.Svg -import Graphics.Svg hiding ( text, path ) -{-import Debug.Trace-} -{-import Text.Printf-} -{-import Text.Groom-} - -loadRender :: [String] -> IO () -loadRender [] = putStrLn "not enough arguments" -loadRender [_] = putStrLn "not enough arguments" -loadRender (svgfilename:pngfilename:_) = do - f <- loadSvgFile svgfilename - case f of - Nothing -> putStrLn "Error while loading SVG" - Just doc -> do - cache <- loadCreateFontCache "fonty-texture-cache" - (finalImage, _) <- renderSvgDocument cache Nothing 96 doc - writePng pngfilename finalImage - -testOutputFolder :: FilePath -testOutputFolder = "gen_test" - -img :: FilePath -> Int -> Int -> H.Html -img path _w _h = H.img H.! H.src (H.toValue path) - -table :: [H.Html] -> [[H.Html]] -> H.Html -table headers cells = - H.table $ header <> foldMap (H.tr . foldMap H.td) cells - where header = H.tr $ foldMap H.th headers - -testFileOfPath :: FilePath -> FilePath -testFileOfPath path = testOutputFolder </> base <.> "png" - where (_, base) = splitFileName path - -svgTestFileOfPath :: FilePath -> FilePath -svgTestFileOfPath path = testOutputFolder </> base <.> "svg" - where (_, base) = splitFileName path - - -text :: String -> H.Html -text txt = H.toHtml txt <> H.br - -generateFileInfo :: FilePath -> [H.Html] -generateFileInfo path = - [ text path, img path 0 0 - , img pngRef 0 0 - , img (testFileOfPath path) 0 0 - , img (svgTestFileOfPath path) 0 0] - where - pngRef = dropExtension path <.> "png" - -toHtmlDocument :: H.Html -> String -toHtmlDocument html = H.renderHtml $ - H.html $ H.head (HT.title $ H.toHtml "Test results") - <> H.body html - -analyzeFolder :: FontCache -> FilePath -> IO () -analyzeFolder cache folder = do - createDirectoryIfMissing True testOutputFolder - fileList <- sort . filter (".svg" `isSuffixOf`) <$> getDirectoryContents folder - let hdr = H.toHtml <$> ["name", "W3C Svg", "W3C ref PNG", "mine", "svgmine"] - all_table = - table hdr . map generateFileInfo $ map (folder </>) fileList - doc = toHtmlDocument all_table - (_, folderBase) = splitFileName folder - - print fileList - - writeFile (folder </> ".." </> folderBase <.> "html") doc - forM_ fileList $ \p -> do - let realFilename = folder </> p - putStrLn $ "Loading: " ++ realFilename - svg <- loadSvgFile realFilename - {-putStrLn $ groom svg-} - case svg of - Nothing -> putStrLn $ "Failed to load " ++ p - Just d -> do - putStrLn $ " => Rendering " ++ show (documentSize 96 d) - (finalImage, _) <- renderSvgDocument cache Nothing 96 d - writePng (testFileOfPath p) finalImage - - putStrLn " => XMLize" - saveXmlFile (svgTestFileOfPath p) d - - -testSuite :: IO () -testSuite = do - cache <- loadCreateFontCache "rasterific-svg-font-cache" - analyzeFolder cache "w3csvg" - {-analyzeFolder cache "test"-} - -main :: IO () -main = do - args <- getArgs - case args of - "test":_ -> testSuite - _ -> loadRender args -
rasterific-svg.cabal view
@@ -1,7 +1,7 @@ -- Initial svg.cabal generated by cabal init. For further documentation, -- see http://haskell.org/cabal/users-guide/ name: rasterific-svg -version: 0.1.0.2 +version: 0.1.0.3 synopsis: SVG renderer based on Rasterific. description: SVG renderer that will let you render svg-tree parsed SVG file to a JuicyPixel image or Rasterific Drawing. @@ -22,7 +22,7 @@ Source-Repository this Type: git Location: git://github.com/Twinside/rasterific-svg.git - Tag: v0.1.0.2 + Tag: v0.1.0.3 library hs-source-dirs: src @@ -47,13 +47,12 @@ , Rasterific >= 0.5 && < 0.6 , FontyFruity >= 0.5 && < 0.6 , svg-tree >= 0.1 && < 0.2 - , lens >= 4.5 + , lens >= 4.5 && < 4.9 , linear >= 1.16 , vector >= 0.10 , text >= 1.2 , transformers >= 0.3 && < 0.5 , mtl >= 2.1 && < 2.3 - , lens >= 4.6 && < 4.8 Executable svgrender default-language: Haskell2010 @@ -69,26 +68,4 @@ , filepath , FontyFruity , svg-tree - -Test-Suite svgtest - type: exitcode-stdio-1.0 - default-language: Haskell2010 - hs-source-dirs: exec-src - Main-Is: svgtest.hs - Ghc-options: -O3 -Wall - ghc-prof-options: -rtsopts -Wall -prof -auto-all - Build-Depends: base >= 4.6 - , linear - , rasterific-svg - , Rasterific - , JuicyPixels - , directory - , filepath - , attoparsec - , text - , FontyFruity - , binary - , bytestring - , svg-tree - , blaze-html