コード例 #1
0
  // /////////////////////////////////////////////////////////////////////////////////////
  // outlineBox
  // /////////////////////////////////////////////////////////////////////////////////////
  // -outline a zone
  // /////////////////////////////////////////////////////////////////////////////////////
  public void outlineBox(
      int xx,
      int yy,
      int wx,
      int wy,
      int colorIndex1,
      int colorIndex2,
      Vector4f colorValue1,
      Vector4f colorValue2) {
    Vector4f col1;
    Vector4f col2;
    if (colorValue1 == null) {
      col1 = palette[colorIndex1];
      col2 = palette[colorIndex2]; // + (255 << 24); ==> on met A=255
    } else {
      col1 = colorValue1; // & 0xffffff; ==> on supprime le membre A
      col2 = colorValue2;
    }
    for (int i = 0; i < wy; i++) {
      if (i > 0 && i < (wy - 1)) {
        for (int j = 0; j < wx; j++) {
          if (j > 0 && j < (wx - 1)) {
            Vector4f colorPixel = getPixel(xx + j, yy + i);
            if (colorPixel.equals(col1)) {

              if (!getPixel(xx + j - 1, yy + i).equals(col1)) {
                pset(xx + j - 1, yy + i, col2);
              }
              if (!getPixel(xx + j + 1, yy + i).equals(col1)) {
                pset(xx + j + 1, yy + i, col2);
              }
              if (!getPixel(xx + j, yy + i - 1).equals(col1)) {
                pset(xx + j, yy + i - 1, col2);
              }
              if (!getPixel(xx + j, yy + i + 1).equals(col1)) {
                pset(xx + j, yy + i + 1, col2);
              }
            }
          }
        }
      }
    }
  }