1.1 --- a/examples/PyGmy/ppygmy.py Sun Jul 15 23:09:29 2007 +0000
1.2 +++ b/examples/PyGmy/ppygmy.py Sun Jul 15 23:10:23 2007 +0000
1.3 @@ -365,14 +365,12 @@
1.4 given process 'limit' to constrain the number of processes used.
1.5 """
1.6
1.7 - image = Image.new("RGB", (self.width,self.height))
1.8 - exchange = PyGmyExchange(limit=limit)
1.9 - exchange.draw = ImageDraw.Draw(image)
1.10 - exchange.total = self.width*self.height
1.11 - exchange.count = 0
1.12 + image = Image.new("RGB", (self.width, self.height))
1.13 + exchange = PyGmyExchange(self.width, self.height, image, limit=limit)
1.14 + render_row = exchange.manage(self.render_row)
1.15
1.16 for y in range(0, self.height):
1.17 - exchange.start(self.render_row, y)
1.18 + render_row(y)
1.19
1.20 exchange.finish()
1.21 image.save(filename)
1.22 @@ -381,6 +379,18 @@
1.23
1.24 "A convenience class for parallelisation."
1.25
1.26 + def __init__(self, width, height, image, *args, **kw):
1.27 +
1.28 + """
1.29 + Initialise the exchange, adding extra PyGmy-specific data such as the
1.30 + 'width' and 'height' of the eventual 'image'.
1.31 + """
1.32 +
1.33 + pprocess.Exchange.__init__(self, *args, **kw)
1.34 + self.draw = ImageDraw.Draw(image)
1.35 + self.total = width * height
1.36 + self.count = 0
1.37 +
1.38 def store_data(self, channel):
1.39
1.40 "Store the data arriving on the given 'channel'."