Skip to content
RyanGlScott edited this page Oct 9, 2014 · 3 revisions

{-# LANGUAGE OverloadedStrings #-}
module Main where

import Graphics.Blank

main :: IO ()
main = blankCanvas 3000 $ \ context -> do
    send context $ do
        let rectWidth = 150;
        let rectHeight = 75;

        -- translation matrix:
        --  1  0  tx
        --  0  1  ty
        --  0  0  1
        let tx = width context / 2;
        let ty = height context / 2;

        -- apply custom transform
        transform(1, 0, 0, 1, tx, ty);

        fillStyle "blue";
        fillRect(rectWidth / (-2), rectHeight / (-2), rectWidth, rectHeight);
Clone this wiki locally