2

したがって、画像をミラーリングする必要があります。画像の右上を左下にひっくり返す必要があります。画像の左上を右下に反転する関数を作成しましたが、逆の方法がわかりません。コードは次のとおりです。

def mirrorPicture(picture):
 height = getHeight(canvas)
 width = height 

 # to make mirroring easier, let us make it a square with odd number 
 # of rows and columns
 if (height % 2 == 0):
    height =  width = height -1  # let us make the height and width odd


 maxHeight = height - 1
 maxWidth  = width - 1

 for y in range(0, maxWidth):
      for x in range(0, maxHeight - y):     
      sourcePixel = getPixel(canvas, x, y)
      targetPixel = getPixel(canvas, maxWidth - y, maxWidth - x)
      color = getColor(sourcePixel)
      setColor(targetPixel, color)

 return canvas

ところで、「JES」という IDE を使用しています。

4

1 に答える 1