Name: Anonymous 2011-02-10 17:39
So /prog/ I'm working on this little bit of java code for school. What it's supposed to do is read through a pgm file (which is an array as far as I know) and then put horizontal white lines through it.
The problem is that it only puts lines 2/3 of the way across the image and I have no idea why. Any help would be greatly appreciated, code below.
public void gridH(int lineSpacing, int lineWidth){
for (int col = 0; col < pixels.length; ++col){
for(int grid = 0; grid < pixels.length; grid = grid + lineSpacing + lineWidth){
for(int row = grid; row < grid + lineWidth; row++){
int gScale = 255;
pixels[row][col] = gScale;
The problem is that it only puts lines 2/3 of the way across the image and I have no idea why. Any help would be greatly appreciated, code below.
public void gridH(int lineSpacing, int lineWidth){
for (int col = 0; col < pixels.length; ++col){
for(int grid = 0; grid < pixels.length; grid = grid + lineSpacing + lineWidth){
for(int row = grid; row < grid + lineWidth; row++){
int gScale = 255;
pixels[row][col] = gScale;