Cleanup rendering
This commit is contained in:
+22
-7
@@ -25,7 +25,10 @@ module Picture.Base (
|
||||
line,
|
||||
lineCol,
|
||||
text,
|
||||
textRight,
|
||||
textJustifyLeft,
|
||||
textJustifyRight,
|
||||
textJustifyCenter,
|
||||
textVMirror,
|
||||
drawText,
|
||||
centerText,
|
||||
@@ -90,7 +93,6 @@ poly3Col = map f . polyToTris
|
||||
where
|
||||
f (pos, col) = Verx pos col [] BottomLayer polyNum
|
||||
|
||||
|
||||
---- given a one and two zeros of a linear function over x and y,
|
||||
---- determine the function
|
||||
---- so if f(ox,oy) = 1 and f(ax,ay) = f(bx,by) = 0, determines f
|
||||
@@ -201,15 +203,28 @@ stackText :: [String] -> Picture
|
||||
{-# INLINE stackText #-}
|
||||
stackText = mconcat . zipWith (\y s -> translate 0 y $ centerText s) [0, 100 ..]
|
||||
|
||||
textJustifyRight :: String -> Picture
|
||||
{-# INLINE textJustifyRight #-}
|
||||
textJustifyRight str = translate ((-100) * fromIntegral (length str)) 0 $ text str
|
||||
|
||||
text :: String -> Picture
|
||||
{-# INLINE text #-}
|
||||
--text = translate (-50) (-100) . drawText (-10)
|
||||
text = drawText 0
|
||||
--text = drawText (-10)
|
||||
|
||||
-- lines up the rightmost part of the last character with 0
|
||||
textJustifyRight :: String -> Picture
|
||||
{-# INLINE textJustifyRight #-}
|
||||
textJustifyRight str = translate (12.5 + (-100) * fromIntegral (length str)) 0 $ text str
|
||||
|
||||
-- translate the text so its bottom right coordinate is at (0,0)
|
||||
textRight :: String -> Picture
|
||||
{-# INLINE textRight #-}
|
||||
textRight str = translate ((-100) * fromIntegral (length str)) 0 $ text str
|
||||
|
||||
-- lines up the leftmost part of the first character with 0
|
||||
textJustifyLeft :: String -> Picture
|
||||
{-# INLINE textJustifyLeft #-}
|
||||
textJustifyLeft = translate (-12.5) 0 . text
|
||||
|
||||
textJustifyCenter :: String -> Picture
|
||||
{-# INLINE textJustifyCenter #-}
|
||||
textJustifyCenter str = translate ((-50) * fromIntegral (length str)) 0 $ text str
|
||||
|
||||
textVMirror :: String -> Picture
|
||||
{-# INLINE textVMirror #-}
|
||||
|
||||
Reference in New Issue
Block a user