   Texture bytes manipulation
  Hi,i have a function to copy it and modify the color of each point, but the alpha is not copied and the background become black (but at the base it's transparency)to see the picture i manipulate : http://tech.daaboo.net/down/font.tgathe color manipulation work well, the problem is only with alphathe code :public static Texture TextureChangeColor(Texture t, int r, int g, int b){Color colo;int br, bg, bb;SurfaceDescription desc = t.GetLevelDescription(0);SurfaceDescription s = t.GetLevelDescription(0);Texture tex = new Texture(t.Device, desc.Width, desc.Height, 1, 0, t.Device.DisplayMode.Format, Pool.Managed);uint[,] data = (uint[,])t.LockRectangle(typeof(uint), 0, LockFlags.None, s.Width, s.Height);uint[,] datadest = (uint[,])tex.LockRectangle(typeof(uint), 0, LockFlags.None, s.Width, s.Height);for (int i = 0; i < s.Width; i++){for (int j = 0; j < s.Height; j++){colo = Color.FromArgb((int)data[i,j]);if (r > 0){if (colo.R + r <= byte.MaxValue) br = colo.R + r;else br = byte.MaxValue;}else if (r < 0){if (colo.R + r >= byte.MinValue) br = colo.R + r;else br = byte.MinValue;}else br = colo.R;if (g > 0){if (colo.G + r <= byte.MaxValue) bg = colo.G + g;else bg = byte.MaxValue;}else if (g < 0){if (colo.G + g >= byte.MinValue) bg = colo.G + g;else bg = byte.MinValue;}else bg = colo.G;if (b > 0){if (colo.B + r <= byte.MaxValue) bb = colo.B + b;else bb = byte.MaxValue;}else if (b < 0){if (colo.B + b >= byte.MinValue) bb = colo.B + b;else bb = byte.MinValue;}else bb = colo.B;datadest[i,j] = (uint)Color.FromArgb(colo.A,br,bg,bb).ToArgb();}}t.UnlockRectangle(0);tex.UnlockRectangle(0);return tex;}have you an idea ? thanksKillan[Edited by - killan on June 4, 2006 3:43:49 PM]
  You should not use the format of your current display mode if you need an alpha cannel. The display mode format never has an alpha cannel.The format of your current back buffer would be a better choice.But as your conversion function looks like working only with 32 Bit textures you should use a fixed format. A8R8G8B8;  good observationthanks a lotit's working well with the original texture format 'desc.Format'   