def check_cell(self, cellimage, cellindex):
        self.assertTrue(cellimage.width == self.grid.item_width)
        self.assertTrue(cellimage.height == self.grid.item_height)

        cellimage = cellimage.image_data
        data = cellimage.get_data('L', cellimage.width)
        self.assertTrue(data == colorbyte(cellindex + 1) * len(data))
Пример #2
0
    def check_cell(self, cellimage, cellindex):
        self.assertTrue(cellimage.width == self.grid.item_width)
        self.assertTrue(cellimage.height == self.grid.item_height)

        cellimage = cellimage.image_data
        data = cellimage.get_data('L', cellimage.width)
        self.assertTrue(data == colorbyte(cellindex + 1) * len(data))
Пример #3
0
    def set_grid_image(self, itemwidth, itemheight, rows, cols, rowpad, colpad):
        data = b''
        color = 1
        width = itemwidth * cols + colpad * (cols - 1)
        height = itemheight * rows + rowpad * (rows - 1)
        for row in range(rows):
            rowdata = b''
            for col in range(cols):
                rowdata += colorbyte(color) * itemwidth
                if col < cols - 1:
                    rowdata += b'\0' * colpad
                color += 1

            data += rowdata * itemheight
            if row < rows - 1:
                data += (width * b'\0') * rowpad
        assert len(data) == width * height
        self.image = ImageData(width, height, 'L', data)
        self.grid = ImageGrid(self.image, rows, cols,
            itemwidth, itemheight, rowpad, colpad).texture_sequence
    def set_grid_image(self, itemwidth, itemheight, rows, cols, rowpad,
                       colpad):
        data = b''
        color = 1
        width = itemwidth * cols + colpad * (cols - 1)
        height = itemheight * rows + rowpad * (rows - 1)
        for row in range(rows):
            rowdata = b''
            for col in range(cols):
                rowdata += colorbyte(color) * itemwidth
                if col < cols - 1:
                    rowdata += b'\0' * colpad
                color += 1

            data += rowdata * itemheight
            if row < rows - 1:
                data += (width * b'\0') * rowpad
        assert len(data) == width * height
        self.image = ImageData(width, height, 'L', data)
        self.grid = ImageGrid(self.image, rows, cols, itemwidth, itemheight,
                              rowpad, colpad).texture_sequence
Пример #5
0
 def check_image(self, image, width, height, color):
     self.assertTrue(image.width == width)
     self.assertTrue(image.height == height)
     image = image.image_data
     data = image.get_data('L', image.width)
     self.assertTrue(data == colorbyte(color) * len(data))
Пример #6
0
 def create_image(self, width, height, color):
     data =  colorbyte(color) * (width * height)
     return ImageData(width, height, 'L', data)
 def check_image(self, image, width, height, color):
     self.assertTrue(image.width == width)
     self.assertTrue(image.height == height)
     image = image.image_data
     data = image.get_data('L', image.width)
     self.assertTrue(data == colorbyte(color) * len(data))
 def create_image(self, width, height, color):
     data = colorbyte(color) * (width * height)
     return ImageData(width, height, 'L', data)