tags:

views:

475

answers:

2

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  A: 

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

David Brown
While this will do the trick, depending on what you're doing this can be very, very slow.
Crappy Coding Guy
A: 

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.

Aaron de Windt