advertisement

Article:
  Panther, Python, and CoreGraphics
Subject:   Updating this code
Date:   2005-08-02 09:54:37
From:   robertlove
The author has suggested a fix that will work with Tiger and the newer Python. Quoting from him:


Here's a fix for the ImageDecorator.py module and its _getGraphicsContext() method.


The problem is that self._newWidth and self._newHeight contain floating-point values, but CGBitmapContextCreateWithColor expects integer arguments:


def _getGraphicsContext(self):
self._gc = CGBitmapContextCreateWithColor(
int(round(self._newWidth)), int(round(self._newHeight)),
CGColorSpaceCreateDeviceRGB(),
self._bgColor)


It worked for me. Thanks to Mitch for the rapid response.