Task:
"pass these four variables (x,y,w,h) into the getSubimage method of the original_image object."
That method returns a BufferedImage, which i need to directly return from my getImageRect method.
I have not included my whole code, but i was wondering if anybody could help me out with this? If you need me to include other aspects of my code to help understand this program then i can paste them.
BufferedImage getImageRect(int thisCol, int thisRow)
{
// if input is out of range, return "null"
if(thisCol <0 || thisRow < 0)
return null;
if(thisCol>=numCols || thisRow>=numRows)
return null;
// otherwise, make and return the Rectangle
int w = original_image.getWidth()/numCols;
int h = original_image.getHeight()/numRows;
int x = thisCol*w;
int y = thisRow*h;
** BufferedImage subImage = new getSubImage(x, y, w, h); **
return BufferedImage;
}
**
This line of code was just my attempt at achieving this but am well aware it is not the correct way. Please can anyone give me some idea as to what the correct code would be for this line?**
The idea of my program is to uncover bits of a picture until you can guess who is beneath the tiles. Only 4 tiles can be uncovered at a time.