fix arc/sweep flags
This commit is contained in:
parent
4dc0c0394b
commit
6bda613b53
1 changed files with 8 additions and 4 deletions
|
@ -25,6 +25,10 @@ import Data.Text.Lazy.Builder.RealFloat
|
||||||
toText :: RealFloat a => a -> Text
|
toText :: RealFloat a => a -> Text
|
||||||
toText = toStrict . toLazyText . formatRealFloat Fixed (Just 4)
|
toText = toStrict . toLazyText . formatRealFloat Fixed (Just 4)
|
||||||
|
|
||||||
|
-- | Convert an arc/sweep flag to text
|
||||||
|
toFlag :: (Num a, Eq a) => a -> Text
|
||||||
|
toFlag x = if x == 0 then "0" else "1"
|
||||||
|
|
||||||
-- | moveto (absolute)
|
-- | moveto (absolute)
|
||||||
mA :: RealFloat a => a -> a -> Text
|
mA :: RealFloat a => a -> a -> Text
|
||||||
mA x y = T.concat ["M " ,toText x, ",", toText y, " "]
|
mA x y = T.concat ["M " ,toText x, ",", toText y, " "]
|
||||||
|
@ -100,14 +104,14 @@ tR x y = T.concat [ "t ", toText x, ",", toText y, " "]
|
||||||
-- | Arc (absolute)
|
-- | Arc (absolute)
|
||||||
aA :: RealFloat a => a -> a -> a -> a -> a -> a -> a -> Text
|
aA :: RealFloat a => a -> a -> a -> a -> a -> a -> a -> Text
|
||||||
aA rx ry xrot largeFlag sweepFlag x y = T.concat
|
aA rx ry xrot largeFlag sweepFlag x y = T.concat
|
||||||
[ "A ", toText rx, ",", toText ry, " ", toText xrot, " ", toText largeFlag
|
[ "A ", toText rx, ",", toText ry, " ", toText xrot, " ", toFlag largeFlag
|
||||||
, " ", toText sweepFlag, " ", toText x, " ", toText y, " "]
|
, " ", toFlag sweepFlag, " ", toText x, " ", toText y, " "]
|
||||||
|
|
||||||
-- | Arc (relative)
|
-- | Arc (relative)
|
||||||
aR :: RealFloat a => a -> a -> a -> a -> a -> a -> a -> Text
|
aR :: RealFloat a => a -> a -> a -> a -> a -> a -> a -> Text
|
||||||
aR rx ry xrot largeFlag sweepFlag x y = T.concat
|
aR rx ry xrot largeFlag sweepFlag x y = T.concat
|
||||||
[ "a ", toText rx, ",", toText ry, " ", toText xrot, " ", toText largeFlag
|
[ "a ", toText rx, ",", toText ry, " ", toText xrot, " ", toFlag largeFlag
|
||||||
, " ", toText sweepFlag, " ", toText x, " ", toText y, " "]
|
, " ", toFlag sweepFlag, " ", toText x, " ", toText y, " "]
|
||||||
|
|
||||||
-- | closepath
|
-- | closepath
|
||||||
z :: Text
|
z :: Text
|
||||||
|
|
Loading…
Reference in a new issue