code: private void setNoValueBorder( WritableRaster pitWR, int width, int height, WritableRaster hillshadeWR ) {
          for( int y = 2; y < height - 2; y++ ) {
              for( int x = 2; x < width - 2; x++ ) {
                  if (pitWR.getSampleDouble(x, y, 0) == -9999.0) {
                      hillshadeWR.setSample(x, y, 0, doubleNoValue);
                  }
              }
          }
  
          // maybe NaN instead of 0
          for( int y = 0; y < height; y++ ) {
              hillshadeWR.setSample(0, y, 0, 0);
              hillshadeWR.setSample(1, y, 0, 0);
              hillshadeWR.setSample(width - 2, y, 0, 0);
              hillshadeWR.setSample(width - 1, y, 0, 0);
          }
  
          for( int x = 2; x < width - 2; x++ ) {
              hillshadeWR.setSample(x, 0, 0, 0);
              hillshadeWR.setSample(x, 1, 0, 0);
              hillshadeWR.setSample(x, height - 2, 0, 0);
              hillshadeWR.setSample(x, height - 1, 0, 0);
          }
      }
docs: /*
  Re-set the no value to NaN (I have set it to -9999.0 in order to use this
  value in the equation) and set the border to 0.