summaryrefslogtreecommitdiffstats
path: root/Mac/Contrib/ImageHelpers/ExtPixMapWrapper.py
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2003-11-19 14:34:18 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2003-11-19 14:34:18 (GMT)
commit28ecf70db57828db2ca279643bf9aeca7662f35c (patch)
tree09b7767bbc411f85313b58d6fe7e5e67d9392973 /Mac/Contrib/ImageHelpers/ExtPixMapWrapper.py
parent6045b9c93511c767f6cfa2d2fa299c76181acd9b (diff)
downloadcpython-28ecf70db57828db2ca279643bf9aeca7662f35c.zip
cpython-28ecf70db57828db2ca279643bf9aeca7662f35c.tar.gz
cpython-28ecf70db57828db2ca279643bf9aeca7662f35c.tar.bz2
Getting rid of support for MacOS9 and earlier. This is the first step,
and the biggest in size, but probably the easiest. Hunting through the source code comes next.
Diffstat (limited to 'Mac/Contrib/ImageHelpers/ExtPixMapWrapper.py')
-rw-r--r--Mac/Contrib/ImageHelpers/ExtPixMapWrapper.py46
1 files changed, 0 insertions, 46 deletions
diff --git a/Mac/Contrib/ImageHelpers/ExtPixMapWrapper.py b/Mac/Contrib/ImageHelpers/ExtPixMapWrapper.py
deleted file mode 100644
index ac261b5..0000000
--- a/Mac/Contrib/ImageHelpers/ExtPixMapWrapper.py
+++ /dev/null
@@ -1,46 +0,0 @@
-'''
-A really quick and dirty hack to extend PixMapWrapper
-They are mere copies of the toImage and fromImage methods.
-Riccardo Trocca (rtrocca@libero.it)
-'''
-from PixMapWrapper import *
-import Numeric
-
-class ExtPixMapWrapper(PixMapWrapper):
-
- def toNumeric(self):
-
- data = self.tostring()[1:] + chr(0)
- bounds = self.bounds
- tmp=Numeric.fromstring(data,Numeric.UnsignedInt8)
- #tmp.shape=(bounds[3]-bounds[1],bounds[2]-bounds[0],4)
- tmp.shape=(bounds[2]-bounds[0],bounds[3]-bounds[1],4)
- return Numeric.transpose(tmp,(1,0,2))
-
- def fromNumeric(self,num):
- s=num.shape
- x=num.shape[1]
- y=num.shape[0]
- #bands=1 Greyscale image
- #bands=3 RGB image
- #bands=4 RGBA image
- if len(s)==2:
- bands=1
- num=Numeric.resize(num,(y,x,1))
- else:
- bands=num.shape[2]
-
- if bands==1:
- num=Numeric.concatenate((num,num,num),2)
- bands=3
- if bands==3:
- alpha=Numeric.ones((y,x))*255
- alpha.shape=(y,x,1)
- num=Numeric.concatenate((num,alpha),2)
-
- data=chr(0)+Numeric.transpose(num,(1,0,2)).astype(Numeric.UnsignedInt8).tostring()
- PixMapWrapper.fromstring(self,data,x,y)
-
-
-
-