~alcinnz/Mondrian

ref: 595c10c349e1810e1deb4ed192b7f6a54d554d70 Mondrian/lib/Graphics/Rendering/Rect.hs -rw-r--r-- 797 bytes
595c10c3 — Adrian Cochrane Fix transformation matrix (should be fixed upstream, but that'd be breaking). 1 year, 4 months ago
                                                                                
10e61b66 Adrian Cochrane
eba0f9a2 Adrian Cochrane
10e61b66 Adrian Cochrane
eba0f9a2 Adrian Cochrane
10e61b66 Adrian Cochrane
a08fe055 Adrian Cochrane
10e61b66 Adrian Cochrane
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module Graphics.Rendering.Rect(Rect(..), Rects(..), shrink, shrink1, renderRects,
    RectStyle(..), colour, Backgrounds(..)) where

import Graphics.Rendering.Rect.CSS
import Graphics.Rendering.Rect.Backgrounds
import Graphics.Rendering.Rect.Types

import Linear (M44)
import Control.Monad.IO.Class (MonadIO)

shrink :: Rect -> Float -> Float -> Float -> Float -> Rect
shrink self dLeft dTop dRight dBottom =
    Rect (left self + dLeft) (top self + dTop)
         (right self - dRight) (bottom self - dBottom)
shrink1 :: Rect -> Float -> Rect
shrink1 self d = shrink self d d d d

renderRects :: (MonadIO m, MonadIO n) =>
        n (RectStyle -> Rects -> M44 Float -> m ())
renderRects = do
    bg <- renderBackgrounds
    return $ \style rects mat -> do
        bg (backgrounds style) rects mat