fastqr 1.0.15 → 1.0.18
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/CMakeLists.txt +14 -14
- data/VERSION +1 -1
- data/bindings/nodejs/package.json +1 -1
- data/bindings/ruby/lib/fastqr/version.rb +1 -1
- data/bindings/ruby/lib/fastqr.rb +1 -2
- data/bindings/ruby/prebuilt/linux-aarch64/bin/fastqr +0 -0
- data/bindings/ruby/prebuilt/linux-aarch64/include/fastqr.h +142 -0
- data/bindings/ruby/prebuilt/linux-aarch64/include/stb_image.h +7988 -0
- data/bindings/ruby/prebuilt/linux-aarch64/include/stb_image_write.h +1724 -0
- data/bindings/ruby/prebuilt/linux-arm64.tar.gz +0 -0
- data/bindings/ruby/prebuilt/linux-x86_64/bin/fastqr +0 -0
- data/bindings/ruby/prebuilt/linux-x86_64/include/fastqr.h +142 -0
- data/bindings/ruby/prebuilt/linux-x86_64/include/stb_image.h +7988 -0
- data/bindings/ruby/prebuilt/linux-x86_64/include/stb_image_write.h +1724 -0
- data/bindings/ruby/prebuilt/linux-x86_64.tar.gz +0 -0
- data/bindings/ruby/prebuilt/macos-arm64/bin/fastqr +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.tar.gz +0 -0
- data/scripts/build-binaries.sh +7 -0
- data/src/fastqr.cpp +1 -1
- metadata +11 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 90d2641326b26cbd7eba9f4d236c2ec1dcb7dd383ab98c3d68e9a65b42a11d3a
|
|
4
|
+
data.tar.gz: 16b4002229fe498291a9ed8ccfb80ad9732b36d7552a6788456e50947f107c01
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d645c37db8bdb8e987589283998a4460fdf76de7404e03bb48218f2bf040179a06857335179829dd6eb7edd432b46039ad47206f6fba196277853da7d990ecb5
|
|
7
|
+
data.tar.gz: 91f881148ca5c2d2ba5281b211d11d354133a1ac81d035a49c10df29449a00b68f2f27772337c6bb37b99bb5efa82dddfb468bdd04c750c6181372f1099c5a46
|
data/CMakeLists.txt
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
cmake_minimum_required(VERSION 3.15)
|
|
2
|
-
project(fastqr VERSION 1.0.
|
|
2
|
+
project(fastqr VERSION 1.0.18 LANGUAGES CXX C)
|
|
3
3
|
|
|
4
4
|
set(CMAKE_CXX_STANDARD 14)
|
|
5
5
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
@@ -87,28 +87,28 @@ add_executable(fastqr-cli
|
|
|
87
87
|
if(NOT BUILD_SHARED_LIBS)
|
|
88
88
|
# Add PNG library directories to search path
|
|
89
89
|
link_directories(${PNG_LIBRARY_DIRS})
|
|
90
|
-
|
|
90
|
+
|
|
91
91
|
# Find static versions of libraries
|
|
92
|
-
find_library(PNG_STATIC_LIBRARY
|
|
92
|
+
find_library(PNG_STATIC_LIBRARY
|
|
93
93
|
NAMES libpng.a libpng16.a
|
|
94
|
-
PATHS
|
|
95
|
-
${PNG_LIBRARY_DIRS}
|
|
96
|
-
/usr/local/lib
|
|
97
|
-
/opt/homebrew/lib
|
|
98
|
-
/usr/lib
|
|
99
|
-
NO_DEFAULT_PATH
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
find_library(QRENCODE_STATIC_LIBRARY
|
|
103
|
-
NAMES libqrencode.a
|
|
104
94
|
PATHS
|
|
105
|
-
${
|
|
95
|
+
${PNG_LIBRARY_DIRS}
|
|
106
96
|
/usr/local/lib
|
|
107
97
|
/opt/homebrew/lib
|
|
108
98
|
/usr/lib
|
|
109
99
|
NO_DEFAULT_PATH
|
|
110
100
|
)
|
|
111
101
|
|
|
102
|
+
find_library(QRENCODE_STATIC_LIBRARY
|
|
103
|
+
NAMES libqrencode.a
|
|
104
|
+
PATHS
|
|
105
|
+
/usr/local/lib # Linux: from source build
|
|
106
|
+
${QRENCODE_LIBRARY_DIRS}
|
|
107
|
+
/opt/homebrew/lib # macOS: from Homebrew
|
|
108
|
+
/usr/lib
|
|
109
|
+
NO_DEFAULT_PATH
|
|
110
|
+
)
|
|
111
|
+
|
|
112
112
|
if(PNG_STATIC_LIBRARY AND QRENCODE_STATIC_LIBRARY)
|
|
113
113
|
message(STATUS "✓ Found static libpng: ${PNG_STATIC_LIBRARY}")
|
|
114
114
|
message(STATUS "✓ Found static libqrencode: ${QRENCODE_STATIC_LIBRARY}")
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.18
|
data/bindings/ruby/lib/fastqr.rb
CHANGED
|
@@ -101,8 +101,7 @@ module FastQR
|
|
|
101
101
|
temp_file.close
|
|
102
102
|
|
|
103
103
|
# Call CLI with batch mode
|
|
104
|
-
|
|
105
|
-
cli_path = File.join(lib_dir, Platform.binary_name)
|
|
104
|
+
cli_path = Platform.find_binary
|
|
106
105
|
|
|
107
106
|
# Build command
|
|
108
107
|
cmd_parts = [cli_path, '-F', temp_file.path, output_dir]
|
|
Binary file
|
|
@@ -0,0 +1,142 @@
|
|
|
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 size (QR codes are square)
|
|
39
|
+
int size = 300;
|
|
40
|
+
|
|
41
|
+
// Optimize size - round up to nearest integer multiple for best performance
|
|
42
|
+
bool optimize_size = false;
|
|
43
|
+
|
|
44
|
+
// QR code colors (RGB)
|
|
45
|
+
struct Color {
|
|
46
|
+
uint8_t r = 0;
|
|
47
|
+
uint8_t g = 0;
|
|
48
|
+
uint8_t b = 0;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
Color foreground = {0, 0, 0}; // QR code color (default: black)
|
|
52
|
+
Color background = {255, 255, 255}; // Background color (default: white)
|
|
53
|
+
|
|
54
|
+
// Error correction level
|
|
55
|
+
ErrorCorrectionLevel ec_level = ErrorCorrectionLevel::MEDIUM;
|
|
56
|
+
|
|
57
|
+
// Logo options
|
|
58
|
+
std::string logo_path = ""; // Path to logo image
|
|
59
|
+
int logo_size_percent = 20; // Logo size as percentage of QR code (default: 20%)
|
|
60
|
+
|
|
61
|
+
// Output format
|
|
62
|
+
std::string format = "png"; // png, jpg, webp, etc.
|
|
63
|
+
int quality = 95; // For lossy formats (1-100)
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Generate QR code and save to file
|
|
68
|
+
*
|
|
69
|
+
* @param data The data to encode (supports UTF-8)
|
|
70
|
+
* @param output_path Path to save the generated QR code image
|
|
71
|
+
* @param options QR code generation options
|
|
72
|
+
* @return true if successful, false otherwise
|
|
73
|
+
*/
|
|
74
|
+
bool generate(const std::string& data, const std::string& output_path, const QROptions& options = QROptions());
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Generate QR code and return image data as buffer
|
|
78
|
+
*
|
|
79
|
+
* @param data The data to encode (supports UTF-8)
|
|
80
|
+
* @param buffer Output buffer for image data
|
|
81
|
+
* @param buffer_size Size of the output buffer
|
|
82
|
+
* @param options QR code generation options
|
|
83
|
+
* @return Size of image data written to buffer, or -1 on error
|
|
84
|
+
*/
|
|
85
|
+
int generate_to_buffer(const std::string& data, void* buffer, size_t buffer_size, const QROptions& options = QROptions());
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Get library version
|
|
89
|
+
*
|
|
90
|
+
* @return Version string (e.g., "1.0.0")
|
|
91
|
+
*/
|
|
92
|
+
const char* version();
|
|
93
|
+
|
|
94
|
+
} // namespace fastqr
|
|
95
|
+
|
|
96
|
+
// C API for FFI bindings (Ruby, Node.js, Python, etc.)
|
|
97
|
+
#ifdef __cplusplus
|
|
98
|
+
extern "C" {
|
|
99
|
+
#endif
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* C struct for QR options (FFI-friendly)
|
|
103
|
+
*/
|
|
104
|
+
typedef struct {
|
|
105
|
+
int size;
|
|
106
|
+
int optimize_size; // boolean: 0 or 1
|
|
107
|
+
unsigned char foreground_r;
|
|
108
|
+
unsigned char foreground_g;
|
|
109
|
+
unsigned char foreground_b;
|
|
110
|
+
unsigned char background_r;
|
|
111
|
+
unsigned char background_g;
|
|
112
|
+
unsigned char background_b;
|
|
113
|
+
int ec_level; // 0=LOW, 1=MEDIUM, 2=QUARTILE, 3=HIGH
|
|
114
|
+
const char* logo_path;
|
|
115
|
+
int logo_size_percent;
|
|
116
|
+
const char* format;
|
|
117
|
+
int quality;
|
|
118
|
+
} QROptions;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Generate QR code (C API)
|
|
122
|
+
*
|
|
123
|
+
* @param data Data to encode (UTF-8 string)
|
|
124
|
+
* @param output_path Path to save the QR code image
|
|
125
|
+
* @param options Pointer to QROptions struct (can be NULL for defaults)
|
|
126
|
+
* @return 1 if successful, 0 on error
|
|
127
|
+
*/
|
|
128
|
+
int fastqr_generate(const char* data, const char* output_path, const QROptions* options);
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Get library version (C API)
|
|
132
|
+
*
|
|
133
|
+
* @return Version string (e.g., "1.0.7")
|
|
134
|
+
*/
|
|
135
|
+
const char* fastqr_version(void);
|
|
136
|
+
|
|
137
|
+
#ifdef __cplusplus
|
|
138
|
+
}
|
|
139
|
+
#endif
|
|
140
|
+
|
|
141
|
+
#endif // FASTQR_H
|
|
142
|
+
|