|
6 | 6 | import pygame |
7 | 7 | from pygame.locals import * |
8 | 8 |
|
9 | | -# Issue https://github.com/pygame/pygame/issues/3778 (fixed in pygame 2.4.0) |
10 | | -USE_GFXDRAW = 0 # set for pygame < 2.4.0; gfxdraw allows negative circle positions, but fill and stroke are not match for small circles |
11 | | -if USE_GFXDRAW: |
12 | | - import pygame.gfxdraw |
13 | | - |
14 | 9 | import cursors |
15 | 10 | import toolbar |
16 | 11 |
|
@@ -265,7 +260,8 @@ def __init__( self, caption ): |
265 | 260 | fontsize = fontsize * 3//2 #!!! fixing pygbag |
266 | 261 | toolbar.ToolbarItem.fontsize = fontsize |
267 | 262 | toolbar.ToolbarItem.font = pygame.font.SysFont( 'lucidaconsole', fontsize ) |
268 | | - toolbar.ToolbarItem.fontAntialias = config.IS_WEB_PLATFORM #!!! fixing pygbag |
| 263 | + #toolbar.ToolbarItem.fontAntialias = config.IS_WEB_PLATFORM #!!! fixing pygbag |
| 264 | + toolbar.ToolbarItem.fontAntialias = True |
269 | 265 |
|
270 | 266 | left = toolbar.Toolbar( toolbar.LEFT ) |
271 | 267 | if config.ALLOW_SYSTEM_CONSOLE: |
@@ -361,25 +357,14 @@ def checkRanges( pos,r, size ): |
361 | 357 | -r < pos[1] < size[1]+r |
362 | 358 |
|
363 | 359 |
|
364 | | - def circle( self, surface, pos, r, col=None, width=1 ): |
365 | | - |
366 | | - r = toInt( r ) |
367 | | - |
368 | | - if r < 1: |
369 | | - debug( 1, "Error: circle radius < 1" ) |
370 | | - return |
371 | | - |
372 | | - pos = tuple(map( toInt, pos )) |
| 360 | + def circle( self, surface, pos, r, col=None, width=1, aa=True ): |
373 | 361 |
|
374 | 362 | col = self.getColor( col ) |
375 | 363 |
|
376 | | - if USE_GFXDRAW: |
377 | | - if width == 0: |
378 | | - pygame.gfxdraw.filled_circle( surface, pos[0], pos[1], r, col ) |
379 | | - else: |
380 | | - pygame.gfxdraw.circle( surface, pos[0], pos[1], r, col ) |
381 | | - if width > 1: |
382 | | - pygame.gfxdraw.circle( surface, pos[0], pos[1], r-1, col ) |
| 364 | + if aa: |
| 365 | + if width > 1 and r < 50: # avoid small bold circles |
| 366 | + width = 1 |
| 367 | + pygame.draw.aacircle( surface, col, pos, r, width ) |
383 | 368 | else: |
384 | 369 | pygame.draw.circle( surface, col, pos, r, width ) |
385 | 370 |
|
@@ -530,7 +515,7 @@ def drawHole( self, figure, noke, fill, r ): |
530 | 515 | mask = pygame.Surface( size ) |
531 | 516 | mask.fill( colorMask1 ) |
532 | 517 | r = toInt(r) |
533 | | - self.circle( mask, (r,r), r, colorMask2, width=0 ) |
| 518 | + self.circle( mask, (r,r), r, colorMask2, width=0, aa=False ) |
534 | 519 | mask.set_colorkey( colorMask2, RLEACCEL ) |
535 | 520 | surface.blit( mask, (0,0) ) |
536 | 521 | surface.set_colorkey( colorMask1, RLEACCEL ) |
|
0 commit comments