首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何禁用zbar for android paltform中未使用的符号系统?

如何禁用zbar for android paltform中未使用的符号系统?
EN

Stack Overflow用户
提问于 2014-08-02 22:13:36
回答 1查看 1.3K关注 0票数 1

我已经集成了安卓的zbar扫描器到我的应用程序中,我只使用该应用程序来扫描qrcode,所以现在我想通过禁用不使用的符号系统(如PDF417 CODE39等)来优化阅读器,我应该在哪里更改?我总是想知道Symbol.java文件中的数字是什么意思,比如"QRCODE = 64“Thx:)下面是一些核心文件:

Config.java

代码语言:javascript
复制
public class Config
{

    public static final int ENABLE = 0;
    public static final int ADD_CHECK = 1;
    public static final int EMIT_CHECK = 2;
    public static final int ASCII = 3;
    public static final int MIN_LEN = 32;
    public static final int MAX_LEN = 33;
    public static final int UNCERTAINTY = 64;
    public static final int POSITION = 128;
    public static final int X_DENSITY = 400;
    public static final int Y_DENSITY = 400;

}

Symbol.java

代码语言:javascript
复制
public class Symbol
{

    public static final int NONE = 0;
    public static final int PARTIAL = 1;
    public static final int EAN8 = 8;
    public static final int UPCE = 9;
    public static final int ISBN10 = 10;
    public static final int UPCA = 12;
    public static final int EAN13 = 13;
    public static final int ISBN13 = 14;
    public static final int I25 = 25;
    public static final int DATABAR = 34;
    public static final int DATABAR_EXP = 35;
    public static final int CODABAR = 38;
    public static final int CODE39 = 39;
    public static final int PDF417 = 57;
    public static final int QRCODE = 64;
    public static final int CODE93 = 93;
    public static final int CODE128 = 128;
    private long peer;
    private int type;

    private static native void init();

    Symbol(long l)
    {
        peer = l;
    }

    protected void finalize()
    {
        destroy();
    }

    public synchronized void destroy()
    {
        if (peer != 0L)
        {
            destroy(peer);
            peer = 0L;
        }
    }

    private native void destroy(long l);

    public int getType()
    {
        if (type == 0)
            type = getType(peer);
        return type;
    }

    private native int getType(long l);

    public native int getConfigMask();

    public native int getModifierMask();

    public native String getData();

    public native byte[] getDataBytes();

    public native int getQuality();

    public native int getCount();

    public int[] getBounds()
    {
        int i = getLocationSize(peer);
        if (i <= 0)
            return null;
        int ai[] = new int[4];
        int j = 0x7fffffff;
        int k = 0x80000000;
        int l = 0x7fffffff;
        int i1 = 0x80000000;
        for (int j1 = 0; j1 < i; j1++)
        {
            int k1 = getLocationX(peer, j1);
            if (j > k1)
                j = k1;
            if (k < k1)
                k = k1;
            int l1 = getLocationY(peer, j1);
            if (l > l1)
                l = l1;
            if (i1 < l1)
                i1 = l1;
        }

        ai[0] = j;
        ai[1] = l;
        ai[2] = k - j;
        ai[3] = i1 - l;
        return ai;
    }

    private native int getLocationSize(long l);

    private native int getLocationX(long l, int i);

    private native int getLocationY(long l, int i);

    public int[] getLocationPoint(int i)
    {
        int ai[] = new int[2];
        ai[0] = getLocationX(peer, i);
        ai[1] = getLocationY(peer, i);
        return ai;
    }

    public native int getOrientation();

    public SymbolSet getComponents()
    {
        return new SymbolSet(getComponents(peer));
    }

    private native long getComponents(long l);

    native long next();

    static
    {
        System.loadLibrary("zbarjni");
        init();
    }
}

Modifier.java

代码语言:javascript
复制
public class Modifier
{

    public static final int GS1 = 0;
    public static final int AIM = 1;

    public Modifier()
    {
    }
}

SymbolSet.java

代码语言:javascript
复制
public class SymbolSet extends AbstractCollection
{

    private long peer;

    private static native void init();

    SymbolSet(long l)
    {
        peer = l;
    }

    protected void finalize()
    {
        destroy();
    }

    public synchronized void destroy()
    {
        if (peer != 0L)
        {
            destroy(peer);
            peer = 0L;
        }
    }

    private native void destroy(long l);

    public Iterator iterator()
    {
        long l = firstSymbol(peer);
        if (l == 0L)
            return new SymbolIterator(null);
        else
            return new SymbolIterator(new Symbol(l));
    }

    public native int size();

    private native long firstSymbol(long l);

    static
    {
        System.loadLibrary("zbarjni");
        init();
    }
}
EN

回答 1

Stack Overflow用户

发布于 2014-09-23 03:10:34

如下所示:

代码语言:javascript
复制
scanner = new ImageScanner();
// disable all symbologies first
scanner.setConfig(0, Config.ENABLE, 0);
// only enable QRCODE
scanner.setConfig(Symbol.QRCODE, Config.ENABLE, 1);

对于setConfig,有三个参数都是整型的,第一个是您想要使用Symbol静态属性影响的符号,或者对所有符号使用0。第二个是要使用Config静态属性设置的设置。第三个是设定值。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25095933

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档