![]() |
![]() |
|
home—info—labs—exams—hws
—D2L—MediaSamples/—breeze (snow day)—tutor/PIs
Last time, we saw how we can have a function which uses a
To think on, before starting: what range of y-coordinates do you want to use — starting from and going up to the picture object's . Explore the menu JES Functions > Pictures to see if there is a function that can help give you the end of the range.
hint: I suggest temporarily addingrepaint at the end of this function, but then removing it once you have the function working. If somebody callsstripeAtX 300 times, they can callrepaint when they're done; there is no reason to repaint the picture-object 300 times.
To think on, before starting: what range of y-coordinates do you want to use — starting from and going up to the picture object's . Explore the menu JES Functions > Pictures to see if there is a function that can help give you the end of the range.
Here is a solution.
As a followup: once you have
Then: Write a function that enpurples a 10x10 square at a randomly-chosen location, in a picture-object. Write another function that does this 20 times.
1Recall that I'm using “enpurple” to mean turning a pixel's red and blue all the way on:
px = getPixel( somePictureObject, someXCoord, someYCoord ) setRed(px, 255) setBlue(px, 255) |
home—info—labs—exams—hws
—D2L—MediaSamples/—breeze (snow day)—tutor/PIs
©2014, Ian Barland, Radford University Last modified 2014.Apr.29 (Tue) |
Please mail any suggestions (incl. typos, broken links) to ibarland ![]() |
![]() |