Exemple #1
0
 def __init__(self, imagedata):
     self.__imagedata = PyImageData(imagedata)
     array = Ndarray(self.__imagedata.data)
     array.setshape(self.__imagedata.height,self.__imagedata.width,4)
     data = PyUint32Array(self.__imagedata.height*self.__imagedata.width)
     index = 0
     for x in xrange(self.__imagedata.width):
         for y in xrange(self.__imagedata.height):
             data[index] = array[y,x,0]<<16 | array[y,x,1]<<8 | array[y,x,2] | array[y,x,3]<<24
             index += 1
     Ndarray.__init__(self, data, 3)
     self.setshape(self.__imagedata.width,self.__imagedata.height)
Exemple #2
0
 def __init__(self, imagedata):
     self._imagedata = ImageData(imagedata)
     array = Ndarray(self._imagedata.data)
     array.setshape(self._imagedata.height, self._imagedata.width, 4)
     try:
         data = Uint8ClampedArray(self._imagedata.height *
                                  self._imagedata.width)
     except NotImplementedError:
         data = Uint8Array(self._imagedata.height * self._imagedata.width)
     index = 0
     for x in range(self._imagedata.width):
         for y in range(self._imagedata.height):
             data[index] = array[y, x, 3]
             index += 1
     try:
         Ndarray.__init__(self, data, 'uint8c')
     except NotImplementedError:
         Ndarray.__init__(self, data, 'uint8')
     self.setshape(self._imagedata.width, self._imagedata.height)
Exemple #3
0
 def __init__(self, imagedata):
     self._imagedata = ImageData(imagedata)
     array = Ndarray(self._imagedata.data)
     array.setshape(self._imagedata.height, self._imagedata.width, 4)
     data = Uint32Array(self._imagedata.height * self._imagedata.width)
     index = 0
     for x in range(self._imagedata.width):
         for y in range(self._imagedata.height):
             data[index] = (array[y, x, 0] << 16 | array[y, x, 1] << 8
                            | array[y, x, 2] | array[y, x, 3] << 24)
             index += 1
     Ndarray.__init__(self, data, 'uint32')
     self.setshape(self._imagedata.width, self._imagedata.height)
Exemple #4
0
 def __init__(self, imagedata):
     self.__imagedata = PyImageData(imagedata)
     array = Ndarray(self.__imagedata.data)
     array.setshape(self.__imagedata.height, self.__imagedata.width, 4)
     try:
         data = PyUint8ClampedArray(self.__imagedata.height *
                                    self.__imagedata.width)
     except NotImplementedError:  #ie10 supports typedarray, not uint8clampedarray
         data = PyUint8Array(self.__imagedata.height *
                             self.__imagedata.width)
     index = 0
     for x in xrange(self.__imagedata.width):
         for y in xrange(self.__imagedata.height):
             data[index] = array[y, x, 3]
             index += 1
     try:
         Ndarray.__init__(self, data, 0)
     except NotImplementedError:
         Ndarray.__init__(self, data, 1)
     self.setshape(self.__imagedata.width, self.__imagedata.height)
Exemple #5
0
 def __init__(self, imagedata):
     self.__imagedata = PyImageData(imagedata)
     array = Ndarray(self.__imagedata.data)
     array.setshape(self.__imagedata.height,self.__imagedata.width,4)
     try:
         data = PyUint8ClampedArray(self.__imagedata.height*self.__imagedata.width)
     except NotImplementedError:     #ie10 supports typedarray, not uint8clampedarray
         data = PyUint8Array(self.__imagedata.height*self.__imagedata.width)
     index = 0
     for x in xrange(self.__imagedata.width):
         for y in xrange(self.__imagedata.height):
             data[index] = array[y,x,3]
             index += 1
     try:
         Ndarray.__init__(self, data, 0)
     except NotImplementedError:
         Ndarray.__init__(self, data, 1)
     self.setshape(self.__imagedata.width,self.__imagedata.height)