June
02
class pixel:
width = 2
height = 2
pixel = [[0,0],[0,0]]
def __init__(self):
pass
def set_width(self,x):
if (x >= self.width):
for list in self.pixel:
for i in range(x - self.width):
list.append(0)
self.width = x
def set_height(self,y):
if (y >= self.height):
temp = []
for i in range(self.width):
temp.append(0)
for i in range(y-self.height):
self.pixel.append(temp)
self.height = y
def get_width(self):
return self.width
def get_height(self):
return self.height
def set_pixel(self,x,y,value):
self.pixel[x][y] = value
def show_pixel(self):
print self.pixel
width = 2
height = 2
pixel = [[0,0],[0,0]]
def __init__(self):
pass
def set_width(self,x):
if (x >= self.width):
for list in self.pixel:
for i in range(x - self.width):
list.append(0)
self.width = x
def set_height(self,y):
if (y >= self.height):
temp = []
for i in range(self.width):
temp.append(0)
for i in range(y-self.height):
self.pixel.append(temp)
self.height = y
def get_width(self):
return self.width
def get_height(self):
return self.height
def set_pixel(self,x,y,value):
self.pixel[x][y] = value
def show_pixel(self):
print self.pixel
if __name__ == "__main__":
p = pixel()
p.set_width(5)
p.set_height(5)
for i in range(4):
for j in range(4):
p.set_pixel(i+1,j+1,i+j)
print p.pixel
p = pixel()
p.set_width(5)
p.set_height(5)
for i in range(4):
for j in range(4):
p.set_pixel(i+1,j+1,i+j)
print p.pixel
03 June 2008, 21:15
Just wanted to point out that now it is possible to highlight the source code.
28 February 2010, 02:08
The Python program Image2Map.py uses this heuristic to create an image of the unique tiles.