Lab: Interactive Drawing

Take the new code from Basics of Input Processing and add it to the code as of the end of the textured triangle lab.

You can obtain the basics of a drawing program by answering these three questions from the "Coloring Time" section:

  1. At point (1) in the code, how can we check for the number keys 1-3? And how can we update the color field with a new color value?
  2. At point (2), what is the purpose of the division and (in the next statement) the multiplication of the mouse coordinates?
  3. At point (3), try removing the request_redraw() call. What happens?

To complete the lab:

Extend the interactive drawing example from above however you like. For full credit, do two of the following:

  1. Draw three distinct types of shapes interactively by defining new "tools", e.g. by dragging with the mouse you can stretch out a rectangle. Some ideas:
    1. Filled rectangles
    2. Outlined rectangles
    3. Outlined polygons
    4. Bresenham-lines
    5. Circles
    6. Text
  2. Draw with partial transparency (check out the Blend type from imageproc), with keys to increase and decrease the alpha value of the current color. There are some hints on Zulip about this.
  3. Something else, let me know what you have in mind!