samedi 17 juin 2023

Hi a clarification Please about cs50 pset reflection filter

I hope you are doing well. I'm trying to solve the reflection filter in the CS50 Week 4 pset, but I'm stuck. My logic is to use a buffer of type RGBTRIPLE to copy the last pixel from image[n][width - 1] to the first pixel image[n][n] throughout the entire image. However, there seems to be something wrong with my code:

void reflect(int height, int width, RGBTRIPLE image[height][width])
{
    for (int h = 0; h < height; h++)
    {
        RGBTRIPLE buffer;
        for (int w = 0; w < width; w++)
        {
            buffer = image[h][w];
            image[h][w] = image[h][width - w];
            image[h][width - w] = buffer;
        }
    }
    return;
}




Aucun commentaire:

Enregistrer un commentaire