mirror of
https://github.com/ilyakooo0/vty.git
synced 2024-10-04 03:07:07 +03:00
Add sample for #76.
This commit is contained in:
parent
20eb987e2b
commit
7617f21877
@ -184,7 +184,8 @@ pad inL inT inR inB inImage
|
||||
where w = imageWidth i + l
|
||||
h = imageHeight i
|
||||
|
||||
-- | translates an image by padding or cropping the top and left.
|
||||
-- | translates an image by padding or cropping the left and top. First param is amount to translate
|
||||
-- left. Second param is amount to translate top.
|
||||
--
|
||||
-- This can have an unexpected effect: Translating an image to less than (0,0) then to greater than
|
||||
-- (0,0) will crop the image.
|
||||
|
17
test/Issue76.hs
Normal file
17
test/Issue76.hs
Normal file
@ -0,0 +1,17 @@
|
||||
module Main where
|
||||
|
||||
import Control.Monad (void)
|
||||
import Graphics.Vty
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
cfg <- standardIOConfig
|
||||
vty <- mkVty cfg
|
||||
let line1 = charFill (defAttr `withBackColor` blue) ' ' 10 1
|
||||
line2 = charFill (defAttr `withBackColor` green) ' ' 10 1
|
||||
img = translate 10 5 (line1 `vertJoin` line2)
|
||||
pic = picForImage img
|
||||
|
||||
update vty pic
|
||||
void $ nextEvent vty
|
||||
shutdown vty
|
Loading…
Reference in New Issue
Block a user