[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pygame] blitting feature request



Unless I missed something, there is no support for blitting with boolean operators,
as is supported by nearly all GUI systems. The only mode currently supported is
"paint" mode.

What would be really cool would be the blitting model used by the Amiga. The
Amiga supports all 256 possible boolean operators on 3 inputs by using an 8 bit
truth table. The inputs are (source, mask, dest), the ouput is dest.

What's cool about this model is that if you define the following constants to
represent the three inputs...

A = 10101010
B = 11001100
C = 11110000

... you can get the desired boolean operator code by applying the operators to
A, B and C. This makes your code very easy to read.

XOR = A^C
PAINT = (A&B)|(C&~B)

e.g.:

target.blit_bool(source, None, XOR, rect)

These operator codes would, of course, have to be mapped to the appropriate
codes specific to the target hardware platform, and operators that reduce to 2
input operators would be optimized accordingly.

- Ken


____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org