rxing-wasm 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,6 +24,37 @@ function decodeBarcode(canvas) {
24
24
  }
25
25
  ```
26
26
 
27
+ The `convert_canvas_to_luma` function is used to convert a canvas to the luma 8
28
+ format that rxing expects. An example might look like to below.
29
+
30
+ ```javascript
31
+ function decodeBarcode(canvas) {
32
+ let height = canvas.height;
33
+ let width = canvas.width;
34
+ let luma8Data = convert_canvas_to_luma(canvas);
35
+ let parsedBarcode = decode_barcode(luma8Data, width, height);
36
+
37
+ return parsedBarcode;
38
+ }
39
+ ```
40
+
41
+ The `convert_imagedata_to_luma` function is used to convert an ImageData object to the luma 8
42
+ format that rxing expects. An example might look like to below.
43
+
44
+ ```javascript
45
+ function decodeBarcode(canvas) {
46
+ let context = canvas.getContext('2d');
47
+ let height = canvas.height;
48
+ let width = canvas.width;
49
+ let imageData = context.getImageData(0, 0, width, height);
50
+
51
+ let luma8Data = convert_imagedata_to_luma(imageData);
52
+ let parsedBarcode = decode_barcode(luma8Data, width, height);
53
+
54
+ return parsedBarcode;
55
+ }
56
+ ```
57
+
27
58
  ## Hints
28
59
  ### Using the `DecodeHintDictionary` class
29
60
  Add a hint with `set_hint(hint: DecodeHintTypes, value: string)`. The function returns `true` if the hint was added and `false` if it was not. The value of hint must be a `number` representing on of the enum values for `DecodeHintTypes`. The easiest way to use this is to simply pass in one of the values from `DecodeHintTypes`.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "rxing-wasm",
3
3
  "type": "module",
4
4
  "description": "wasm bindings for rxing to provide commong barcode operations (decode/encode)",
5
- "version": "0.3.0",
5
+ "version": "0.3.2",
6
6
  "license": "Apache 2.0",
7
7
  "repository": {
8
8
  "type": "git",