Depending on your operating system, the DrRacket executable may be on your desktop, or you may need to find it with your window system's file manager.

Look for the DrRacket icon:

and launch the executable. As it is loading, a window like this will appear:

Note: The current Racket version is 8.2.

Our text book has written some standard procedures for manipulating images in DrRacket programs.

This section describes how to install and use these procedures.

This section describes more graphics operations, and also a way to save graphical images to files.

You will be asked to enter some Racket (Scheme) code to verify that they have been correctly installed. Enter the code into the interaction window exactly as it is given here. It is not necessary that you understand it at this time.

Download and save this file to a folder of your choice: graphics.scm.

In DrRacket, create a new tab, open graphics.scm, and run it. This will create the quilting basic blocks test-bb and nova-bb. You can evaluate them in the interaction window, but they will not produce any images. This is because they are not actually images, but procedures that make images.

To produce the images, you need to download, open, and run this file: show.scm. Make sure this file is located in the same folder as graphics.scm.

In the interaction window, now enter (show test-bb) and you should see:

A common graphics operation is to produce a mirror image of an image.

Define the mirror image of test-bb in the interaction window:

> (define test-bb-mirrored (make-mirrored-image test-bb))

It looks like this:

Another graphics operation is to overlay an image on another, provided they are the same size (that is, their display areas have the same width and height).

Overlay test-bb and test-bb-mirrored to get a triangle:

> (define triangle (make-overlaid-image test-bb test-bb-mirrored))

It looks like this:

To rotate an image is to turn it around a center point. The make-turned-image operation turns an image by 90 degrees to the right.

Turn the triangle by 180 degrees to get an inverted triangle as shown below. Note that this is accomplished with consecutive applications of make-turned-image:

> (define inverted-triangle (make-turned-image (make-turned-image triangle)))

We can stack an image on another to create a new image whose size is the sum of the sizes of the images. The images are not overlaid.

Stack the triangle on the inverted triangle to get a diamond:

> (define diamond (make-stacked-image triangle inverted-triangle))

The graphics examples so far render images to a display screen using show. We can also save images to files using the Encapsulated PostScript (eps) format.

Instead of showing the image, save it to a file using image->eps.

Save our diamond image to a file named "Diamond":

> (image->eps diamond "Diamond")

The ".eps" file extension will be automatically added. Diamond.eps will be found in the same folder as graphics.scm. It can be opened and viewed with any standard document viewer.

Submit Diamond.eps by going to under the assignment Lab: DrRacket Installation and Setup

Here is a summary of the commands that produce Diamond.eps, once graphics.scm has been opened and run:

> (define test-bb-mirrored (make-mirrored-image test-bb))

> (define triangle (make-overlaid-image test-bb test-bb-mirrored))

> (define inverted-triangle (make-turned-image (make-turned-image triangle)))

> (define diamond (make-stacked-image triangle inverted-triangle))

> (image->eps diamond "Diamond")