3
votes

I have a texture2D where I want to get the color of a specified pixel. Do something with it and put a new color in an other texture2D.

I will need to do this with all the pixels in the texture. How can I do this.

No pixel shader's please. It need to be in C#

2
Isn't that what pixel shader's are for? Why wouldn't you want one?Nate
How big are your textures? setting data onto a texture isn't too bad but getting data from a texture can be very slow...Martin
I am trying to do a 2d water animation. Go here:freespace.virgin.net/hugo.elias/graphics/x_water.htm. The textures are not very big. I think that they are 400 x 300. I will keep experimenting to see how big I can make them.Aaron de Windt

2 Answers

2
votes

The Texture2D class contains the GetData and SetData methods that should do exactly what you want.

0
votes

I found my problem.

When I was trying to get the color of a pixel the Alpha value of the color was 0. This means that the color would be completely transparent. To solve it I just needed to change the Alpha value to 255.

I think that this happened because I am using an jpg file. Jpg file's do not support Alpha values.