@@ -110,11 +110,7 @@ def shift_right(self, rotate=False):
110110
111111 :param rotate: (Optional) Rotate the shifted pixels to the left side (default=False)
112112 """
113- for y in range (0 , self .rows ):
114- last_pixel = self ._matrix [self .columns - 1 , y ] if rotate else 0
115- for x in range (self .columns - 1 , 0 , - 1 ):
116- self ._matrix [x , y ] = self ._matrix [x - 1 , y ]
117- self ._matrix [0 , y ] = last_pixel
113+ self ._matrix .shift_right (rotate )
118114 self ._update ()
119115
120116 def shift_left (self , rotate = False ):
@@ -123,11 +119,7 @@ def shift_left(self, rotate=False):
123119
124120 :param rotate: (Optional) Rotate the shifted pixels to the right side (default=False)
125121 """
126- for y in range (0 , self .rows ):
127- last_pixel = self ._matrix [0 , y ] if rotate else 0
128- for x in range (0 , self .columns - 1 ):
129- self ._matrix [x , y ] = self ._matrix [x + 1 , y ]
130- self ._matrix [self .columns - 1 , y ] = last_pixel
122+ self ._matrix .shift_left (rotate )
131123 self ._update ()
132124
133125 def shift_up (self , rotate = False ):
@@ -136,11 +128,7 @@ def shift_up(self, rotate=False):
136128
137129 :param rotate: (Optional) Rotate the shifted pixels to bottom (default=False)
138130 """
139- for x in range (0 , self .columns ):
140- last_pixel = self ._matrix [x , self .rows - 1 ] if rotate else 0
141- for y in range (self .rows - 1 , 0 , - 1 ):
142- self ._matrix [x , y ] = self ._matrix [x , y - 1 ]
143- self ._matrix [x , 0 ] = last_pixel
131+ self ._matrix .shift_up (rotate )
144132 self ._update ()
145133
146134 def shift_down (self , rotate = False ):
@@ -149,11 +137,7 @@ def shift_down(self, rotate=False):
149137
150138 :param rotate: (Optional) Rotate the shifted pixels to top (default=False)
151139 """
152- for x in range (0 , self .columns ):
153- last_pixel = self ._matrix [x , 0 ] if rotate else 0
154- for y in range (0 , self .rows - 1 ):
155- self ._matrix [x , y ] = self ._matrix [x , y + 1 ]
156- self ._matrix [x , self .rows - 1 ] = last_pixel
140+ self ._matrix .shift_down (rotate )
157141 self ._update ()
158142
159143 @property
0 commit comments