function:RenderSidePart pageleftbodycaption pageleftbody sidenote Main.Hint-SideNote Main.SideNote Site.SideNote

# Hint

 public SImage drawX( SImage oldPic )
{
int [][] pixels = oldPic.getPixelArray();
int width=pixels.length;
int height=pixels[0].length;
double slope=(double)height/width;
int x=0;
while (x< width){
int y=(int)Math.round(x*slope);
pixels[x][y]=0;
x++;
}
// you still need to implement the other diagonal
// by symmetry, you can just add to the
// loop above.  For example, if you have a 100 x 100 grid
//    if (2,2) is a point, then (97,2) is another.....
//    so is (2, 97).. just make a new y from adapting x
//    be careful of OBOE's.. the width is 100, but the last pixel is 99

return new SImage(pixels);
}


A full explanation of using slope can be found at http://www.cs.unc.edu/~mcmillan/comp136/Lecture6/Lines.html