/// <summary>
/// 图片处理 缩放Texture2D
/// </summary>
/// <param name="width">输出图片宽</param>
/// <param name="height">输出图片高</param>
/// <param name="tex">要处理的原图</param>
/// <returns></returns>
private Texture2D GetTexture_缩放(int width,int height, Texture2D tex)
{
Texture2D reslut = new Texture2D(width, height, TextureFormat.ARGB32, false);
for (int i = 0; i < reslut.height; i++)
{
for (int j = 0; j < reslut.width; j++)
{
Color newColor = tex.GetPixelBilinear((float)j / (float)reslut.width, (float)i / (float)reslut.height);
reslut.SetPixel(j, i, newColor);
}
}
reslut.Apply();
return reslut;
}
自定义像素,图片处理缩放Texture2D
最新推荐文章于 2023-08-14 11:20:51 发布