fastqr 1.0.1 → 1.0.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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/bindings/nodejs/package.json +2 -8
- data/bindings/ruby/extconf.rb +57 -0
- data/bindings/ruby/lib/fastqr/version.rb +1 -1
- data/bindings/ruby/prebuilt/macos-arm64/bin/fastqr +0 -0
- data/bindings/ruby/prebuilt/macos-arm64/include/fastqr.h +95 -0
- data/bindings/ruby/prebuilt/macos-arm64/lib/libfastqr.dylib +0 -0
- data/bindings/ruby/prebuilt/macos-arm64.tar.gz +0 -0
- data/bindings/ruby/prebuilt/macos-x86_64/bin/fastqr +0 -0
- data/bindings/ruby/prebuilt/macos-x86_64/include/fastqr.h +95 -0
- data/bindings/ruby/prebuilt/macos-x86_64/lib/libfastqr.dylib +0 -0
- data/bindings/ruby/prebuilt/macos-x86_64.tar.gz +0 -0
- data/src/fastqr.cpp +1 -1
- metadata +7 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fcec6f8e2ad38aed5ba26c3c5546d56b862926ae66c13695f9f435214fbbf291
|
|
4
|
+
data.tar.gz: 57b79df20dbd852544bfbff0a0ebaac7eb28aa7c2ba98e507067c9a3c8391061
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7400f2b6f9f3eb3cb26903d46d8057bb26ef907e9afcef5d5676c3e0adf33aee7abea4ff467c77a94a02528afc21a9839080817c5ac263dc64faf73435df47f6
|
|
7
|
+
data.tar.gz: bfdbf0b17aab3dd58f03bc18e51684d78233aa1eae8f2491f4ff47d0964839026b8d3cc4826ab91106f28934e778b975f246a4c2785355d3900f00900f7305c6
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.2
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fastqr",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Fast QR code generator with UTF-8 support, custom colors, logo embedding, and precise size control",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"install": "node-gyp rebuild",
|
|
9
8
|
"test": "node test/test.js"
|
|
10
9
|
},
|
|
11
10
|
"keywords": [
|
|
@@ -31,13 +30,8 @@
|
|
|
31
30
|
"url": "https://github.com/tranhuucanh/fastqr/issues"
|
|
32
31
|
},
|
|
33
32
|
"homepage": "https://github.com/tranhuucanh/fastqr#readme",
|
|
34
|
-
"dependencies": {
|
|
35
|
-
"node-gyp": "^9.0.0",
|
|
36
|
-
"ffi-napi": "^4.0.3",
|
|
37
|
-
"ref-napi": "^3.0.3"
|
|
38
|
-
},
|
|
33
|
+
"dependencies": {},
|
|
39
34
|
"devDependencies": {},
|
|
40
|
-
"gypfile": true,
|
|
41
35
|
"engines": {
|
|
42
36
|
"node": ">=14.0.0"
|
|
43
37
|
}
|
data/bindings/ruby/extconf.rb
CHANGED
|
@@ -1,4 +1,61 @@
|
|
|
1
1
|
require 'mkmf'
|
|
2
|
+
require 'rbconfig'
|
|
3
|
+
|
|
4
|
+
# Check if pre-built binary exists
|
|
5
|
+
def check_prebuilt_binary
|
|
6
|
+
os = RbConfig::CONFIG['host_os']
|
|
7
|
+
arch = RbConfig::CONFIG['host_cpu']
|
|
8
|
+
|
|
9
|
+
platform = case os
|
|
10
|
+
when /darwin/
|
|
11
|
+
case arch
|
|
12
|
+
when /arm64|aarch64/
|
|
13
|
+
'macos-arm64'
|
|
14
|
+
when /x86_64|x64/
|
|
15
|
+
'macos-x86_64'
|
|
16
|
+
else
|
|
17
|
+
nil
|
|
18
|
+
end
|
|
19
|
+
when /linux/
|
|
20
|
+
case arch
|
|
21
|
+
when /x86_64|x64/
|
|
22
|
+
'linux-x86_64'
|
|
23
|
+
when /arm64|aarch64/
|
|
24
|
+
'linux-arm64'
|
|
25
|
+
else
|
|
26
|
+
nil
|
|
27
|
+
end
|
|
28
|
+
else
|
|
29
|
+
nil
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
return false unless platform
|
|
33
|
+
|
|
34
|
+
prebuilt_dir = File.expand_path("../../prebuilt/#{platform}", __FILE__)
|
|
35
|
+
binary_path = File.join(prebuilt_dir, 'fastqr')
|
|
36
|
+
|
|
37
|
+
if File.exist?(binary_path)
|
|
38
|
+
puts "✅ Found pre-built binary at #{binary_path}"
|
|
39
|
+
puts "⏭️ Skipping compilation"
|
|
40
|
+
|
|
41
|
+
# Create a dummy Makefile that does nothing
|
|
42
|
+
File.open('Makefile', 'w') do |f|
|
|
43
|
+
f.puts "all:\n\t@echo 'Using pre-built binary'\n"
|
|
44
|
+
f.puts "install:\n\t@echo 'Using pre-built binary'\n"
|
|
45
|
+
f.puts "clean:\n\t@echo 'Nothing to clean'\n"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
return true
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
false
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Try to use pre-built binary first
|
|
55
|
+
exit 0 if check_prebuilt_binary
|
|
56
|
+
|
|
57
|
+
# If no pre-built binary, compile from source
|
|
58
|
+
puts "⚠️ No pre-built binary found, compiling from source..."
|
|
2
59
|
|
|
3
60
|
# Check for required libraries
|
|
4
61
|
unless have_library('qrencode')
|
|
Binary file
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* FastQR - Fast QR Code Generator Library
|
|
3
|
+
* Copyright (C) 2025 FastQR Project
|
|
4
|
+
*
|
|
5
|
+
* This library is free software; you can redistribute it and/or
|
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
|
7
|
+
* License as published by the Free Software Foundation; either
|
|
8
|
+
* version 2.1 of the License, or (at your option) any later version.
|
|
9
|
+
*
|
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
13
|
+
* Lesser General Public License for more details.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
#ifndef FASTQR_H
|
|
17
|
+
#define FASTQR_H
|
|
18
|
+
|
|
19
|
+
#include <string>
|
|
20
|
+
#include <cstdint>
|
|
21
|
+
|
|
22
|
+
namespace fastqr {
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* QR Code error correction level
|
|
26
|
+
*/
|
|
27
|
+
enum class ErrorCorrectionLevel {
|
|
28
|
+
LOW, // Level L - ~7% correction
|
|
29
|
+
MEDIUM, // Level M - ~15% correction
|
|
30
|
+
QUARTILE, // Level Q - ~25% correction
|
|
31
|
+
HIGH // Level H - ~30% correction
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Options for QR code generation
|
|
36
|
+
*/
|
|
37
|
+
struct QROptions {
|
|
38
|
+
// Output image dimensions
|
|
39
|
+
int width = 300;
|
|
40
|
+
int height = 300;
|
|
41
|
+
|
|
42
|
+
// QR code colors (RGB)
|
|
43
|
+
struct Color {
|
|
44
|
+
uint8_t r = 0;
|
|
45
|
+
uint8_t g = 0;
|
|
46
|
+
uint8_t b = 0;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
Color foreground = {0, 0, 0}; // QR code color (default: black)
|
|
50
|
+
Color background = {255, 255, 255}; // Background color (default: white)
|
|
51
|
+
|
|
52
|
+
// Error correction level
|
|
53
|
+
ErrorCorrectionLevel ec_level = ErrorCorrectionLevel::MEDIUM;
|
|
54
|
+
|
|
55
|
+
// Logo options
|
|
56
|
+
std::string logo_path = ""; // Path to logo image
|
|
57
|
+
int logo_size_percent = 20; // Logo size as percentage of QR code (default: 20%)
|
|
58
|
+
|
|
59
|
+
// Output format
|
|
60
|
+
std::string format = "png"; // png, jpg, webp, etc.
|
|
61
|
+
int quality = 95; // For lossy formats (1-100)
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Generate QR code and save to file
|
|
66
|
+
*
|
|
67
|
+
* @param data The data to encode (supports UTF-8)
|
|
68
|
+
* @param output_path Path to save the generated QR code image
|
|
69
|
+
* @param options QR code generation options
|
|
70
|
+
* @return true if successful, false otherwise
|
|
71
|
+
*/
|
|
72
|
+
bool generate(const std::string& data, const std::string& output_path, const QROptions& options = QROptions());
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Generate QR code and return image data as buffer
|
|
76
|
+
*
|
|
77
|
+
* @param data The data to encode (supports UTF-8)
|
|
78
|
+
* @param buffer Output buffer for image data
|
|
79
|
+
* @param buffer_size Size of the output buffer
|
|
80
|
+
* @param options QR code generation options
|
|
81
|
+
* @return Size of image data written to buffer, or -1 on error
|
|
82
|
+
*/
|
|
83
|
+
int generate_to_buffer(const std::string& data, void* buffer, size_t buffer_size, const QROptions& options = QROptions());
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Get library version
|
|
87
|
+
*
|
|
88
|
+
* @return Version string (e.g., "1.0.0")
|
|
89
|
+
*/
|
|
90
|
+
const char* version();
|
|
91
|
+
|
|
92
|
+
} // namespace fastqr
|
|
93
|
+
|
|
94
|
+
#endif // FASTQR_H
|
|
95
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* FastQR - Fast QR Code Generator Library
|
|
3
|
+
* Copyright (C) 2025 FastQR Project
|
|
4
|
+
*
|
|
5
|
+
* This library is free software; you can redistribute it and/or
|
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
|
7
|
+
* License as published by the Free Software Foundation; either
|
|
8
|
+
* version 2.1 of the License, or (at your option) any later version.
|
|
9
|
+
*
|
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
13
|
+
* Lesser General Public License for more details.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
#ifndef FASTQR_H
|
|
17
|
+
#define FASTQR_H
|
|
18
|
+
|
|
19
|
+
#include <string>
|
|
20
|
+
#include <cstdint>
|
|
21
|
+
|
|
22
|
+
namespace fastqr {
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* QR Code error correction level
|
|
26
|
+
*/
|
|
27
|
+
enum class ErrorCorrectionLevel {
|
|
28
|
+
LOW, // Level L - ~7% correction
|
|
29
|
+
MEDIUM, // Level M - ~15% correction
|
|
30
|
+
QUARTILE, // Level Q - ~25% correction
|
|
31
|
+
HIGH // Level H - ~30% correction
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Options for QR code generation
|
|
36
|
+
*/
|
|
37
|
+
struct QROptions {
|
|
38
|
+
// Output image dimensions
|
|
39
|
+
int width = 300;
|
|
40
|
+
int height = 300;
|
|
41
|
+
|
|
42
|
+
// QR code colors (RGB)
|
|
43
|
+
struct Color {
|
|
44
|
+
uint8_t r = 0;
|
|
45
|
+
uint8_t g = 0;
|
|
46
|
+
uint8_t b = 0;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
Color foreground = {0, 0, 0}; // QR code color (default: black)
|
|
50
|
+
Color background = {255, 255, 255}; // Background color (default: white)
|
|
51
|
+
|
|
52
|
+
// Error correction level
|
|
53
|
+
ErrorCorrectionLevel ec_level = ErrorCorrectionLevel::MEDIUM;
|
|
54
|
+
|
|
55
|
+
// Logo options
|
|
56
|
+
std::string logo_path = ""; // Path to logo image
|
|
57
|
+
int logo_size_percent = 20; // Logo size as percentage of QR code (default: 20%)
|
|
58
|
+
|
|
59
|
+
// Output format
|
|
60
|
+
std::string format = "png"; // png, jpg, webp, etc.
|
|
61
|
+
int quality = 95; // For lossy formats (1-100)
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Generate QR code and save to file
|
|
66
|
+
*
|
|
67
|
+
* @param data The data to encode (supports UTF-8)
|
|
68
|
+
* @param output_path Path to save the generated QR code image
|
|
69
|
+
* @param options QR code generation options
|
|
70
|
+
* @return true if successful, false otherwise
|
|
71
|
+
*/
|
|
72
|
+
bool generate(const std::string& data, const std::string& output_path, const QROptions& options = QROptions());
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Generate QR code and return image data as buffer
|
|
76
|
+
*
|
|
77
|
+
* @param data The data to encode (supports UTF-8)
|
|
78
|
+
* @param buffer Output buffer for image data
|
|
79
|
+
* @param buffer_size Size of the output buffer
|
|
80
|
+
* @param options QR code generation options
|
|
81
|
+
* @return Size of image data written to buffer, or -1 on error
|
|
82
|
+
*/
|
|
83
|
+
int generate_to_buffer(const std::string& data, void* buffer, size_t buffer_size, const QROptions& options = QROptions());
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Get library version
|
|
87
|
+
*
|
|
88
|
+
* @return Version string (e.g., "1.0.0")
|
|
89
|
+
*/
|
|
90
|
+
const char* version();
|
|
91
|
+
|
|
92
|
+
} // namespace fastqr
|
|
93
|
+
|
|
94
|
+
#endif // FASTQR_H
|
|
95
|
+
|
|
Binary file
|
|
Binary file
|
data/src/fastqr.cpp
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fastqr
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- FastQR Project
|
|
@@ -101,7 +101,13 @@ files:
|
|
|
101
101
|
- bindings/ruby/lib/fastqr/platform.rb
|
|
102
102
|
- bindings/ruby/lib/fastqr/version.rb
|
|
103
103
|
- bindings/ruby/prebuilt/macos-arm64.tar.gz
|
|
104
|
+
- bindings/ruby/prebuilt/macos-arm64/bin/fastqr
|
|
105
|
+
- bindings/ruby/prebuilt/macos-arm64/include/fastqr.h
|
|
106
|
+
- bindings/ruby/prebuilt/macos-arm64/lib/libfastqr.dylib
|
|
104
107
|
- bindings/ruby/prebuilt/macos-x86_64.tar.gz
|
|
108
|
+
- bindings/ruby/prebuilt/macos-x86_64/bin/fastqr
|
|
109
|
+
- bindings/ruby/prebuilt/macos-x86_64/include/fastqr.h
|
|
110
|
+
- bindings/ruby/prebuilt/macos-x86_64/lib/libfastqr.dylib
|
|
105
111
|
- build.sh
|
|
106
112
|
- cmake/fastqrConfig.cmake.in
|
|
107
113
|
- composer.json
|