コード例 #1
0
 private IEnumerator ProcessImage(int inputSize, System.Action <Color32[]> callback)
 {
     yield return(StartCoroutine(TextureTools.CropSquare(backCamera,
                                                         TextureTools.RectOptions.Center, snap =>
     {
         var scaled = Scale(snap, inputSize);
         var rotated = Rotate(scaled.GetPixels32(), scaled.width, scaled.height);
         callback(rotated);
     })));
 }
コード例 #2
0
 private IEnumerator ProcessImage(Texture texture, int inputSize, System.Action <Color32[]> callback)
 {
     if (texture is WebCamTexture)
     {
         yield return(StartCoroutine(TextureTools.CropSquare(texture as WebCamTexture,
                                                             TextureTools.RectOptions.Center, snap =>
         {
             var scaled = TextureTools.scaled(snap, inputSize, inputSize);
             var rotated = TextureTools.RotateImageMatrix(scaled.GetPixels32(), scaled.width, scaled.height, 90);
             callback(rotated);
         })));
     }
     else if (texture is Texture2D)
     {
         yield return(StartCoroutine(TextureTools.CropSquare(texture as Texture2D,
                                                             TextureTools.RectOptions.Center, snap =>
         {
             var scaled = TextureTools.scaled(snap, inputSize, inputSize);
             var rotated = TextureTools.RotateImageMatrix(scaled.GetPixels32(), scaled.width, scaled.height, 90);
             callback(rotated);
         })));
     }
 }