packages feed

xdot 0.2.3.1 → 0.2.4

raw patch · 4 files changed

+23/−7 lines, 4 files

Files

src/Graphics/XDot/Parser.hs view
@@ -69,6 +69,7 @@ import Data.Maybe import Data.Char import Data.Ratio+import Data.Bits  import qualified Data.Foldable as F import qualified Data.Text.Lazy as B@@ -168,6 +169,7 @@     'L' -> parsePolyline     'B' -> parseBSpline False     'b' -> parseBSpline True+    't' -> parseFontCharacteristics     'T' -> parseText     'C' -> parseColor True     'c' -> parseColor False@@ -192,6 +194,11 @@       xs <- parsePoints       return $ BSpline xs filled +    parseFontCharacteristics = do+      f <- parseInt'+      character ' '+      return $ FontCharacteristics (testBit f 0) (testBit f 1) (testBit f 2) (testBit f 3) (testBit f 4) (testBit f 5)+     parseText = do       baseline <- parsePoint       j <- parseInt'@@ -241,16 +248,22 @@       return (x,y)      parseColor filled = do -- TODO: Not complete-      _ <- parseInt+      n <- parseInt       character ' '       character '-'       character '#'       r <- parseHex       g <- parseHex       b <- parseHex-      a <- parseHex-      character ' '-      return $ Color (r,g,b,a) filled+      case n of+        7 -> do+          character ' '+          return $ Color (r,g,b,1) filled+        9 -> do+          a <- parseHex+          character ' '+          return $ Color (r,g,b,a) filled+        _ -> fail "Unknown color encoding"      where parseHex = liftM hexToFloat $ replicateM 2 P.next            hexToFloat s = foldl (\x y -> 16 * x + fromIntegral (digitToInt y)) 0 s / 255 
src/Graphics/XDot/Types.hs view
@@ -40,6 +40,7 @@                | Polygon { points :: [Point], filled :: Bool }                | Polyline { points :: [Point] }                | BSpline { points :: [Point], filled :: Bool }+               | FontCharacteristics { bold :: Bool, italic :: Bool, underline :: Bool, superscript :: Bool, subscript :: Bool, strikethrough :: Bool }                | Text { baseline :: Point, alignment :: Alignment, width :: Double, text :: String }                | Color { rgba :: (Double, Double, Double, Double), filled :: Bool }                | Font { size :: Double, name :: String }
src/Graphics/XDot/Viewer.hs view
@@ -222,3 +222,5 @@   return []  draw _ (_, Image{}) = return [] -- TODO++draw _ (_, FontCharacteristics{}) = return [] -- TODO
xdot.cabal view
@@ -1,5 +1,5 @@ name:               xdot-version:            0.2.3.1+version:            0.2.4 license:            BSD3 license-file:       LICENSE category:           Graphs, Graphics@@ -7,7 +7,7 @@ build-type:         Simple author:             Dennis Felsing <dennis@felsin9.de> maintainer:         Dennis Felsing <dennis@felsin9.de>-copyright:          Dennis Felsing 2012+copyright:          Dennis Felsing 2012-2013 synopsis:           Parse Graphviz xdot files and interactively view them using GTK and Cairo description:        Parse Graphviz xdot files and interactively view them using                     GTK and Cairo.@@ -22,7 +22,7 @@                     is now a seperate project, in case anyone else may have a                     use for it. -tested-with: GHC == 7.4.1, GHC == 7.4.2, GHC == 7.6.1+tested-with: GHC == 7.4.1, GHC == 7.4.2, GHC == 7.6.1, GHC == 7.6.2, GHC == 7.6.3 Extra-source-files: Demo.hs, dot-examples/*.dot Library   Exposed-modules: Graphics.XDot.Parser Graphics.XDot.Viewer Graphics.XDot.Types