mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2026-08-09 00:04:55 +00:00
temporarily revert jzbar application image loading
This commit is contained in:
+3
-3
@@ -206,8 +206,8 @@ jlink {
|
||||
'glob:/org.hid4java/win32-*/**,' +
|
||||
'glob:/openpnp.capture.java/darwin-*/**,' +
|
||||
'glob:/openpnp.capture.java/linux-*/**,' +
|
||||
'glob:/openpnp.capture.java/win32-*/**,' +
|
||||
'glob:/io.github.doblon8.jzbar/native/**']
|
||||
'glob:/openpnp.capture.java/win32-*/**']
|
||||
// TODO: exclude glob:/io.github.doblon8.jzbar/native/** once jzbar supports pre-loaded natives
|
||||
launcher {
|
||||
name = 'sparrow'
|
||||
jvmArgs = ["--enable-native-access=com.sparrowwallet.drongo",
|
||||
@@ -401,7 +401,7 @@ def nativeLibJars = [
|
||||
'openpnp-capture-java': "${jnaPlatform}/*",
|
||||
'jSerialComm-' : "${serialOs}/${serialArch}/*",
|
||||
'usb4java-' : "org/usb4java/${jnaPlatform}/*",
|
||||
'jzbar-' : "native/${osName}/${osArch}/*",
|
||||
// TODO: add 'jzbar-' once jzbar supports pre-loaded natives
|
||||
]
|
||||
|
||||
tasks.register('extractNativeLibraries') {
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user