Better draw code (with bitmaps and lines)

October 16, 2009
by Lee Spector (lspector)

Here is a better version of the drawing code, with Adria’s bitmap contribution (which should help with the unwanted window-clearing on some systems and also make the window redraw when resized, etc.), some enhancements that I made to the bitmap code because it wasn’t working right with iterative drawing, plus two other changes:

  • A “line” procedure to draw a line that takes 9 arguments — x1 y1 x2 y2 width r g b a — and draws a line from (x1, y1) to (x2, y2) that’s width pixels wide, with color red=r, green=g, blue=b, and transparency alpha=a.
  • I changed the name of “make-window” to “show-window” because that’s really what it does.

Here it is: better-draw

Let me know if you have any problems with it.



2 Responses to “Better draw code (with bitmaps and lines)”

  1.   Code Immersion » Blog Archive » Simple animation Says:

    […] Better draw code (with bitmaps and lines) […]

  2.   Code Immersion » Blog Archive » Saving a jpeg of your graphics Says:

    […] on A Scheme “while loop”Code Immersion » Blog Archive » Simple animation on Better draw code (with bitmaps and lines)lspector on Memoizationas07 on Memoization « Simple frame-based […]

Leave a Reply

You must be logged in to post a comment.