@@ -110,11 +110,7 @@ def shift_right(self, rotate=False):
110
110
111
111
:param rotate: (Optional) Rotate the shifted pixels to the left side (default=False)
112
112
"""
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 )
118
114
self ._update ()
119
115
120
116
def shift_left (self , rotate = False ):
@@ -123,11 +119,7 @@ def shift_left(self, rotate=False):
123
119
124
120
:param rotate: (Optional) Rotate the shifted pixels to the right side (default=False)
125
121
"""
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 )
131
123
self ._update ()
132
124
133
125
def shift_up (self , rotate = False ):
@@ -136,11 +128,7 @@ def shift_up(self, rotate=False):
136
128
137
129
:param rotate: (Optional) Rotate the shifted pixels to bottom (default=False)
138
130
"""
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 )
144
132
self ._update ()
145
133
146
134
def shift_down (self , rotate = False ):
@@ -149,11 +137,7 @@ def shift_down(self, rotate=False):
149
137
150
138
:param rotate: (Optional) Rotate the shifted pixels to top (default=False)
151
139
"""
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 )
157
141
self ._update ()
158
142
159
143
@property
0 commit comments