Skip to content
Chung-Sheng Wu edited this page Jun 5, 2020 · 5 revisions

API Reference

There are two kinds of api:

  • Public functions: for easily use
  • C++ mapping objects: for better configurations

First one should be enough in most cases, but if users want to access the low level C++ api, they can use the second one. Note that if users create C++ mapping objects, the destroy method of the object must be called to release memory. Otherwise it may cause memory leak in WASM instance memory space.

For api details, see API Reference.

About Performance

Note that image with higher resolution is easier to scan but cost more CPU. Sometime low resolution is enough to get the results. Scan frequency may also affect user experience.

Disable unused symbol type

Disable unused symbol type should increase performance. ZBar by default enable all symbol types. User can modify the default ImageScanner or create new ImageScanner and pass it into scanXXX functions.

To disable all but one symbol, use following code:

scanner.setConfig(
	ZBarSymbolType.ZBAR_NONE, /* "None" for "All", design by original ZBar library */,
	ZBarConfigType.ZBAR_CFG_ENABLE, /* The field you want to change */
	0 /* 0 for disable */
);
scanner.setConfig(ZBarSymbolType.ZBAR_QRCODE, ZBarConfigType.ZBAR_CFG_ENABLE, 1);

There are many other options, but may not be well-documented. See zbar document.

Clone this wiki locally