It is a very cool project, but we have not covered 50% of what we are supposed to do here in class. So that is why I am having trouble...
If you have still some patiance Codeplug, could you help me with the Flip upside-down function, I can do it, when the image is grayscale, (2D) by doing something like this:
Code:
void applyUpsideDown(float pict[][Height])
{
for (int i=0; i < Width; i++) {
for (int j=0, k=Height-1; j < k; j++, k--) {
float temp = pict[i][j];
pict[i][j] = pict[i][k];
pict[i][k] = temp;
}
}
}
and this does it. But when I want to do a similar thing with the color image it seems not to be working. I'm not exactly sure if I'm even on the right track here is the code so far:
Code:
void applyUpsideDown(Picture& pict)
{
int width = pict.getWidth();
int height = pict.getHeight();
int i, j, k;
Color flip( 0, 0, 0 );
for ( i=0; i < width; i++){
for ( j=0, k = (height-1); j < k; j++, k++){
flip = pict.getPixel(i, j);
Color temp = flip;
flip = pict.getPixel(i, k);
pict.setPixel(i, j, flip);
pict.setPixel(i, j, temp);
}
}
}
axon