Welcome to the CSC Q&A, where you can get help (and share your knowledge) about computer science!

11c of the PDF

+12 votes
Indexing for coordinates and how it's 0 based and going up from 0 minus 1 is confusing me.
asked Jan 16, 2016 in (Winter 15-16) by Austin Chausse (100 points)

1 Answer

+6 votes
Best answer

Don't stress about this too much.  It just means that in your calls to .getColorAtPixel(X, Y) your X values always need to be between 0 and the imageWidth - 1 , and your Y values always need to be between 0 and imageHeight - 1.  Otherwise your code will produce an error and red error message text about the coordinate being out of bounds will appear in the console.

answered Jan 16, 2016 by Forrest Stonedahl (100 points)
selected Jan 17, 2016 by Austin Chausse