def init_pixel_grid(self):
s = self.width/self.row if self.row > self.column else self.height/self.column
with ui.ImageContext(*self.frame[2:]) as ctx:
for y in xrange(self.column):
for x in xrange(self.row):
# Fills image with pixels
# Changing this changes the pixel aspect
pixel = Pixel(x*s*2, y*s, s*2, s)
pixel.index = len(self.pixels)
pixel.position = (x,y)
self.pixels.append(pixel) #Adds this pixel to the pixels list
return ctx.get_image()
# Draw the pixel and character grid
# This function is pretty slow. Find a way to speed it up.
评论列表
文章目录