Mirroring

Article Info

Pseudocode

PROCEDURE top_copy(image)
    midpoint <- h / 2
    FOR x = 0 .. width DO
        FOR y = 0 .. midpoint DO
            c <- pixel(x, y)
            i <- height - y - 1
            pixel(x, i) <- c
        END FOR
    END FOR
END PROCEDURE

Description

Loop through each pixel in the image and retrieve its value. Calculate the location which this pixel will be copied to, and set the pixel at that location to the source pixel’s value.

This is very similar to the Top Copy algorithm, except rather than displace the copied pixel half way down the image this instead will make the image look liks its reflected around the midpoint.

Acknowledgements

Adapted from Pseudocode produced for COMP120 by Dr. Micheal Scott.

Graduation Cap Book Open book GitHub Info chevron-right Sticky Note chevron-left Puzzle Piece Square Lightbulb Video Exclamation Triangle Globe