Added new class Color V
This commit is contained in:
parent
7d39047402
commit
f3a1411509
@ -101,7 +101,7 @@ public final class Color {
|
|||||||
public static final float DEFAULT_ALPHA = 1f;
|
public static final float DEFAULT_ALPHA = 1f;
|
||||||
|
|
||||||
// Default alpha int value for colors
|
// Default alpha int value for colors
|
||||||
public static final int DEFAULT_ALPHA_INT = 256;
|
public static final int DEFAULT_ALPHA_INT = 255;
|
||||||
|
|
||||||
// Default constructor initializes color to black with full opacity
|
// Default constructor initializes color to black with full opacity
|
||||||
public Color() {
|
public Color() {
|
||||||
|
@ -31,15 +31,15 @@ import lombok.Getter;
|
|||||||
*/
|
*/
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Getter
|
@Getter
|
||||||
public class ColorDepthHelper {
|
class ColorDepthHelper {
|
||||||
|
|
||||||
final int r, g, b;
|
final int r, g, b;
|
||||||
final int redBits, greenBits, blueBits;
|
final int redBits, greenBits, blueBits;
|
||||||
|
|
||||||
public ColorDepthHelper(Color color, ColorDepth colorDepth) {
|
ColorDepthHelper(Color color, ColorDepth colorDepth) {
|
||||||
this(color, colorDepth.getRedBitCount(), colorDepth.getGreenBitCount(), colorDepth.getBlueBitCount());
|
this(color, colorDepth.getRedBitCount(), colorDepth.getGreenBitCount(), colorDepth.getBlueBitCount());
|
||||||
}
|
}
|
||||||
public ColorDepthHelper(Color color, int redBits, int greenBits, int blueBits) {
|
ColorDepthHelper(Color color, int redBits, int greenBits, int blueBits) {
|
||||||
// Create masks based on the number of bits for each color component
|
// Create masks based on the number of bits for each color component
|
||||||
int redMask = (1 << redBits) - 1; // Mask for red
|
int redMask = (1 << redBits) - 1; // Mask for red
|
||||||
int greenMask = (1 << greenBits) - 1; // Mask for green
|
int greenMask = (1 << greenBits) - 1; // Mask for green
|
||||||
@ -53,7 +53,7 @@ public class ColorDepthHelper {
|
|||||||
this.greenBits = greenBits;
|
this.greenBits = greenBits;
|
||||||
this.blueBits = blueBits;
|
this.blueBits = blueBits;
|
||||||
}
|
}
|
||||||
public BitSet getBitSet() {
|
BitSet getBitSet() {
|
||||||
BinaryUtils bu = Pixel.utils().binary();
|
BinaryUtils bu = Pixel.utils().binary();
|
||||||
return bu.merge3BitSets(
|
return bu.merge3BitSets(
|
||||||
bu.convertIntToBitSet(r, redBits),
|
bu.convertIntToBitSet(r, redBits),
|
||||||
|
Reference in New Issue
Block a user