ZXingCpp.Angle 3.1.1-angle.1

This is a prerelease version of ZXingCpp.Angle.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package ZXingCpp.Angle --version 3.1.1-angle.1
                    
NuGet\Install-Package ZXingCpp.Angle -Version 3.1.1-angle.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ZXingCpp.Angle" Version="3.1.1-angle.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZXingCpp.Angle" Version="3.1.1-angle.1" />
                    
Directory.Packages.props
<PackageReference Include="ZXingCpp.Angle" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ZXingCpp.Angle --version 3.1.1-angle.1
                    
#r "nuget: ZXingCpp.Angle, 3.1.1-angle.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ZXingCpp.Angle@3.1.1-angle.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ZXingCpp.Angle&version=3.1.1-angle.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=ZXingCpp.Angle&version=3.1.1-angle.1&prerelease
                    
Install as a Cake Tool

ZXingCpp.Angle

非官方修改版:基于 zxing-cpp 3.1.1 与官方 .NET 封装 ZXingCpp 0.5.3,新增一维条码任意角度识别。

⚠️ 这是替代包:请用它替换官方的 ZXingCpp 包,不要把两个包同时引用(托管程序集同名)。

相对上游的改进

项目 上游 3.1.1 本包
一维码可读角度 0°/90°(倾斜约 8~19° 以上就失败,取决于条码宽高比) ±45° + 0°/90°
细模组条码(1~2 px/模块、无抗锯齿截图) 常常失败 亚像素(2 点/像素)采样后可读
小条码在大照片里(占画面 2% 左右) 常失败 瓦片候选区域 + 细角度扫描后可读
反向读取时的识别框 可能被拉成对角线 已修正

解码结果(内容、格式、Position、Rotation)语义与官方一致;rotation() 折叠在 (-90°, 90°] (例如同一条轴会报 -64° 而不是 118°,两者等价)。

用法

与官方完全一致:

using ZXingCpp;

using var bmp = new Bitmap(path);
var data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height),
                        ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
var iv = new ImageView(data.Scan0, bmp.Width, bmp.Height, ImageFormat.BGRA, data.Stride);
var reader = new BarcodeReader { TryHarder = true, TryRotate = true, TryInvert = true };
foreach (var bc in reader.From(iv))
    Console.WriteLine($"{bc.Format} {bc.Text} rot={bc.Rotation}");

注意:把图片画到新的 32bpp 位图上时用 DrawImage(src, 0, 0, src.Width, src.Height)(显式宽高), 否则 GDI+ 会按 DPI 缩放,条码被缩小后可能解不出。

平台

本包只带 win-x64 的原生库(runtimes/win-x64/native/ZXing.dll)。 其它平台请自行用修改后的源码编译(-DBUILD_SHARED_LIBS=ON -DZXING_C_API=ON)。

许可与声明

Apache-2.0,见随包的 LICENSE。对上游源码的修改清单见 NOTICE.md(Apache-2.0 §4(b) 要求声明修改)。 本项目与 zxing-cpp 作者无关,也未获其背书;问题请提到本包仓库,不要打扰上游。

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.1.1-angle.2 92 10/17/2026
3.1.1-angle.1 79 10/17/2026
1.4.15 93 11/30/2026
1.2.1 129 10/26/2026
1.2.0 103 10/26/2026
1.1.0 113 10/25/2026
1.0.0 121 10/18/2026

基于 zxing-cpp 3.1.1:新增一维条码任意角度识别(±45°)、亚像素扫描线采样、瓦片局部搜索、反向读取位置修正。详见 NOTICE.md。