MCPcopy Create free account
hub / github.com/antirez/freakwan / rect

Method rect

st7789.py:227–240  ·  view source on GitHub ↗
(self,x,y,w,h,color,fill=False)

Source from the content-addressed store, hash-verified

225 # x,y are the top-left corner coordinates.
226 # w and h are width/height in pixels.
227 def rect(self,x,y,w,h,color,fill=False):
228 if fill:
229 self.set_window(x,y,x+w-1,y+1-w)
230 if w*h > 256:
231 buf = color*w
232 for i in range(h): self.write(None, buf)
233 else:
234 buf = color*(w*h)
235 self.write(None, buf)
236 else:
237 self.hline(x,x+w-1,y,color)
238 self.hline(x,x+w-1,y+h-1,color)
239 self.vline(y,y+h-1,x,color)
240 self.vline(y,y+h-1,x+w-1,color)
241
242 # We can draw horizontal and vertical lines very fast because
243 # we can just set a 1 pixel wide/tall window and fill it.

Callers

nothing calls this directly

Calls 4

set_windowMethod · 0.95
writeMethod · 0.95
hlineMethod · 0.95
vlineMethod · 0.95

Tested by

no test coverage detected