uniy3D,實現改變一條像素點的功能 並存爲png圖

Color[] colors = new Color[tex.width / 2];
tex.SetPixels(tex.width / 2, tex.height / 2, tex.width / 2, 1, colors);
tex.SetPixels(tex.width / 2, tex.height / 2, 1, tex.height / 2, colors);

//將RenderTexture保存成一張png圖片
public bool SaveRenderTextureToPNG(byte[] bytes, string contents, string pngName)
{
if (!Directory.Exists(contents))
Directory.CreateDirectory(contents);
FileStream file = File.Open(contents + “/” + pngName + “.png”, FileMode.Create);
BinaryWriter writer = new BinaryWriter(file);
writer.Write(bytes);
file.Close();
return true;
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章