-
-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Description
FYI, I found an issue in PyObjC that pertains to DrawBot: ronaldoussoren/pyobjc#649 (comment)
I first encountered this error in DrawBot before I moved to running from the commandline. This script will trigger the issue in DrawBot:
import drawBot as bot
steps = 20
step = 50
imageWidth = step * steps
imageHeight = imageWidth
imageRect = (0, 0, imageWidth, imageHeight)
sections = []
for x in range(steps):
x *= step
for y in range(steps):
y *= step
sections.append((x, y, step, step))
def sampleImage():
image = bot.ImageObject()
with image:
bot.size(imageWidth, imageHeight)
bot.fill(1, 1, 1, 1)
bot.rect(*imageRect)
bot.fill(0, 0, 0, 1)
path = bot.BezierPath()
path.oval(*imageRect)
bot.drawPath(path)
samples = {}
for section in sections:
i = image.copy()
i.areaAverage(section)
color = bot.imagePixelColor(i, (0, 0))
samples[section] = color
return image
for i in range(100):
print(f"try {i}...")
sampleImage()As Ronald suggested, wrapping the for section in sections in with objc.autorelease_pool(): solves the problem. I don't know if you want to wrap the bitmap representation code in this or leave it up to the user.
Metadata
Metadata
Assignees
Labels
No labels