Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lua-resty-qrencode
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jiming
lua-resty-qrencode
Commits
7c7c51ae
Commit
7c7c51ae
authored
Nov 03, 2014
by
nosa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix a bug when initialize value
parent
889d6e4d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
28 deletions
+43
-28
ChangeLog
+7
-1
README.md
+6
-5
qrencode.c
+23
-15
test/test.lua
+7
-7
No files found.
ChangeLog
View file @
7c7c51ae
2014-11-03 vinoca <vinoca@vinoca.org>
* qrencode.c:
* fixed a bug when initialize value.
[1.0]
- Bumped verstion to 1.0.2
2014-10-30 vinoca <vinoca@vinoca.org>
* qrencode.c:
* add ansi type.
[1.0]
* add luarocks rockspec.
- Bumped verstion to
3.4.4.
- Bumped verstion to
1.0.1
2014-10-16 vinoca <vinoca@vinoca.org>
* Bumped version to 1.0.0.
README.md
View file @
7c7c51ae
...
...
@@ -28,17 +28,18 @@ print(qr {
text
=
"is ok?"
,
level
=
"L"
,
kanji
=
false
,
ansi
=
false
,
size
=
3
,
ansi
=
true
,
size
=
4
,
margin
=
2
,
symversion
=
0
,
dpi
=
80
,
casesensitive
=
true
,
eightbit
=
false
,
dpi
=
78
,
casesensitive
=
false
,
foreground
=
"#48AF6D"
,
background
=
"#3FAF6F"
}
)
```
when pass a table, "text" is required and other is optional.
...
...
qrencode.c
View file @
7c7c51ae
...
...
@@ -27,17 +27,11 @@ enum imageType {
#define INCHES_PER_METER (100.0/2.54)
static
int
casesensitive
=
1
;
static
int
eightbit
=
0
;
static
int
version
=
0
;
static
int
size
=
3
;
static
int
margin
=
4
;
static
int
dpi
=
72
;
static
QRecLevel
level
=
QR_ECLEVEL_L
;
static
QRencodeMode
hint
=
QR_MODE_8
;
static
enum
imageType
image_type
=
PNG_TYPE
;
static
unsigned
int
fg_color
[
4
]
=
{
0
,
0
,
0
,
255
};
static
unsigned
int
bg_color
[
4
]
=
{
255
,
255
,
255
,
255
};
static
int
size
;
static
int
margin
;
static
int
dpi
;
static
unsigned
int
fg_color
[
4
];
static
unsigned
int
bg_color
[
4
];
/* png io callback function */
...
...
@@ -336,12 +330,28 @@ static int encode (lua_State *L)
const
char
*
intext
;
struct
memData
result
;
int
version
=
0
;
int
casesensitive
=
1
;
QRencodeMode
hint
=
QR_MODE_8
;
QRecLevel
level
=
QR_ECLEVEL_L
;
enum
imageType
image_type
=
PNG_TYPE
;
size
=
3
;
margin
=
4
;
dpi
=
72
;
fg_color
[
0
]
=
0
;
fg_color
[
1
]
=
0
;
fg_color
[
2
]
=
0
;
fg_color
[
3
]
=
255
;
bg_color
[
0
]
=
255
;
bg_color
[
1
]
=
255
;
bg_color
[
2
]
=
255
;
bg_color
[
3
]
=
255
;
result
.
buffer
=
NULL
;
result
.
size
=
0
;
image_type
=
PNG_TYPE
;
if
((
lua_gettop
(
L
)
==
1
&&
lua_istable
(
L
,
1
))
||
lua_gettop
(
L
)
==
2
&&
lua_istable
(
L
,
2
)
)
{
(
lua_gettop
(
L
)
==
2
&&
lua_istable
(
L
,
2
))
)
{
if
(
lua_gettop
(
L
)
==
2
)
lua_remove
(
L
,
1
);
...
...
@@ -408,7 +418,6 @@ static int encode (lua_State *L)
set_qr_int
(
L
,
&
margin
,
"margin"
);
set_qr_int
(
L
,
&
dpi
,
"dpi"
);
set_qr_boolean
(
L
,
&
casesensitive
,
"casesensitive"
);
set_qr_boolean
(
L
,
&
eightbit
,
"eightbit"
);
set_png_color
(
L
,
fg_color
,
"foreground"
);
set_png_color
(
L
,
bg_color
,
"background"
);
}
...
...
@@ -460,7 +469,6 @@ static const struct luaL_Reg R [] = {
int
luaopen_qrencode
(
lua_State
*
L
)
{
//luaL_register(L, "qrencode", R);
luaL_newlib
(
L
,
R
);
lua_pushvalue
(
L
,
-
1
);
lua_setmetatable
(
L
,
-
2
);
...
...
test/test.lua
View file @
7c7c51ae
...
...
@@ -5,19 +5,19 @@ print(qr.encode("is ok?"))
print
(
qr
:
encode
(
"is ok?"
))
print
(
qr
(
"is ok?"
))
print
(
qr
{
text
=
"is ok?"
,
ansi
=
true
})
print
(
qr
{
text
=
"
123
"
,
text
=
"
is ok?
"
,
level
=
"L"
,
kanji
=
false
,
ansi
=
false
,
size
=
3
,
ansi
=
true
,
size
=
4
,
margin
=
2
,
symversion
=
0
,
dpi
=
80
,
casesensitive
=
true
,
eightbit
=
false
,
dpi
=
78
,
casesensitive
=
false
,
foreground
=
"#48AF6D"
,
background
=
"#3FAF6F"
}
)
print
(
qr
{
text
=
"is ok?"
,
ansi
=
false
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment