public static Texture2D MixTexture2D(Texture2D originalTexture, Point originalPoint, Texture2D mergeTexture, Point mergePoint) { CheckOriginInside(originalTexture, originalPoint); CheckOriginInside(mergeTexture, mergePoint); Point maxSize = GetMaxSize(originalPoint, originalTexture, mergePoint, mergeTexture); int xSize = maxSize.X; int ySize = maxSize.Y; originalTexture = originalTexture.ResizeTexture2D(xSize, ySize, Main.instance.GraphicsDevice); Color[,] colorOriginal = originalTexture.ToColor().To2DColor(originalTexture.Width, originalTexture.Height); Color[,] colorMerge = mergeTexture.ToColor().To2DColor(mergeTexture.Width, mergeTexture.Height); int startingX = originalPoint.X - mergePoint.X; int startingY = originalPoint.Y - mergePoint.Y; for (int y = startingY; y < startingY + mergeTexture.Height; y++) { int currY = y - startingY; for (int x = startingX; x < startingX + mergeTexture.Width; x++) { int currX = x - startingX; Color pixel = colorMerge[currY, currX]; if (pixel.A != 0) { colorOriginal[y, x] = pixel; } } } originalTexture.SetData(colorOriginal.To1DColor(originalTexture.Width, originalTexture.Height)); return(originalTexture); }