passes the flow down rule
[IRC.git] / Robust / src / Benchmarks / SSJava / EyeTracking / ImageReader.java
index 3428e7b37467526b045ad871608d93ac4afd356f..d89c14cd1f477e39be6bb21df7f048931103be9d 100644 (file)
@@ -2,7 +2,8 @@ public class ImageReader {
   public ImageReader() {
   }
 
-  public Image readImage(String file) {
+  @TRUST
+  public static Image readImage(String file) {
 
     FileInputStream fs = new FileInputStream(file);
     int bflen = 14; // 14 byte BITMAPFILEHEADER
@@ -79,19 +80,21 @@ public class ImageReader {
           // (255 & 0xff) << 24 | (((int) brgb[nindex + 2] & 0xff) << 16)
           // | (((int) brgb[nindex + 1] & 0xff) << 8) | (int) brgb[nindex] &
           // 0xff;
-//           System.out.println("Encoded Color at (" + i + "," + j + ")is:" +
-//           brgb + " (R,G,B)= ("
-//           + ((int) (brgb[nindex + 2]) & 0xff) + "," + ((int) brgb[nindex + 1]
-//           & 0xff) + ","
-//           + ((int) brgb[nindex] & 0xff) + ")");
           int ta =
               ((3 * ((int) (brgb[nindex + 2]) & 0xff) + 6 * ((int) brgb[nindex + 1] & 0xff) + ((int) brgb[nindex] & 0xff))) / 10;
+
           // ndata[nwidth * (nheight - j - 1) + i + 4] = ta;
-          nindex += 3;
-          // image.setPixel(i, j, ta);
           yPos = nheight - j - 1;
-//          System.out.println("yPos=" + yPos + " nheight=" + nheight + " j=" + j);
-          image.setPixel(i, yPos, ta);
+          // System.out.println("yPos=" + yPos + " nheight=" + nheight + " j=" +
+          // j);
+          // System.out.println("Encoded Color at (" + i + "," + yPos + ")is:" +
+          // brgb + " (R,G,B)= ("
+          // + ((int) (brgb[nindex + 2]) & 0xff) + "," + ((int) brgb[nindex + 1]
+          // & 0xff) + ","
+          // + ((int) brgb[nindex] & 0xff) + ")" + "cufoff=" + ta);
+          image.setPixel(i, yPos, ((int) brgb[nindex + 2] & 0xff), ((int) brgb[nindex + 1] & 0xff),
+              ((int) brgb[nindex] & 0xff));
+          nindex += 3;
         }
         nindex += npad;
       }
@@ -174,5 +177,4 @@ public class ImageReader {
     // return ndata;
 
   }
-
 }
\ No newline at end of file