I have some code I'm working on and I can't wrap my head around it.
I need to write the code so that the image is mirrored from bottom left to top right diagonally in that order, not top down. I've seen more complicated examples of this elsewhere but would like to see it solved similiar to the below code:
I realize there are unused variables and bad coding generally.
I think I just need to change what's in the two for statements. What do you guys think?
Thanks in advance.
def mirrorDiagBotLeftToTopRight(): source = pickAFile() picOriginal = makePicture(source) mirrorPoint = getHeight(picOriginal) sourceY = getHeight(picOriginal) sourceX = getWidth(picOriginal) #mirrorPointWidth = width targetX = sourceX - 1 targetY = sourceY - 1 for x in range(targetX, 0): for y in range(0, mirrorPoint): OriginalPixel = getPixel(picOriginal, targetX, targetY) ReplacedPixel = getPixel(picOriginal, x + 1 ,targetY - 1) color = getColor(OriginalPixel) setColor(ReplacedPixel, color) targetY - 1
mirrorPoint = targetX -1
targetX + 1
show(picOriginal)
`mirrorDiagBotLeftToTopRight()`
`
Aplogies this code should be within the quotes but it's not working for me.
Aucun commentaire:
Enregistrer un commentaire