[PYTHON IMAGE-SIG] Using Color Ink in the PSDraw class

Fredrik Lundh fredrik_lundh@ivab.se
Thu, 18 Jul 1996 20:32:20 +0200


> The docs have a setink() function, but my PSDraw.py doesn't have it
> (yet?). Anymore advice or patches that I'm missing?

Add the following method to PSDraw (off the top of my head, so you may
have to fix any typos yourself :-)

    def setink(self, ink):
	if type(ink) == type(0):
	    # greyscale value (0..255)
	    self.fp.write("%g setgray\n" % (ink / 255.0))
	else:
	    # truecolour 3-tuple
	    self.fp.write("%g %g %g setrgbcolor\n" %
		(ink[0] / 255.0, ink[1] / 255.0, ink[2] / 255.0))

I'll add this (or something similar) in 0.2.

Regards	/F

=================
IMAGE-SIG - SIG on Image Processing with Python

send messages to: image-sig@python.org
administrivia to: image-sig-request@python.org
=================