This is an old post I realize, but since I just happened to stumble upon it and it didn’t get any responses, I’ll just mention that you can use clipPath()
and then looping through a grid and drawing an image.
# make an image that we’ll tile
im = ImageObject()
im.sunbeamsGenerator(
(100, 100), # size
(0, 0), # center
)
# draw a single tile in the lower left, for reference
image(im, (0, 0))
# get the size
imWidth, imHeight = im.size()
rows = int(ceil(height()/imHeight))
cols = int(ceil(width()/imWidth))
# make a shape
shape = BezierPath()
shape.oval(100, 100, 800, 800)
shape.rect(500, 500, 400, 400)
# i always like to save state before clip path
with savedState():
# clip the path using the shape
clipPath(shape)
# loop through y and x to make a grid
for y in range(rows):
for x in range(cols):
# draw the image a bunch of times
image(im, (x*imWidth, y*imHeight))