# Recipe 20: Mirror pixels horizontally, top to bottom

def mirrorHorizontal(source):
  mirrorpoint = int(getHeight(source) / 2)
  for yOffset in range(1, mirrorpoint):
    for x in range(1, getWidth(source)+1):
      pbottom = getPixel(source, x, yOffset + mirrorpoint)
      ptop = getPixel(source, x , mirrorpoint - yOffset)
      setColor(pbottom, getColor(ptop))


