Drawing with Text Summary: In this laboratory, you will explore the use of text in GIMP drawings.
Preparation Start GIMP and MediaScript. Create and show a 200x200 image named canvas.
Experiments
Experiment 1: Drawing with text (a) The image.draw-text! procedure allows you to draw text in an image with a specified location and rotation. Try the following expression to see what it does; then experiment with varying the parameters. (image.draw-text! canvas "hello" "Courier" 12 0 0 0) (envt.update-displays!) (b) What do you think the following code will do? Make a prediction, then see if your prediction is correct. (image.draw-text! canvas "hello" "Arial" 16 100 100 (* pi 0)) (image.draw-text! canvas "hello" "Arial" 16 100 100 (* pi 0.5)) (image.draw-text! canvas "hello" "Arial" 16 100 100 (* pi 1)) (image.draw-text! canvas "hello" "Arial" 16 100 100 (* pi 1.5)) (envt.update-displays!)
Experiment 2: Choosing a font
The font.list procedure works much like brush.list or color.list. Use it to obtain a list of all fonts; to list fonts with Times in their names; to find a font that you like.
Explorations Choose any of the following explorations to do in (or after) class. You need not do them in the order they are listed, but some will take more time than others. Some details are deliberately left unspecified for you to figure out. They are all things I think you can figure out how to do based on what you've already learned. If you are particularly proud of your work, please email me your code for possible extra credit. Write a procedure, image.draw-whirled-text!, to repeatedly draw the same text with the same starting location, while varying the angle by which the text is rotated. Use text as a stamp when drawing &spirograph;-like drawings. Write a procedure, image.draw-shadowed-text!, that produces a 3D shadow effect by drawing the text first in black (for the shadow) and then in another color, in slightly different positions. For a different 3D effect, write a recursive procedure to draw the same text in the same location with a series of different font sizes. Jitter the text: Write a procedure, image.draw-jittered-text!, that draws the same text several times in approximately the same location, introducing a small random offset to the position each time. Produce a contact sheet: The purpose of a contact sheet is to let you compare different fonts. Write the same text in several different locations, each time using a different font from a list of fonts provided by the user. Draw a text wave: Take a string and use numeric recursion along with string-ref to draw each character separately. Vary the vertical position of each character by using the sin or cos procedure (or some other interesting mathematical function). You will also need to compute a horizontal position for each character; it's easiest if you assume all characters are the same width. Produce a ransom note effect: Take a string and use numeric recursion along with string-ref to draw each character separately. Randomly vary the position, angle, font size, and/or font for each character. Draw each character in the string using a different color. The color could be algorithmically generated or selected from a list, based on either the position of the character in the string or its position in the ASCII collating sequence. Draw alphabet blocks, with a different colored square behind each character. Write a procedure to draw a personalized greeting card, with text that includes the recipient's name, and also an interesting picture. The picture could use any of the techniques for making images you've learned about this semester. You might make the picture look different for each different recipient, perhaps by transforming the characters in the recipient's name into integers and then using these integers as parameters for the drawing procedures. Any other interesting ideas?