xlang v4.0 Release
程序设计语言基础库文档
载入中...
搜索中...
未找到
zxing.xcs
浏览该文件的文档.
1//xlang
2class ZXing : Library {
3 public enum BarcodeFormat {
6
9
12
15
18
21
24
27
30
33
36
39
42
45
48
51
54
55
56
57 // Not valid value, used to count the number of formats, thus should be always the last listed here
58 FORMAT_COUNT
59 };
60
61 static bool bLoaded = new ZXing().load();
62
63 static bool load() {
64 try {
65 loadLibrary("ZXingCore");
66 return true;
67 } catch(Exception e) {
68 }
69
70 return false;
71 }
72
73 import {
74 Object cdecl generator_qr(int format, String content, int width, int height, bool naked, bool bpixels);
75 Object cdecl read_qrcode(ObjectPtr buffer, int offset, int width, int height, int row_bytes, int pixel_bytes,
76 int index_r, int index_g, int index_b, ObjectPtr num_bits, ObjectPtr status, ObjectPtr format);
77 };
78
79 public static class Result {
81 BarcodeFormat format;
82
83 public Result(byte [] data, ZXing.BarcodeFormat fmt) {
84 text = new String(data);
85 format = fmt;
86 }
87 public String getText() {
88 return text;
89 }
90 public BarcodeFormat getFormat() {
91 return format;
92 }
93 };
94
95 public static Result readQRCodeFromARGB8888Buffer(int[] data, int offset, int width, int height) {
96 int num_bits = 5, status = 7;
98 byte [] rs = (byte [])ZXing.read_qrcode(data, offset, width, height, width * 4, 4, 1, 2, 3, num_bits, status, format);
99
100 if (rs != nilptr) {
101 return new Result(rs, format);
102 }
103
104 return nilptr;
105 }
106
107 public static byte[] generateQRCodeToARGB8888Bitmap(String content, int widthOrHeight, bool isBmpFile) {
108 return (byte[])generator_qr(ZXing.BarcodeFormat.QR_CODE, content, widthOrHeight, widthOrHeight, !isBmpFile, false);
109 }
110
111 public static int[] generateQRCodeToARGB8888Pixels(String content, int widthOrHeight, bool isBmpFile) {
112 return (int[])generator_qr(ZXing.BarcodeFormat.QR_CODE, content, widthOrHeight, widthOrHeight, !isBmpFile, true);
113 }
114};
115
116/*
117int main(String [] args){
118 byte [] data = ZXing.generateQRCodeToARGB8888Bitmap("1566", 100, true);
119 long hf = _system_.openFile("ll.bmp","w");
120 _system_.writeFile(hf,data,0,data.length);
121 _system_.closeFile(hf);
122 return 0;
123}*/
异常类
static final void loadLibrary(String)
字符串类
Result(byte [] data, ZXing.BarcodeFormat fmt)
Definition zxing.xcs:83
BarcodeFormat getFormat()
Definition zxing.xcs:90
String getText()
Definition zxing.xcs:87
String text
Definition zxing.xcs:80
BarcodeFormat format
Definition zxing.xcs:81
Definition zxing.xcs:2
static int [] generateQRCodeToARGB8888Pixels(String content, int widthOrHeight, bool isBmpFile)
Definition zxing.xcs:111
static byte [] generateQRCodeToARGB8888Bitmap(String content, int widthOrHeight, bool isBmpFile)
Definition zxing.xcs:107
static bool bLoaded
Definition zxing.xcs:61
static Result readQRCodeFromARGB8888Buffer(int[] data, int offset, int width, int height)
Definition zxing.xcs:95
static bool load()
Definition zxing.xcs:63
Object cdecl read_qrcode(ObjectPtr buffer, int offset, int width, int height, int row_bytes, int pixel_bytes, int index_r, int index_g, int index_b, ObjectPtr num_bits, ObjectPtr status, ObjectPtr format)