Hello,

I want to make a surface of size sqrt(n) on a side filled with special
values.

The values range from 0.0 to 3.0, starting with 0.0 at one corner and ending
at 3.0 in the opposite, increasing going row by row.  The value is to be
encoded in each color.  Because this is somewhat abstract, here's a small
example (n=25), generated using the attached code (it also multiplies the
number by 255 to obtain a RGB color).  The real version should be done by
surfarray.  This is where I need help; I have no idea how to even approach
the problem.

[[  0,  0,  0],[ 32,  0,  0],[ 64,  0,  0],[ 96,  0,  0],[128,  0,  0],
 [159,  0,  0],[191,  0,  0],[223,  0,  0],[255,  0,  0],[255, 32,  0],
 [255, 64,  0],[255, 96,  0],[255,128,  0],[255,159,  0],[255,191,  0],
 [255,223,  0],[255,255,  0],[255,255, 32],[255,255, 64],[255,255, 96],
 [255,255,128],[255,255,159],[255,255,191],[255,255,223],[255,255,255]]

Arrays like this need to be generated quite quickly, so the per-pixel method
I presented will not work.  How should I do it with surfarray?

Thanks,
Ian

Attachment: particlesurfgen.py
Description: Binary data

Reply via email to