You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
image = Image('0 0 0 0 0\n0 0 0 0 0\n0 0 0 0 0\n0 0 0 0 0\n0 0 0 0 0') # create an image from a string - each character in the string represents an LED - 0 is off and 1 is on.
88
+
image = Image('90009\n09090\n00900\n09090\n90009') # create an image from a string - each character in the string represents an LED - 0 (or space) is off and 9 is maximum brightness.
90
89
image = Image(width, height) # create an empty image of given size
91
90
image = Image(width, height, buffer) # initialises an Image with the specified width and height. The buffer should be an array of length width * height
92
91
93
92
# methods
94
-
image.clear() # clear all pixels
95
93
image.width() # returns the image's width (most often 5)
96
94
image.height() # returns the image's height (most often 5)
97
-
image.set_pixel(x, y, value) # sets the pixel at the specified position (between 0 and 255)
98
-
image.get_pixel(x, y) # gets the pixel at the specified position (between 0 and 255)
99
-
image.shift_left(n) # shifts the picture left 'n' times.
100
-
image.shift_right(n) # shifts the picture right 'n' times.
101
-
image.shift_up(n) # shifts the picture up 'n' times.
102
-
image.shift_down(n) # shifts the picture down 'n' times.
103
-
image.paste(image, x, y, transparent=False) # paste another image to this one at (x,y) [NOT YET IMPLEMENTED]
104
-
str(image) # get the string representation of the image
95
+
image.set_pixel(x, y, value) # sets the pixel at the specified position (between 0 and 9). May fail for constant images.
96
+
image.get_pixel(x, y) # gets the pixel at the specified position (between 0 and 9)
97
+
image.shift_left(n) # returns a new image created by shifting the picture left 'n' times.
98
+
image.shift_right(n) # returns a new image created by shifting the picture right 'n' times.
99
+
image.shift_up(n) # returns a new image created by shifting the picture up 'n' times.
100
+
image.shift_down(n) # returns a new image created by shifting the picture down 'n' times.
101
+
repr(image) # get a compact string representation of the image
102
+
str(image) # get a more readable string representation of the image
103
+
104
+
#operators
105
+
image + image # returns a new image created by superimposing the two images
106
+
image * n # returns a new image created by multiplying the brightness of each pixel by n
0 commit comments