htdp-image: Beginner friendly graphics library.

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

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]

Properties

Versions 1.0.0.0, 1.0.0.0, 1.1.0.0, 1.1.0.1
Change log CHANGELOG.md
Dependencies AC-Angle (>=1.0 && <1.1), base (>=4.12 && <4.13), 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 2019-07-26T02:17:27Z

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for htdp-image-1.0.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