You can get individual pixels on image surfaces by using theget_at
method of Pygame surfaces - as inmouse_c.get_at((0,0))
.
This is strictly what you are asking for -- but it won't suit any real world needs, as it is extremely, and I am saying extremely, slow to process all pixels of an image calling just this.
You could take the image buffer withget_buffer
and interpret the data there, raw, or pass the buffer along to a function written in native code to get some speed.
Still, if your goal is to replace a color by another in real time you can resort to use indexed images - that way, each image will have a color table, you just modify,say, the color number 10
to be 0,0,255
, and as you render the image, all occurrences of that color become blue. This is fast -- not as efficient as back in the 8 bit video-games time when this was done by hardware -- but it will be orders of magnitude faster any substitutions you try to make in pure Python code.