fastqr 1.0.14 → 1.0.16

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72b0cdd2bbb4146bb4aecf29f4512d0642cd133baa7cb2ba56b2753094960ef4
4
- data.tar.gz: cc580fdb28bce00a51c709bd254e567e470da68e59ba923761030c39b38a18b5
3
+ metadata.gz: 8052ae73e79a369c231c105363d4783192c181479344d5bda9f8653d183d9451
4
+ data.tar.gz: '0802a6f8da625c6a41f228e7e234ed8515705dc0f6ca11ba516317c7474836a7'
5
5
  SHA512:
6
- metadata.gz: 1aa068b171eea38eaa47fe5de6f34eb54e87860064bff61fc21cfa028ebf4625844610ab74877ae4a572dccb45f39a85979d417489e00bfa9d101750d7fa8e16
7
- data.tar.gz: ad41c89507e5dff8285e830a339dd2197512ac718285d3e9d3a9e6a7eb02e586835087558ce971a6ef437dc7e3c4270bf6c9cb07e0fde1a710c14d8c35eb4786
6
+ metadata.gz: f96dfffb85201c4a7f47af6e282df1ea324b040908942c157b3183bf6b29b149ea2cdaca0cb8cf396d60d96c2dbe765f006399c431f5b47fb26605b8214dd16a
7
+ data.tar.gz: f03a09575b0b7736f31d791544e6b1691c65e1e67601bb7249cf11d6d5d8ac8e07c4ea42de27bf094db182b5288e6eadf044f8007e5019476cf1eec6f50edae5
data/CMakeLists.txt CHANGED
@@ -1,5 +1,5 @@
1
1
  cmake_minimum_required(VERSION 3.15)
2
- project(fastqr VERSION 1.0.14 LANGUAGES CXX C)
2
+ project(fastqr VERSION 1.0.16 LANGUAGES CXX C)
3
3
 
4
4
  set(CMAKE_CXX_STANDARD 14)
5
5
  set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -20,7 +20,9 @@ option(FASTQR_BUILD_BINDINGS "Build language bindings" ON)
20
20
 
21
21
  # Find dependencies
22
22
  find_package(PkgConfig REQUIRED)
23
- find_package(PNG REQUIRED)
23
+
24
+ # Find libpng via pkg-config (more reliable than find_package)
25
+ pkg_check_modules(PNG REQUIRED libpng)
24
26
 
25
27
  # Find libqrencode
26
28
  pkg_check_modules(QRENCODE REQUIRED libqrencode)
@@ -66,7 +68,7 @@ target_link_directories(fastqr
66
68
  target_link_libraries(fastqr
67
69
  PRIVATE
68
70
  ${QRENCODE_LIBRARIES}
69
- PNG::PNG
71
+ ${PNG_LIBRARIES}
70
72
  )
71
73
 
72
74
  # Set library output name
@@ -83,6 +85,9 @@ add_executable(fastqr-cli
83
85
 
84
86
  # For standalone CLI binary, link with object library and static dependencies
85
87
  if(NOT BUILD_SHARED_LIBS)
88
+ # Add PNG library directories to search path
89
+ link_directories(${PNG_LIBRARY_DIRS})
90
+
86
91
  # Find static versions of libraries
87
92
  find_library(PNG_STATIC_LIBRARY
88
93
  NAMES libpng.a libpng16.a
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.14
1
+ 1.0.16
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastqr-pro",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
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",
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FastQR
4
- VERSION = "1.0.14"
4
+ VERSION = "1.0.16"
5
5
  end
6
6
 
@@ -101,8 +101,7 @@ module FastQR
101
101
  temp_file.close
102
102
 
103
103
  # Call CLI with batch mode
104
- lib_dir = File.expand_path('../../../lib', __dir__)
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]
@@ -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
+