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]

Modules

[Last Documentation]

  • Graphics
    • Graphics.Htdp
      • Graphics.Htdp.Combinator
      • Data
        • Graphics.Htdp.Data.Image
      • Graphics.Htdp.Shape

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 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.14), 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 2021-08-24T03:38:58Z
Distributions
Downloads 1117 total (3 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2021-08-24 [all 2 reports]

Readme for htdp-image-1.1.0.1

[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