コード例 #1
0
  public SeamCarver(Picture picture) {
    // create a seam carver object based on the given picture
    int picWidth = picture.width();
    int picHeight = picture.height();
    currentPicture = picture;
    pixelColor = new Color[picWidth][picHeight];

    for (int i = 0; i < picHeight; i++) {
      for (int j = 0; j < picWidth; j++) {
        pixelColor[j][i] = picture.get(j, i);
      }
    }
  }
コード例 #2
0
  private void CreatePictureFromColorMatrix(int width, int height) {
    verticalSeamCarve = new Picture(width, height);
    for (int i = 0; i < width; i++) {
      for (int j = 0; j < height; j++) {
        verticalSeamCarve.set(i, j, pixelColor[i][j]);
      }
    }

    currentPicture = verticalSeamCarve;
  }
コード例 #3
0
 public int height() {
   // height of current picture
   return currentPicture.height();
 }
コード例 #4
0
 public int width() {
   // width of current picture
   return currentPicture.width();
 }