- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用这个 Delphi-Unit。我被迫使用这个旧的 Delphi 实现,所以不要问这个: https://github.com/foxitsoftware/DelphiZXingQRCode
只要我将纠错级别保持在“低”,它生成的 QR 码就可以被任何解码器解码。如果我增加纠错级别,生成的代码将无法被我迄今为止尝试过的任何解码器解码。但我被迫(根据标准)使用“中”纠错级别,不多也不少。
但是目前还不清楚如何提高纠错级别(ecl 从现在开始)。我假设它被硬编码在文件 DelphiZXingQRCode 的第 3491 行:Level.FBits := 1 上。我找到了一些有关代表 ecls 的十六进制数字的信息,但现在找不到它。但我尝试将这些十六进制数字作为位,并且 QRcode 上的 ecl 位相应地发生了变化。所以我假设十六进制数字是正确的(1=低,0=中,2=高,3=四分位数)。
这是一个带有 Level.FBits := 2 的 QRcode 示例,这意味着我希望 ecl 为“高”。内容是“Hello world”。中间的十字图像是我必须实现的标准[原文如此]的一部分,所以不要问这个。
有人知道如何解决这个问题吗?我尝试过……好吧……我试图理解代码,但它太多了。我就是无法修复它。如果我无法让其他人修复它,我将不得不......寻找另一个解决方案。这将是一个问题。
最佳答案
已解决。请参阅下面的代码。方法GenerateQRCode() 现在需要ErrorCorrectionLevel 的参数:整数0-3。似乎有效。我必须删除一些未更改的行,因为该文件对于 StackOverflow 来说太大了。合并你自己。
unit DelphiZXingQRCode;
// ZXing QRCode port to Delphi, by Debenu Pty Ltd
// www.debenu.com
// Original copyright notice
(*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*)
interface
type
TQRCodeEncoding = (qrAuto, qrNumeric, qrAlphanumeric, qrISO88591, qrUTF8NoBOM, qrUTF8BOM);
T2DBooleanArray = array of array of Boolean;
TDelphiZXingQRCode = class
protected
FData: WideString;
FRows: Integer;
FColumns: Integer;
FEncoding: TQRCodeEncoding;
FQuietZone: Integer;
FElements: T2DBooleanArray;
FErrorCorrectionLevel: integer;
procedure SetEncoding(NewEncoding: TQRCodeEncoding);
procedure SetData(const NewData: WideString);
procedure SetQuietZone(NewQuietZone: Integer);
procedure SetErrorCorrectionLevel(value: integer);
function GetIsBlack(Row, Column: Integer): Boolean;
procedure Update;
public
constructor Create;
property Data: WideString read FData write SetData;
property Encoding: TQRCodeEncoding read FEncoding write SetEncoding;
property ErrorCorrectionLevel: integer read fErrorCorrectionLevel write SetErrorCorrectionLevel;
property QuietZone: Integer read FQuietZone write SetQuietZone;
property Rows: Integer read FRows;
property Columns: Integer read FColumns;
property IsBlack[Row, Column: Integer]: Boolean read GetIsBlack;
end;
implementation
uses
SysUtils,
contnrs, Math, Classes;
type
TByteArray = array of Byte;
T2DByteArray = array of array of Byte;
TIntegerArray = array of Integer;
// File too large for Stackoverflow: Deleted unchanged lines.
{ TErrorCorrectionLevel }
procedure TErrorCorrectionLevel.Assign(Source: TErrorCorrectionLevel);
begin
Self.fOrdinal := Source.FOrdinal;
end;
constructor TErrorCorrectionLevel.Create(ordinalValue: integer);
begin
fOrdinal:=0;
if (ordinalValue >= 0) and (ordinalValue <=3) then
fOrdinal:=ordinalValue;
end;
function TErrorCorrectionLevel.GetBits: integer;
begin
if fOrdinal = 0 then // level L
result:=1
else
if fOrdinal = 1 then // level M
result:=0
else
if fOrdinal = 2 then // level Q
result:=3
else
if fOrdinal = 3 then // level H
result:=2
else
result:=1;
end;
// File too large for Stackoverflow: Deleted unchanged lines.
procedure TDelphiZXingQRCode.SetErrorCorrectionLevel(value: integer);
begin
if (value < 0) or (value > 3) then
raise Exception.Create('invalid error correction value. must be in range 0..3.');
if value <> fErrorCorrectionLevel then
begin
FErrorCorrectionLevel:=value;
Update;
end;
end;
procedure TDelphiZXingQRCode.SetQuietZone(NewQuietZone: Integer);
begin
if ((FQuietZone <> NewQuietZone) and (NewQuietZone >= 0) and (NewQuietZone <= 100)) then
begin
FQuietZone := NewQuietZone;
Update;
end;
end;
procedure TDelphiZXingQRCode.Update;
begin
FElements := GenerateQRCode(FData, Ord(FEncoding), FErrorCorrectionLevel);
FRows := Length(FElements) + FQuietZone * 2;
FColumns := FRows;
end;
end.
关于delphi - 由 DelphiZXingQRCode 编码的 QR 码无法在 ErrorCorrectionLevel > Low 的情况下解码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44160153/
我正在研究树问题 Convert Sorted Array to Binary Search Tree - LeetCode Given an array where elements are sor
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
目前我想使用来自 http://codepen.io/JaxoDI/pen/DtsdH 的评级系统.但目前它在您从右向左悬停时有效。请随意在给定的链接中尝试一下。但我想要一个从左到右悬停的评级系统。
我读过多篇文章,包括 Jon Bentley 的二分查找章节。这是我对 CORRECT 二进制搜索逻辑的理解,它在我所做的简单测试中有效: binarysearch (arr, low, high,
我设置了 doobie + hikaricp,其设置与默认设置类似。通过调试日志记录,我可以看到有多少连接处于事件/空闲状态,这也反射(reflect)了 pg_stat_activity 通过此查询
我了解 >>> 修复了溢出:当添加两个大的正长时,您最终可能会得到一个负数。有人能解释一下这种按位移位如何神奇地解决溢出问题吗?它与 >> 有何不同? 我的怀疑:我认为这与 Java 使用二进制补码这
返回值存储在内存中的哪个位置? 考虑以下代码: int add(int a, int b) { int result = a+b; return result; } void main
我打算开发一个内置 TI CC2540 的小型设备。它将与 iPhone4s 通信。该设备旨在接收来自 iPhone 的命令并对其执行特定操作。大多数时间设备处于空闲状态(99% 的时间)。但在任何时
嗯,这是一个低级问题 假设我存储一个数字(当然是二进制格式的计算机存储数字) 如何以十进制格式打印它。在高级程序中很明显,只需打印它,库就会为您完成。 但是在我没有这个库的非常低级的情况下怎么样。 我
您一直听说高频交易 (HFT) 以及算法有多快。但我想知道 - 现在什么是快? 更新 我考虑的不是交易所和运行交易应用程序的服务器之间的物理距离造成的延迟,而是程序本身引入的延迟。 更具体地说:从事件
嗨,我是韩国人,对“ Bootstrap 首先将自身复制到固定的高端内存地址以为操作系统释放低端内存”感到困惑。 我通过谷歌搜索发现的关于低内存的知识是,这是 DOS 系统中的第一个 640K 内存。
在 Trac 主要功能页面中 https://trac.edgewall.org/wiki/TracFeatures Trac 据说强调“易用性和低调”。有人可以解释一下“仪式”在软件使用方面的含义吗
我想知道在游戏过程中如何处理低电量警报。我使用 Cocos2D 来制作我的游戏。当出现短信或电话等中断时,我会让游戏暂停。但是低电量警报又如何呢?它们与其他中断相同吗?看来并非如此。 有什么方法可以检
我和一个 friend 正在与脑筋急转弯来回走,我不知道如何解决这个问题。我的假设是某些按位运算符是可能的,但不确定。 最佳答案 在C中,按位运算符: #include int add(int x,
如果你看过我的另一篇 question ,你会知道我已经花了这个周末组装一个 6502 CPU 仿真器作为一个编程练习。 CPU 模拟器大部分是完整的,从我有限的测试来看似乎相当准确,但是它运行得非常
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 3 年前。 Improve th
我想知道使用 Java 做一些低级或操作系统的东西(一个项目)是否有意义。我之所以问这个问题,是因为我想扩展我在 Java 方面的知识,并且我喜欢做文件压缩器、批量文件重命名器等工作。有没有我可以查看
Cheat Engine带有一个称为速度破解的功能,它基本上可以减慢或提高游戏速度。其实不光是游戏,如果有一款带时钟的软件也可以加快速度。这是如何运作的?我可能会想象有一些内部时钟在运行这些东西,但不
我知道 >> 表示有符号,>>> 表示无符号 类似的问题不能回答我的问题: Java, will (low + high) >>> 1 overflow? Safe integer middle va
我是一名法国学生,实际上我在移动应用程序中实习。 我使用以下代码创建了一个应用程序来获取有关加速度计传感器的信息: @Override protected void onCreate(Bundle s
我是一名优秀的程序员,十分优秀!