7. แถวลำดับ

The Camtasia Studio video content presented here requires JavaScript to be enabled and the latest version of the Macromedia Flash Player. If you are you using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Flash Player by downloading here.

 
รหัสที่ 7-31  เมท็อดการทำภาพเนกาทิฟ
  public static int[][] negative(int[][] p) {
    int[][] out = new int[p.length][p[0].length];
    for (int x = 0; x < p.length; x++) {
      for (int y = 0; y < p[0].length; y++) {
        int r = 255 - DWindow.getR(p[x][y]);
        int g = 255 - DWindow.getG(p[x][y]);
        int b = 255 - DWindow.getB(p[x][y]);
        out[x][y] = DWindow.mixRGB(r, g, b);
      }
    }
    return out;
  }
©2009 S.Prasitjutrakul