Added new class Color V

This commit is contained in:
Robert Vokac 2024-10-01 19:20:46 +02:00
parent 7d39047402
commit f3a1411509
Signed by: robertvokac
GPG Key ID: FB9CE8E20AADA55F
2 changed files with 5 additions and 5 deletions

View File

@ -101,7 +101,7 @@ public final class Color {
public static final float DEFAULT_ALPHA = 1f;
// 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
public Color() {

View File

@ -31,15 +31,15 @@ import lombok.Getter;
*/
@AllArgsConstructor
@Getter
public class ColorDepthHelper {
class ColorDepthHelper {
final int r, g, b;
final int redBits, greenBits, blueBits;
public ColorDepthHelper(Color color, ColorDepth colorDepth) {
ColorDepthHelper(Color color, ColorDepth colorDepth) {
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
int redMask = (1 << redBits) - 1; // Mask for red
int greenMask = (1 << greenBits) - 1; // Mask for green
@ -53,7 +53,7 @@ public class ColorDepthHelper {
this.greenBits = greenBits;
this.blueBits = blueBits;
}
public BitSet getBitSet() {
BitSet getBitSet() {
BinaryUtils bu = Pixel.utils().binary();
return bu.merge3BitSets(
bu.convertIntToBitSet(r, redBits),