temporarily revert jzbar application image loading

This commit is contained in:
Craig Raw
2026-03-13 09:09:13 +02:00
parent 98ae891898
commit 53b6e2532f
2 changed files with 19 additions and 3 deletions
@@ -10,15 +10,31 @@ import org.slf4j.LoggerFactory;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferByte;
import java.io.File;
public class ZBar {
private static final Logger log = LoggerFactory.getLogger(ZBar.class);
private static boolean zbarLoaded;
public static boolean isEnabled() {
return com.sparrowwallet.sparrow.io.Config.get().isUseZbar();
}
private static synchronized void loadZBar() {
if(!zbarLoaded) {
String javaHome = System.getProperty("java.home");
if(javaHome != null) {
File libFile = new File(javaHome, "lib" + java.io.File.separator + System.mapLibraryName("zbar"));
if(libFile.exists()) {
System.load(libFile.getAbsolutePath());
}
}
zbarLoaded = true;
}
}
public static Scan scan(BufferedImage bufferedImage) {
loadZBar();
try {
BufferedImage grayscale = new BufferedImage(bufferedImage.getWidth(), bufferedImage.getHeight(), BufferedImage.TYPE_BYTE_GRAY);
Graphics2D g2d = (Graphics2D)grayscale.getGraphics();