| 259 | bresLine = staticmethod( bresLine ) |
| 260 | |
| 261 | def _drawLine( self, x1, y1, x2, y2 ): |
| 262 | # special checks for vert and horiz lines |
| 263 | if ( x1 == x2 ): |
| 264 | if 0 <= x1 < self.wd: |
| 265 | if ( y2 < y1 ): |
| 266 | y1,y2 = y2,y1 |
| 267 | cury = max( y1, 0 ) |
| 268 | maxy = min( y2, self.ht-1 ) |
| 269 | while cury <= maxy : |
| 270 | self.plotPoint( x1, cury ) |
| 271 | cury += 1 |
| 272 | return |
| 273 | |
| 274 | if ( y1 == y2 ): |
| 275 | if ( 0 <= y1 < self.ht ): |
| 276 | if ( x2 < x1 ): |
| 277 | x1,x2 = x2,x1 |
| 278 | curx = max( x1, 0 ) |
| 279 | maxx = min( x2, self.wd-1 ) |
| 280 | while curx <= maxx: |
| 281 | self.plotPoint( curx, y1 ) |
| 282 | curx += 1 |
| 283 | return |
| 284 | |
| 285 | for pt in BitMap.bresLine(x1, y1, x2, y2): |
| 286 | self.plotPoint( pt[0], pt[1] ) |
| 287 | |
| 288 | def _drawLines( self, lineSegs ): |
| 289 | for x1,y1,x2,y2 in lineSegs: |