code: private static long colorBlendingDigit( long longDigit1, long longDigit2, int op ) {
          switch( op ) {
              case MULTIPLY:
                  return longDigit1 * longDigit2 / 0xFF00;
              case SCREEN:
                  return longDigit1 + longDigit2 - longDigit1 * longDigit2 / 0xFF00;
              case OVERLAY:
                  longDigit1 *= 2;
                  if( longDigit1 <= 0xFF00 ) {
                      return colorBlendingDigit( longDigit1, longDigit2, MULTIPLY );
                  } else {
                      return colorBlendingDigit( longDigit1 - 0xFF00, longDigit2, SCREEN );
                  }
              case SOFTLIGHT:
                  long d = 0xFF00, e = longDigit1;
                  if (longDigit2 > 0x8000) {
                      e = 0xFF00;
                      d = (longDigit1 > 0x4000) ? (long)(Math.sqrt(longDigit1 / (double)0xFF00 ) * 0xFF00)
                          : ((16 * longDigit1 - 12 * 0xFF00) * longDigit1 / 0xFF00 + 4 * 0xFF00) * longDigit1 / 0xFF00;
                  }
                  return longDigit1 - (0xFF00 - 2 * longDigit2) * e * (d - longDigit1) / 0xFF00 / 0xFF00;
              case HARDLIGHT:
                  return colorBlendingDigit( longDigit2, longDigit1, OVERLAY );
              case DIFFERENCE:
                  return Math.abs( longDigit1 - longDigit2 );
              case EXCLUSION:
                  return longDigit1 + longDigit2 - 2 * longDigit1 * longDigit2 / 0xFF00;
              case AVERAGE:
                  return (longDigit1 + longDigit2) / 2;
              case NEGATION:
                  return 0xFF00 - Math.abs( longDigit1 + longDigit2 - 0xFF00 );
              default:
                  throw new IllegalArgumentException( String.valueOf( op ) );
          }
      }
docs: Color blending operation for a single color channel.
  
  @param longDigit1 left digit
  @param longDigit2 right digit
  @param op blending operation
  @return resulting color digit
  @throws IllegalArgumentException if the operation is unknown