|
@@ -51,7 +51,7 @@ public class TexturePixel implements Cloneable {
|
|
|
* @param b
|
|
* @param b
|
|
|
* the blue value
|
|
* the blue value
|
|
|
*/
|
|
*/
|
|
|
- public void fromARGB8(float a, float r, float g, float b) {
|
|
|
|
|
|
|
+ public void fromARGB(float a, float r, float g, float b) {
|
|
|
this.alpha = a;
|
|
this.alpha = a;
|
|
|
this.red = r;
|
|
this.red = r;
|
|
|
this.green = g;
|
|
this.green = g;
|
|
@@ -77,6 +77,25 @@ public class TexturePixel implements Cloneable {
|
|
|
this.blue = b >= 0 ? b / 255.0f : 1.0f - ~b / 255.0f;
|
|
this.blue = b >= 0 ? b / 255.0f : 1.0f - ~b / 255.0f;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Copies the values from the given values.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param a
|
|
|
|
|
+ * the alpha value
|
|
|
|
|
+ * @param r
|
|
|
|
|
+ * the red value
|
|
|
|
|
+ * @param g
|
|
|
|
|
+ * the green value
|
|
|
|
|
+ * @param b
|
|
|
|
|
+ * the blue value
|
|
|
|
|
+ */
|
|
|
|
|
+ public void fromARGB16(short a, short r, short g, short b) {
|
|
|
|
|
+ this.alpha = a >= 0 ? a / 65535.0f : 1.0f - ~a / 65535.0f;
|
|
|
|
|
+ this.red = r >= 0 ? r / 65535.0f : 1.0f - ~r / 65535.0f;
|
|
|
|
|
+ this.green = g >= 0 ? g / 65535.0f : 1.0f - ~g / 65535.0f;
|
|
|
|
|
+ this.blue = b >= 0 ? b / 65535.0f : 1.0f - ~b / 65535.0f;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Copies the intensity from the given value.
|
|
* Copies the intensity from the given value.
|
|
|
*
|
|
*
|
|
@@ -215,6 +234,34 @@ public class TexturePixel implements Cloneable {
|
|
|
return (byte) (this.blue * 255.0f);
|
|
return (byte) (this.blue * 255.0f);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @return the alpha value of the pixel
|
|
|
|
|
+ */
|
|
|
|
|
+ public short getA16() {
|
|
|
|
|
+ return (byte) (this.alpha * 65535.0f);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @return the alpha red of the pixel
|
|
|
|
|
+ */
|
|
|
|
|
+ public short getR16() {
|
|
|
|
|
+ return (byte) (this.red * 65535.0f);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @return the green value of the pixel
|
|
|
|
|
+ */
|
|
|
|
|
+ public short getG16() {
|
|
|
|
|
+ return (byte) (this.green * 65535.0f);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @return the blue value of the pixel
|
|
|
|
|
+ */
|
|
|
|
|
+ public short getB16() {
|
|
|
|
|
+ return (byte) (this.blue * 65535.0f);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Merges two pixels (adds the values of each color).
|
|
* Merges two pixels (adds the values of each color).
|
|
|
*
|
|
*
|