Skip to content

Adding a wrapper for iOS #337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 92 commits into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
6dd5c57
Add iOS Wrapper
parallaxe Feb 25, 2022
9c7659d
Add a demo project
parallaxe May 24, 2022
cc699a8
Add SPDX-License-Identifier: Apache-2. to sources
parallaxe Jun 2, 2022
b79fb7a
Update copyright comments
parallaxe Jun 2, 2022
7074871
ci: exclude test/samples from "Source code" release assets
axxel Jun 1, 2022
71adf1d
example: install the ZXingReader and ZXingWriter
axxel Jun 3, 2022
109d81e
CharacterSet: new CharacterSetFromString and deprecated CharacterSetECI
axxel Jun 3, 2022
e4604f6
CharacterSet: introduce name normalization like in BarcodeFormatFromS…
axxel Jun 3, 2022
eea9ea0
ECI: remove the need to publish ECI.h (via Content.h -> Result.h)
axxel Jun 3, 2022
305ef8a
cmake: only install minimal set of header files
axxel Jun 3, 2022
798673c
Add .gitignore
ChristianNorbertBraun Jun 20, 2022
4de75d7
Add license comments
ChristianNorbertBraun Jun 20, 2022
20cd066
Rename to ZXingCpp
ChristianNorbertBraun Jun 20, 2022
fe75d0f
Disable printing of written code in debug mode
ChristianNorbertBraun Jun 20, 2022
24044e3
Add WriteViewController to demo project
ChristianNorbertBraun Jun 20, 2022
82dceba
Use .binary() on result for reader
ChristianNorbertBraun Jun 20, 2022
dd9831a
Update .gitignore
ChristianNorbertBraun Jun 20, 2022
fd79e7a
Make demo app only work in portrait
ChristianNorbertBraun Jun 20, 2022
0840db6
Set demo development team to None
ChristianNorbertBraun Jun 20, 2022
b43cc2b
Remove whitelines
ChristianNorbertBraun Jun 20, 2022
23c2051
Add maxSymbolNumber and downscale option to hints
ChristianNorbertBraun Jun 20, 2022
0c3e097
WIP: Return multiple results
ChristianNorbertBraun Jun 20, 2022
32e813b
CharacterSet: replace deprecated CharsetFromName in WASM wrapper
axxel Jun 3, 2022
6b7c776
DMDecoder: set missing Result::applicationIndicator
axxel Jun 6, 2022
8e64c30
Result: add GS1, ISO15434 and UnknownECI ContentTypes
axxel Jun 6, 2022
9aac5f6
Result: deprecate rawBytes and numBits
axxel Jun 6, 2022
72e8ae1
Result: rename `binary` to `bytes`
axxel Jun 7, 2022
27ef8f6
python: add the `bytes` property to the Result struct
axxel Jun 7, 2022
97adf17
Result: add MergeStructuredAppendResults()
axxel Jun 8, 2022
e6b8558
DecoderResult: remove `text` and `symbologyIdentifier` member variables
axxel Jun 8, 2022
9633b25
TextDecoder: non-printable ASCII control chars -> probably not Shift_JIS
axxel Jun 8, 2022
84ec5b9
ECI: change handling of pseudo-ECIs to fix MergeStructuredAppendResults
axxel Jun 9, 2022
f8e4117
Result: clear position and structuredAppendIndex in merged result
axxel Jun 9, 2022
69576e3
Result: add MergeStructuredAppendSequences for automatically merging
axxel Jun 9, 2022
d0a8b9f
example: port ZXingQtReader to Qt6
axxel Jun 13, 2022
5bd41cd
cmake: revert breaking change of `INTERFACE "$<INSTALL_INTERFACE:incl…
axxel Jun 13, 2022
9df7ef5
API: improve a few comments for public symbols
axxel Jun 14, 2022
29388db
Result: remove applicationIndicator property (for now)
axxel Jun 14, 2022
f4c18c1
Result: increase API resilience against future ABI breakages (de-inli…
axxel Jun 14, 2022
0a3f169
GridSampler: support multi-symbol debugging
axxel Jun 18, 2022
9760a0b
QRCode: detect mirrored symbols directly from FormatInfo bits
axxel Jun 18, 2022
2de9605
MicoQRCode: choose orientation with the lowest hamming distance Forma…
axxel Jun 18, 2022
78f2b4e
Result: compare bytes instead of text in opoerator== (performance)
axxel Jun 18, 2022
ad70b40
Result: rename utf8Protocol -> utf8ECI
axxel Jun 18, 2022
c4748b1
GTIN: parse the `bytes()` instead of `text()` in `EanAddOn()`
axxel Jun 19, 2022
fdca0b6
example: don't double quote the `bytes` result in ZXingReader output
axxel Jun 19, 2022
805c793
example: use new Result::utf8()
axxel Jun 20, 2022
4618689
Result: add new `utf8` property (forgot in last commit)
axxel Jun 20, 2022
feba841
Writers: add utf8 overload for `encode()` functions
axxel Jun 20, 2022
6284572
Content: cleanup text/utf8/utf16 situation and remove code duplication
axxel Jun 20, 2022
48ec194
Result: #define ZX_USE_UTF8 to transition from std::wstring to std::s…
axxel Jun 20, 2022
1a27185
License: add overlooked SPDX-License-Identifier in 2 files
axxel Jun 20, 2022
c44da70
Use .bytes() instead of .binary() on Result
ChristianNorbertBraun Jun 21, 2022
7a23355
Use NSInteger for maxNumberOfSymbols
ChristianNorbertBraun Jun 21, 2022
82ec9c9
Renaming rawBytes to bytes on Result
ChristianNorbertBraun Jun 21, 2022
403337e
Move MicroQRCode next to QRCode in ZXIFormat
ChristianNorbertBraun Jun 21, 2022
d843be1
Remove errors from reader
ChristianNorbertBraun Jun 21, 2022
da3a9c6
Update ZXIErrors
ChristianNorbertBraun Jun 21, 2022
222841c
Update demo project for new read api
ChristianNorbertBraun Jun 21, 2022
f6090cc
Remove whiteline
ChristianNorbertBraun Jun 21, 2022
ec22310
Add position to ZXIResult
ChristianNorbertBraun Jun 21, 2022
febea8d
Update umbrella header
ChristianNorbertBraun Jun 21, 2022
ba8def7
android: add `bytes` and `contentType` members to `Result`
axxel Jun 21, 2022
a4f359f
python: add `content_type` property in Result
axxel Jun 21, 2022
2b03796
Code128: properly report contentType GS1
axxel Jun 21, 2022
4122e14
Result: report (empty) NotFound results as ContentType::Text
axxel Jun 21, 2022
509a4ab
test: add a few checks for contentType to black box tests
axxel Jun 21, 2022
520bc12
Rename local variable to bytes
ChristianNorbertBraun Jun 21, 2022
25393b5
Add correct license header
ChristianNorbertBraun Jun 21, 2022
1fcd508
Merge branch 'master' into ios_wrapper
axxel Jun 3, 2022
d5183d1
Add StructuredAppend.h to common files again
ChristianNorbertBraun Jun 22, 2022
6505e3c
Merge remote-tracking branch 'origin/master' into ios_wrapper
ChristianNorbertBraun Jun 22, 2022
8fbe696
Update README.md
ChristianNorbertBraun Jun 22, 2022
7f6256f
Set team to None
ChristianNorbertBraun Jun 22, 2022
81d6746
Add api to work directly with CVPixelBuffer
ChristianNorbertBraun Jun 28, 2022
57a223a
Update .gitignore
ChristianNorbertBraun Jun 28, 2022
6ef880d
Merge remote-tracking branch 'origin/master' into ios_wrapper
ChristianNorbertBraun Jun 28, 2022
399b3a0
Create build-ios.yml
ChristianNorbertBraun Jul 1, 2022
2c09991
Revert "Create build-ios.yml"
ChristianNorbertBraun Jul 1, 2022
be84df6
Add ci for iOS wrapper
ChristianNorbertBraun Jul 1, 2022
104b4e5
Merge remote-tracking branch 'origin/master' into ios_wrapper
ChristianNorbertBraun Jul 5, 2022
42fa8ea
Remove fmtlib-src
ChristianNorbertBraun Jul 5, 2022
19556e3
Use readImageView to remove code duplication
ChristianNorbertBraun Jul 5, 2022
48c9315
Remove ZXing from target include directory path
ChristianNorbertBraun Jul 5, 2022
9c9d257
Add #define ZX_USE_UTF8 to get utf8 std::string
ChristianNorbertBraun Jul 5, 2022
4250ba4
Rename 1D and 2D codes to linear and matrix
ChristianNorbertBraun Jul 6, 2022
9cbe49f
Remove error check for result
ChristianNorbertBraun Jul 6, 2022
8621191
Remove charset from writer api
ChristianNorbertBraun Jul 8, 2022
651e54d
Remove character encoding
ChristianNorbertBraun Jul 11, 2022
c1c7898
Use initWithBytes for text
ChristianNorbertBraun Jul 11, 2022
5844605
Merge branch 'master' of https://github.com/nu-book/zxing-cpp into io…
ChristianNorbertBraun Jul 11, 2022
f1fe8b2
Remove #define ZX_USE_UTF8
ChristianNorbertBraun Jul 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,29 @@ jobs:
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -V -C $BUILD_TYPE

build-ios:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{github.ref}}

- name: Build the ZXingCpp.xcframework
shell: sh
working-directory: ${{runner.workspace}}/${{github.event.repository.name}}/wrappers/ios
run: ./build-release.sh

- name: Upload .xcframework
uses: actions/upload-artifact@v3
with:
name: ios-artifacts
path: ${{runner.workspace}}/${{github.event.repository.name}}/wrappers/ios/ZXingCpp.xcframework

- name: Build the demo app
shell: sh
working-directory: ${{runner.workspace}}/${{github.event.repository.name}}/wrappers/ios/demo
run: xcodebuild build -scheme demo -sdk "iphonesimulator"

build-android:
runs-on: ubuntu-latest
Expand Down
19 changes: 19 additions & 0 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ if (BUILD_READERS)
src/Result.cpp
src/ResultPoint.h
src/ResultPoint.cpp
src/StructuredAppend.h
src/TextDecoder.h
src/TextDecoder.cpp
src/ThresholdBinarizer.h
Expand Down Expand Up @@ -484,13 +485,31 @@ endif()

set_target_properties(ZXing PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}")

if (APPLE)
set_target_properties(ZXing PROPERTIES
FRAMEWORK TRUE
FRAMEWORK_VERSION "C"
XCODE_ATTRIBUTE_DEFINES_MODULE YES
XCODE_ATTRIBUTE_BUILD_LIBRARY_FOR_DISTRIBUTION YES
XCODE_ATTRIBUTE_MODULEMAP_FILE "wrappers/ios/Sources/Wrapper/module.modulemap"
XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES
MACOSX_FRAMEWORK_IDENTIFIER "com.zxing_cpp.ios"
CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH NO
#MACOSX_FRAMEWORK_INFO_PLIST Info.plist
PUBLIC_HEADER "${PUBLIC_HEADERS}"
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
XCODE_ATTRIBUTE_ENABLE_BITCODE "YES"
)
endif()

include (GNUInstallDirs)

install (
TARGETS ZXing EXPORT ZXingTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR}
# INCLUDES DESTINATION include
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ZXing"
)
Expand Down
5 changes: 5 additions & 0 deletions wrappers/ios/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.swiftpm
_builds
.build
xcuserdata
ZXingCpp.xcframework
Binary file added wrappers/ios/Info.plist
Binary file not shown.
31 changes: 31 additions & 0 deletions wrappers/ios/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// swift-tools-version:5.3
import PackageDescription

let package = Package(
name: "ZXingCppWrapper",
platforms: [
.iOS(.v13)
],
products: [
.library(
name: "ZXingCppWrapper",
type: .static,
targets: ["ZXingCppWrapper"])
],
targets: [
.binaryTarget(
name: "ZXingCpp",
path: "ZXingCpp.xcframework"
),
.target(
name: "ZXingCppWrapper",
dependencies: ["ZXingCpp"],
path: "Sources/Wrapper",
publicHeadersPath: ".",
cxxSettings: [
.unsafeFlags(["-stdlib=libc++"]),
.unsafeFlags(["-std=gnu++17"])
]
)
]
)
14 changes: 14 additions & 0 deletions wrappers/ios/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# ZXingCpp iOS Framework

To use the iOS (wrapper) framework in other apps, it is easiest
to build the library project and include the resulting xcframework
file in your app.

## How to build and use

To build the xcframework:

$ ./build-release.sh

Then you can add the iOS Wrapper as a local Swift Package by adding it as a dependency to your app.
Don't forget to add the wrapper to the `Frameworks, Libraries, and Embedded Content` section within the `General` tab.
21 changes: 21 additions & 0 deletions wrappers/ios/Sources/Wrapper/Reader/ZXIBarcodeReader.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2022 KURZ Digital Solutions GmbH
//
// SPDX-License-Identifier: Apache-2.0

#import <CoreGraphics/CoreGraphics.h>
#import <CoreImage/CoreImage.h>
#import "ZXIResult.h"
#import "ZXIDecodeHints.h"

NS_ASSUME_NONNULL_BEGIN

@interface ZXIBarcodeReader : NSObject
@property(nonatomic, strong) ZXIDecodeHints *hints;

- (instancetype)initWithHints:(ZXIDecodeHints*)options;
- (NSArray<ZXIResult *> *)readCIImage:(nonnull CIImage *)image;
- (NSArray<ZXIResult *> *)readCGImage:(nonnull CGImageRef)image;
- (NSArray<ZXIResult *> *)readCVPixelBuffer:(nonnull CVPixelBufferRef)pixelBuffer;
@end

NS_ASSUME_NONNULL_END
127 changes: 127 additions & 0 deletions wrappers/ios/Sources/Wrapper/Reader/ZXIBarcodeReader.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
// Copyright 2022 KURZ Digital Solutions GmbH
//
// SPDX-License-Identifier: Apache-2.0

#import "ZXIBarcodeReader.h"
#import "ZXing/ReadBarcode.h"
#import "ZXing/ImageView.h"
#import "ZXing/Result.h"
#import "ZXIFormatHelper.h"
#import "ZXIPosition+Helper.h"

using namespace ZXing;

@interface ZXIBarcodeReader()
@property (nonatomic, strong) CIContext* ciContext;
@end

@implementation ZXIBarcodeReader

- (instancetype)init {
return [self initWithHints: [[ZXIDecodeHints alloc]initWithTryHarder:NO tryRotate:NO tryDownscale:NO maxNumberOfSymbols:1 formats:@[]]];
}

- (instancetype)initWithHints:(ZXIDecodeHints*)hints{
self = [super init];
self.ciContext = [CIContext new];
self.hints = hints;
return self;
}

- (NSArray<ZXIResult *> *)readCVPixelBuffer:(nonnull CVPixelBufferRef)pixelBuffer {
OSType pixelFormat = CVPixelBufferGetPixelFormatType(pixelBuffer);

// We tried to work with all luminance based formats listed in kCVPixelFormatType
// but only the following ones seem to be supported on iOS.
switch (pixelFormat) {
case kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange:
case kCVPixelFormatType_420YpCbCr8BiPlanarFullRange:
NSInteger cols = CVPixelBufferGetWidth(pixelBuffer);
NSInteger rows = CVPixelBufferGetHeight(pixelBuffer);
NSInteger bytesPerRow = CVPixelBufferGetBytesPerRowOfPlane(pixelBuffer, 0);
CVPixelBufferLockBaseAddress(pixelBuffer, kCVPixelBufferLock_ReadOnly);
const uint8_t * bytes = static_cast<const uint8_t *>(CVPixelBufferGetBaseAddressOfPlane(pixelBuffer, 0));
ImageView imageView = ImageView(
static_cast<const uint8_t *>(bytes),
static_cast<int>(cols),
static_cast<int>(rows),
ImageFormat::Lum,
static_cast<int>(bytesPerRow),
0);
NSArray* results = [self readImageView:imageView];
CVPixelBufferUnlockBaseAddress(pixelBuffer, kCVPixelBufferLock_ReadOnly);
return results;
}

// If given pixel format is not a supported type with a luminance channel we just use the
// default method
return [self readCIImage:[[CIImage alloc] initWithCVImageBuffer:pixelBuffer]];
}

- (NSArray<ZXIResult *> *)readCIImage:(nonnull CIImage *)image {
CGImageRef cgImage = [self.ciContext createCGImage:image fromRect:image.extent];
auto results = [self readCGImage:cgImage];
CGImageRelease(cgImage);
return results;
}

- (NSArray<ZXIResult *> *)readCGImage: (nonnull CGImageRef)image {
CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericGray);
CGFloat cols = CGImageGetWidth(image);
CGFloat rows = CGImageGetHeight(image);
NSMutableData *data = [NSMutableData dataWithLength: cols * rows];


CGContextRef contextRef = CGBitmapContextCreate(
data.mutableBytes,// Pointer to backing data
cols, // Width of bitmap
rows, // Height of bitmap
8, // Bits per component
cols, // Bytes per row
colorSpace, // Colorspace
kCGBitmapByteOrderDefault); // Bitmap info flags
CGContextDrawImage(contextRef, CGRectMake(0, 0, cols, rows), image);
CGContextRelease(contextRef);

ImageView imageView = ImageView(
static_cast<const uint8_t *>(data.bytes),
static_cast<int>(cols),
static_cast<int>(rows),
ImageFormat::Lum);
return [self readImageView:imageView];
}

+ (DecodeHints)DecodeHintsFromZXIOptions:(ZXIDecodeHints*)hints {
BarcodeFormats formats;
for(NSNumber* flag in hints.formats) {
formats.setFlag(BarcodeFormatFromZXIFormat((ZXIFormat)flag.integerValue));
}
DecodeHints resultingHints = DecodeHints()
.setTryRotate(hints.tryRotate)
.setTryHarder(hints.tryHarder)
.setTryDownscale(hints.tryDownscale)
.setFormats(formats)
.setMaxNumberOfSymbols(hints.maxNumberOfSymbols);
return resultingHints;
}

- (NSArray<ZXIResult*> *)readImageView: (ImageView)imageView {
Results results = ReadBarcodes(imageView, [ZXIBarcodeReader DecodeHintsFromZXIOptions:self.hints]);

NSMutableArray* zxiResults = [NSMutableArray array];
for (auto result: results) {
auto resultText = result.text();
NSString *text = [[NSString alloc]initWithBytes:resultText.data() length:resultText.size() encoding:NSUTF8StringEncoding];

NSData *bytes = [[NSData alloc] initWithBytes:result.bytes().data() length:result.bytes().size()];
[zxiResults addObject:
[[ZXIResult alloc] init:text
format:ZXIFormatFromBarcodeFormat(result.format())
bytes:bytes
position:[[ZXIPosition alloc]initWithPosition: result.position()]
]];
}
return zxiResults;
}

@end
24 changes: 24 additions & 0 deletions wrappers/ios/Sources/Wrapper/Reader/ZXIDecodeHints.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2022 KURZ Digital Solutions GmbH
//
// SPDX-License-Identifier: Apache-2.0

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface ZXIDecodeHints : NSObject
@property(nonatomic) BOOL tryHarder;
@property(nonatomic) BOOL tryRotate;
@property(nonatomic) BOOL tryDownscale;
@property(nonatomic) NSInteger maxNumberOfSymbols;
/// An array of ZXIFormat
@property(nonatomic, strong) NSArray<NSNumber*> *formats;

- (instancetype)initWithTryHarder:(BOOL)tryHarder
tryRotate:(BOOL)tryRotate
tryDownscale:(BOOL)tryDownscale
maxNumberOfSymbols:(NSInteger)maxNumberOfSymbol
formats:(NSArray<NSNumber*>*)formats;
@end

NS_ASSUME_NONNULL_END
23 changes: 23 additions & 0 deletions wrappers/ios/Sources/Wrapper/Reader/ZXIDecodeHints.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright 2022 KURZ Digital Solutions GmbH
//
// SPDX-License-Identifier: Apache-2.0

#import "ZXIDecodeHints.h"

@implementation ZXIDecodeHints

- (instancetype)initWithTryHarder:(BOOL)tryHarder
tryRotate:(BOOL)tryRotate
tryDownscale:(BOOL)tryDownscale
maxNumberOfSymbols:(NSInteger)maxNumberOfSymbols
formats:(NSArray<NSNumber*>*)formats {
self = [super init];
self.tryHarder = tryHarder;
self.tryRotate = tryRotate;
self.tryDownscale = tryDownscale;
self.maxNumberOfSymbols = maxNumberOfSymbols;
self.formats = formats;
return self;
}

@end
17 changes: 17 additions & 0 deletions wrappers/ios/Sources/Wrapper/Reader/ZXIPoint.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2022 KURZ Digital Solutions GmbH
//
// SPDX-License-Identifier: Apache-2.0


#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface ZXIPoint : NSObject
@property(nonatomic) NSInteger x;
@property(nonatomic) NSInteger y;

- (instancetype)initWithX:(NSInteger)x y:(NSInteger)y;
@end

NS_ASSUME_NONNULL_END
16 changes: 16 additions & 0 deletions wrappers/ios/Sources/Wrapper/Reader/ZXIPoint.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2022 KURZ Digital Solutions GmbH
//
// SPDX-License-Identifier: Apache-2.0


#import "ZXIPoint.h"

@implementation ZXIPoint

- (instancetype)initWithX:(NSInteger)x y:(NSInteger)y {
self = [super init];
self.x = x;
self.y = y;
return self;
}
@end
15 changes: 15 additions & 0 deletions wrappers/ios/Sources/Wrapper/Reader/ZXIPosition+Helper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright 2022 KURZ Digital Solutions GmbH
//
// SPDX-License-Identifier: Apache-2.0

#import <Foundation/Foundation.h>
#import "ZXIPosition.h"
#import "ZXing/Result.h"

NS_ASSUME_NONNULL_BEGIN

@interface ZXIPosition(Helper)
- (instancetype)initWithPosition:(ZXing::Position)position;
@end

NS_ASSUME_NONNULL_END
17 changes: 17 additions & 0 deletions wrappers/ios/Sources/Wrapper/Reader/ZXIPosition+Helper.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2022 KURZ Digital Solutions GmbH
//
// SPDX-License-Identifier: Apache-2.0


#import "ZXIPosition+Helper.h"
#import "ZXIPoint.h"

@implementation ZXIPosition(Helper)
-(instancetype)initWithPosition:(ZXing::Position)position {
return [self initWithTopLeft:[[ZXIPoint alloc] initWithX:position.topLeft().x y:position.topLeft().y]
topRight:[[ZXIPoint alloc] initWithX:position.topRight().x y:position.topRight().y]
bottomRight:[[ZXIPoint alloc] initWithX:position.bottomRight().x y:position.bottomRight().y]
bottomLeft:[[ZXIPoint alloc] initWithX:position.bottomLeft().x y:position.bottomLeft().y]];
}

@end
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy