Rabbit-R1/switch port/java/sources/com/google/zxing/InvertedLuminanceSource.java
2024-05-21 17:08:36 -04:00

62 lines
2 KiB
Java

package com.google.zxing;
/* loaded from: classes3.dex */
public final class InvertedLuminanceSource extends LuminanceSource {
private final LuminanceSource delegate;
@Override // com.google.zxing.LuminanceSource
public LuminanceSource invert() {
return this.delegate;
}
public InvertedLuminanceSource(LuminanceSource luminanceSource) {
super(luminanceSource.getWidth(), luminanceSource.getHeight());
this.delegate = luminanceSource;
}
@Override // com.google.zxing.LuminanceSource
public byte[] getRow(int i, byte[] bArr) {
byte[] row = this.delegate.getRow(i, bArr);
int width = getWidth();
for (int i2 = 0; i2 < width; i2++) {
row[i2] = (byte) (255 - (row[i2] & 255));
}
return row;
}
@Override // com.google.zxing.LuminanceSource
public byte[] getMatrix() {
byte[] matrix = this.delegate.getMatrix();
int width = getWidth() * getHeight();
byte[] bArr = new byte[width];
for (int i = 0; i < width; i++) {
bArr[i] = (byte) (255 - (matrix[i] & 255));
}
return bArr;
}
@Override // com.google.zxing.LuminanceSource
public boolean isCropSupported() {
return this.delegate.isCropSupported();
}
@Override // com.google.zxing.LuminanceSource
public LuminanceSource crop(int i, int i2, int i3, int i4) {
return new InvertedLuminanceSource(this.delegate.crop(i, i2, i3, i4));
}
@Override // com.google.zxing.LuminanceSource
public boolean isRotateSupported() {
return this.delegate.isRotateSupported();
}
@Override // com.google.zxing.LuminanceSource
public LuminanceSource rotateCounterClockwise() {
return new InvertedLuminanceSource(this.delegate.rotateCounterClockwise());
}
@Override // com.google.zxing.LuminanceSource
public LuminanceSource rotateCounterClockwise45() {
return new InvertedLuminanceSource(this.delegate.rotateCounterClockwise45());
}
}