Support embedding raw images in Prim

This commit is contained in:
Jonathan Daugherty 2015-05-11 23:35:35 -07:00
parent ebc5c80a79
commit 6c3c43e9fe

View File

@ -38,11 +38,15 @@ data Prim = Fixed String
| HLimit Int Prim
| VLimit Int Prim
| UseAttr Attr Prim
| Raw Image
mkImage :: DisplayRegion -> Attr -> Prim -> Image
mkImage (w, h) a (Fixed s) = if w > 0 && h > 0
then crop w h $ string a s
else emptyImage
mkImage (w, h) _ (Raw img) = if w > 0 && h > 0
then crop w h img
else emptyImage
mkImage (w, _) a (HFill c) = charFill a c w 1
mkImage (_, h) a (VFill c) = charFill a c 1 h
mkImage (_, h) a (HLimit w p) = mkImage (w, h) a p