/** Sets the RGBA values for the color. Also clamps them to 0-255. */
  public void setColorRGBA(int par1, int par2, int par3, int par4) {
    if (isColorDisabled) {
      return;
    }

    if (par1 > 255) {
      par1 = 255;
    }

    if (par2 > 255) {
      par2 = 255;
    }

    if (par3 > 255) {
      par3 = 255;
    }

    if (par4 > 255) {
      par4 = 255;
    }

    if (par1 < 0) {
      par1 = 0;
    }

    if (par2 < 0) {
      par2 = 0;
    }

    if (par3 < 0) {
      par3 = 0;
    }

    if (par4 < 0) {
      par4 = 0;
    }

    hasColor = true;

    if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
      color = par4 << 24 | par3 << 16 | par2 << 8 | par1;
    } else {
      color = par1 << 24 | par2 << 16 | par3 << 8 | par4;
    }
  }
Beispiel #2
0
 static {
   littleEndianByteOrder = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN;
 }