From f044593c24692c867cc1da19fc6689b3427d9bfd Mon Sep 17 00:00:00 2001 From: jgk Date: Thu, 22 Jul 2021 14:50:35 +0200 Subject: [PATCH] Commit before removing line shader --- src/Picture.hs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Picture.hs b/src/Picture.hs index 2956450da..94ac74e60 100644 --- a/src/Picture.hs +++ b/src/Picture.hs @@ -193,11 +193,13 @@ text = Text line :: [Point2] -> Picture {-# INLINE line #-} -line = Line +--line = Line +line = flip thickLine 1 lineCol :: [(Point2,RGBA)] -> Picture {-# INLINE lineCol #-} -lineCol = LineCol +--lineCol = LineCol +lineCol = flip thickLineCol 1 thickLine :: [Point2] -> Float -> Picture {-# INLINE thickLine #-} @@ -209,6 +211,21 @@ thickLine ps t = pictures $ f ps f _ = [] n a b = (t*0.5) *.* errorNormalizeV 42 (vNormal (a -.- b)) +thickLineCol :: [(Point2,RGBA)] -> Float -> Picture +{-# INLINE thickLineCol #-} +thickLineCol ps t = pictures $ f ps + where + f ((x,c):(y,c'):ys) + | x == y = f ((x,c):ys) + | otherwise = polygonCol + [(x +.+ n x y,c) + ,(x -.- n x y,c) + ,(y -.- n x y,c') + ,(y +.+ n x y,c') + ] : f ((y,c'):ys) + f _ = [] + n a b = (t*0.5) *.* errorNormalizeV 42 (vNormal (a -.- b)) + thickCircle :: Float -> Float -> Picture {-# INLINE thickCircle #-} thickCircle = thickArc 0 (2*pi)