Due: Tuesday 4/8 10:00am

Submission name: w13_drawChar

Write a processing program with the following functions

  • color charToColor(char c)
    • Create and return a color based on the value of c as follows:
    • Multiply c by 23, 41 and 67, respectively to to get red, green and blue values (you could use other numbers, but small, relatively prime numbers work best).
    • Don’t forget to make sure each color is within the range [0, 255]
  • void drawChar(char c, int x, int y)
    • Draw a square using the color from charToColor() at the given x and y location, using c as the side length.
    • Set textSize to the value of c.
    • Display c as a character inside the square.
  • setup()
    • Set the screen size to 600x400
    • Using a for loop controlled by a char variable, loop through the chars from 'A' to 'Z', calling drawChar() appropriately. Set x and y values as you see fit.

Reference Image:

abcs.png