htdp-image: Beginner friendly graphics library.

[ bsd3, graphics, library ] [ Propose Tags ]

htdp-image is a simple graphics library inspired by Racket's htdp/image. Under the hood, it is a wrapper on top of Gloss, another easy to use graphics library but htdp-image makes drawing objects even easier for beginners. As long as Gloss works on a machine, this library should also work.


[Skip to Readme]
Versions [faq] 1.0.0.0, 1.1.0.0
Change log CHANGELOG.md
Dependencies AC-Angle (==1.0.*), base (==4.12.*), gloss (>=1.13.0 && <1.14) [details]
License BSD-3-Clause
Author Turab Jafri
Maintainer trajafri@gmail.com
Category Graphics
Source repo head: git clone https://github.com/trajafri/htdp-image
Uploaded by trajafri at Fri Jul 26 03:09:12 UTC 2019
Distributions NixOS:1.1.0.0
Downloads 113 total (50 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2019-07-26 [all 1 reports]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for htdp-image-1.1.0.0

[back to package description]

htdp-image

htdp-image is a simple graphics library inspired by Racket's 2htdp/image library. Check the feature list to see what has been ported from 2htdp/image so far.

Under the hood, it is currently a wrapper on top of Gloss, another easy to use graphics library, but htdp-image makes drawing objects even easier for beginners.

In the future, if it seems like Gloss is limiting the features this library wishes to implement, then the newer versions might start using graphics libraries that work on a lower level than Gloss.

This library uses the combinator pattern to draw images.

For an example program, check tromino-tile.

Examples:

To draw five circles beside each other:

drawImage $ foldr1 beside $ replicate 5 (circle 20 solid red)

alt text

To draw five circles above each other:

drawImage $ foldr1 above $ replicate 5 (circle 20 solid red)

alt text

To draw four circles stacked on top of each other (2 on 2):

drawImage $ above (beside redCirc blueCirc) (beside blueCirc redCirc)
 where
  redCirc  = (circle 20 solid red)
  blueCirc = (circle 20 solid blue)

alt text

To draw four iterations of the sierpinski triangle (don't try super big iterations!):

drawImage $ sier . sier . sier . sier $ (triangle 20 solid red)
 where
  sier t = above t $ beside t t

alt text