コード例 #1
0
 public Texture2D applyFilter00(Texture2D texture, Texture2D sample, Vector2 from, Vector2 dis)
 {
     Vector2 sampleSize = new Vector2(sample.width, sample.height);
     for (int i = 0; i < dis.x; i++) for (int j = 0; j < dis.y; j++)
         {
             Vector2 ratio = new Vector2(i, j).divide(dis),
                     at = from + new Vector2(i, j),
                     atTexture = ratio.mult(sampleSize);
             texture.SetPixel((int)at.x, (int)at.y, sample.GetPixel((int)atTexture.x, (int)atTexture.y));
         }
     texture.Apply();
     return texture;
 }