Reputation: 1
I am using Jython
, or JES
, and I want to repeatedly copy, in a checkerboard pattern, part of one image into another image. I am wondering how that might be done?
So far I have this:
def checkerboard(pic):
p = makeEmptyPicture(500,500)
targetX = 100
for sourceX in range(81,123):
targetY = 100
for sourceY in range(99,126):
color = getColor(getPixel(pic,sourceX,sourceY))
setColor(getPixel(p,targetX,targetY),color)
targetY = targetY + 1
targetX = targetX + 1
show(p)
Pic
is the user selected image, and picX
and picY
are the ranges of the picture.
The issue is that this just pastes part of an image once into the empty picture (p
). I want the part of the image to be pasted repeatedly into the empty picture in a certain area of the empty picture.
Upvotes: 0
Views: 93