Basically part of my project was to take the rows of pixels from a picture and make each row display twice, and the same for the column, and then eventually do them both together. However, I am having trouble with my loop to duplicate the rows or column. What I think is happenin in my code is the its just skipping a line instead of duplicating it, but im not sure. Ive spent hours on this and am truly stuck. any help is appreciated.
public static Photograph stretched(Photograph photo, int type) {
height = photo.getHeight();
width= photo.getWidth();
if(type == 0){
Photograph fat = new Photograph(2*width,height);
fat(width,height,fat,photo);
return fat;
}else{
Photograph tall = new Photograph(width, 2*height);
tall(width,height,tall,photo);
return tall;
}
}
private static Photograph fat(int width,int height, Photograph brandnew,
Photograph original){
for(int c = 0; c < height; c++){
int test =2, mark = 0;
for(int d = 0; d < width; d++){
Pixel a = original.getPixel(d,c);
while(mark < test){
brandnew.setPixel(d+mark, c, a);
mark++;
}
test++;
}
}
return brandnew;
}
private static void tall(int width,int height, Photograph brandnew,
Photograph original){
int mark = 0, test =2;
for(int c = 0; c < height; c++){
while(mark < test){
for(int d = 0; d < width; d++){
Pixel a = original.getPixel(d,c);
brandnew.setPixel(d, c+mark, a);
}
mark++;
}
test++;
}
}