code: protected static boolean bordersNonTransparentPixel (
          BufferedImage data, int wid, int hei, boolean[] traced, int x, int y)
      {
          // check the three-pixel row above the pixel
          if (y > 0) {
              for (int rxx = x - 1; rxx <= x + 1; rxx++) {
                  if (rxx < 0 || rxx >= wid || traced[((y-1)*wid)+rxx]) {
                      continue;
                  }
  
                  if ((data.getRGB(rxx, y - 1) & TRANS_MASK) != 0) {
                      return true;
                  }
              }
          }
  
          // check the pixel to the left
          if (x > 0 && !traced[(y*wid)+(x-1)]) {
              if ((data.getRGB(x - 1, y) & TRANS_MASK) != 0) {
                  return true;
              }
          }
  
          // check the pixel to the right
          if (x < wid - 1 && !traced[(y*wid)+(x+1)]) {
              if ((data.getRGB(x + 1, y) & TRANS_MASK) != 0) {
                  return true;
              }
          }
  
          // check the three-pixel row below the pixel
          if (y < hei - 1) {
              for (int rxx = x - 1; rxx <= x + 1; rxx++) {
                  if (rxx < 0 || rxx >= wid || traced[((y+1)*wid)+rxx]) {
                      continue;
                  }
  
                  if ((data.getRGB(rxx, y + 1) & TRANS_MASK) != 0) {
                      return true;
                  }
              }
          }
  
          return false;
      }
docs: Returns whether the given pixel is bordered by any non-transparent pixel.