Wednesday, December 18, 2013

Mirror an Image Vertically

def mirrorVertical (source):
  width = getWidth (source)
  mirrorPoint = widtht/2
  for y in range (0, getHeight(source)):
    for x in range (0, mirrorPoint):
      leftPixel = getPixel (source, x, y)
      rightPixel = getPixel (source, width - x - 1, y)
      color = getColor (rightPixel)
      setColor (leftPixel, color)
  repaint(source)

No comments:

Post a Comment