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

Re: [pygame] Python extensions.



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Friday 28 March 2003 18:45, Arturo Espinosa Aldama wrote:
> Hey, what's up?
>
> I'd like to code a very small extension in C that takes two surfaces, src
> and dest, and blits src into dest, but only where the pixels of dest have
> a given color. The reason is that Numeric isn't flexible enough to do this
> in an efficient way, and I think it would be really easy to write this
> code.
> [...]

Have you tried (somewhat pseudo-codeish):

temp1 = N.equal(N.ones(dest.shape) * color, dest)
return N.logical_or(temp1 * src, dest)

(temp1 is 1 where dest has the desired color, 0 otherwise. The logical or 
return pixels from src iff temp1 is 1. Otherwise, the pixels from dest are 
preserved)

[]s,

- -- 
Fábio "ctg \pi" Dias Moreira
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE+hPOMalOQFrvzGQoRAiumAJ9u5vdqLZZYh0KTkmsJwzCp1zrc3gCfVC6t
EReFmk1ZlRZkGf/Z3rqRNsE=
=pcpu
-----END PGP SIGNATURE-----