MCPcopy Create free account
hub / github.com/ActiveState/code / drawRect

Method drawRect

recipes/Python/577674_Bitmap_Maker/recipe-577674.py:200–218  ·  view source on GitHub ↗
( self, x, y, wid, ht, fill=False )

Source from the content-addressed store, hash-verified

198 self.bitarray[y][x] = self.currentPen
199
200 def drawRect( self, x, y, wid, ht, fill=False ):
201 x = int(x)
202 y = int(y)
203 cury = y
204
205 # subtract one for line width
206 wid -= 1
207 ht -= 1
208
209 self.drawLine( x, y, x+wid, y )
210 if fill:
211 cury = y
212 while cury < y+ht:
213 self.drawLine( x, cury, x+wid, cury )
214 cury += 1
215 else:
216 self.drawLine( x, y, x, y+ht )
217 self.drawLine( x+wid, y, x+wid, y+ht )
218 self.drawLine( x, y+ht, x+wid, y+ht )
219
220 def drawSquare( self, x, y, wid, fill=False ):
221 self.drawRect( x, y, wid, wid, fill )

Callers 3

drawSquareMethod · 0.95
drawSines.pyFile · 0.80
recipe-580810.pyFile · 0.80

Calls 1

drawLineMethod · 0.95

Tested by

no test coverage detected