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 ofc
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]
- Create and return a
void drawChar(char c, int x, int y)
- Draw a square using the color from
charToColor()
at the givenx
andy
location, usingc
as the side length. - Set
textSize
to the value ofc
. - Display
c
as a character inside the square.
- Draw a square using the color from
setup()
- Set the screen size to 600x400
- Using a
for
loop controlled by achar
variable, loop through the chars from'A'
to'Z'
, callingdrawChar()
appropriately. Setx
andy
values as you see fit.
Reference Image: