-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathn_cst_qrcode_dwsrv.sru
109 lines (82 loc) · 2.61 KB
/
n_cst_qrcode_dwsrv.sru
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
HA$PBExportHeader$n_cst_qrcode_dwsrv.sru
forward
global type n_cst_qrcode_dwsrv from nonvisualobject
end type
end forward
global type n_cst_qrcode_dwsrv from nonvisualobject
end type
global n_cst_qrcode_dwsrv n_cst_qrcode_dwsrv
type variables
private:
n_cst_qrcoder inv_qrcoder
datawindow idw_requestor
end variables
forward prototypes
public subroutine of_setrequestor (datawindow adw_requestor)
public function long of_render (string as_text, long al_blocksizeinpixel) throws throwable
end prototypes
public subroutine of_setrequestor (datawindow adw_requestor);//////////////////////////////////////////////////////////////////////////////
// Description:
// Initialize Requestor
//
// Author:
// B.Kemner, 13.07.2015
//
idw_requestor = adw_requestor
end subroutine
public function long of_render (string as_text, long al_blocksizeinpixel) throws throwable;//////////////////////////////////////////////////////////////////////////////
// Description:
// Renders the QR Code
//
// Author:
// B.Kemner, 13.07.2015
//
long ll_size, ll_x, ll_y
string ls_modify
n_cst_qrcode lnv_qrcode
s_bitarray lstra_modulMatrix[]
lnv_qrcode = inv_qrcoder.of_createQrCode(as_text, n_cst_qrcoder.ECCLEVEL_M)
ll_size = lnv_qrcode.of_getModulMatrix(ref lstra_modulMatrix)
for ll_x = 1 to ll_size
for ll_y = 1 to ll_size
if lstra_modulMatrix[ll_y].bits[ll_x] then
ls_modify += &
" create rectangle(band=detail" + &
" moveable=0 resizeable=0 x='" + string((ll_x -1) * PixelsToUnits(al_blockSizeInPixel, XPixelsToUnits!)) + "' y='" + string((ll_y -1) * PixelsToUnits(al_blockSizeInPixel, YPixelsToUnits!)) + "' height='" + string(PixelsToUnits(al_blockSizeInPixel, YPixelsToUnits!)) + "' width='" + string(PixelsToUnits(al_blockSizeInPixel, XPixelsToUnits!)) + "' name=r_qr_" + string(ll_x) + "_" + string(ll_y) + &
" background.mode='0' background.color='0')"
end if
next
next
idw_requestor.setRedraw(false)
idw_requestor.modify(ls_modify)
idw_requestor.setRedraw(true)
return 1
end function
on n_cst_qrcode_dwsrv.create
call super::create
TriggerEvent( this, "constructor" )
end on
on n_cst_qrcode_dwsrv.destroy
TriggerEvent( this, "destructor" )
call super::destroy
end on
event constructor;//////////////////////////////////////////////////////////////////////////////
// Description:
// Initialization
//
// Author:
// B.Kemner, 13.07.2015
//
inv_qrcoder = create n_cst_qrcoder
return 0
end event
event destructor;//////////////////////////////////////////////////////////////////////////////
// Description:
// Finalize
//
// Author:
// B.Kemner, 13.07.2015
//
destroy inv_qrcoder
return 0
end event