コード例 #1
0
ファイル: surfarray.py プロジェクト: jggatc/pyj2d
 def array3d(self, surface):
     """
     Return data array of the Surface argument.
     Array consists of pixel data arranged by [x,y] in RGB format.
     """
     if not self.initialized:
         self._init()
     data = surface.getRGB(0, 0, surface.width, surface.height, None, 0, surface.width)
     data = numeric.array([(dat>>16 & 0xff, dat>>8 & 0xff, dat & 0xff) for dat in data])
     array = numeric.reshape(data, (surface.width,surface.height,3))
     return array
コード例 #2
0
ファイル: surfarray.py プロジェクト: jggatc/pyj2d
 def array_alpha(self, surface):
     """
     Return data array of the Surface argument.
     Array consists of pixel data arranged by [x,y] of pixel alpha value.
     """
     if not self.initialized:
         self._init()
     data = surface.getRGB(0, 0, surface.width, surface.height, None, 0, surface.width)
     data = numeric.array([dat>>24 & 0xff for dat in data], numeric.Int8)
     array = numeric.reshape(data, (surface.width,surface.height))
     return array
コード例 #3
0
ファイル: surfarray.py プロジェクト: jggatc/pyj2d
 def array2d(self, surface):
     """
     Return data array of the Surface argument.
     Array consists of pixel data arranged by [x,y] in integer color format.
     """
     if not self.initialized:
         self._init()
     data = numeric.zeros((surface.width*surface.height), 'i')
     data = surface.getRGB(0, 0, surface.width, surface.height, data, 0, surface.width)
     array = numeric.reshape(data, (surface.width,surface.height))
     return array