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

Color pixelColor = panel.getColorAtPixel(srcX,srcY)?

+15 votes
Confused about how to go about getting these numbers to put in for the getColorAtPixel. Any ideas how to go about this?
asked Jan 16, 2016 in (Winter 15-16) by Austin Chausse (100 points)

1 Answer

+6 votes
 
Best answer
Well, before doing anything fancy, I would try it out at some random coordinates by just doing:

int srcX = 100;
int srcY = 150;

and see if I could get ONE dot to appear.

Then eventually, you want to make it so that srcX takes on multiple values that are regularly spaced along the source image coordinates.  e.g. if the image width is 600, and numDotsWide is 10, then you'd want srcX to be:

0, then 60, then 120, then 180, ... etc.
answered Jan 16, 2016 by Forrest Stonedahl (3,438 points)
selected Jan 17, 2016 by Austin Chausse
...