Two (unrelated) anomalies in pygame.Surface.blit(), bugs or what ?
Tests in windows XP + sp2
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32
pygame 1.8.1release ( installed from pygame-1.8.1release.win32-py2.4.msi )
1. The pygame documentation and help(pygame.Surface.blit) tells
Surface.blit(source, dest, area=None, special_flags = 0): return Rect
but
surf.blit(sf2,(0,0),special_flags = op)
crashes with traceback:
[...]
File "F:\newcode\_minitest\pygame blit\eblit.py", line 23, in blend
surf.blit(sf2,(0,0),special_flags = op) # crash
TypeError: blit() takes no keyword arguments
Replacing with:
surf.blit(sf2,(0,0),None,op)
there is no crash.
On the other side, dst1.blit(src1, (0,0)) is acceptable.
Looks like a bug or that the real signature is
Surface.blit(source, dest, *args ): return Rect ?
( eblit.py demoes this problem )
2. When blitting (with no blend flags) an opaque pixel ( alpha channel at 255 ) over any other pixel, seems natural that the resulting color be the src color. (opaque is opaque, right ?). In most cases pygame is off by one, by example:
. dst is filled with (x,0,0,128)
. src is filled with (0,z,0,255)
. dst.blit(src,(0,0)) will be filled with ( 0, z-1, 0, 255)
( minusblit.py demoes this )