From 44cf8ec67278bd1ab6c7f83a9993f7a5686a9541 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 9 Mar 2024 01:06:44 +0100 Subject: Adding upstream version 0.23.93. Signed-off-by: Daniel Baumann --- iphone/ChangeLog | 138 +++ iphone/README | 66 ++ iphone/ZBarCVImage.h | 41 + iphone/ZBarCVImage.m | 195 ++++ iphone/ZBarCameraSimulator.m | 120 ++ iphone/ZBarCaptureReader.m | 370 ++++++ iphone/ZBarHelpController.m | 305 +++++ iphone/ZBarImage.m | 306 +++++ iphone/ZBarImageScanner.m | 85 ++ iphone/ZBarReaderController.m | 747 ++++++++++++ iphone/ZBarReaderView.m | 596 ++++++++++ iphone/ZBarReaderViewController.m | 711 ++++++++++++ iphone/ZBarReaderViewImpl_Capture.m | 402 +++++++ iphone/ZBarReaderViewImpl_Simulator.m | 219 ++++ iphone/ZBarSymbol.m | 197 ++++ iphone/bin/BuildUniversal.sh | 23 + iphone/bin/CreateDMG.sh | 44 + iphone/bin/CreateDSStore.pl | 72 ++ iphone/bin/Mac/Finder/AliasRecord.pm | 169 +++ iphone/debug.h | 51 + iphone/doc/Documentation.html | 11 + iphone/doc/ZBarImage.rst | 150 +++ iphone/doc/ZBarImageScanner.rst | 99 ++ iphone/doc/ZBarReaderController.rst | 156 +++ iphone/doc/ZBarReaderDelegate.rst | 70 ++ iphone/doc/ZBarReaderView.rst | 126 +++ iphone/doc/ZBarReaderViewController.rst | 190 ++++ iphone/doc/ZBarReaderViewDelegate.rst | 26 + iphone/doc/ZBarSymbol.rst | 186 +++ iphone/doc/ZBarSymbolSet.rst | 43 + iphone/doc/apiref.rst | 16 + iphone/doc/camera.rst | 130 +++ iphone/doc/compat.rst | 190 ++++ iphone/doc/conf.py | 77 ++ iphone/doc/custom.rst | 70 ++ iphone/doc/devguide.rst | 13 + iphone/doc/faq.rst | 101 ++ iphone/doc/getstarted.rst | 12 + iphone/doc/index.rst | 20 + iphone/doc/install.rst | 141 +++ iphone/doc/licensing.rst | 187 +++ iphone/doc/optimizing.rst | 435 +++++++ iphone/doc/picker.rst | 104 ++ iphone/doc/static/style.css | 36 + iphone/doc/support.rst | 19 + iphone/doc/tutorial.rst | 228 ++++ .../EmbedReader.xcodeproj/project.pbxproj | 416 +++++++ .../xcshareddata/xcschemes/EmbedReader.xcscheme | 76 ++ .../EmbedReader/EmbedReader/EmbedReader-Info.plist | 39 + .../EmbedReader/EmbedReader/EmbedReader-Prefix.pch | 11 + .../EmbedReader/EmbedReaderAppDelegate.h | 19 + .../EmbedReader/EmbedReaderAppDelegate.m | 34 + .../EmbedReader/EmbedReaderViewController.h | 20 + .../EmbedReader/EmbedReaderViewController.m | 101 ++ .../en.lproj/EmbedReaderViewController.xib | 336 ++++++ .../EmbedReader/en.lproj/InfoPlist.strings | 2 + .../EmbedReader/en.lproj/MainWindow.xib | 444 ++++++++ iphone/examples/EmbedReader/EmbedReader/main.m | 16 + iphone/examples/EmbedReader/ZBarSDK | 1 + iphone/examples/EmbedReader/build | 1 + .../ReaderSample.xcodeproj/project.pbxproj | 419 +++++++ .../xcshareddata/xcschemes/ReaderSample.xcscheme | 76 ++ .../ReaderSample/ReaderSample-Info.plist | 38 + .../ReaderSample/ReaderSample-Prefix.pch | 16 + .../ReaderSample/ReaderSampleAppDelegate.h | 20 + .../ReaderSample/ReaderSampleAppDelegate.m | 67 ++ .../ReaderSample/ReaderSampleViewController.h | 19 + .../ReaderSample/ReaderSampleViewController.m | 68 ++ .../ReaderSample/en.lproj/InfoPlist.strings | 2 + .../ReaderSample/en.lproj/MainWindow.xib | 444 ++++++++ .../en.lproj/ReaderSampleViewController.xib | 319 ++++++ iphone/examples/ReaderSample/ReaderSample/main.m | 16 + iphone/examples/ReaderSample/ZBarSDK | 1 + iphone/examples/ReaderSample/build | 1 + .../TabReader/TabReader.xcodeproj/project.pbxproj | 420 +++++++ .../xcshareddata/xcschemes/TabReader.xcscheme | 80 ++ .../TabReader/TabReader/ResultsViewController.h | 16 + .../TabReader/TabReader/ResultsViewController.m | 20 + .../TabReader/TabReader/TabReader-Info.plist | 38 + .../TabReader/TabReader/TabReader-Prefix.pch | 15 + .../TabReader/TabReader/TabReaderAppDelegate.h | 18 + .../TabReader/TabReader/TabReaderAppDelegate.m | 62 + .../TabReader/TabReader/en.lproj/InfoPlist.strings | 2 + .../TabReader/TabReader/en.lproj/MainWindow.xib | 411 +++++++ .../TabReader/TabReader/en.lproj/ResultsView.xib | 303 +++++ iphone/examples/TabReader/TabReader/main.m | 16 + iphone/examples/TabReader/ZBarSDK | 1 + iphone/examples/TabReader/build | 1 + iphone/examples/readertest/ZBarSDK | 1 + iphone/examples/readertest/build | 1 + iphone/examples/readertest/entitlements.plist | 8 + iphone/examples/readertest/prefix.pch | 11 + iphone/examples/readertest/readertest.m | 991 ++++++++++++++++ iphone/examples/readertest/readertest.plist | 28 + .../readertest.xcodeproj/project.pbxproj | 351 ++++++ .../xcshareddata/xcschemes/readertest.xcscheme | 76 ++ iphone/include/ZBarSDK/ZBarCameraSimulator.h | 42 + iphone/include/ZBarSDK/ZBarCaptureReader.h | 109 ++ iphone/include/ZBarSDK/ZBarHelpController.h | 59 + iphone/include/ZBarSDK/ZBarImage.h | 64 ++ iphone/include/ZBarSDK/ZBarImageScanner.h | 50 + iphone/include/ZBarSDK/ZBarReaderController.h | 139 +++ iphone/include/ZBarSDK/ZBarReaderView.h | 137 +++ iphone/include/ZBarSDK/ZBarReaderViewController.h | 132 +++ iphone/include/ZBarSDK/ZBarSDK.h | 34 + iphone/include/ZBarSDK/ZBarSymbol.h | 67 ++ iphone/include/config.h | 236 ++++ iphone/include/prefix.pch | 10 + iphone/res/ZBarSDK-Info.plist | 16 + iphone/res/ZBarSDK-bg.svg | 78 ++ iphone/res/buttondown.svg | 57 + iphone/res/buttonmask.svg | 26 + iphone/res/buttonup.svg | 57 + iphone/res/lightbulb.svg | 108 ++ iphone/res/shakyhand.svg | 108 ++ iphone/res/shakyphone.svg | 51 + iphone/res/stopwatch.svg | 88 ++ iphone/res/zbar-back.png | Bin 0 -> 319 bytes iphone/res/zbar-back.svg | 31 + iphone/res/zbar-help.html | 90 ++ iphone/res/zbar-helpicons.png | Bin 0 -> 18350 bytes iphone/res/zbar-samples.png | Bin 0 -> 1181 bytes iphone/zbar.xcodeproj/project.pbxproj | 1196 ++++++++++++++++++++ .../xcshareddata/xcschemes/ZBarSDK.dmg.xcscheme | 62 + .../xcshareddata/xcschemes/ZBarSDK.xcscheme | 62 + .../xcshareddata/xcschemes/libzbar.xcscheme | 58 + .../xcshareddata/xcschemes/readertest.xcscheme | 83 ++ 127 files changed, 16835 insertions(+) create mode 100644 iphone/ChangeLog create mode 100644 iphone/README create mode 100644 iphone/ZBarCVImage.h create mode 100644 iphone/ZBarCVImage.m create mode 100644 iphone/ZBarCameraSimulator.m create mode 100644 iphone/ZBarCaptureReader.m create mode 100644 iphone/ZBarHelpController.m create mode 100644 iphone/ZBarImage.m create mode 100644 iphone/ZBarImageScanner.m create mode 100644 iphone/ZBarReaderController.m create mode 100644 iphone/ZBarReaderView.m create mode 100644 iphone/ZBarReaderViewController.m create mode 100644 iphone/ZBarReaderViewImpl_Capture.m create mode 100644 iphone/ZBarReaderViewImpl_Simulator.m create mode 100644 iphone/ZBarSymbol.m create mode 100755 iphone/bin/BuildUniversal.sh create mode 100755 iphone/bin/CreateDMG.sh create mode 100755 iphone/bin/CreateDSStore.pl create mode 100755 iphone/bin/Mac/Finder/AliasRecord.pm create mode 100644 iphone/debug.h create mode 100644 iphone/doc/Documentation.html create mode 100644 iphone/doc/ZBarImage.rst create mode 100644 iphone/doc/ZBarImageScanner.rst create mode 100644 iphone/doc/ZBarReaderController.rst create mode 100644 iphone/doc/ZBarReaderDelegate.rst create mode 100644 iphone/doc/ZBarReaderView.rst create mode 100644 iphone/doc/ZBarReaderViewController.rst create mode 100644 iphone/doc/ZBarReaderViewDelegate.rst create mode 100644 iphone/doc/ZBarSymbol.rst create mode 100644 iphone/doc/ZBarSymbolSet.rst create mode 100644 iphone/doc/apiref.rst create mode 100644 iphone/doc/camera.rst create mode 100644 iphone/doc/compat.rst create mode 100644 iphone/doc/conf.py create mode 100644 iphone/doc/custom.rst create mode 100644 iphone/doc/devguide.rst create mode 100644 iphone/doc/faq.rst create mode 100644 iphone/doc/getstarted.rst create mode 100644 iphone/doc/index.rst create mode 100644 iphone/doc/install.rst create mode 100644 iphone/doc/licensing.rst create mode 100644 iphone/doc/optimizing.rst create mode 100644 iphone/doc/picker.rst create mode 100644 iphone/doc/static/style.css create mode 100644 iphone/doc/support.rst create mode 100644 iphone/doc/tutorial.rst create mode 100644 iphone/examples/EmbedReader/EmbedReader.xcodeproj/project.pbxproj create mode 100644 iphone/examples/EmbedReader/EmbedReader.xcodeproj/xcshareddata/xcschemes/EmbedReader.xcscheme create mode 100644 iphone/examples/EmbedReader/EmbedReader/EmbedReader-Info.plist create mode 100644 iphone/examples/EmbedReader/EmbedReader/EmbedReader-Prefix.pch create mode 100644 iphone/examples/EmbedReader/EmbedReader/EmbedReaderAppDelegate.h create mode 100644 iphone/examples/EmbedReader/EmbedReader/EmbedReaderAppDelegate.m create mode 100644 iphone/examples/EmbedReader/EmbedReader/EmbedReaderViewController.h create mode 100644 iphone/examples/EmbedReader/EmbedReader/EmbedReaderViewController.m create mode 100644 iphone/examples/EmbedReader/EmbedReader/en.lproj/EmbedReaderViewController.xib create mode 100644 iphone/examples/EmbedReader/EmbedReader/en.lproj/InfoPlist.strings create mode 100644 iphone/examples/EmbedReader/EmbedReader/en.lproj/MainWindow.xib create mode 100644 iphone/examples/EmbedReader/EmbedReader/main.m create mode 100644 iphone/examples/EmbedReader/ZBarSDK create mode 100644 iphone/examples/EmbedReader/build create mode 100644 iphone/examples/ReaderSample/ReaderSample.xcodeproj/project.pbxproj create mode 100644 iphone/examples/ReaderSample/ReaderSample.xcodeproj/xcshareddata/xcschemes/ReaderSample.xcscheme create mode 100644 iphone/examples/ReaderSample/ReaderSample/ReaderSample-Info.plist create mode 100644 iphone/examples/ReaderSample/ReaderSample/ReaderSample-Prefix.pch create mode 100644 iphone/examples/ReaderSample/ReaderSample/ReaderSampleAppDelegate.h create mode 100644 iphone/examples/ReaderSample/ReaderSample/ReaderSampleAppDelegate.m create mode 100644 iphone/examples/ReaderSample/ReaderSample/ReaderSampleViewController.h create mode 100644 iphone/examples/ReaderSample/ReaderSample/ReaderSampleViewController.m create mode 100644 iphone/examples/ReaderSample/ReaderSample/en.lproj/InfoPlist.strings create mode 100644 iphone/examples/ReaderSample/ReaderSample/en.lproj/MainWindow.xib create mode 100644 iphone/examples/ReaderSample/ReaderSample/en.lproj/ReaderSampleViewController.xib create mode 100644 iphone/examples/ReaderSample/ReaderSample/main.m create mode 100644 iphone/examples/ReaderSample/ZBarSDK create mode 100644 iphone/examples/ReaderSample/build create mode 100644 iphone/examples/TabReader/TabReader.xcodeproj/project.pbxproj create mode 100644 iphone/examples/TabReader/TabReader.xcodeproj/xcshareddata/xcschemes/TabReader.xcscheme create mode 100644 iphone/examples/TabReader/TabReader/ResultsViewController.h create mode 100644 iphone/examples/TabReader/TabReader/ResultsViewController.m create mode 100644 iphone/examples/TabReader/TabReader/TabReader-Info.plist create mode 100644 iphone/examples/TabReader/TabReader/TabReader-Prefix.pch create mode 100644 iphone/examples/TabReader/TabReader/TabReaderAppDelegate.h create mode 100644 iphone/examples/TabReader/TabReader/TabReaderAppDelegate.m create mode 100644 iphone/examples/TabReader/TabReader/en.lproj/InfoPlist.strings create mode 100644 iphone/examples/TabReader/TabReader/en.lproj/MainWindow.xib create mode 100644 iphone/examples/TabReader/TabReader/en.lproj/ResultsView.xib create mode 100644 iphone/examples/TabReader/TabReader/main.m create mode 100644 iphone/examples/TabReader/ZBarSDK create mode 100644 iphone/examples/TabReader/build create mode 100644 iphone/examples/readertest/ZBarSDK create mode 100644 iphone/examples/readertest/build create mode 100644 iphone/examples/readertest/entitlements.plist create mode 100644 iphone/examples/readertest/prefix.pch create mode 100644 iphone/examples/readertest/readertest.m create mode 100644 iphone/examples/readertest/readertest.plist create mode 100644 iphone/examples/readertest/readertest.xcodeproj/project.pbxproj create mode 100644 iphone/examples/readertest/readertest.xcodeproj/xcshareddata/xcschemes/readertest.xcscheme create mode 100644 iphone/include/ZBarSDK/ZBarCameraSimulator.h create mode 100644 iphone/include/ZBarSDK/ZBarCaptureReader.h create mode 100644 iphone/include/ZBarSDK/ZBarHelpController.h create mode 100644 iphone/include/ZBarSDK/ZBarImage.h create mode 100644 iphone/include/ZBarSDK/ZBarImageScanner.h create mode 100644 iphone/include/ZBarSDK/ZBarReaderController.h create mode 100644 iphone/include/ZBarSDK/ZBarReaderView.h create mode 100644 iphone/include/ZBarSDK/ZBarReaderViewController.h create mode 100644 iphone/include/ZBarSDK/ZBarSDK.h create mode 100644 iphone/include/ZBarSDK/ZBarSymbol.h create mode 100644 iphone/include/config.h create mode 100644 iphone/include/prefix.pch create mode 100644 iphone/res/ZBarSDK-Info.plist create mode 100644 iphone/res/ZBarSDK-bg.svg create mode 100644 iphone/res/buttondown.svg create mode 100644 iphone/res/buttonmask.svg create mode 100644 iphone/res/buttonup.svg create mode 100644 iphone/res/lightbulb.svg create mode 100644 iphone/res/shakyhand.svg create mode 100644 iphone/res/shakyphone.svg create mode 100644 iphone/res/stopwatch.svg create mode 100644 iphone/res/zbar-back.png create mode 100644 iphone/res/zbar-back.svg create mode 100644 iphone/res/zbar-help.html create mode 100644 iphone/res/zbar-helpicons.png create mode 100644 iphone/res/zbar-samples.png create mode 100644 iphone/zbar.xcodeproj/project.pbxproj create mode 100644 iphone/zbar.xcodeproj/xcshareddata/xcschemes/ZBarSDK.dmg.xcscheme create mode 100644 iphone/zbar.xcodeproj/xcshareddata/xcschemes/ZBarSDK.xcscheme create mode 100644 iphone/zbar.xcodeproj/xcshareddata/xcschemes/libzbar.xcscheme create mode 100644 iphone/zbar.xcodeproj/xcshareddata/xcschemes/readertest.xcscheme (limited to 'iphone') diff --git a/iphone/ChangeLog b/iphone/ChangeLog new file mode 100644 index 0000000..cce05df --- /dev/null +++ b/iphone/ChangeLog @@ -0,0 +1,138 @@ +version 1.3.1: + * fix examples + - fix EmbedReader initial iPad orientation + - fix TabReader shouldn't show controls + * add retry workaround when device lock fails + - add iPhone 5 launch image to examples + - doc updates + * Lion and Xcode updates + - fix new warnings/errors + - find missing buddy + - fix SDK bg image: force resolution to 72dpi + * Fix EmbedReader example rotation interaction + +version 1.2.2: + * reduce controller present and dismiss latency + - add simple shutter to mask video start + +version 1.2.1: + * fix overlay resizing bug + +version 1.2: + * release updates + +version 1.1.3: + * fix UITabViewController rotation interaction + +version 1.1.2: + * add maxZoom for increasing zoom range + - workaround camera preview initial location/size bug + * add emulation for UI videoQuality to adjust camera resolution + * fix several simulator-related bugs + - fix device property missing from simulated ZBarReaderView + - fix AVCaptureDevice referenced from ZBarReaderViewController + - fix simulated camera gesture multiple recognition + +version 1.1.1: + * fix ReaderSample project path to ZBarSDK + * README document new examples + - make ReaderSample scheme public + * documentation updates + * add emulation for UI camera device and flash mode properties + * workaround orientation bugs in parent controllers + - enable orientation and iPad support for all examples + * add orientation detection fall back + * fix captureReader not exposed to simulator + * fix camera preview stale rotation corner + - fix ZBarReaderViewController toolbar layout accomodation + - switch pre-release samples to use debug library + * update docs to note possible link order dependency + * add missing references to new samples + * add IB support to ZBarReaderViewController + - add tabbed reader sample + * add embedded reader sample + - factor out camera simulation logic + * fix readertest max quality result filtering + - thanks to John Boydon for finding this! + * improve support for resizing, rotating and embedding the reader + * add readertest fixed zoom stops + * add manual frame capture + - readertest save as PNG + * enhance readertest to support default/demo pre-config and distribution + * updates for Xcode 4 + * expose tracking box color + +version 1.1: + * fix doc typo (bug #3139087) + - add modifier bit docs + +version 1.0.1: + * hotfix broken ZBarHelpController back button + * release updates + - update docs + * fix support for GS1 AIs + * fix simulated camera image orientation/scaling + * cleanup and expose ZBarHelpController + * expose enable for reader capture processing + * workaround iOS 4.2 hang + - update to use latest SDK + * add support for Code 93 symbology + +version 1.0: + * update to SDK 4.1, clean out LLVM warnings + * fix camera simulation gesture + +version 0.1.2: + * fix missing header dependency + * doc enhancements + * force controls to front when showsZBarControls is enabled + * fix initial zoom crop (performance bug) + * workaround iPhone quartz access past image data + +version 0.1.1: + * migrate to binary iPhone SDK distribution (NB backward incompatibilities!) + - restructure headers + +version 0.1: + * workaround for iPhone simulator builds + - refactor ZBarReaderView for capture/simulator specific implementations + - fix tracking calculations + - fix captured video frame color conversion + * fix for poor iPhone 4 performance + * enable torch for iPhone 4 + * fix iPhone circular ref bug + * add iPhone cache flush, change new libs to weak refs + * fix iPhone async ref bug + * enhance iPhone readertest w/more options + * add iPhone zoom support, integrate with crop + * add iPhone OS 4.0 video capture support + - replacement view controller for new camera reader + - separate view for use without controller + - separate capture delegate for use standalone + - add continuous autofocus + * cleanup and expose iphone help display API + * fixes to new iphone help display + * migrate iphone help display to integrated web page (NB resource updates!) + - allows easier customization + - local links open directly, external links confirm and jump out to Safari + - JavaScript hook for help context customization + - also enhanced default help (note this changes the required resources) + - fix to disable scanning during help overlay + - thanks to iafanasyev and others for detailed suggestions + * fix iphone custom overlay response (bug #2959617) + - thanks to an anonymous user for the patch! + * iphone widget performance tuning enhancements + - fix crop calculation bug in ZBarImage + - add properties to control pre-scan image cropping and scaling + - add property for scanner cache control + - enable some scanner density control (FIXME should be property) + - fix ifdef for quality control (FIXME should be property) + - add "sequence" mode test (not actually so useful) + * realtime scanning for iphone widget + - uses UIGetScreenImage() (NB private) + - ZBarImage from CGImage (instead of UIImage) + - add crop to scaling step + - expose symbol set unfiltered results + * iphone widget back compat updates, add basic test app + * add Obj-C wrapper + * first pass working iPhone "widget" diff --git a/iphone/README b/iphone/README new file mode 100644 index 0000000..bd2df0e --- /dev/null +++ b/iphone/README @@ -0,0 +1,66 @@ +ZBar iOS SDK +============ + +ZBar Bar Code Reader is an open source software suite for reading bar +codes from various sources, such as video streams, image files and raw +intensity sensors. It supports EAN-13/UPC-A, UPC-E, EAN-8, DataBar, +Code 128, Code 93, Code 39, Codabar, Interleaved 2 of 5 and QR Code. +These are the Objective C wrappers and integrated widget for developing +with the library on the iOS platform. + +Check the ZBar project home page for the latest release, forums, etc. + +* http://zbar.sourceforge.net/iphone + +Installation +------------ + +If you are migrating from a pre-SDK source version of the library, +first make sure you remove all of the old references to zbar.xcodeproj +and libzbar.a and revert any related build settings. + +To add the SDK to an Xcode project: + + 1. Drag ZBarSDK into your Xcode project. + 3. Add these system frameworks to your project: + * AVFoundation.framework (weak) + * CoreMedia.framework (weak) + * CoreVideo.framework (weak) + * QuartzCore.framework + * libiconv.dylib + +Documentation +------------- + +See Documentation.html for complete SDK documentation. + +Examples +-------- + +You should be able to open and build the examples directly from the +disk image (ignore warnings about the read-only volume). If you have +problems with this, please copy the examples to your local drive +instead and build from there. + +A tutorial that walks through installing and using the SDK is +available in the documentation. The SDK disk image also contains the +resulting Xcode project at Examples/ReaderSample. + +Examples/readertest demonstrates most of the configuration options +available for the reader. + +Examples/TabReader shows how you can use Interface Builder to add the +reader as a tab in a UITabBarController. + +Examples/EmbedReader shows how a ZBarReaderView may be embedded +directly in the application view hierarchy. + +Copyright and License +--------------------- + +Licensed under the GNU Lesser General Public License, version 2.1. +http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt + +Copyright 2008-2011 © Jeff Brown et al + +See the included files COPYING and LICENSE.md for details diff --git a/iphone/ZBarCVImage.h b/iphone/ZBarCVImage.h new file mode 100644 index 0000000..d4d9934 --- /dev/null +++ b/iphone/ZBarCVImage.h @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------ +// Copyright 2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import + +// ZBarImage referring to a CVPixelBuffer. used internally to handle +// asynchronous conversion to UIImage + +@interface ZBarCVImage : ZBarImage { + CVPixelBufferRef pixelBuffer; + void *rgbBuffer; + NSInvocationOperation *conversion; +} + +- (void)waitUntilConverted; + +@property (nonatomic) CVPixelBufferRef pixelBuffer; +@property (nonatomic, readonly) void *rgbBuffer; + +@end diff --git a/iphone/ZBarCVImage.m b/iphone/ZBarCVImage.m new file mode 100644 index 0000000..63065dd --- /dev/null +++ b/iphone/ZBarCVImage.m @@ -0,0 +1,195 @@ +//------------------------------------------------------------------------ +// Copyright 2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import "ZBarCVImage.h" +#define MODULE ZBarCVImage +#import "debug.h" + +static NSOperationQueue *conversionQueue; + +static const void* +asyncProvider_getBytePointer (void *info) +{ + // block until data is available + ZBarCVImage *image = info; + assert(image); + [image waitUntilConverted]; + void *buf = image.rgbBuffer; + assert(buf); + return(buf); +} + +static const CGDataProviderDirectCallbacks asyncProvider = { + .version = 0, + .getBytePointer = asyncProvider_getBytePointer, + .releaseBytePointer = NULL, + .getBytesAtPosition = NULL, + .releaseInfo = (void*)CFRelease, +}; + +@implementation ZBarCVImage + +@synthesize pixelBuffer, rgbBuffer; + +- (void) dealloc +{ + self.pixelBuffer = NULL; + if(rgbBuffer) { + free(rgbBuffer); + rgbBuffer = NULL; + } + [conversion release]; + conversion = nil; + [super dealloc]; +} + +- (void) setPixelBuffer: (CVPixelBufferRef) newbuf +{ + CVPixelBufferRef oldbuf = pixelBuffer; + if(newbuf) + CVPixelBufferRetain(newbuf); + pixelBuffer = newbuf; + if(oldbuf) + CVPixelBufferRelease(oldbuf); +} + +- (void) waitUntilConverted +{ + // operation will at least have been queued already + NSOperation *op = [conversion retain]; + if(!op) + return; + [op waitUntilFinished]; + [op release]; +} + +- (UIImage*) UIImageWithOrientation: (UIImageOrientation) orient +{ + if(!conversion && !rgbBuffer) { + // start format conversion in separate thread + NSOperationQueue *queue = conversionQueue; + if(!queue) { + queue = conversionQueue = [NSOperationQueue new]; + queue.maxConcurrentOperationCount = 1; + } + else + [queue waitUntilAllOperationsAreFinished]; + + conversion = [[NSInvocationOperation alloc] + initWithTarget: self + selector: @selector(convertCVtoRGB) + object: nil]; + [queue addOperation: conversion]; + [conversion release]; + } + + // create UIImage before converted data is available + CGSize size = self.size; + int w = size.width; + int h = size.height; + + CGDataProviderRef datasrc = + CGDataProviderCreateDirect([self retain], 3 * w * h, &asyncProvider); + CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB(); + CGImageRef cgimg = + CGImageCreate(w, h, 8, 24, 3 * w, cs, + kCGBitmapByteOrderDefault, datasrc, + NULL, YES, kCGRenderingIntentDefault); + CGColorSpaceRelease(cs); + CGDataProviderRelease(datasrc); + + UIImage *uiimg = + [UIImage imageWithCGImage: cgimg + scale: 1 + orientation: orient]; + CGImageRelease(cgimg); + + return(uiimg); +} + +// convert video frame to a CGImage compatible RGB format +// FIXME this is temporary until we can find the native way... +- (void) convertCVtoRGB +{ + timer_start; + unsigned long format = self.format; + assert(format == zbar_fourcc('C','V','2','P')); + if(format != zbar_fourcc('C','V','2','P')) + return; + + CVPixelBufferLockBaseAddress(pixelBuffer, kCVPixelBufferLock_ReadOnly); + int w = CVPixelBufferGetWidth(pixelBuffer); + int h = CVPixelBufferGetHeight(pixelBuffer); + int dy = CVPixelBufferGetBytesPerRowOfPlane(pixelBuffer, 0); + int duv = CVPixelBufferGetBytesPerRowOfPlane(pixelBuffer, 1); + uint8_t *py = CVPixelBufferGetBaseAddressOfPlane(pixelBuffer, 0); + uint8_t *puv = CVPixelBufferGetBaseAddressOfPlane(pixelBuffer, 1); + if(!py || !puv || dy < w || duv < w) + goto error; + + int datalen = 3 * w * h; + // Quartz accesses some undocumented amount past allocated data? + // ...allocate extra to compensate + uint8_t *pdst = rgbBuffer = malloc(datalen + 3 * w); + if(!pdst) + goto error; + [self setData: rgbBuffer + withLength: datalen]; + + for(int y = 0; y < h; y++) { + const uint8_t *qy = py; + const uint8_t *quv = puv; + for(int x = 0; x < w; x++) { + int Y1 = *(qy++) - 16; + int Cb = *(quv) - 128; + int Cr = *(quv + 1) - 128; + Y1 *= 4769; + quv += (x & 1) << 1; + int r = (Y1 + 6537 * Cr + 2048) / 4096; + int g = (Y1 - 1604 * Cb - 3329 * Cr + 2048) / 4096; + int b = (Y1 + 8263 * Cb + 2048) / 4096; + + r = (r | -!!(r >> 8)) & -((r >> 8) >= 0); + g = (g | -!!(g >> 8)) & -((g >> 8) >= 0); + b = (b | -!!(b >> 8)) & -((b >> 8) >= 0); + + *(pdst++) = r; + *(pdst++) = g; + *(pdst++) = b; + } + py += dy; + if(y & 1) + puv += duv; + } + +error: + CVPixelBufferUnlockBaseAddress(pixelBuffer, kCVPixelBufferLock_ReadOnly); + zlog(@"convert time %gs", timer_elapsed(t_start, timer_now())); + + // release buffer as soon as conversion is complete + self.pixelBuffer = NULL; + + conversion = nil; +} + +@end diff --git a/iphone/ZBarCameraSimulator.m b/iphone/ZBarCameraSimulator.m new file mode 100644 index 0000000..96fd753 --- /dev/null +++ b/iphone/ZBarCameraSimulator.m @@ -0,0 +1,120 @@ +//------------------------------------------------------------------------ +// Copyright 2010-2011 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import + +// hack around missing simulator support for AVCapture interfaces + +@implementation ZBarCameraSimulator + +@synthesize readerView; + +- (id) initWithViewController: (UIViewController*) vc +{ + if(!TARGET_IPHONE_SIMULATOR) { + [self release]; + return(nil); + } + self = [super init]; + if(!self) + return(nil); + + viewController = vc; + + return(self); +} + +- (void) dealloc +{ + viewController = nil; + readerView = nil; + [picker release]; + picker = nil; + [pickerPopover release]; + pickerPopover = nil; + [super dealloc]; +} + +- (void) setReaderView: (ZBarReaderView*) view +{ + ZBarReaderView *oldView = readerView; + readerView = [view retain]; + [oldView release]; + + UILongPressGestureRecognizer *gesture = + [[UILongPressGestureRecognizer alloc] + initWithTarget: self + action: @selector(didLongPress:)]; + gesture.numberOfTouchesRequired = 2; + [view addGestureRecognizer: gesture]; + [gesture release]; +} + +- (void) didLongPress: (UILongPressGestureRecognizer*) gesture +{ + if(gesture.state == UIGestureRecognizerStateBegan) + [self takePicture]; +} + +- (void) takePicture +{ + if(!picker) { + picker = [UIImagePickerController new]; + picker.delegate = self; + } + if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { + if(!pickerPopover) + pickerPopover = [[UIPopoverController alloc] + initWithContentViewController: picker]; + [pickerPopover presentPopoverFromRect: CGRectZero + inView: readerView + permittedArrowDirections: UIPopoverArrowDirectionAny + animated: YES]; + } + else + [viewController presentModalViewController: picker + animated: YES]; +} + +- (void) imagePickerController: (UIImagePickerController*) _picker + didFinishPickingMediaWithInfo: (NSDictionary*) info +{ + UIImage *image = [info objectForKey: UIImagePickerControllerOriginalImage]; + + if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) + [pickerPopover dismissPopoverAnimated: YES]; + else + [_picker dismissModalViewControllerAnimated: YES]; + + [readerView performSelector: @selector(scanImage:) + withObject: image + afterDelay: .1]; +} + +- (void) imagePickerControllerDidCancel: (UIImagePickerController*) _picker +{ + [_picker dismissModalViewControllerAnimated: YES]; +} + +@end diff --git a/iphone/ZBarCaptureReader.m b/iphone/ZBarCaptureReader.m new file mode 100644 index 0000000..b3dd65c --- /dev/null +++ b/iphone/ZBarCaptureReader.m @@ -0,0 +1,370 @@ +//------------------------------------------------------------------------ +// Copyright 2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import +#import +#import +#import +#import +#import "ZBarCVImage.h" + +#define MODULE ZBarCaptureReader +#import "debug.h" + +enum { + STOPPED = 0, + RUNNING = 1, + PAUSED = 2, + CAPTURE = 4, +}; + +@implementation ZBarCaptureReader + +@synthesize captureOutput, captureDelegate, scanner, scanCrop, size, + framesPerSecond, enableCache; +@dynamic enableReader; + +- (void) initResult +{ + [result release]; + result = [ZBarCVImage new]; + result.format = [ZBarImage fourcc: @"CV2P"]; +} + +- (id) initWithImageScanner: (ZBarImageScanner*) _scanner +{ + self = [super init]; + if(!self) + return(nil); + + t_fps = t_frame = timer_now(); + enableCache = YES; + + scanner = [_scanner retain]; + scanCrop = CGRectMake(0, 0, 1, 1); + image = [ZBarImage new]; + image.format = [ZBarImage fourcc: @"Y800"]; + [self initResult]; + + captureOutput = [AVCaptureVideoDataOutput new]; + captureOutput.alwaysDiscardsLateVideoFrames = YES; + +#ifdef FIXED_8697526 + /* iOS 4.2 introduced a bug that causes [session startRunning] to + * hang if the session has a preview layer and this property is + * specified at the output. As this happens to be the default + * setting for the currently supported devices, it can be omitted + * without causing a functional problem (for now...). Of course, + * we still have no idea what the real problem is, or how robust + * this is as a workaround... + */ + captureOutput.videoSettings = + [NSDictionary + dictionaryWithObject: + [NSNumber numberWithInt: + kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange] + forKey: (NSString*)kCVPixelBufferPixelFormatTypeKey]; +#endif + + queue = dispatch_queue_create("ZBarCaptureReader", NULL); + [captureOutput setSampleBufferDelegate: + (id)self + queue: queue]; + + return(self); +} + +- (id) init +{ + self = [self initWithImageScanner: + [[ZBarImageScanner new] + autorelease]]; + if(!self) + return(nil); + + [scanner setSymbology: 0 + config: ZBAR_CFG_X_DENSITY + to: 3]; + [scanner setSymbology: 0 + config: ZBAR_CFG_Y_DENSITY + to: 3]; + return(self); +} + +- (void) dealloc +{ + captureDelegate = nil; + + // queue continues to run after stopping (NB even after DidStopRunning!); + // ensure released delegate is not called. (also NB that the queue + // may not be null, even in this case...) + [captureOutput setSampleBufferDelegate: nil + queue: queue]; + [captureOutput release]; + captureOutput = nil; + dispatch_release(queue); + + [image release]; + image = nil; + [result release]; + result = nil; + [scanner release]; + scanner = nil; + [super dealloc]; +} + +- (BOOL) enableReader +{ + return(OSAtomicOr32Barrier(0, &state) & RUNNING); +} + +- (void) setEnableReader: (BOOL) enable +{ + if(!enable) + OSAtomicAnd32Barrier(STOPPED, &state); + else if(!(OSAtomicOr32OrigBarrier(RUNNING, &state) & RUNNING)) { + OSAtomicAnd32Barrier(~PAUSED, &state); + @synchronized(scanner) { + scanner.enableCache = enableCache; + } + } +} + +- (void) willStartRunning +{ + self.enableReader = YES; +} + +- (void) willStopRunning +{ + self.enableReader = NO; +} + +- (void) flushCache +{ + @synchronized(scanner) { + scanner.enableCache = enableCache; + } +} + +- (void) captureFrame +{ + OSAtomicOr32(CAPTURE, &state); +} + +- (void) setCaptureDelegate: (id) delegate +{ + @synchronized(scanner) { + captureDelegate = delegate; + } +} + +- (void) cropUpdate +{ + @synchronized(scanner) { + image.crop = CGRectMake(scanCrop.origin.x * width, + scanCrop.origin.y * height, + scanCrop.size.width * width, + scanCrop.size.height * height); + } +} + +- (void) setScanCrop: (CGRect) crop +{ + if(CGRectEqualToRect(scanCrop, crop)) + return; + scanCrop = crop; + [self cropUpdate]; +} + +- (void) didTrackSymbols: (ZBarSymbolSet*) syms +{ + [captureDelegate + captureReader: self + didTrackSymbols: syms]; +} + +- (void) didReadNewSymbolsFromImage: (ZBarImage*) img +{ + timer_start; + [captureDelegate + captureReader: self + didReadNewSymbolsFromImage: img]; + OSAtomicAnd32Barrier(~PAUSED, &state); + zlog(@"latency: delegate=%gs total=%gs", + timer_elapsed(t_start, timer_now()), + timer_elapsed(t_scan, timer_now())); +} + +- (void) setFramesPerSecond: (CGFloat) fps +{ + framesPerSecond = fps; +} + +- (void) updateFPS: (NSNumber*) val +{ + [self setFramesPerSecond: val.doubleValue]; +} + +- (void) setSize: (CGSize) _size +{ + size = _size; +} + +- (void) updateSize: (CFDictionaryRef) val +{ + CGSize _size; + if(CGSizeMakeWithDictionaryRepresentation(val, &_size)) + [self setSize: _size]; +} + +- (void) captureOutput: (AVCaptureOutput*) output + didOutputSampleBuffer: (CMSampleBufferRef) samp + fromConnection: (AVCaptureConnection*) conn +{ + // queue is apparently not flushed when stopping; + // only process when running + uint32_t _state = OSAtomicOr32Barrier(0, &state); + if((_state & (PAUSED | RUNNING)) != RUNNING) + return; + + NSAutoreleasePool *pool = [NSAutoreleasePool new]; + image.sequence = framecnt++; + + uint64_t now = timer_now(); + double dt = timer_elapsed(t_frame, now); + t_frame = now; + if(dt > 2) { + t_fps = now; + dt_frame = 0; + } + else if(!dt_frame) + dt_frame = dt; + dt_frame = (dt_frame + dt) / 2; + if(timer_elapsed(t_fps, now) >= 1) { + [self performSelectorOnMainThread: @selector(updateFPS:) + withObject: [NSNumber numberWithDouble: 1 / dt_frame] + waitUntilDone: NO]; + t_fps = now; + } + + CVImageBufferRef buf = CMSampleBufferGetImageBuffer(samp); + if(CMSampleBufferGetNumSamples(samp) != 1 || + !CMSampleBufferIsValid(samp) || + !CMSampleBufferDataIsReady(samp) || + !buf) { + zlog(@"ERROR: invalid sample"); + goto error; + } + + OSType format = CVPixelBufferGetPixelFormatType(buf); + int planes = CVPixelBufferGetPlaneCount(buf); + + if(format != kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange || + !planes) { + zlog(@"ERROR: invalid buffer format"); + goto error; + } + + int w = CVPixelBufferGetBytesPerRowOfPlane(buf, 0); + int h = CVPixelBufferGetHeightOfPlane(buf, 0); + CVReturn rc = + CVPixelBufferLockBaseAddress(buf, kCVPixelBufferLock_ReadOnly); + if(!w || !h || rc) { + zlog(@"ERROR: invalid buffer data"); + goto error; + } + + void *data = CVPixelBufferGetBaseAddressOfPlane(buf, 0); + if(data) { + [image setData: data + withLength: w * h]; + + BOOL doTrack = NO; + int ngood = 0; + ZBarSymbolSet *syms = nil; + @synchronized(scanner) { + if(width != w || height != h) { + width = w; + height = h; + CGSize _size = CGSizeMake(w, h); + CFDictionaryRef sized = + CGSizeCreateDictionaryRepresentation(_size); + if(sized) { + [self performSelectorOnMainThread: @selector(updateSize:) + withObject: (id)sized + waitUntilDone: NO]; + CFRelease(sized); + } + image.size = _size; + [self cropUpdate]; + } + + ngood = [scanner scanImage: image]; + syms = scanner.results; + doTrack = [captureDelegate respondsToSelector: + @selector(captureReader:didTrackSymbols:)]; + } + now = timer_now(); + + if(ngood >= 0) { + // return unfiltered results for tracking feedback + syms.filterSymbols = NO; + int nraw = syms.count; + if(nraw > 0 || (_state & CAPTURE)) + zlog(@"scan image: %dx%d crop=%@ ngood=%d nraw=%d st=%d", + w, h, NSStringFromCGRect(image.crop), ngood, nraw, _state); + + if(ngood || (_state & CAPTURE)) { + // copy image data so we can release the buffer + result.size = CGSizeMake(w, h); + result.pixelBuffer = buf; + result.symbols = syms; + t_scan = now; + OSAtomicXor32Barrier((_state & CAPTURE) | PAUSED, &state); + [self performSelectorOnMainThread: + @selector(didReadNewSymbolsFromImage:) + withObject: result + waitUntilDone: NO]; + [self initResult]; + } + + if(nraw && doTrack) + [self performSelectorOnMainThread: + @selector(didTrackSymbols:) + withObject: syms + waitUntilDone: NO]; + } + [image setData: NULL + withLength: 0]; + } + else + zlog(@"ERROR: invalid data"); + CVPixelBufferUnlockBaseAddress(buf, kCVPixelBufferLock_ReadOnly); + + error: + [pool release]; +} + +@end diff --git a/iphone/ZBarHelpController.m b/iphone/ZBarHelpController.m new file mode 100644 index 0000000..2451843 --- /dev/null +++ b/iphone/ZBarHelpController.m @@ -0,0 +1,305 @@ +//------------------------------------------------------------------------ +// Copyright 2009-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import + +#define MODULE ZBarHelpController +#import "debug.h" + +@implementation ZBarHelpController + +@synthesize delegate; + +- (id) initWithReason: (NSString*) _reason +{ + self = [super init]; + if(!self) + return(nil); + + if(!_reason) + _reason = @"INFO"; + reason = [_reason retain]; + return(self); +} + +- (id) init +{ + return([self initWithReason: nil]); +} + +- (void) cleanup +{ + [toolbar release]; + toolbar = nil; + [webView release]; + webView = nil; + [doneBtn release]; + doneBtn = nil; + [backBtn release]; + backBtn = nil; + [space release]; + space = nil; +} + +- (void) dealloc +{ + [self cleanup]; + [reason release]; + reason = nil; + [linkURL release]; + linkURL = nil; + [super dealloc]; +} + +- (void) viewDidLoad +{ + [super viewDidLoad]; + + UIView *view = self.view; + CGRect bounds = self.view.bounds; + if(!bounds.size.width || !bounds.size.height) + view.frame = bounds = CGRectMake(0, 0, 320, 480); + view.backgroundColor = [UIColor colorWithWhite: .125f + alpha: 1]; + view.autoresizingMask = (UIViewAutoresizingFlexibleWidth | + UIViewAutoresizingFlexibleHeight); + + webView = [[WKWebView alloc] + initWithFrame: CGRectMake(0, 0, + bounds.size.width, + bounds.size.height - 44)]; + webView.navigationDelegate = self; + webView.backgroundColor = [UIColor colorWithWhite: .125f + alpha: 1]; + webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | + UIViewAutoresizingFlexibleHeight | + UIViewAutoresizingFlexibleBottomMargin); + webView.hidden = YES; + [view addSubview: webView]; + + CGRect r = view.bounds; + r.origin.y = r.size.height - 44; + r.size.height = 44; + controls = [[UIView alloc] + initWithFrame: r]; + controls.autoresizingMask = + UIViewAutoresizingFlexibleWidth | + UIViewAutoresizingFlexibleHeight | + UIViewAutoresizingFlexibleTopMargin; + controls.backgroundColor = [UIColor blackColor]; + + r.origin.y = 0; + toolbar = [[UIToolbar alloc] + initWithFrame: r]; + toolbar.barStyle = UIBarStyleBlackOpaque; + toolbar.autoresizingMask = (UIViewAutoresizingFlexibleWidth | + UIViewAutoresizingFlexibleHeight); + + doneBtn = [[UIBarButtonItem alloc] + initWithBarButtonSystemItem: UIBarButtonSystemItemDone + target: self + action: @selector(dismiss)]; + + backBtn = [[UIBarButtonItem alloc] + initWithImage: [UIImage imageNamed: @"zbar-back.png"] + style: UIBarButtonItemStylePlain + target: webView + action: @selector(goBack)]; + + space = [[UIBarButtonItem alloc] + initWithBarButtonSystemItem: + UIBarButtonSystemItemFlexibleSpace + target: nil + action: nil]; + + toolbar.items = [NSArray arrayWithObjects: space, doneBtn, nil]; + + [controls addSubview: toolbar]; + toolbar.autoresizingMask = + UIViewAutoresizingFlexibleWidth | + UIViewAutoresizingFlexibleHeight; + [toolbar release]; + + [view addSubview: controls]; + + if (@available(iOS 11, *)) { + UILayoutGuide *safe = self.view.safeAreaLayoutGuide; + controls.translatesAutoresizingMaskIntoConstraints = NO; + webView.translatesAutoresizingMaskIntoConstraints = NO; + + [NSLayoutConstraint activateConstraints:@[ + [safe.trailingAnchor constraintEqualToAnchor:webView.trailingAnchor], + [webView.leadingAnchor constraintEqualToAnchor:safe.leadingAnchor], + [webView.topAnchor constraintEqualToAnchor:safe.topAnchor], + [webView.bottomAnchor constraintEqualToAnchor:controls.topAnchor] + ]]; + + [NSLayoutConstraint activateConstraints:@[ + [safe.trailingAnchor constraintEqualToAnchor:controls.trailingAnchor], + [controls.leadingAnchor constraintEqualToAnchor:safe.leadingAnchor], + [controls.bottomAnchor constraintEqualToAnchor:safe.bottomAnchor] + ]]; + + [NSLayoutConstraint + constraintWithItem:controls + attribute:NSLayoutAttributeHeight + relatedBy:NSLayoutRelationEqual + toItem:nil + attribute:NSLayoutAttributeHeight + multiplier:1.0 + constant:44.0].active = YES; + } + + NSString *path = [[NSBundle mainBundle] + pathForResource: @"zbar-help" + ofType: @"html"]; + + NSURLRequest *req = nil; + if(path) { + NSURL *url = [NSURL fileURLWithPath: path + isDirectory: NO]; + if(url) + req = [NSURLRequest requestWithURL: url]; + } + if(req) + [webView loadRequest: req]; + else + NSLog(@"ERROR: unable to load zbar-help.html from bundle"); +} + +- (void) viewWillAppear: (BOOL) animated +{ + assert(webView); + if(webView.loading) + webView.hidden = YES; + [super viewWillAppear: animated]; +} + +- (void) viewWillDisappear: (BOOL) animated +{ + [webView stopLoading]; + [super viewWillDisappear: animated]; +} + +- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) orient +{ + return([self isInterfaceOrientationSupported: orient]); +} + +- (void) willAnimateRotationToInterfaceOrientation: (UIInterfaceOrientation) orient + duration: (NSTimeInterval) duration +{ + [webView reload]; +} + +- (void) didRotateFromInterfaceOrientation: (UIInterfaceOrientation) orient +{ + zlog(@"frame=%@ webView.frame=%@ toolbar.frame=%@", + NSStringFromCGRect(self.view.frame), + NSStringFromCGRect(webView.frame), + NSStringFromCGRect(toolbar.frame)); +} + +- (BOOL) isInterfaceOrientationSupported: (UIInterfaceOrientation) orient +{ + UIViewController *parent = self.parentViewController; + if(parent && !orientations) + return([parent shouldAutorotateToInterfaceOrientation: orient]); + return((orientations >> orient) & 1); +} + +- (void) setInterfaceOrientation: (UIInterfaceOrientation) orient + supported: (BOOL) supported +{ + NSUInteger mask = 1 << orient; + if(supported) + orientations |= mask; + else + orientations &= ~mask; +} + +- (void) dismiss +{ + if([delegate respondsToSelector: @selector(helpControllerDidFinish:)]) + [delegate helpControllerDidFinish: self]; + + [self dismissViewControllerAnimated:YES completion:nil]; +} + +- (void)webView:(WKWebView *)view + didFinishNavigation:(WKNavigation *)navigation +{ + if(view.hidden) { + [view evaluateJavaScript:[NSString stringWithFormat: @"onZBarHelp({reason:\"%@\"});", reason] + completionHandler:^(id abc, NSError *error){ + [UIView beginAnimations: @"ZBarHelp" + context: nil]; + view.hidden = NO; + [UIView commitAnimations]; + }]; + + } + + BOOL canGoBack = [view canGoBack]; + NSArray *items = toolbar.items; + if(canGoBack != ([items objectAtIndex: 0] == backBtn)) { + if(canGoBack) + items = [NSArray arrayWithObjects: backBtn, space, doneBtn, nil]; + else + items = [NSArray arrayWithObjects: space, doneBtn, nil]; + [toolbar setItems: items + animated: YES]; + } +} + +- (BOOL) webView: (WKWebView*) view + shouldStartLoadWithRequest: (NSURLRequest*) req + navigationType: (WKNavigationType) nav +{ + NSURL *url = [req URL]; + if([url isFileURL]) + return(YES); + + linkURL = [url retain]; + UIAlertView *alert = + [[UIAlertView alloc] + initWithTitle: @"Open External Link" + message: @"Close this application and open link in Safari?" + delegate: nil + cancelButtonTitle: @"Cancel" + otherButtonTitles: @"OK", nil]; + alert.delegate = self; + [alert show]; + [alert release]; + return(NO); +} + +- (void) alertView: (UIAlertView*) view + clickedButtonAtIndex: (NSInteger) idx +{ + if(idx) + [[UIApplication sharedApplication] + openURL: linkURL]; +} + +@end diff --git a/iphone/ZBarImage.m b/iphone/ZBarImage.m new file mode 100644 index 0000000..f723e7a --- /dev/null +++ b/iphone/ZBarImage.m @@ -0,0 +1,306 @@ +//------------------------------------------------------------------------ +// Copyright 2009-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import +#import "debug.h" + +static void image_cleanup(zbar_image_t *zimg) +{ + ZBarImage *image = zbar_image_get_userdata(zimg); + [image cleanup]; +} + +@implementation ZBarImage + +@dynamic format, sequence, size, crop, data, dataLength, symbols, zbarImage, + UIImage; + ++ (unsigned long) fourcc: (NSString*) format +{ + return(zbar_fourcc_parse([format UTF8String])); +} + +- (id) initWithImage: (zbar_image_t*) image +{ + if(!image) { + [self release]; + return(nil); + } + if(self = [super init]) { + zimg = image; + zbar_image_ref(image, 1); + zbar_image_set_userdata(zimg, self); + } + return(self); +} + +- (id) init +{ + zbar_image_t *image = zbar_image_create(); + self = [self initWithImage: image]; + zbar_image_ref(image, -1); + return(self); +} + +- (void) dealloc +{ + if(zimg) { + zbar_image_ref(zimg, -1); + zimg = NULL; + } + [super dealloc]; +} + +- (id) initWithCGImage: (CGImageRef) image + crop: (CGRect) crop + size: (CGSize) size +{ + if(!(self = [self init])) + return(nil); + uint64_t t_start = timer_now(); + + unsigned int w = size.width + 0.5; + unsigned int h = size.height + 0.5; + + unsigned long datalen = w * h; + uint8_t *raw = malloc(datalen); + if(!raw) { + [self release]; + return(nil); + } + + zbar_image_set_data(zimg, raw, datalen, zbar_image_free_data); + zbar_image_set_format(zimg, zbar_fourcc('Y','8','0','0')); + zbar_image_set_size(zimg, w, h); + + // scale and crop simultaneously + CGFloat scale = size.width / crop.size.width; + crop.origin.x *= -scale; + crop.size.width = scale * (CGFloat)CGImageGetWidth(image); + scale = size.height / crop.size.height; + CGFloat height = CGImageGetHeight(image); + // compensate for wacky origin + crop.origin.y = height - crop.origin.y - crop.size.height; + crop.origin.y *= -scale; + crop.size.height = scale * height; + + // generate grayscale image data + CGColorSpaceRef cs = CGColorSpaceCreateDeviceGray(); + CGContextRef ctx = + CGBitmapContextCreate(raw, w, h, 8, w, cs, kCGImageAlphaNone); + CGColorSpaceRelease(cs); + CGContextSetAllowsAntialiasing(ctx, 0); + + CGContextDrawImage(ctx, crop, image); + +#if 0 + zlog(@"convert image %dx%d: crop %g,%g %gx%g size %gx%g (%dx%d)", + CGImageGetWidth(image), CGImageGetHeight(image), + crop.origin.x, crop.origin.y, crop.size.width, crop.size.height, + size.width, size.height, w, h); + CGImageRef cgdump = CGBitmapContextCreateImage(ctx); + UIImage *uidump = [[UIImage alloc] + initWithCGImage: cgdump]; + CGImageRelease(cgdump); + UIImageWriteToSavedPhotosAlbum(uidump, nil, nil, NULL); + [uidump release]; +#endif + + CGContextRelease(ctx); + + t_convert = timer_elapsed(t_start, timer_now()); + return(self); +} + +- (id) initWithCGImage: (CGImageRef) image + size: (CGSize) size +{ + CGRect crop = CGRectMake(0, 0, + CGImageGetWidth(image), + CGImageGetHeight(image)); + return([self initWithCGImage: image + crop: crop + size: size]); +} + +- (id) initWithCGImage: (CGImageRef) image +{ + CGRect crop = CGRectMake(0, 0, + CGImageGetWidth(image), + CGImageGetHeight(image)); + return([self initWithCGImage: image + crop: crop + size: crop.size]); +} + +- (zbar_image_t*) image +{ + return(zimg); +} + +- (unsigned long) format +{ + return(zbar_image_get_format(zimg)); +} + +- (void) setFormat: (unsigned long) format +{ + zbar_image_set_format(zimg, format); +} + +- (unsigned) sequence +{ + return(zbar_image_get_sequence(zimg)); +} + +- (void) setSequence: (unsigned) seq +{ + zbar_image_set_sequence(zimg, seq); +} + +- (CGSize) size +{ + unsigned w, h; + zbar_image_get_size(zimg, &w, &h); + return(CGSizeMake(w, h)); +} + +- (void) setSize: (CGSize) size +{ + zbar_image_set_size(zimg, size.width + .5, size.height + .5); +} + +- (CGRect) crop +{ + unsigned x, y, w, h; + zbar_image_get_crop(zimg, &x, &y, &w, &h); + return(CGRectMake(x, y, w, h)); +} + +- (void) setCrop: (CGRect) crop +{ + zbar_image_set_crop(zimg, crop.origin.x + .5, crop.origin.y + .5, + crop.size.width + .5, crop.size.height + .5); +} + +- (ZBarSymbolSet*) symbols +{ + return([[[ZBarSymbolSet alloc] + initWithSymbolSet: zbar_image_get_symbols(zimg)] + autorelease]); +} + +- (void) setSymbols: (ZBarSymbolSet*) symbols +{ + zbar_image_set_symbols(zimg, [symbols zbarSymbolSet]); +} + +- (const void*) data +{ + return(zbar_image_get_data(zimg)); +} + +- (unsigned long) dataLength +{ + return(zbar_image_get_data_length(zimg)); +} + +- (void) setData: (const void*) data + withLength: (unsigned long) length +{ + zbar_image_set_data(zimg, data, length, image_cleanup); +} + +- (zbar_image_t*) zbarImage +{ + return(zimg); +} + +- (UIImage*) UIImageWithOrientation: (UIImageOrientation) orient +{ + unsigned long format = self.format; + size_t bpc, bpp; + switch(format) + { + case zbar_fourcc('R','G','B','3'): + bpc = 8; + bpp = 24; + break; + case zbar_fourcc('R','G','B','4'): + bpc = 8; + bpp = 32; + break; + case zbar_fourcc('R','G','B','Q'): + bpc = 5; + bpp = 16; + break; + default: + NSLog(@"ERROR: format %.4s(%08lx) is unsupported", + (char*)&format, format); + assert(0); + return(nil); + }; + + unsigned w = zbar_image_get_width(zimg); + unsigned h = zbar_image_get_height(zimg); + const void *data = zbar_image_get_data(zimg); + size_t datalen = zbar_image_get_data_length(zimg); + CGDataProviderRef datasrc = + CGDataProviderCreateWithData(self, data, datalen, (void*)CFRelease); + CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB(); + CGImageRef cgimg = + CGImageCreate(w, h, bpc, bpp, ((bpp + 7) >> 3) * w, cs, + kCGBitmapByteOrderDefault | + kCGImageAlphaNoneSkipFirst, + datasrc, NULL, YES, kCGRenderingIntentDefault); + CGColorSpaceRelease(cs); + CGDataProviderRelease(datasrc); + + UIImage *uiimg = + [UIImage imageWithCGImage: cgimg + scale: 1 + orientation: orient]; + CGImageRelease(cgimg); + return(uiimg); +} + +- (UIImage*) UIImage +{ + return([self UIImageWithOrientation: UIImageOrientationUp]); +} + +- (void) cleanup +{ +} + +#if 0 +- (ZBarImage*) convertToFormat: (unsigned long) format +{ + zbar_image_t *zdst = zbar_image_convert(zimg, format); + ZBarImage *image = ; + return([[[ZBarImage alloc] initWithImage: zdst] autorelease]); +} +#endif + +@end diff --git a/iphone/ZBarImageScanner.m b/iphone/ZBarImageScanner.m new file mode 100644 index 0000000..cdc4ea4 --- /dev/null +++ b/iphone/ZBarImageScanner.m @@ -0,0 +1,85 @@ +//------------------------------------------------------------------------ +// Copyright 2009 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import "debug.h" + +@implementation ZBarImageScanner + +@dynamic enableCache, results; + +- (id) init +{ + if(self = [super init]) { + scanner = zbar_image_scanner_create(); + } + return(self); +} + +- (void) dealloc +{ + if(scanner) { + zbar_image_scanner_destroy(scanner); + scanner = NULL; + } + [super dealloc]; +} + +- (BOOL) enableCache +{ + assert(0); // FIXME + return(NO); +} + +- (void) setEnableCache: (BOOL) enable +{ + zbar_image_scanner_enable_cache(scanner, enable); +} + +- (ZBarSymbolSet*) results +{ + const zbar_symbol_set_t *set = zbar_image_scanner_get_results(scanner); + return([[[ZBarSymbolSet alloc] initWithSymbolSet: set] autorelease]); +} + +// image scanner config wrappers +- (void) parseConfig: (NSString*) cfg +{ + zbar_image_scanner_parse_config(scanner, [cfg UTF8String]); + // FIXME throw errors +} + +- (void) setSymbology: (zbar_symbol_type_t) sym + config: (zbar_config_t) cfg + to: (int) val +{ + zbar_image_scanner_set_config(scanner, sym, cfg, val); + // FIXME throw errors +} + +- (NSInteger) scanImage: (ZBarImage*) image +{ + return(zbar_scan_image(scanner, image.zbarImage)); +} + +@end diff --git a/iphone/ZBarReaderController.m b/iphone/ZBarReaderController.m new file mode 100644 index 0000000..6b3d18e --- /dev/null +++ b/iphone/ZBarReaderController.m @@ -0,0 +1,747 @@ +//------------------------------------------------------------------------ +// Copyright 2009-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import +#import "debug.h" + +/* the use of UIGetScreenImage() may no longer be sanctioned, even + * though it was previously "allowed". define this to 0 to rip it out + * and fall back to cameraMode=Default (manual capture) + */ +#ifndef USE_PRIVATE_APIS +# define USE_PRIVATE_APIS 0 +#endif + +#ifndef MIN_QUALITY +# define MIN_QUALITY 10 +#endif + +NSString* const ZBarReaderControllerResults = @"ZBarReaderControllerResults"; + +#if USE_PRIVATE_APIS +// expose undocumented API +CF_RETURNS_RETAINED +CGImageRef UIGetScreenImage(void); +#endif + +@implementation ZBarReaderController + +@synthesize scanner, readerDelegate, cameraMode, scanCrop, maxScanDimension, + showsHelpOnFail, takesPicture, enableCache, tracksSymbols; +@dynamic showsZBarControls; + +- (id) init +{ + if(self = [super init]) { + showsHelpOnFail = YES; + hasOverlay = showsZBarControls = + [self respondsToSelector: @selector(cameraOverlayView)]; + enableCache = tracksSymbols = YES; + scanCrop = CGRectMake(0, 0, 1, 1); + maxScanDimension = 640; + + scanner = [ZBarImageScanner new]; + [scanner setSymbology: 0 + config: ZBAR_CFG_X_DENSITY + to: 2]; + [scanner setSymbology: 0 + config: ZBAR_CFG_Y_DENSITY + to: 2]; + + if([UIImagePickerController + isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) + self.sourceType = UIImagePickerControllerSourceTypeCamera; + +#if USE_PRIVATE_APIS + cameraMode = ZBarReaderControllerCameraModeSampling; +#else + cameraMode = ZBarReaderControllerCameraModeDefault; +#endif + } + return(self); +} + +- (void) initOverlay +{ + CGRect bounds = self.view.bounds; + overlay = [[UIView alloc] initWithFrame: bounds]; + overlay.backgroundColor = [UIColor clearColor]; + + CGRect r = bounds; + r.size.height -= 54; + boxView = [[UIView alloc] initWithFrame: r]; + + boxLayer = [CALayer new]; + boxLayer.frame = r; + boxLayer.borderWidth = 1; + boxLayer.borderColor = [UIColor greenColor].CGColor; + [boxView.layer addSublayer: boxLayer]; + + toolbar = [UIToolbar new]; + toolbar.barStyle = UIBarStyleBlackOpaque; + r.origin.y = r.size.height; + r.size.height = 54; + toolbar.frame = r; + + cancelBtn = [[UIBarButtonItem alloc] + initWithBarButtonSystemItem: UIBarButtonSystemItemCancel + target: self + action: @selector(cancel)]; + cancelBtn.width = r.size.width / 4 - 16; + + scanBtn = [[UIBarButtonItem alloc] + initWithTitle: @"Scan!" + style: UIBarButtonItemStyleDone + target: self + action: @selector(scan)]; + scanBtn.width = r.size.width / 2 - 16; + + for(int i = 0; i < 2; i++) + space[i] = [[UIBarButtonItem alloc] + initWithBarButtonSystemItem: + UIBarButtonSystemItemFlexibleSpace + target: nil + action: nil]; + + space[2] = [[UIBarButtonItem alloc] + initWithBarButtonSystemItem: + UIBarButtonSystemItemFixedSpace + target: nil + action: nil]; + space[2].width = r.size.width / 4 - 16; + + infoBtn = [[UIButton buttonWithType: UIButtonTypeInfoLight] retain]; + r.origin.x = r.size.width - 54; + r.size.width = 54; + infoBtn.frame = r; + [infoBtn addTarget: self + action: @selector(info) + forControlEvents: UIControlEventTouchUpInside]; +} + +- (void) viewDidLoad +{ + [super viewDidLoad]; + [super setDelegate: self]; + if(hasOverlay) + [self initOverlay]; +} + +- (void) cleanup +{ + [overlay release]; + overlay = nil; + [boxView release]; + boxView = nil; + [boxLayer release]; + boxLayer = nil; + [toolbar release]; + toolbar = nil; + [cancelBtn release]; + cancelBtn = nil; + [scanBtn release]; + scanBtn = nil; + for(int i = 0; i < 3; i++) { + [space[i] release]; + space[i] = nil; + } + [infoBtn release]; + infoBtn = nil; + [help release]; + help = nil; +} + +- (void) viewDidUnload +{ + [self cleanup]; + [super viewDidUnload]; +} + +- (void) dealloc +{ + [self cleanup]; + [scanner release]; + scanner = nil; + [super dealloc]; +} + +- (void) scan +{ + scanBtn.enabled = NO; + self.view.userInteractionEnabled = NO; + [self takePicture]; +} + +- (void) cancel +{ + [self performSelector: @selector(imagePickerControllerDidCancel:) + withObject: self + afterDelay: 0.1]; +} + +- (void) reenable +{ + scanBtn.enabled = YES; + self.view.userInteractionEnabled = YES; +} + +- (void) initScanning +{ + if(hasOverlay && + self.sourceType == UIImagePickerControllerSourceTypeCamera) { + if(showsZBarControls || ![self cameraOverlayView]) + [self setCameraOverlayView: overlay]; + + UIView *activeOverlay = [self cameraOverlayView]; + + if(showsZBarControls) { + if(!toolbar.superview) { + [overlay addSubview: toolbar]; + [overlay addSubview: infoBtn]; + } + [self setShowsCameraControls: NO]; + } + else { + [toolbar removeFromSuperview]; + [infoBtn removeFromSuperview]; + if(activeOverlay == overlay) + [self setShowsCameraControls: YES]; + } + + self.view.userInteractionEnabled = YES; + + sampling = (cameraMode == ZBarReaderControllerCameraModeSampling || + cameraMode == ZBarReaderControllerCameraModeSequence); + + if(sampling) { + toolbar.items = [NSArray arrayWithObjects: + cancelBtn, space[0], nil]; + + t_frame = timer_now(); + dt_frame = 0; + boxLayer.opacity = 0; + if(boxView.superview != activeOverlay) + [boxView removeFromSuperview]; + if(!boxView.superview) + [activeOverlay insertSubview: boxView atIndex:0]; + scanner.enableCache = enableCache; + + SEL meth = nil; + if(cameraMode == ZBarReaderControllerCameraModeSampling) { + // ensure crop rect does not include controls + if(scanCrop.origin.x + scanCrop.size.width > .8875) + scanCrop.size.width = .8875 - scanCrop.origin.x; + + meth = @selector(scanScreen); + } + else + meth = @selector(takePicture); + + [self performSelector: meth + withObject: nil + afterDelay: 2]; +#ifdef DEBUG_OBJC + [self performSelector: @selector(dumpFPS) + withObject: nil + afterDelay: 4]; +#endif + } + else { + scanBtn.enabled = NO; + toolbar.items = [NSArray arrayWithObjects: + cancelBtn, space[0], scanBtn, space[1], space[2], nil]; + + [self performSelector: @selector(reenable) + withObject: nil + afterDelay: .5]; + + [boxView removeFromSuperview]; + } + } +} + +- (void) viewWillAppear: (BOOL) animated +{ + [self initScanning]; + [super viewWillAppear: animated]; +} + +- (void) viewWillDisappear: (BOOL) animated +{ + sampling = NO; + scanner.enableCache = NO; + [super viewWillDisappear: animated]; +} + +- (BOOL) showsZBarControls +{ + return(showsZBarControls); +} + +- (void) setCameraMode: (ZBarReaderControllerCameraMode) mode +{ +#if !USE_PRIVATE_APIS + if(mode == ZBarReaderControllerCameraModeSampling) + [NSException raise: NSInvalidArgumentException + format: @"ZBarReaderController cannot set cameraMode=Sampling" + @" when USE_PRIVATE_APIS=0"]; +#endif + cameraMode = mode; +} + +- (void) setShowsZBarControls: (BOOL) show +{ + if(show && !hasOverlay) + [NSException raise: NSInvalidArgumentException + format: @"ZBarReaderController cannot set showsZBarControls=YES for OS<3.1"]; + + showsZBarControls = show; +} + +// intercept delegate as readerDelegate + +- (void) setDelegate: (id ) delegate +{ + self.readerDelegate = (id )delegate; +} + + +#ifdef DEBUG_OBJC +- (void) dumpFPS +{ + if(!sampling) + return; + [self performSelector: @selector(dumpFPS) + withObject: nil + afterDelay: 2]; + zlog(@"fps=%g", 1 / dt_frame); +} +#endif + +- (NSInteger) scanImage: (CGImageRef) image + withScaling: (CGFloat) scale +{ + uint64_t now = timer_now(); + if(dt_frame) + dt_frame = (dt_frame + timer_elapsed(t_frame, now)) / 2; + else + dt_frame = timer_elapsed(t_frame, now); + t_frame = now; + + int w = CGImageGetWidth(image); + int h = CGImageGetHeight(image); + CGRect crop; + if(w >= h) + crop = CGRectMake(scanCrop.origin.x * w, scanCrop.origin.y * h, + scanCrop.size.width * w, scanCrop.size.height * h); + else + crop = CGRectMake(scanCrop.origin.y * w, scanCrop.origin.x * h, + scanCrop.size.height * w, scanCrop.size.width * h); + + CGSize size; + if(crop.size.width >= crop.size.height && + crop.size.width > maxScanDimension) + size = CGSizeMake(maxScanDimension, + crop.size.height * maxScanDimension / crop.size.width); + else if(crop.size.height > maxScanDimension) + size = CGSizeMake(crop.size.width * maxScanDimension / crop.size.height, + maxScanDimension); + else + size = crop.size; + + if(scale) { + size.width *= scale; + size.height *= scale; + } + + if(self.sourceType != UIImagePickerControllerSourceTypeCamera || + cameraMode == ZBarReaderControllerCameraModeDefault) { + // limit the maximum number of scan passes + int density; + if(size.width > 720) + density = (size.width / 240 + 1) / 2; + else + density = 1; + [scanner setSymbology: 0 + config: ZBAR_CFG_X_DENSITY + to: density]; + + if(size.height > 720) + density = (size.height / 240 + 1) / 2; + else + density = 1; + [scanner setSymbology: 0 + config: ZBAR_CFG_Y_DENSITY + to: density]; + } + + ZBarImage *zimg = [[ZBarImage alloc] + initWithCGImage: image + crop: crop + size: size]; + int nsyms = [scanner scanImage: zimg]; + [zimg release]; + + return(nsyms); +} + +- (ZBarSymbol*) extractBestResult: (BOOL) filter +{ + ZBarSymbol *sym = nil; + ZBarSymbolSet *results = scanner.results; + results.filterSymbols = filter; + for(ZBarSymbol *s in results) + if(!sym || sym.quality < s.quality) + sym = s; + return(sym); +} + +- (void) updateBox: (ZBarSymbol*) sym + imageSize: (CGSize) size +{ + [CATransaction begin]; + [CATransaction setAnimationDuration: .3]; + [CATransaction setAnimationTimingFunction: + [CAMediaTimingFunction functionWithName: + kCAMediaTimingFunctionLinear]]; + + CGFloat alpha = boxLayer.opacity; + if(sym) { + CGRect r = sym.bounds; + if(r.size.width > 16 && r.size.height > 16) { + r.origin.x += scanCrop.origin.y * size.width; + r.origin.y += scanCrop.origin.x * size.height; + r = CGRectInset(r, -16, -16); + if(alpha > .25) { + CGRect frame = boxLayer.frame; + r.origin.x = (r.origin.x * 3 + frame.origin.x) / 4; + r.origin.y = (r.origin.y * 3 + frame.origin.y) / 4; + r.size.width = (r.size.width * 3 + frame.size.width) / 4; + r.size.height = (r.size.height * 3 + frame.size.height) / 4; + } + boxLayer.frame = r; + boxLayer.opacity = 1; + } + } + else { + if(alpha > .1) + boxLayer.opacity = alpha / 2; + else if(alpha) + boxLayer.opacity = 0; + } + [CATransaction commit]; +} + +#if USE_PRIVATE_APIS + +- (void) scanScreen +{ + if(!sampling) + return; + + // FIXME ugly hack: use private API to sample screen + CGImageRef image = UIGetScreenImage(); + + [self scanImage: image + withScaling: 0]; + CGSize size = CGSizeMake(CGImageGetWidth(image), CGImageGetHeight(image)); + CGImageRelease(image); + + ZBarSymbol *sym = [self extractBestResult: NO]; + + if(sym && !sym.count) { + SEL cb = @selector(imagePickerController:didFinishPickingMediaWithInfo:); + if(takesPicture) { + symbol = [sym retain]; + [self takePicture]; + } + else if([readerDelegate respondsToSelector: cb]) { + symbol = [sym retain]; + + [CATransaction begin]; + [CATransaction setDisableActions: YES]; + boxLayer.opacity = 0; + [CATransaction commit]; + + // capture preview image and send to delegate + // after box has been hidden + [self performSelector: @selector(captureScreen) + withObject: nil + afterDelay: 0.001]; + return; + } + } + + // reschedule + [self performSelector: @selector(scanScreen) + withObject: nil + afterDelay: 0.001]; + + if(tracksSymbols) + [self updateBox: sym + imageSize: size]; +} + +- (void) captureScreen +{ + CGImageRef screen = UIGetScreenImage(); + + CGRect r = CGRectMake(0, 0, + CGImageGetWidth(screen), CGImageGetHeight(screen)); + if(r.size.width > r.size.height) + r.size.width -= 54; + else + r.size.height -= 54; + CGImageRef preview = CGImageCreateWithImageInRect(screen, r); + CGImageRelease(screen); + + UIImage *image = [UIImage imageWithCGImage: preview]; + CGImageRelease(preview); + + [readerDelegate + imagePickerController: self + didFinishPickingMediaWithInfo: + [NSDictionary dictionaryWithObjectsAndKeys: + image, UIImagePickerControllerOriginalImage, + [NSArray arrayWithObject: symbol], + ZBarReaderControllerResults, + nil]]; + [symbol release]; + symbol = nil; + + // continue scanning until dismissed + [self performSelector: @selector(scanScreen) + withObject: nil + afterDelay: 0.001]; +} + +#endif /* USE_PRIVATE_APIS */ + +- (void) scanSequence: (UIImage*) image +{ + if(!sampling) { + [image release]; + return; + } + + int nsyms = [self scanImage: image.CGImage + withScaling: 0]; + + ZBarSymbol *sym = nil; + if(nsyms) + [self extractBestResult: NO]; + + SEL cb = @selector(imagePickerController:didFinishPickingMediaWithInfo:); + if(sym && !sym.count && + [readerDelegate respondsToSelector: cb]) + [readerDelegate + imagePickerController: self + didFinishPickingMediaWithInfo: + [NSDictionary dictionaryWithObjectsAndKeys: + image, UIImagePickerControllerOriginalImage, + [NSArray arrayWithObject: sym], + ZBarReaderControllerResults, + nil]]; + CGSize size = image.size; + [image release]; + + // reschedule + [self performSelector: @selector(takePicture) + withObject: nil + afterDelay: 0.001]; + + if(tracksSymbols) + [self updateBox: sym + imageSize: size]; +} + +- (void) showHelpWithReason: (NSString*) reason +{ + if(help) { + [help.view removeFromSuperview]; + [help release]; + } + help = [[ZBarHelpController alloc] + initWithReason: reason]; + help.delegate = (id)self; + + if(self.sourceType != UIImagePickerControllerSourceTypeCamera) { + [self presentModalViewController: help + animated: YES]; + return; + } + + // show help as overlay view to workaround controller bugs + sampling = NO; + scanner.enableCache = NO; + help.wantsFullScreenLayout = YES; + help.view.alpha = 0; + + UIView *activeOverlay = [self cameraOverlayView]; + help.view.frame = [activeOverlay + convertRect: CGRectMake(0, 0, 320, 480) + fromView: nil]; + [activeOverlay addSubview: help.view]; + [UIView beginAnimations: @"ZBarHelp" + context: nil]; + help.view.alpha = 1; + [UIView commitAnimations]; +} + +- (void) info +{ + [self showHelpWithReason: @"INFO"]; +} + +- (void) imagePickerController: (UIImagePickerController*) picker + didFinishPickingMediaWithInfo: (NSDictionary*) info +{ + UIImage *img = [info objectForKey: UIImagePickerControllerOriginalImage]; + + id results = nil; + if(self.sourceType == UIImagePickerControllerSourceTypeCamera && + cameraMode == ZBarReaderControllerCameraModeSequence) { + if(sampling) + [self performSelector: @selector(scanSequence:) + withObject: [img retain] + afterDelay: 0.001]; + return; + } + else if(!sampling) + results = [self scanImage: img.CGImage]; + else { + results = [NSArray arrayWithObject: symbol]; + [symbol release]; + symbol = nil; + } + + [self performSelector: @selector(reenable) + withObject: nil + afterDelay: .25]; + + if(results) { + NSMutableDictionary *newinfo = [info mutableCopy]; + [newinfo setObject: results + forKey: ZBarReaderControllerResults]; + SEL cb = @selector(imagePickerController:didFinishPickingMediaWithInfo:); + if([readerDelegate respondsToSelector: cb]) + [readerDelegate imagePickerController: self + didFinishPickingMediaWithInfo: newinfo]; + else + [self dismissModalViewControllerAnimated: YES]; + [newinfo release]; + return; + } + + BOOL camera = (self.sourceType == UIImagePickerControllerSourceTypeCamera); + BOOL retry = !camera || (hasOverlay && ![self showsCameraControls]); + if(showsHelpOnFail && retry) + [self showHelpWithReason: @"FAIL"]; + + SEL cb = @selector(readerControllerDidFailToRead:withRetry:); + if([readerDelegate respondsToSelector: cb]) + // assume delegate dismisses controller if necessary + [readerDelegate readerControllerDidFailToRead: self + withRetry: retry]; + else if(!retry) + // must dismiss stock controller + [self dismissModalViewControllerAnimated: YES]; +} + +- (void) imagePickerControllerDidCancel: (UIImagePickerController*) picker +{ + SEL cb = @selector(imagePickerControllerDidCancel:); + if([readerDelegate respondsToSelector: cb]) + [readerDelegate imagePickerControllerDidCancel: self]; + else + [self dismissModalViewControllerAnimated: YES]; +} + +// ZBarHelpDelegate + +- (void) helpControllerDidFinish: (ZBarHelpController*) hlp +{ + if(self.sourceType == UIImagePickerControllerSourceTypeCamera) { + [UIView beginAnimations: @"ZBarHelp" + context: nil]; + hlp.view.alpha = 0; + [UIView commitAnimations]; + [self initScanning]; + } + else + [hlp dismissModalViewControllerAnimated: YES]; +} + +- (id ) scanImage: (CGImageRef) image +{ + timer_start; + + int nsyms = [self scanImage: image + withScaling: 0]; + + if(!nsyms && + CGImageGetWidth(image) >= 640 && + CGImageGetHeight(image) >= 640) + // make one more attempt for close up, grainy images + nsyms = [self scanImage: image + withScaling: .5]; + + NSMutableArray *syms = nil; + if(nsyms) { + // quality/type filtering + int max_quality = MIN_QUALITY; + for(ZBarSymbol *sym in scanner.results) { + zbar_symbol_type_t type = sym.type; + int quality; + if(type == ZBAR_QRCODE) + quality = INT_MAX; + else + quality = sym.quality; + + if(quality < max_quality) { + zlog(@" type=%d quality=%d < %d\n", + type, quality, max_quality); + continue; + } + + if(max_quality < quality) { + max_quality = quality; + if(syms) + [syms removeAllObjects]; + } + zlog(@" type=%d quality=%d\n", type, quality); + if(!syms) + syms = [NSMutableArray arrayWithCapacity: 1]; + + [syms addObject: sym]; + } + } + + zlog(@"read %d filtered symbols in %gs total\n", + (!syms) ? 0 : [syms count], timer_elapsed(t_start, timer_now())); + return(syms); +} + +@end diff --git a/iphone/ZBarReaderView.m b/iphone/ZBarReaderView.m new file mode 100644 index 0000000..60fc18d --- /dev/null +++ b/iphone/ZBarReaderView.m @@ -0,0 +1,596 @@ +//------------------------------------------------------------------------ +// Copyright 2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import + +#define MODULE ZBarReaderView +#import "debug.h" + +// silence warning +@interface ZBarReaderViewImpl : NSObject +@end + +@implementation ZBarReaderView + +@synthesize readerDelegate, tracksSymbols, trackingColor, torchMode, showsFPS, + zoom, maxZoom, scanCrop, previewTransform, captureReader; +@dynamic scanner, allowsPinchZoom, enableCache, device, session; + ++ (id) alloc +{ + if(self == [ZBarReaderView class]) { + // this is an abstract wrapper for implementation selected + // at compile time. replace with concrete subclass. + return((id)[ZBarReaderViewImpl alloc]); + } + return([super alloc]); +} + +- (void) initSubviews +{ + assert(preview); + + overlay = [CALayer new]; + overlay.backgroundColor = [UIColor clearColor].CGColor; + [preview addSublayer: overlay]; + +#ifndef NDEBUG + overlay.borderWidth = 2; + overlay.borderColor = [UIColor colorWithRed: 1 + green: 0 + blue: 0 + alpha: .5].CGColor; + cropLayer = [CALayer new]; + cropLayer.backgroundColor = [UIColor clearColor].CGColor; + cropLayer.borderWidth = 2; + cropLayer.borderColor = [UIColor colorWithRed: 0 + green: 0 + blue: 1 + alpha: .5].CGColor; + [overlay addSublayer: cropLayer]; +#endif + + tracking = [CALayer new]; + tracking.opacity = 0; + tracking.borderWidth = 1; + tracking.backgroundColor = [UIColor clearColor].CGColor; + [overlay addSublayer: tracking]; + + trackingColor = [[UIColor greenColor] + retain]; + tracking.borderColor = trackingColor.CGColor; + + fpsView = [UIView new]; + fpsView.backgroundColor = [UIColor colorWithWhite: 0 + alpha: .333]; + fpsView.layer.cornerRadius = 12; + fpsView.hidden = YES; + [self addSubview: fpsView]; + + fpsLabel = [[UILabel alloc] + initWithFrame: CGRectMake(0, 0, 80, 32)]; + fpsLabel.backgroundColor = [UIColor clearColor]; + fpsLabel.textColor = [UIColor colorWithRed: .333 + green: .666 + blue: 1 + alpha: 1]; + fpsLabel.font = [UIFont systemFontOfSize: 18]; + fpsLabel.textAlignment = UITextAlignmentRight; + [fpsView addSubview: fpsLabel]; + + self.zoom = 1.25; +} + +- (void) _initWithImageScanner: (ZBarImageScanner*) scanner +{ + assert(scanner); + + tracksSymbols = YES; + interfaceOrientation = UIInterfaceOrientationPortrait; + torchMode = 2; // AVCaptureTorchModeAuto + scanCrop = effectiveCrop = CGRectMake(0, 0, 1, 1); + imageScale = 1; + previewTransform = CGAffineTransformIdentity; + maxZoom = 2; + + pinch = [[UIPinchGestureRecognizer alloc] + initWithTarget: self + action: @selector(handlePinch)]; + [self addGestureRecognizer: pinch]; +} + +- (id) initWithImageScanner: (ZBarImageScanner*) scanner +{ + self = [super initWithFrame: CGRectMake(0, 0, 320, 426)]; + if(!self) + return(nil); + + self.backgroundColor = [UIColor blackColor]; + self.contentMode = UIViewContentModeScaleAspectFill; + self.clipsToBounds = YES; + self.autoresizingMask = + UIViewAutoresizingFlexibleWidth | + UIViewAutoresizingFlexibleHeight; + + [self _initWithImageScanner: scanner]; + return(self); +} + +- (id) init +{ + ZBarImageScanner *scanner = + [[ZBarImageScanner new] + autorelease]; + self = [self initWithImageScanner: scanner]; + if(!self) + return(nil); + + [scanner setSymbology: 0 + config: ZBAR_CFG_X_DENSITY + to: 3]; + [scanner setSymbology: 0 + config: ZBAR_CFG_Y_DENSITY + to: 3]; + return(self); +} + +- (id) initWithCoder: (NSCoder*) decoder +{ + self = [super initWithCoder: decoder]; + if(!self) + return(nil); + ZBarImageScanner *scanner = + [[ZBarImageScanner new] + autorelease]; + [self _initWithImageScanner: scanner]; + + [scanner setSymbology: 0 + config: ZBAR_CFG_X_DENSITY + to: 3]; + [scanner setSymbology: 0 + config: ZBAR_CFG_Y_DENSITY + to: 3]; + return(self); +} + +- (void) dealloc +{ + [preview removeFromSuperlayer]; + [preview release]; + preview = nil; + [overlay release]; + overlay = nil; + [cropLayer release]; + cropLayer = nil; + [tracking release]; + tracking = nil; + [trackingColor release]; + trackingColor = nil; + [fpsLabel release]; + fpsLabel = nil; + [fpsView release]; + fpsView = nil; + [pinch release]; + pinch = nil; + [super dealloc]; +} + +- (void) resetTracking +{ + [tracking removeAllAnimations]; + [CATransaction begin]; + [CATransaction setDisableActions: YES]; + CGSize size = overlay.bounds.size; + CGRect crop = effectiveCrop; + tracking.frame = CGRectMake(crop.origin.x * size.width, + crop.origin.y * size.height, + crop.size.width * size.width, + crop.size.height * size.height); + tracking.opacity = 0; + [CATransaction commit]; +} + +- (void) updateCrop +{ +} + +static inline CGFloat rotationForInterfaceOrientation (int orient) +{ + // resolve camera/device image orientation to view/interface orientation + switch(orient) + { + case UIInterfaceOrientationLandscapeLeft: + return(M_PI_2); + case UIInterfaceOrientationPortraitUpsideDown: + return(M_PI); + case UIInterfaceOrientationLandscapeRight: + return(3 * M_PI_2); + case UIInterfaceOrientationPortrait: + return(2 * M_PI); + } + return(0); +} + +- (void) layoutSubviews +{ + CGRect bounds = self.bounds; + if(!bounds.size.width || !bounds.size.height) + return; + + [CATransaction begin]; + if(animationDuration) { + [CATransaction setAnimationDuration: animationDuration]; + [CATransaction setAnimationTimingFunction: + [CAMediaTimingFunction functionWithName: + kCAMediaTimingFunctionEaseInEaseOut]]; + } + else + [CATransaction setDisableActions: YES]; + + [super layoutSubviews]; + fpsView.frame = CGRectMake(bounds.size.width - 80, bounds.size.height - 32, + 80 + 12, 32 + 12); + + // orient view bounds to match camera image + CGSize psize; + if(UIInterfaceOrientationIsPortrait(interfaceOrientation)) + psize = CGSizeMake(bounds.size.height, bounds.size.width); + else + psize = bounds.size; + + // calculate scale from view coordinates to image coordinates + // FIXME assumes AVLayerVideoGravityResizeAspectFill + CGFloat scalex = imageSize.width / psize.width; + CGFloat scaley = imageSize.height / psize.height; + imageScale = (scalex < scaley) ? scalex : scaley; + if(!imageScale) + imageScale = 1; + // apply zoom + imageScale /= zoom; + + // scale crop by zoom factor + CGFloat z = 1 / zoom; + CGFloat t = (1 - z) / 2; + CGRect zoomCrop = + CGRectMake(scanCrop.origin.x * z + t, + scanCrop.origin.y * z + t, + scanCrop.size.width * z, + scanCrop.size.height * z); + + // convert effective preview area to normalized image coordinates + CGRect previewCrop; + if(scalex < scaley && imageSize.height) + previewCrop.size = + CGSizeMake(z, psize.height * imageScale / imageSize.height); + else if(imageSize.width) + previewCrop.size = + CGSizeMake(psize.width * imageScale / imageSize.width, z); + else + previewCrop.size = CGSizeMake(1, 1); + previewCrop.origin = CGPointMake((1 - previewCrop.size.width) / 2, + (1 - previewCrop.size.height) / 2); + + // clip crop to visible preview area + effectiveCrop = CGRectIntersection(zoomCrop, previewCrop); + if(CGRectIsNull(effectiveCrop)) + effectiveCrop = zoomCrop; + + // size preview to match image in view coordinates + CGFloat viewScale = 1 / imageScale; + if(imageSize.width && imageSize.height) + psize = CGSizeMake(imageSize.width * viewScale, + imageSize.height * viewScale); + + preview.bounds = CGRectMake(0, 0, psize.height, psize.width); + // center preview in view + preview.position = CGPointMake(bounds.size.width / 2, + bounds.size.height / 2); + + CGFloat angle = rotationForInterfaceOrientation(interfaceOrientation); + CATransform3D xform = + CATransform3DMakeAffineTransform(previewTransform); + preview.transform = CATransform3DRotate(xform, angle, 0, 0, 1); + + // scale overlay to match actual image + if(imageSize.width && imageSize.height) + overlay.bounds = CGRectMake(0, 0, imageSize.width, imageSize.height); + else + overlay.bounds = CGRectMake(0, 0, psize.width, psize.height); + // center overlay in preview + overlay.position = CGPointMake(psize.height / 2, psize.width / 2); + + // image coordinates rotated from preview + xform = CATransform3DMakeRotation(M_PI_2, 0, 0, 1); + overlay.transform = CATransform3DScale(xform, viewScale, viewScale, 1); + tracking.borderWidth = imageScale; + +#ifndef NDEBUG + preview.backgroundColor = [UIColor yellowColor].CGColor; + overlay.borderWidth = 2 * imageScale; + cropLayer.borderWidth = 2 * imageScale; + cropLayer.frame = CGRectMake(effectiveCrop.origin.x * imageSize.width, + effectiveCrop.origin.y * imageSize.height, + effectiveCrop.size.width * imageSize.width, + effectiveCrop.size.height * imageSize.height); + zlog(@"layoutSubviews: bounds=%@ orient=%d image=%@ crop=%@ zoom=%g\n" + @"=> preview=%@ crop=(z%@ p%@ %@ i%@) scale=%g %c %g = 1/%g", + NSStringFromCGSize(bounds.size), interfaceOrientation, + NSStringFromCGSize(imageSize), NSStringFromCGRect(scanCrop), zoom, + NSStringFromCGSize(psize), NSStringFromCGRect(zoomCrop), + NSStringFromCGRect(previewCrop), NSStringFromCGRect(effectiveCrop), + NSStringFromCGRect(cropLayer.frame), + scalex, (scalex > scaley) ? '>' : '<', scaley, viewScale); +#endif + + [self resetTracking]; + [self updateCrop]; + + [CATransaction commit]; + animationDuration = 0; +} + +- (void) setImageSize: (CGSize) size +{ + zlog(@"imageSize=%@", NSStringFromCGSize(size)); + imageSize = size; + + // FIXME bug in AVCaptureVideoPreviewLayer fails to update preview location + preview.bounds = CGRectMake(0, 0, size.width, size.height); + + [self setNeedsLayout]; +} + +- (void) willRotateToInterfaceOrientation: (UIInterfaceOrientation) orient + duration: (NSTimeInterval) duration +{ + if(interfaceOrientation != orient) { + zlog(@"orient=%d #%g", orient, duration); + interfaceOrientation = orient; + animationDuration = duration; + } +} + +- (void) setScanCrop: (CGRect) r +{ + if(CGRectEqualToRect(scanCrop, r)) + return; + scanCrop = r; + [self setNeedsLayout]; +} + +- (void) setTracksSymbols: (BOOL) track +{ + if(track == tracksSymbols) + return; + tracksSymbols = track; + [self resetTracking]; +} + +- (BOOL) allowsPinchZoom +{ + return(pinch.enabled); +} + +- (void) setAllowsPinchZoom: (BOOL) enabled +{ + pinch.enabled = enabled; +} + +- (void) setTrackingColor: (UIColor*) color +{ + if(!color) + return; + [color retain]; + [trackingColor release]; + trackingColor = color; + tracking.borderColor = color.CGColor; +} + +- (void) setShowsFPS: (BOOL) show +{ + if(show == showsFPS) + return; + fpsView.hidden = !show; +} + +- (void) setZoom: (CGFloat) z +{ + if(z < 1.0) + z = 1.0; + if(z > maxZoom) + z = maxZoom; + if(z == zoom) + return; + zoom = z; + + [self setNeedsLayout]; +} + +- (void) setZoom: (CGFloat) z + animated: (BOOL) animated +{ + [CATransaction begin]; + if(animated) { + [CATransaction setAnimationDuration: .1]; + [CATransaction setAnimationTimingFunction: + [CAMediaTimingFunction functionWithName: + kCAMediaTimingFunctionLinear]]; + } + else + [CATransaction setDisableActions: YES]; + // FIXME animate from current value + self.zoom = z; + [self layoutIfNeeded]; + [CATransaction commit]; +} + +- (void) setPreviewTransform: (CGAffineTransform) xfrm +{ + previewTransform = xfrm; + [self setNeedsLayout]; +} + +- (void) start +{ + if(started) + return; + started = YES; + + [self resetTracking]; + fpsLabel.text = @"--- fps "; + + [[UIDevice currentDevice] + beginGeneratingDeviceOrientationNotifications]; +} + +- (void) stop +{ + if(!started) + return; + started = NO; + + [[UIDevice currentDevice] + endGeneratingDeviceOrientationNotifications]; +} + +- (void) flushCache +{ +} + +// UIGestureRecognizer callback + +- (void) handlePinch +{ + if(pinch.state == UIGestureRecognizerStateBegan) + zoom0 = zoom; + CGFloat z = zoom0 * pinch.scale; + [self setZoom: z + animated: YES]; + + if((zoom < 1.5) != (z < 1.5)) { + int d = (z < 1.5) ? 3 : 2; + ZBarImageScanner *scanner = self.scanner; + @synchronized(scanner) { + [scanner setSymbology: 0 + config: ZBAR_CFG_X_DENSITY + to: d]; + [scanner setSymbology: 0 + config: ZBAR_CFG_Y_DENSITY + to: d]; + } + } +} + +- (void) updateTracking: (CALayer*) trk + withSymbol: (ZBarSymbol*) sym +{ + if(!sym) + return; + + CGRect r = sym.bounds; + if(r.size.width <= 32 && r.size.height <= 32) + return; + r = CGRectInset(r, -24, -24); + + CALayer *current = trk.presentationLayer; + CGPoint cp = current.position; + CGPoint p = CGPointMake(CGRectGetMidX(r), CGRectGetMidY(r)); + p = CGPointMake((p.x * 3 + cp.x) / 4, (p.y * 3 + cp.y) / 4); + + CGRect cr = current.bounds; + r.origin = cr.origin; + r.size.width = (r.size.width * 3 + cr.size.width) / 4; + r.size.height = (r.size.height * 3 + cr.size.height) / 4; + + CAMediaTimingFunction *linear = + [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionLinear]; + + CABasicAnimation *resize = + [CABasicAnimation animationWithKeyPath: @"bounds"]; + resize.fromValue = [NSValue valueWithCGRect: cr]; + resize.toValue = [NSValue valueWithCGRect: r]; + resize.duration = .2; + resize.timingFunction = linear; + resize.fillMode = kCAFillModeForwards; + resize.removedOnCompletion = NO; + + CABasicAnimation *move = + [CABasicAnimation animationWithKeyPath: @"position"]; + move.fromValue = [NSValue valueWithCGPoint: cp]; + move.toValue = [NSValue valueWithCGPoint: p]; + move.duration = .2; + move.timingFunction = linear; + move.fillMode = kCAFillModeForwards; + move.removedOnCompletion = NO; + + CABasicAnimation *on = + [CABasicAnimation animationWithKeyPath: @"opacity"]; + on.fromValue = [NSNumber numberWithDouble: current.opacity]; + on.toValue = [NSNumber numberWithDouble: 1]; + on.duration = .2; + on.timingFunction = linear; + on.fillMode = kCAFillModeForwards; + on.removedOnCompletion = NO; + + CABasicAnimation *off = nil; + if(!TARGET_IPHONE_SIMULATOR) { + off = [CABasicAnimation animationWithKeyPath: @"opacity"]; + off.fromValue = [NSNumber numberWithDouble: 1]; + off.toValue = [NSNumber numberWithDouble: 0]; + off.beginTime = .5; + off.duration = .5; + off.timingFunction = linear; + } + + CAAnimationGroup *group = [CAAnimationGroup animation]; + group.animations = [NSArray arrayWithObjects: resize, move, on, off, nil]; + group.duration = 1; + group.fillMode = kCAFillModeForwards; + group.removedOnCompletion = !TARGET_IPHONE_SIMULATOR; + [trk addAnimation: group + forKey: @"tracking"]; +} + +- (void) didTrackSymbols: (ZBarSymbolSet*) syms +{ + if(!tracksSymbols) + return; + + int n = syms.count; + assert(n); + if(!n) + return; + + ZBarSymbol *sym = nil; + for(ZBarSymbol *s in syms) + if(!sym || s.type == ZBAR_QRCODE || s.quality > sym.quality) + sym = s; + assert(sym); + if(!sym) + return; + + [self updateTracking: tracking + withSymbol: sym]; +} + +@end diff --git a/iphone/ZBarReaderViewController.m b/iphone/ZBarReaderViewController.m new file mode 100644 index 0000000..03faf70 --- /dev/null +++ b/iphone/ZBarReaderViewController.m @@ -0,0 +1,711 @@ +//------------------------------------------------------------------------ +// Copyright 2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import +#import +#import +#import + +#define MODULE ZBarReaderViewController +#import "debug.h" + +static inline AVCaptureDevicePosition +AVPositionForUICamera (UIImagePickerControllerCameraDevice camera) +{ + switch(camera) { + case UIImagePickerControllerCameraDeviceRear: + return(AVCaptureDevicePositionBack); + case UIImagePickerControllerCameraDeviceFront: + return(AVCaptureDevicePositionFront); + } + return(-1); +} + +static inline UIImagePickerControllerCameraDevice +UICameraForAVPosition (AVCaptureDevicePosition position) +{ + switch(position) + { + case AVCaptureDevicePositionBack: + return(UIImagePickerControllerCameraDeviceRear); + case AVCaptureDevicePositionFront: + return(UIImagePickerControllerCameraDeviceFront); + } + return(-1); +} + +static inline AVCaptureDevice* +AVDeviceForUICamera (UIImagePickerControllerCameraDevice camera) +{ + AVCaptureDevicePosition position = AVPositionForUICamera(camera); + if(position < 0) + return(nil); + +#if !TARGET_IPHONE_SIMULATOR + NSArray *allDevices = + [AVCaptureDevice devicesWithMediaType: AVMediaTypeVideo]; + for(AVCaptureDevice *device in allDevices) + // FIXME how to quantify "best" of several (theoretical) possibilities + if(device.position == position) + return(device); +#endif + return(nil); +} + +static inline AVCaptureTorchMode +AVTorchModeForUIFlashMode (UIImagePickerControllerCameraFlashMode mode) +{ + switch(mode) + { + case UIImagePickerControllerCameraFlashModeAuto: + return(AVCaptureTorchModeAuto); + case UIImagePickerControllerCameraFlashModeOn: + return(AVCaptureTorchModeOn); + case UIImagePickerControllerCameraFlashModeOff: + break; + } + return(AVCaptureTorchModeOff); +} + +static inline NSString* +AVSessionPresetForUIVideoQuality (UIImagePickerControllerQualityType quality) +{ +#if !TARGET_IPHONE_SIMULATOR + switch(quality) + { + case UIImagePickerControllerQualityTypeHigh: + return(AVCaptureSessionPresetHigh); + case UIImagePickerControllerQualityType640x480: + return(AVCaptureSessionPreset640x480); + case UIImagePickerControllerQualityTypeMedium: + return(AVCaptureSessionPresetMedium); + case UIImagePickerControllerQualityTypeLow: + return(AVCaptureSessionPresetLow); + case UIImagePickerControllerQualityTypeIFrame1280x720: + return(AVCaptureSessionPresetiFrame1280x720); + case UIImagePickerControllerQualityTypeIFrame960x540: + return(AVCaptureSessionPresetiFrame960x540); + } +#endif + return(nil); +} + + +@implementation ZBarReaderViewController + +@synthesize scanner, readerDelegate, showsZBarControls, + supportedOrientationsMask, tracksSymbols, enableCache, cameraOverlayView, + cameraViewTransform, cameraDevice, cameraFlashMode, videoQuality, + readerView, scanCrop; +@dynamic sourceType, allowsEditing, allowsImageEditing, showsCameraControls, + showsHelpOnFail, cameraMode, takesPicture, maxScanDimension; + ++ (BOOL) isSourceTypeAvailable: (UIImagePickerControllerSourceType) sourceType +{ + if(sourceType != UIImagePickerControllerSourceTypeCamera) + return(NO); + return(TARGET_IPHONE_SIMULATOR || + [UIImagePickerController isSourceTypeAvailable: sourceType]); +} + ++ (BOOL) isCameraDeviceAvailable: (UIImagePickerControllerCameraDevice) camera +{ + return(TARGET_IPHONE_SIMULATOR || + [UIImagePickerController isCameraDeviceAvailable: camera]); +} + ++ (BOOL) isFlashAvailableForCameraDevice: (UIImagePickerControllerCameraDevice) camera +{ + return(TARGET_IPHONE_SIMULATOR || + [UIImagePickerController isFlashAvailableForCameraDevice: camera]); +} + ++ (NSArray*) availableCaptureModesForCameraDevice: (UIImagePickerControllerCameraDevice) camera +{ + if(![self isCameraDeviceAvailable: camera]) + return([NSArray array]); + + // current reader only supports automatic detection + return([NSArray arrayWithObject: + [NSNumber numberWithInteger: + UIImagePickerControllerCameraCaptureModeVideo]]); +} + +- (void) _init +{ + supportedOrientationsMask = + ZBarOrientationMask(UIInterfaceOrientationPortrait); + showsZBarControls = tracksSymbols = enableCache = YES; + scanCrop = CGRectMake(0, 0, 1, 1); + cameraViewTransform = CGAffineTransformIdentity; + + cameraFlashMode = UIImagePickerControllerCameraFlashModeAuto; + videoQuality = UIImagePickerControllerQualityType640x480; + AVCaptureDevice *device = nil; +#if !TARGET_IPHONE_SIMULATOR + device = [AVCaptureDevice defaultDeviceWithMediaType: AVMediaTypeVideo]; +#endif + if(device) + cameraDevice = UICameraForAVPosition(device.position); + else + cameraDevice = UIImagePickerControllerCameraDeviceRear; + + // create our own scanner to store configuration, + // independent of whether view is loaded + scanner = [ZBarImageScanner new]; + [scanner setSymbology: 0 + config: ZBAR_CFG_X_DENSITY + to: 3]; + [scanner setSymbology: 0 + config: ZBAR_CFG_Y_DENSITY + to: 3]; +} + +- (id) init +{ + if(!TARGET_IPHONE_SIMULATOR && + !NSClassFromString(@"AVCaptureSession")) { + // fallback to old interface + zlog(@"Falling back to ZBarReaderController"); + [self release]; + return((id)[ZBarReaderController new]); + } + + self = [super init]; + if(!self) + return(nil); + + self.wantsFullScreenLayout = YES; + [self _init]; + return(self); +} + +- (id) initWithCoder: (NSCoder*) decoder +{ + self = [super initWithCoder: decoder]; + if(!self) + return(nil); + + [self _init]; + return(self); +} + +- (void) cleanup +{ + [cameraOverlayView removeFromSuperview]; + cameraSim.readerView = nil; + [cameraSim release]; + cameraSim = nil; + readerView.readerDelegate = nil; + [readerView release]; + readerView = nil; + [controls release]; + controls = nil; + [shutter release]; + shutter = nil; +} + +- (void) dealloc +{ + [self cleanup]; + [cameraOverlayView release]; + cameraOverlayView = nil; + [scanner release]; + scanner = nil; + [super dealloc]; +} + +- (void) initControls +{ + if(!showsZBarControls && controls) { + [controls removeFromSuperview]; + [controls release]; + controls = nil; + } + if(!showsZBarControls) + return; + + UIView *view = self.view; + if(controls) { + assert(controls.superview == view); + [view bringSubviewToFront: controls]; + return; + } + + CGRect r = view.bounds; + r.origin.y = r.size.height - 44; + r.size.height = 44; + controls = [[UIView alloc] + initWithFrame: r]; + controls.autoresizingMask = + UIViewAutoresizingFlexibleWidth | + UIViewAutoresizingFlexibleTopMargin; + controls.backgroundColor = [UIColor blackColor]; + + UIToolbar *toolbar = + [UIToolbar new]; + r.origin.y = 0; + toolbar.frame = r; + toolbar.barStyle = UIBarStyleBlackOpaque; + toolbar.autoresizingMask = + UIViewAutoresizingFlexibleWidth | + UIViewAutoresizingFlexibleHeight; + + UIButton *info = + [UIButton buttonWithType: UIButtonTypeInfoLight]; + CGRect frame = info.frame; + frame.size.height = 44; + info.frame = frame; + [info addTarget: self + action: @selector(info) + forControlEvents: UIControlEventTouchUpInside]; + + toolbar.items = + [NSArray arrayWithObjects: + [[[UIBarButtonItem alloc] + initWithBarButtonSystemItem: UIBarButtonSystemItemCancel + target: self + action: @selector(cancel)] + autorelease], + [[[UIBarButtonItem alloc] + initWithBarButtonSystemItem: UIBarButtonSystemItemFlexibleSpace + target: nil + action: nil] + autorelease], + [[[UIBarButtonItem alloc] + initWithCustomView: info] + autorelease], + nil]; + [controls addSubview: toolbar]; + toolbar.autoresizingMask = + UIViewAutoresizingFlexibleWidth | + UIViewAutoresizingFlexibleHeight; + [toolbar release]; + + [view addSubview: controls]; + + if (@available(iOS 11, *)) { + UILayoutGuide *safe = self.view.safeAreaLayoutGuide; + controls.translatesAutoresizingMaskIntoConstraints = NO; + //toolbar.translatesAutoresizingMaskIntoConstraints = NO; + [NSLayoutConstraint activateConstraints:@[ + [safe.trailingAnchor constraintEqualToAnchor:controls.trailingAnchor], + [controls.leadingAnchor constraintEqualToAnchor:safe.leadingAnchor], + [safe.bottomAnchor constraintEqualToAnchor:controls.bottomAnchor] + ]]; + [NSLayoutConstraint + constraintWithItem:controls + attribute:NSLayoutAttributeHeight + relatedBy:NSLayoutRelationEqual + toItem:nil + attribute:NSLayoutAttributeHeight + multiplier:1.0 + constant:44.0].active = YES; + } +} + +- (void) initVideoQuality +{ + if(!readerView) { + assert(0); + return; + } + + AVCaptureSession *session = readerView.session; + NSString *preset = AVSessionPresetForUIVideoQuality(videoQuality); + if(session && preset && [session canSetSessionPreset: preset]) { + zlog(@"set session preset=%@", preset); + session.sessionPreset = preset; + } + else + zlog(@"unable to set session preset=%@", preset); +} + +- (void) loadView +{ + self.view = [[UIView alloc] + initWithFrame: CGRectMake(0, 0, 320, 480)]; +} + +- (void) viewDidLoad +{ + [super viewDidLoad]; + UIView *view = self.view; + view.backgroundColor = [UIColor blackColor]; + view.autoresizingMask = + UIViewAutoresizingFlexibleWidth | + UIViewAutoresizingFlexibleHeight; + + readerView = [[ZBarReaderView alloc] + initWithImageScanner: scanner]; + CGRect bounds = view.bounds; + CGRect r = bounds; + NSUInteger autoresize = + UIViewAutoresizingFlexibleWidth | + UIViewAutoresizingFlexibleHeight; + + if(showsZBarControls || + self.parentViewController.modalViewController == self) + { + autoresize |= UIViewAutoresizingFlexibleBottomMargin; + r.size.height -= 44; + } + readerView.frame = r; + readerView.autoresizingMask = autoresize; + AVCaptureDevice *device = AVDeviceForUICamera(cameraDevice); + if(device && device != readerView.device) + readerView.device = device; + readerView.torchMode = AVTorchModeForUIFlashMode(cameraFlashMode); + [self initVideoQuality]; + + readerView.readerDelegate = (id)self; + readerView.scanCrop = scanCrop; + readerView.previewTransform = cameraViewTransform; + readerView.tracksSymbols = tracksSymbols; + readerView.enableCache = enableCache; + [view addSubview: readerView]; + + shutter = [[UIView alloc] + initWithFrame: r]; + shutter.backgroundColor = [UIColor blackColor]; + shutter.opaque = NO; + shutter.autoresizingMask = + UIViewAutoresizingFlexibleWidth | + UIViewAutoresizingFlexibleHeight; + [view addSubview: shutter]; + + if(cameraOverlayView) { + assert(!cameraOverlayView.superview); + [cameraOverlayView removeFromSuperview]; + [view addSubview: cameraOverlayView]; + } + + [self initControls]; + + if(TARGET_IPHONE_SIMULATOR) { + cameraSim = [[ZBarCameraSimulator alloc] + initWithViewController: self]; + cameraSim.readerView = readerView; + } +} + +- (void) viewDidUnload +{ + [cameraOverlayView removeFromSuperview]; + [self cleanup]; + [super viewDidUnload]; +} + +- (void) viewWillAppear: (BOOL) animated +{ + zlog(@"willAppear: anim=%d orient=%d", + animated, self.interfaceOrientation); + [self initControls]; + [super viewWillAppear: animated]; + + [readerView willRotateToInterfaceOrientation: self.interfaceOrientation + duration: 0]; + [readerView performSelector: @selector(start) + withObject: nil + afterDelay: .001]; + shutter.alpha = 1; + shutter.hidden = NO; + + UIApplication *app = [UIApplication sharedApplication]; + BOOL willHideStatusBar = + !didHideStatusBar && self.wantsFullScreenLayout && !app.statusBarHidden; + if(willHideStatusBar) + [app setStatusBarHidden: YES + withAnimation: UIStatusBarAnimationFade]; + didHideStatusBar = didHideStatusBar || willHideStatusBar; +} + +- (void) dismissModalViewControllerAnimated: (BOOL) animated +{ + if(didHideStatusBar) { + [[UIApplication sharedApplication] + setStatusBarHidden: NO + withAnimation: UIStatusBarAnimationFade]; + didHideStatusBar = NO; + } + [super dismissModalViewControllerAnimated: animated]; +} + +- (void) viewWillDisappear: (BOOL) animated +{ + readerView.captureReader.enableReader = NO; + + if(didHideStatusBar) { + [[UIApplication sharedApplication] + setStatusBarHidden: NO + withAnimation: UIStatusBarAnimationFade]; + didHideStatusBar = NO; + } + + [super viewWillDisappear: animated]; +} + +- (void) viewDidDisappear: (BOOL) animated +{ + // stopRunning can take a really long time (>1s observed), + // so defer until the view transitions are complete + [readerView stop]; +} + +- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) orient +{ + return((supportedOrientationsMask >> orient) & 1); +} + +- (void) willRotateToInterfaceOrientation: (UIInterfaceOrientation) orient + duration: (NSTimeInterval) duration +{ + zlog(@"willRotate: orient=%d #%g", orient, duration); + rotating = YES; + if(readerView) + [readerView willRotateToInterfaceOrientation: orient + duration: duration]; +} + +- (void) willAnimateRotationToInterfaceOrientation: (UIInterfaceOrientation) orient + duration: (NSTimeInterval) duration +{ + zlog(@"willAnimateRotation: orient=%d #%g", orient, duration); + if(helpController) + [helpController willAnimateRotationToInterfaceOrientation: orient + duration: duration]; + if(readerView) + [readerView setNeedsLayout]; +} + +- (void) didRotateFromInterfaceOrientation: (UIInterfaceOrientation) orient +{ + zlog(@"didRotate(%d): orient=%d", rotating, orient); + if(!rotating && readerView) { + // work around UITabBarController bug: willRotate is not called + // for non-portrait initial interface orientation + [readerView willRotateToInterfaceOrientation: self.interfaceOrientation + duration: 0]; + [readerView setNeedsLayout]; + } + rotating = NO; +} + +- (ZBarReaderView*) readerView +{ + // force view to load + (void)self.view; + assert(readerView); + return(readerView); +} + +- (void) setTracksSymbols: (BOOL) track +{ + tracksSymbols = track; + if(readerView) + readerView.tracksSymbols = track; +} + +- (void) setEnableCache: (BOOL) enable +{ + enableCache = enable; + if(readerView) + readerView.enableCache = enable; +} + +- (void) setScanCrop: (CGRect) r +{ + scanCrop = r; + if(readerView) + readerView.scanCrop = r; +} + +- (void) setCameraOverlayView: (UIView*) newview +{ + UIView *oldview = cameraOverlayView; + [oldview removeFromSuperview]; + + cameraOverlayView = [newview retain]; + if([self isViewLoaded] && newview) + [self.view addSubview: newview]; + + [oldview release]; +} + +- (void) setCameraViewTransform: (CGAffineTransform) xfrm +{ + cameraViewTransform = xfrm; + if(readerView) + readerView.previewTransform = xfrm; +} + +- (void) cancel +{ + if(!readerDelegate) + return; + SEL cb = @selector(imagePickerControllerDidCancel:); + if([readerDelegate respondsToSelector: cb]) + [readerDelegate + imagePickerControllerDidCancel: (UIImagePickerController*)self]; + else + [self dismissViewControllerAnimated:YES completion:nil]; +} + +- (void) info +{ + [self showHelpWithReason: @"INFO"]; +} + +- (void) showHelpWithReason: (NSString*) reason +{ + if(helpController) + return; + helpController = [[ZBarHelpController alloc] + initWithReason: reason]; + helpController.delegate = (id)self; + [self presentViewController:helpController animated:YES completion:nil]; +} + +- (void) takePicture +{ + if(TARGET_IPHONE_SIMULATOR) { + [cameraSim takePicture]; + // FIXME return selected image + } + else if(readerView) + [readerView.captureReader captureFrame]; +} + +- (void) setCameraDevice: (UIImagePickerControllerCameraDevice) camera +{ + cameraDevice = camera; + if(readerView) { + AVCaptureDevice *device = AVDeviceForUICamera(camera); + if(device) + readerView.device = device; + } +} + +- (void) setCameraFlashMode: (UIImagePickerControllerCameraFlashMode) mode +{ + cameraFlashMode = mode; + if(readerView) + readerView.torchMode = AVTorchModeForUIFlashMode(mode); +} + +- (UIImagePickerControllerCameraCaptureMode) cameraCaptureMode +{ + return(UIImagePickerControllerCameraCaptureModeVideo); +} + +- (void) setCameraCaptureMode: (UIImagePickerControllerCameraCaptureMode) mode +{ + NSAssert2(mode == UIImagePickerControllerCameraCaptureModeVideo, + @"attempt to set unsupported value (%d)" + @" for %@ property", mode, @"cameraCaptureMode"); +} + +- (void) setVideoQuality: (UIImagePickerControllerQualityType) quality +{ + videoQuality = quality; + if(readerView) + [self initVideoQuality]; +} + + +// ZBarHelpDelegate + +- (void) helpControllerDidFinish: (ZBarHelpController*) help +{ + + [UIView beginAnimations: @"ZBarHelp" + context: NULL]; + [UIView setAnimationDelegate: self]; + [UIView setAnimationDidStopSelector: @selector(removeHelp:done:context:)]; + [UIView commitAnimations]; +} + +- (void) removeHelp: (NSString*) tag + done: (NSNumber*) done + context: (void*) ctx +{ + if([tag isEqualToString: @"ZBarHelp"] && helpController) { + [helpController release]; + helpController = nil; + } +} + + +// ZBarReaderViewDelegate + +- (void) readerView: (ZBarReaderView*) readerView + didReadSymbols: (ZBarSymbolSet*) syms + fromImage: (UIImage*) image +{ + [readerDelegate + imagePickerController: (UIImagePickerController*)self + didFinishPickingMediaWithInfo: + [NSDictionary dictionaryWithObjectsAndKeys: + image, UIImagePickerControllerOriginalImage, + syms, ZBarReaderControllerResults, + nil]]; +} + +- (void) readerViewDidStart: (ZBarReaderView*) readerView +{ + if(!shutter.hidden) + [UIView animateWithDuration: .25 + animations: ^{ + shutter.alpha = 0; + } + completion: ^(BOOL finished) { + shutter.hidden = YES; + }]; +} + + +// "deprecated" properties + +#define DEPRECATED_PROPERTY(getter, setter, type, val, ignore) \ + - (type) getter \ + { \ + return(val); \ + } \ + - (void) setter: (type) v \ + { \ + NSAssert2(ignore || v == val, \ + @"attempt to set unsupported value (%d)" \ + @" for %@ property", val, @#getter); \ + } + +DEPRECATED_PROPERTY(sourceType, setSourceType, UIImagePickerControllerSourceType, UIImagePickerControllerSourceTypeCamera, NO) +DEPRECATED_PROPERTY(allowsEditing, setAllowsEditing, BOOL, NO, NO) +DEPRECATED_PROPERTY(allowsImageEditing, setAllowsImageEditing, BOOL, NO, NO) +DEPRECATED_PROPERTY(showsCameraControls, setShowsCameraControls, BOOL, NO, NO) +DEPRECATED_PROPERTY(showsHelpOnFail, setShowsHelpOnFail, BOOL, NO, YES) +DEPRECATED_PROPERTY(cameraMode, setCameraMode, ZBarReaderControllerCameraMode, ZBarReaderControllerCameraModeSampling, NO) +DEPRECATED_PROPERTY(takesPicture, setTakesPicture, BOOL, NO, NO) +DEPRECATED_PROPERTY(maxScanDimension, setMaxScanDimension, NSInteger, 640, YES) + +@end diff --git a/iphone/ZBarReaderViewImpl_Capture.m b/iphone/ZBarReaderViewImpl_Capture.m new file mode 100644 index 0000000..dd5a696 --- /dev/null +++ b/iphone/ZBarReaderViewImpl_Capture.m @@ -0,0 +1,402 @@ +//------------------------------------------------------------------------ +// Copyright 2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import +#import +#import +#import + +#define MODULE ZBarReaderView +#import "debug.h" + +// protected APIs +@interface ZBarReaderView() +- (void) _initWithImageScanner: (ZBarImageScanner*) _scanner; +- (void) initSubviews; +- (void) updateCrop; +- (void) setImageSize: (CGSize) size; +- (void) didTrackSymbols: (ZBarSymbolSet*) syms; +@end + +@interface ZBarReaderViewImpl + : ZBarReaderView +{ + AVCaptureSession *session; + AVCaptureDevice *device; + AVCaptureInput *input; +} + +@end + +@implementation ZBarReaderViewImpl + +@synthesize device, session; + +- (void) _initWithImageScanner: (ZBarImageScanner*) scanner +{ + [super _initWithImageScanner: scanner]; + + session = [AVCaptureSession new]; + NSNotificationCenter *notify = + [NSNotificationCenter defaultCenter]; + [notify addObserver: self + selector: @selector(onVideoError:) + name: AVCaptureSessionRuntimeErrorNotification + object: session]; + [notify addObserver: self + selector: @selector(onVideoStart:) + name: AVCaptureSessionDidStartRunningNotification + object: session]; + [notify addObserver: self + selector: @selector(onVideoStop:) + name: AVCaptureSessionDidStopRunningNotification + object: session]; + [notify addObserver: self + selector: @selector(onVideoStop:) + name: AVCaptureSessionWasInterruptedNotification + object: session]; + [notify addObserver: self + selector: @selector(onVideoStart:) + name: AVCaptureSessionInterruptionEndedNotification + object: session]; + + self.device = [AVCaptureDevice + defaultDeviceWithMediaType: AVMediaTypeVideo]; + + captureReader = [[ZBarCaptureReader alloc] + initWithImageScanner: scanner]; + captureReader.captureDelegate = (id)self; + [session addOutput: captureReader.captureOutput]; + + if([session canSetSessionPreset: AVCaptureSessionPreset640x480]) + session.sessionPreset = AVCaptureSessionPreset640x480; + + [captureReader addObserver: self + forKeyPath: @"size" + options: 0 + context: NULL]; + + [self initSubviews]; +} + +- (void) initSubviews +{ + AVCaptureVideoPreviewLayer *videoPreview = + [[AVCaptureVideoPreviewLayer + layerWithSession: session] + retain]; + preview = videoPreview; + CGRect bounds = self.bounds; + bounds.origin = CGPointZero; + preview.bounds = bounds; + preview.position = CGPointMake(bounds.size.width / 2, + bounds.size.height / 2); + videoPreview.videoGravity = AVLayerVideoGravityResizeAspectFill; + [self.layer addSublayer: preview]; + + [super initSubviews]; +} + +- (void) dealloc +{ + [[NSNotificationCenter defaultCenter] + removeObserver: self]; + if(showsFPS) { + @try { + [captureReader removeObserver: self + forKeyPath: @"framesPerSecond"]; + } + @catch(...) { } + } + @try { + [captureReader removeObserver: self + forKeyPath: @"size"]; + } + @catch(...) { } + captureReader.captureDelegate = nil; + [captureReader release]; + captureReader = nil; + [device release]; + device = nil; + [input release]; + input = nil; + [session release]; + session = nil; + [super dealloc]; +} + +- (void) updateCrop +{ + [super updateCrop]; + captureReader.scanCrop = effectiveCrop; +} + +- (ZBarImageScanner*) scanner +{ + return(captureReader.scanner); +} + +- (void) setDevice: (AVCaptureDevice*) newdev +{ + id olddev = device; + AVCaptureInput *oldinput = input; + assert(!olddev == !oldinput); + + NSError *error = nil; + device = [newdev retain]; + if(device) { + assert([device hasMediaType: AVMediaTypeVideo]); + input = [[AVCaptureDeviceInput alloc] + initWithDevice: newdev + error: &error]; + assert(input); + } + else + input = nil; + + [session beginConfiguration]; + if(oldinput) + [session removeInput: oldinput]; + if(input) + [session addInput: input]; + [session commitConfiguration]; + + [olddev release]; + [oldinput release]; +} + +- (BOOL) enableCache +{ + return(captureReader.enableCache); +} + +- (void) setEnableCache: (BOOL) enable +{ + captureReader.enableCache = enable; +} + +- (void) setTorchMode: (NSInteger) mode +{ + [super setTorchMode: mode]; + if(running && [device isTorchModeSupported: mode]) + @try { + device.torchMode = mode; + } + @catch(...) { } +} + +- (void) setShowsFPS: (BOOL) show +{ + [super setShowsFPS: show]; + @try { + if(show) + [captureReader addObserver: self + forKeyPath: @"framesPerSecond" + options: 0 + context: NULL]; + else + [captureReader removeObserver: self + forKeyPath: @"framesPerSecond"]; + } + @catch(...) { } +} + +- (void) start +{ + if(started) + return; + [super start]; + + [session startRunning]; + captureReader.enableReader = YES; +} + +- (void) stop +{ + if(!started) + return; + [super stop]; + + captureReader.enableReader = NO; + [session stopRunning]; +} + +- (void) flushCache +{ + [captureReader flushCache]; +} + +- (void) configureDevice +{ + if([device isFocusModeSupported: AVCaptureFocusModeContinuousAutoFocus]) + device.focusMode = AVCaptureFocusModeContinuousAutoFocus; + if([device isTorchModeSupported: torchMode]) + device.torchMode = torchMode; +} + +- (void) lockDevice +{ + if(!running || locked) { + assert(0); + return; + } + + // lock device and set focus mode + NSError *error = nil; + if([device lockForConfiguration: &error]) { + locked = YES; + [self configureDevice]; + } + else { + zlog(@"failed to lock device: %@", error); + // just keep trying + [self performSelector: @selector(lockDevice) + withObject: nil + afterDelay: .5]; + } +} + + +// AVCaptureSession notifications + +- (void) onVideoStart: (NSNotification*) note +{ + zlog(@"onVideoStart: running=%d %@", running, note); + if(running) + return; + running = YES; + locked = NO; + + [self lockDevice]; + + if([readerDelegate respondsToSelector: @selector(readerViewDidStart:)]) + [readerDelegate readerViewDidStart: self]; +} + +- (void) onVideoStop: (NSNotification*) note +{ + zlog(@"onVideoStop: %@", note); + if(!running) + return; + running = NO; + + if(locked) + [device unlockForConfiguration]; + else + [NSObject cancelPreviousPerformRequestsWithTarget: self + selector: @selector(lockDevice) + object: nil]; + locked = NO; + + if([readerDelegate respondsToSelector: + @selector(readerView:didStopWithError:)]) + [readerDelegate readerView: self + didStopWithError: nil]; +} + +- (void) onVideoError: (NSNotification*) note +{ + zlog(@"onVideoError: %@", note); + if(running) { + // FIXME does session always stop on error? + running = started = NO; + [device unlockForConfiguration]; + } + NSError *err = + [note.userInfo objectForKey: AVCaptureSessionErrorKey]; + + if([readerDelegate respondsToSelector: + @selector(readerView:didStopWithError:)]) + [readerDelegate readerView: self + didStopWithError: err]; + else + NSLog(@"ZBarReaderView: ERROR during capture: %@: %@", + [err localizedDescription], + [err localizedFailureReason]); +} + +// NSKeyValueObserving + +- (void) observeValueForKeyPath: (NSString*) path + ofObject: (id) obj + change: (NSDictionary*) info + context: (void*) ctx +{ + if(obj == captureReader && + [path isEqualToString: @"size"]) + // adjust preview to match image size + [self setImageSize: captureReader.size]; + else if(obj == captureReader && + [path isEqualToString: @"framesPerSecond"]) + fpsLabel.text = [NSString stringWithFormat: @"%.2ffps ", + captureReader.framesPerSecond]; +} + +// ZBarCaptureDelegate + +- (void) captureReader: (ZBarCaptureReader*) reader + didTrackSymbols: (ZBarSymbolSet*) syms +{ + [self didTrackSymbols: syms]; +} + +- (void) captureReader: (ZBarCaptureReader*) reader + didReadNewSymbolsFromImage: (ZBarImage*) zimg +{ + zlog(@"scanned %d symbols: %@", zimg.symbols.count, zimg); + if(!readerDelegate) + return; + + UIImageOrientation orient = [UIDevice currentDevice].orientation; + if(!UIDeviceOrientationIsValidInterfaceOrientation(orient)) { + orient = interfaceOrientation; + if(orient == UIInterfaceOrientationLandscapeLeft) + orient = UIDeviceOrientationLandscapeLeft; + else if(orient == UIInterfaceOrientationLandscapeRight) + orient = UIDeviceOrientationLandscapeRight; + } + switch(orient) + { + case UIDeviceOrientationPortraitUpsideDown: + orient = UIImageOrientationLeft; + break; + case UIDeviceOrientationLandscapeLeft: + orient = UIImageOrientationUp; + break; + case UIDeviceOrientationLandscapeRight: + orient = UIImageOrientationDown; + break; + default: + orient = UIImageOrientationRight; + break; + } + + UIImage *uiimg = [zimg UIImageWithOrientation: orient]; + [readerDelegate + readerView: self + didReadSymbols: zimg.symbols + fromImage: uiimg]; +} + +@end diff --git a/iphone/ZBarReaderViewImpl_Simulator.m b/iphone/ZBarReaderViewImpl_Simulator.m new file mode 100644 index 0000000..328a59e --- /dev/null +++ b/iphone/ZBarReaderViewImpl_Simulator.m @@ -0,0 +1,219 @@ +//------------------------------------------------------------------------ +// Copyright 2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import + +#define MODULE ZBarReaderView +#import "debug.h" + +// hack around missing simulator support for AVCapture interfaces + +// protected APIs +@interface ZBarReaderView() +- (void) _initWithImageScanner: (ZBarImageScanner*) _scanner; +- (void) initSubviews; +- (void) setImageSize: (CGSize) size; +- (void) didTrackSymbols: (ZBarSymbolSet*) syms; +@end + +@interface ZBarReaderViewImpl + : ZBarReaderView +{ + ZBarImageScanner *scanner; + UILabel *simLabel; + UIImage *scanImage; + CALayer *previewImage; + BOOL enableCache; +} +@end + +@implementation ZBarReaderViewImpl + +@synthesize scanner, enableCache; + +- (void) _initWithImageScanner: (ZBarImageScanner*) _scanner +{ + [super _initWithImageScanner: _scanner]; + scanner = [_scanner retain]; + + [self initSubviews]; +} + +- (void) initSubviews +{ + simLabel = [UILabel new]; + simLabel.backgroundColor = [UIColor clearColor]; + simLabel.textColor = [UIColor whiteColor]; + simLabel.font = [UIFont boldSystemFontOfSize: 20]; + simLabel.numberOfLines = 4; + simLabel.textAlignment = UITextAlignmentCenter; + simLabel.text = @"Camera Simulation\n\n" + @"Tap and hold with two \"fingers\" to select image"; + simLabel.autoresizingMask = + UIViewAutoresizingFlexibleWidth | + UIViewAutoresizingFlexibleHeight; + [self addSubview: simLabel]; + + preview = [CALayer new]; + [self.layer addSublayer: preview]; + + previewImage = [CALayer new]; + [preview addSublayer: previewImage]; + + [super initSubviews]; +} + +- (void) dealloc +{ + [scanner release]; + scanner = nil; + [simLabel release]; + simLabel = nil; + [previewImage release]; + previewImage = nil; + [super dealloc]; +} + +- (AVCaptureDevice*) device +{ + return(nil); +} + +- (void) setDevice: (AVCaptureDevice*) device +{ + // simulated camera does nothing with this +} + +- (AVCaptureSession*) session +{ + return(nil); +} + +- (void) updateCrop +{ + previewImage.frame = preview.bounds; + CGRect bounds = self.bounds; + simLabel.frame = CGRectInset(bounds, + bounds.size.width * .05, + bounds.size.height * .05); +} + +- (void) start +{ + if(started) + return; + [super start]; + running = YES; + + [self performSelector: @selector(onVideoStart) + withObject: nil + afterDelay: 0.5]; +} + +- (void) stop +{ + if(!started) + return; + [super stop]; + running = NO; + + [self performSelector: @selector(onVideoStop) + withObject: nil + afterDelay: 0.5]; +} + +- (void) scanImage: (UIImage*) image +{ + // strip EXIF info + CGImageRef cgimage = image.CGImage; + image = [[UIImage alloc] + initWithCGImage: cgimage + scale: 1.0 + orientation: UIImageOrientationUp]; + + [self setImageSize: image.size]; + [self layoutIfNeeded]; + + [CATransaction begin]; + [CATransaction setDisableActions: YES]; + previewImage.contentsGravity = kCAGravityResizeAspectFill; + previewImage.transform = CATransform3DMakeRotation(M_PI_2, 0, 0, 1); + previewImage.contents = (id)cgimage; + [CATransaction commit]; + + ZBarImage *zimg = + [[ZBarImage alloc] + initWithCGImage: cgimage]; + + CGSize size = zimg.size; + zimg.crop = CGRectMake(effectiveCrop.origin.x * size.width, + effectiveCrop.origin.y * size.height, + effectiveCrop.size.width * size.width, + effectiveCrop.size.height * size.height); + + int nsyms = [scanner scanImage: zimg]; + zlog(@"scan image: %@ crop=%@ nsyms=%d", + NSStringFromCGSize(size), NSStringFromCGRect(zimg.crop), nsyms); + [zimg release]; + + if(nsyms > 0) { + scanImage = [image retain]; + ZBarSymbolSet *syms = scanner.results; + [self performSelector: @selector(didReadSymbols:) + withObject: syms + afterDelay: .4]; + [self performSelector: @selector(didTrackSymbols:) + withObject: syms + afterDelay: .001]; + } + [image release]; +} + +- (void) didReadSymbols: (ZBarSymbolSet*) syms +{ + [readerDelegate + readerView: self + didReadSymbols: syms + fromImage: scanImage]; + [scanImage release]; + scanImage = nil; +} + +- (void) onVideoStart +{ + if(running && + [readerDelegate respondsToSelector: @selector(readerViewDidStart:)]) + [readerDelegate readerViewDidStart: self]; +} + +- (void) onVideoStop +{ + if(!running && + [readerDelegate respondsToSelector: + @selector(readerView:didStopWithError:)]) + [readerDelegate readerView: self + didStopWithError: nil]; +} + +@end diff --git a/iphone/ZBarSymbol.m b/iphone/ZBarSymbol.m new file mode 100644 index 0000000..3131205 --- /dev/null +++ b/iphone/ZBarSymbol.m @@ -0,0 +1,197 @@ +//------------------------------------------------------------------------ +// Copyright 2009-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import + +@implementation ZBarSymbol + +@dynamic type, typeName, configMask, modifierMask, data, quality, count, + zbarSymbol; + ++ (NSString*) nameForType: (zbar_symbol_type_t) type +{ + return([NSString stringWithUTF8String: zbar_get_symbol_name(type)]); +} + +- (id) initWithSymbol: (const zbar_symbol_t*) sym +{ + if(self = [super init]) { + symbol = sym; + zbar_symbol_ref(sym, 1); + } + return(self); +} + +- (void) dealloc +{ + if(symbol) { + zbar_symbol_ref(symbol, -1); + symbol = NULL; + } + [super dealloc]; +} + +- (zbar_symbol_type_t) type +{ + return(zbar_symbol_get_type(symbol)); +} + +- (NSString*) typeName +{ + return([[self class] nameForType: zbar_symbol_get_type(symbol)]); +} + +- (NSUInteger) configMask +{ + return(zbar_symbol_get_configs(symbol)); +} + +- (NSUInteger) modifierMask +{ + return(zbar_symbol_get_modifiers(symbol)); +} + +- (NSString*) data +{ + return([NSString stringWithUTF8String: zbar_symbol_get_data(symbol)]); +} + +- (int) quality +{ + return(zbar_symbol_get_quality(symbol)); +} + +- (int) count +{ + return(zbar_symbol_get_count(symbol)); +} + +- (zbar_orientation_t) orientation +{ + return(zbar_symbol_get_orientation(symbol)); +} + +- (const zbar_symbol_t*) zbarSymbol +{ + return(symbol); +} + +- (ZBarSymbolSet*) components +{ + return([[[ZBarSymbolSet alloc] + initWithSymbolSet: zbar_symbol_get_components(symbol)] + autorelease]); +} + +- (CGRect) bounds +{ + int n = zbar_symbol_get_loc_size(symbol); + if(!n) + return(CGRectNull); + + int xmin = INT_MAX, xmax = INT_MIN; + int ymin = INT_MAX, ymax = INT_MIN; + + for(int i = 0; i < n; i++) { + int t = zbar_symbol_get_loc_x(symbol, i); + if(xmin > t) xmin = t; + if(xmax < t) xmax = t; + t = zbar_symbol_get_loc_y(symbol, i); + if(ymin > t) ymin = t; + if(ymax < t) ymax = t; + } + return(CGRectMake(xmin, ymin, xmax - xmin, ymax - ymin)); +} + +@end + + +@implementation ZBarSymbolSet + +@dynamic count, zbarSymbolSet; +@synthesize filterSymbols; + +- (id) initWithSymbolSet: (const zbar_symbol_set_t*) s +{ + if(!s) { + [self release]; + return(nil); + } + if(self = [super init]) { + set = s; + zbar_symbol_set_ref(s, 1); + filterSymbols = YES; + } + return(self); +} + +- (void) dealloc +{ + if(set) { + zbar_symbol_set_ref(set, -1); + set = NULL; + } + [super dealloc]; +} + +- (int) count +{ + if(filterSymbols) + return(zbar_symbol_set_get_size(set)); + + int n = 0; + const zbar_symbol_t *sym = zbar_symbol_set_first_unfiltered(set); + for(; sym; sym = zbar_symbol_next(sym)) + n++; + return(n); +} + +- (const zbar_symbol_set_t*) zbarSymbolSet +{ + return(set); +} + +- (NSUInteger) countByEnumeratingWithState: (NSFastEnumerationState*) state + objects: (id*) stackbuf + count: (NSUInteger) len +{ + const zbar_symbol_t *sym = (void*)state->state; // FIXME + if(sym) + sym = zbar_symbol_next(sym); + else if(set && filterSymbols) + sym = zbar_symbol_set_first_symbol(set); + else if(set) + sym = zbar_symbol_set_first_unfiltered(set); + + if(sym) + *stackbuf = [[[ZBarSymbol alloc] + initWithSymbol: sym] + autorelease]; + + state->state = (unsigned long)sym; // FIXME + state->itemsPtr = stackbuf; + state->mutationsPtr = (void*)self; + return((sym) ? 1 : 0); +} + +@end diff --git a/iphone/bin/BuildUniversal.sh b/iphone/bin/BuildUniversal.sh new file mode 100755 index 0000000..658c633 --- /dev/null +++ b/iphone/bin/BuildUniversal.sh @@ -0,0 +1,23 @@ +#!/bin/sh +set -ux +SUBTARGET=${1:?} +OUTDIR=${2:-$TARGET_BUILD_DIR} + +# build library for device and simulator +xcodebuild -target $SUBTARGET -configuration $CONFIGURATION -sdk iphoneos BUILD_DIR=$BUILD_DIR BUILD_ROOT=$BUILD_ROOT\ + || exit 1 +xcodebuild -target $SUBTARGET -configuration $CONFIGURATION -sdk iphonesimulator BUILD_DIR=$BUILD_DIR BUILD_ROOT=$BUILD_ROOT\ + || exit 1 + +mkdir -p $OUTDIR + +# combine device and simulator libs into single fat lib. +# others have indicated that this approach is "wrong", but for us +# the ease of including the universal lib in a project without complicated +# changes to build settings outweighs any lack of purity in the approach +# ...we can always fix things later, if necessary +lipo -create \ + $BUILD_ROOT/$CONFIGURATION-iphoneos/$SUBTARGET.a \ + $BUILD_ROOT/$CONFIGURATION-iphonesimulator/$SUBTARGET.a \ + -output $OUTDIR/$SUBTARGET.a \ + || exit 1 diff --git a/iphone/bin/CreateDMG.sh b/iphone/bin/CreateDMG.sh new file mode 100755 index 0000000..0290471 --- /dev/null +++ b/iphone/bin/CreateDMG.sh @@ -0,0 +1,44 @@ +#!/bin/sh +set -ux +VOLNAME=${1:?} +shift +RES=$SOURCE_ROOT/res +BUDDY=/usr/libexec/PlistBuddy +if [ ! -x "$BUDDY" ]; then + BUDDY=$(xcrun -find PlistBuddy) \ + || exit 1 +fi +VERSION=$($BUDDY -c 'Print :CFBundleVersion' $RES/$VOLNAME-Info.plist) \ + || exit 1 +DMG=$VOLNAME-$VERSION + +mkdir -p $TARGET_BUILD_DIR/.background \ + || exit 1 +cp -af $RES/$VOLNAME.DS_Store $TARGET_BUILD_DIR/.DS_Store +cp -af $RES/$VOLNAME-bg.png $TARGET_BUILD_DIR/.background/ + +# copy remaining arguments to image directly +for content +do + cp -af $content $TARGET_BUILD_DIR/ \ + || exit 1 +done + +# prepare examples for distribution +for example in $(find $TARGET_BUILD_DIR/Examples -depth 1 -not -name '.*') +do + rm -rf $example/{build,*.xcodeproj/{*.{mode1v3,pbxuser},project.xcworkspace,xcuserdata},ZBarSDK} + cp -af $BUILT_PRODUCTS_DIR/ZBarSDK $example/ +done + +# override subdir .DS_Stores +for dir in $(find $TARGET_BUILD_DIR -type d -depth 1) +do + cp -af $RES/Columns.DS_Store $dir/.DS_Store +done + +hdiutil create -ov -fs HFS+ -format UDZO -imagekey zlib-level=9 \ + -volname $VOLNAME \ + -srcdir $TARGET_BUILD_DIR \ + $BUILT_PRODUCTS_DIR/$DMG.dmg \ + || exit 1 diff --git a/iphone/bin/CreateDSStore.pl b/iphone/bin/CreateDSStore.pl new file mode 100755 index 0000000..e6bc7df --- /dev/null +++ b/iphone/bin/CreateDSStore.pl @@ -0,0 +1,72 @@ +#!/usr/bin/perl + +# Quick hack script to generate the .DS_Store for the DMG, which +# * allows us to precisely position the window and icons +# * is more usefully versioned +# * avoids references to my local HD(!?) + +use warnings; +use strict; + +BEGIN { + use File::Spec::Functions qw(rel2abs splitpath); + use lib (splitpath(rel2abs($0)))[1]; +} + +use Data::Plist::BinaryWriter; +use Mac::Finder::DSStore qw(writeDSDBEntries makeEntries); +use Mac::Finder::AliasRecord; + +$Mac::Finder::DSStore::Entry::types{bwsp} = 'blob'; +$Mac::Finder::DSStore::Entry::types{icvp} = 'blob'; + +writeDSDBEntries($ARGV[0] || "DS_Store", + makeEntries(".", + bwsp => Data::Plist::BinaryWriter->new(serialize => 0)->write([ + dict => { + WindowBounds => [ + string => sprintf('{{%d, %d}, {%d, %d}}', + 512, 128, 512, 608 + 22) + ], + SidebarWidth => [integer => 0], + ShowToolbar => [false => 0], + ShowSidebar => [false => 0], + ShowPathbar => [false => 0], + ShowStatusBar => [false => 0], + } + ]), + icvp => Data::Plist::BinaryWriter->new(serialize => 0)->write([ + dict => { + viewOptionsVersion => [integer => 0], + arrangeBy => [string => "none"], + iconSize => [real => 64], + textSize => [real => 12], + labelOnBottom => [true => 1], + gridSpacing => [real => 100], + gridOffsetX => [real => 0], + gridOffsetY => [real => 0], + showItemInfo => [false => 0], + showIconPreview => [false => 0], + backgroundType => [integer => 2], + backgroundColorRed => [real => 0], + backgroundColorGreen => [real => 0], + backgroundColorBlue => [real => .5], + backgroundImageAlias => [ + data => Mac::Finder::AliasRecord->new( + path => 'ZBarSDK:.background:ZBarSDK-bg.png', + volumeFS => 'HFS+')->write() + ], + }, + ]), + vstl => "icnv", + ), + makeEntries("README", Iloc_xy => [ 4.5 * 32, 2.5 * 32 ]), + makeEntries("ZBarSDK", Iloc_xy => [ 4.5 * 32, 7.5 * 32 ]), + makeEntries("ChangeLog", Iloc_xy => [ 4 * 32, 12.5 * 32 ]), + makeEntries("Documentation.html", + Iloc_xy => [ 8 * 32, 12.5 * 32 ]), + makeEntries("Examples", Iloc_xy => [ 12 * 32, 12.5 * 32 ]), + makeEntries("COPYING", Iloc_xy => [ 4 * 32, 16 * 32 ]), + makeEntries("LICENSE.md", Iloc_xy => [ 8 * 32, 16 * 32 ]), + makeEntries("Documentation",Iloc_xy => [ 12 * 32, 16 * 32 ]), +); diff --git a/iphone/bin/Mac/Finder/AliasRecord.pm b/iphone/bin/Mac/Finder/AliasRecord.pm new file mode 100755 index 0000000..06f68f6 --- /dev/null +++ b/iphone/bin/Mac/Finder/AliasRecord.pm @@ -0,0 +1,169 @@ +package Mac::Finder::AliasRecord; + +# Generate(/Parse) a Mac "alias record" binary string/file. +# +# Currently just enough is implemented to satisfy immediate requirements +# (ie, write backgroundImageAlias to .DS_Store for DMG) +# +# based on these documents: +# http://www.geocities.com/xhelmboyx/quicktime/formats/alias-layout.txt +# http://sebastien.kirche.free.fr/python_stuff/MacOS-aliases.txt +# +# FIXME interface is very poor... + +use warnings; +use strict; +use DateTime; +use File::Spec; +use File::Spec::Mac; +use Encode qw(encode); +require Exporter; + +our $VERSION = '0.1'; +our @ISA = qw(Exporter); + +my %FSEncodings = ( + MacFS => ['RW', ''], + MFS => ['RW', ''], + HFS => ['BD', ''], + 'HFS+' => ['H+', ''], + + AudioCD => ['', 'JH'], + ISO9660 => ['', 'AG'], + FAT => ['', 'IS'], + Joliet => ['', 'Jo'], + 'ISO9660+Joliet' => ['', 'Jo'], +); + +my %DiskEncodings = ( + HD => 0, + FixedHD => 0, + Network => 1, + NetworkDisk => 1, + Floppy => 4, + Floppy1440 => 4, + Other => 5, + OtherDisk => 5, +); + +my %RecordEncodings = ( + parentDir => 0x00, + absolutePath => 0x02, + unicodeFile => 0x0e, + unicodeVolume => 0x0f, + volumePath => 0x12, +); + +sub new { + my $class = shift || __PACKAGE__; + my $self = { + aliasCreator => '', + aliasVersion => 2, + aliasType => 'file', + volume => '', + volumeCreated => 0, + volumeFS => 'HFS', + volumeDisk => undef, + volumeAttrs => 0, + directoryID => 0, + file => '', + fileID => 0, + fileCreated => 0, + fileType => '', + fileCreator => '', + nlvlFrom => -1, + nlvlTo => -1, + records => { }, + @_ + }; + if(exists($self->{path})) { + my $path = $self->{path}; + my ($vol, $dir, $file) = File::Spec::Mac->splitpath($path); + $vol =~ s/:$//; + my @dir = File::Spec::Mac->splitdir($dir); + while(@dir && !$dir[0]) { + shift(@dir); + } + while(@dir && !$dir[-1]) { + pop(@dir); + } + $self->{volume} ||= $vol; + $self->{records}{unicodeVolume} ||= + pack('na*', length($vol), encode('utf-16be', $vol)); + + $self->{file} ||= $file; + $self->{records}{parentDir} ||= $dir[-1] + if(@dir); + $self->{records}{absolutePath} ||= $path; + $self->{records}{volumePath} ||= File::Spec->catfile('', @dir, $file); + $self->{records}{unicodeFile} ||= + pack('na*', length($file), encode('utf-16be', $file)); + } + return(bless($self, ref($class) || $class)); +} + +sub toFSTime { + my $val = shift; + if(ref($val) && $val->isa("DateTime")) { + $val = $val->epoch - DateTime->new(year => 1904)->epoch(); + } + return($val); +} + +sub write { + my ($self, $out) = @_; + + my $aliasType = $self->{aliasType}; + $aliasType = (($aliasType =~ /^d(ir(ectory)?)?$/i && 1) || + ($aliasType !~ /^f(ile)?$/ && $aliasType) || 0); + + my $volumeCreated = toFSTime($self->{volumeCreated}); + my $volumeFS = $self->{volumeFS}; + if(ref($volumeFS) ne 'ARRAY') { + $volumeFS = $FSEncodings{$volumeFS} || ['', '']; + } + + my $volumeDisk = $self->{volumeDisk}; + if(!defined($volumeDisk)) { + if($volumeFS->[0] eq 'H+') { + $volumeDisk = 'Floppy'; + } + elsif($volumeFS->[0]) { + $volumeDisk = 'HD'; + } + else { + $volumeDisk = 'Other'; + } + } + $volumeDisk = (exists($DiskEncodings{$volumeDisk}) + ? $DiskEncodings{$volumeDisk} + : $volumeDisk); + + my $fileCreated = toFSTime($self->{fileCreated}); + + my $buf = + pack('nn (C/a @28)Na2n N(C/a @64)NNa4a4 n!n!Na2 x10 (n!n/ax!2)*', + $self->{aliasVersion}, $aliasType, + $self->{volume}, $volumeCreated, $volumeFS->[0], $volumeDisk, + $self->{directoryID}, $self->{file}, $self->{fileID}, $fileCreated, + $self->{fileType}, $self->{fileCreator}, $self->{nlvlFrom}, + $self->{nlvlTo}, $self->{volumeAttrs}, $volumeFS->[1], + map(((exists($RecordEncodings{$_}) ? $RecordEncodings{$_} : $_) + => $self->{records}{$_}), + keys(%{$self->{records}})), + (-1, '')); + $buf = pack('a4n', $self->{aliasCreator}, length($buf) + 6) . $buf; + + if(!$out) { + return($buf); + } + elsif(ref($out) eq 'GLOB') { + print $out $buf; + } + else { + open(my $outfh, '>', $out) || die; + print $outfh $buf; + } +} + +1; diff --git a/iphone/debug.h b/iphone/debug.h new file mode 100644 index 0000000..8a35b62 --- /dev/null +++ b/iphone/debug.h @@ -0,0 +1,51 @@ +//------------------------------------------------------------------------ +// Copyright 2009 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#include +#define xNSSTR(s) @ #s +#define NSSTR(s) xNSSTR(s) + +#ifdef DEBUG_OBJC +#ifndef MODULE +#define MODULE ZBarReaderController +#endif +#define zlog(fmt, ...) NSLog(NSSTR(MODULE) @": " fmt, ##__VA_ARGS__) + +#define timer_start uint64_t t_start = timer_now(); + +#else +#define zlog(...) while (0) +#define timer_start +#endif + +static inline uint64_t timer_now() +{ + return (mach_absolute_time()); +} + +static inline double timer_elapsed(uint64_t start, uint64_t end) +{ + mach_timebase_info_data_t info; + mach_timebase_info(&info); + return ((double)(end - start) * info.numer / (info.denom * 1000000000.)); +} diff --git a/iphone/doc/Documentation.html b/iphone/doc/Documentation.html new file mode 100644 index 0000000..c6a532a --- /dev/null +++ b/iphone/doc/Documentation.html @@ -0,0 +1,11 @@ + + + + + + + +

redirecting to Documentation/index.html

+ + diff --git a/iphone/doc/ZBarImage.rst b/iphone/doc/ZBarImage.rst new file mode 100644 index 0000000..59f537e --- /dev/null +++ b/iphone/doc/ZBarImage.rst @@ -0,0 +1,150 @@ +ZBarImage Class Reference +========================= + +.. class:: ZBarImage + + :Inherits from: :class:`NSObject` + + A :class:`ZBarImage` is a wrapper for images passed to the barcode reader. + It encapsulates raw image data with the format and size metadata necessary + to interpret it. + + An image must be wrapped in a :class:`ZBarImage` in order to be scanned by + the library. At least the format, size and data must be set. There are + also initialization methods for automatically extracting the data and + format from a `CGImage`. + + This class is a wrapper around a :type:`zbar_image_t` C object (q.v.) + + +Properties +---------- + + .. member:: unsigned long format + + The image format four-charcter code (fourcc) as a 4-byte integer. Use + :ref:`fourcc:` to create a fourcc value from a string. + + .. member:: unsigned sequence + + A "sequence number" associated with the image. This reference value is + unused by the library. + + .. member:: CGSize size + + The size of the image in pixels. + + .. note:: + + There is no separate "bytesPerLine" property, the width must match + the image data (which is not always the logical image width). + + .. member:: CGRect crop + + Optionally limit the scan region to this rectangle without having to + generate a cropped image. + + .. member:: const void *data + + Obtain a pointer to the raw image data. This property is read-only, use + :ref:`setData:withLength:` to set the image data. + + .. member:: unsigned long dataLength + + Byte length of the raw image data. This property is read-only, use + :ref:`setData:withLength:` to set the image data. + + .. member:: ZBarSymbolSet *symbols + + Barcode results from the last scan. + + .. member:: zbar_image_t *zbarImage + + Retrieve the underlying C object instance. (read-only) + + .. member:: UIImage *UIImage + + Convert the image to a UIImage. Only certain image formats are + supported for conversion (read-only) + + :See also: :ref:`UIImageWithOrientation:` + + +Class Methods +------------- + + .. _`fourcc:`: + .. describe:: + (unsigned long) fourcc:(NSString*)format + + Parse the integer four-character code from a string. Alternatively use + the :func:`zbar_fourcc` macro to create a constant expression. + + :format: A four character string representing an image format. + :Returns: The corresponding 4-byte integer format code. + + +Instance Methods +---------------- + + .. _`initWithImage:`: + .. describe:: - (id) initWithImage:(zbar_image_t*)image + + Initialize an image wrapper, given the C object to wrap. + + :image: The C object to wrap. + :Returns: The initialized :class:`ZBarImage`. + + .. _`initWithCGImage:`: + .. describe:: - (id) initWithCGImage:(CGImageRef)image + + Initialize a :class:`ZBarImage` from the data and metadata extracted + from a `CGImage`. The image is converted to `Y800` (grayscale) format. + + :image: A `CGImage` to source the data and metadata. + :Returns: The initialized :class:`ZBarImage`. + :See also: :ref:`initWithCGImage:size:` + + .. _`initWithCGImage:size:`: + .. describe:: - (id) initWithCGImage:(CGImageRef)image size:(CGSize)size + + Initialize a :class:`ZBarImage` from the data and metadata extracted + from a `CGImage`. The image is converted to `Y800` (grayscale) format + and scaled to the specified size. + + :image: A `CGImage` to source the data and metadata. + :size: The pixel size of the resulting ZBarImage. + :Returns: The initialized :class:`ZBarImage`. + :See also: :ref:`initWithCGImage:crop:size:` + + .. _`initWithCGImage:crop:size:`: + .. describe:: - (id) initWithCGImage:(CGImageRef)image crop:(CGRect)crop size:(CGSize)size + + Initialize a :class:`ZBarImage` from the data and metadata extracted + from a `CGImage`. The image is simultaneously converted to `Y800` + (grayscale) format, cropped and scaled to the specified size. + + :image: A `CGImage` to source the data and metadata. + :crop: The region to convert, in image coordinates. + :size: The pixel size of the resulting ZBarImage. + :Returns: The initialized :class:`ZBarImage`. + + .. _`setData:withLength:`: + .. describe:: - (void) setData:(const void*)data withLength:(unsigned long)length + + Specify a pointer to the raw image data, for the image format and size. + The length of the data must also be provided. Note that the data must + remain valid as long as the image has a reference to it. Set data to + ``NULL`` to clear a previous reference. + + :data: A pointer to a raw image data buffer. + :length: The size of the image data buffer. + + .. _`UIImageWithOrientation:`: + .. describe:: - (UIImage*) UIImageWithOrientation:(UIImageOrientation)orient + + Convert the image to a UIImage with the specified orientation. Only + certain image formats are supported for conversion. (currently + ``RGB3``, ``RGB4``, ``RGBQ``) + + :orient: Desired orientation of the image. + :Returns: A new :class:`UIImage`, or ``nil`` in case of error. diff --git a/iphone/doc/ZBarImageScanner.rst b/iphone/doc/ZBarImageScanner.rst new file mode 100644 index 0000000..5835a17 --- /dev/null +++ b/iphone/doc/ZBarImageScanner.rst @@ -0,0 +1,99 @@ +ZBarImageScanner Class Reference +================================ + +.. class:: ZBarImageScanner + + :Inherits from: :class:`NSObject` + + This is a low-level interface for programmatically scanning images without + a user interface. If you want to scan images manually selected by the user + (from the photo library or using the camera), you may prefer to use a + :class:`ZBarReaderController` instead. + + This class is a wrapper around a :type:`zbar_image_scanner_t` C object + (q.v.) + + +Properties +---------- + + .. member:: BOOL enableCache + + Enable the inter-frame consistency cache. Set to ``YES`` for scanning + video or ``NO`` for scanning images. + + .. member:: ZBarSymbolSet results + + Decoded symbols resulting from the last scan. + + +Instance Methods +---------------- + + .. _`parseConfig:`: + .. describe:: - (void) parseConfig:(NSString*)config + + Apply scanner/decoder configuration parsed from a string. + + :config: A configuration setting of the form: `symbology.config[=value]`. + + .. _`setSymbology:config:to:`: + .. describe:: - (void) setSymbology:(zbar_symbol_type_t)symbology config:(zbar_config_t)config to:(int)value + + Apply generic scanner/decoder configuration. + + :symbology: The symbology to effect, or 0 for all. + :config: The configuration setting to adjust. + :value: The value to set for the specific configuration/symbology. + + .. _`scanImage:`: + .. describe:: - (NSInteger) scanImage:(ZBarImage*)image + + Scan an image for barcodes using the current configuration. The image + must be in ``Y800`` format (8-bpp graysale). + + :image: The :class:`ZBarImage` to scan. + :Returns: The number of barcode symbols decoded in the image. + + +Constants +--------- + +.. type:: zbar_config_t + + ZBAR_CFG_ENABLE + Control whether specific symbologies will be recognized. Disabling + unused symbologies improves performance and prevents bad scans. + + ZBAR_CFG_EMIT_CHECK + Whether to include the check digit in the result data string. This + value may be set individually for symbologies where it makes sense. + + ZBAR_CFG_MIN_LEN + The minimum data length for a symbol to be valid, set to 0 to disable. + Use with eg, I2/5 to avoid short scans. This value may be set + individually for variable-length symbologies. + + ZBAR_CFG_MAX_LEN + The maximum data length for which a symbol is valid, set to 0 to + disable. Use with eg, I2/5 to enforce a specific range of data lengths. + This value may be set individually for variable-length symbologies. + + ZBAR_CFG_UNCERTAINTY + Number of "nearby" frames that must contain a symbol before it will be + considered valid. This value may be set for individual symbologies. + + ZBAR_CFG_POSITION + Whether to track position information. + + ZBAR_CFG_X_DENSITY + The stride to use for scanning vertical columns of the image. This many + pixel columns will be skipped between vertical scan passes. Useful for + trading off between resolution and performance. This is a scanner + setting (use 0 for the symbology). + + ZBAR_CFG_Y_DENSITY + The stride to use for scanning horizontal columns of the image. This + many pixel rows will be skipped between horizontal scan passes. Useful + for trading off between resolution and performance. This is a scanner + setting (use 0 for the symbology). diff --git a/iphone/doc/ZBarReaderController.rst b/iphone/doc/ZBarReaderController.rst new file mode 100644 index 0000000..cf7ee09 --- /dev/null +++ b/iphone/doc/ZBarReaderController.rst @@ -0,0 +1,156 @@ +ZBarReaderController Class Reference +==================================== + +.. class:: ZBarReaderController + + :Inherits from: :class:`UIImagePickerController` + + This is the controller to use for scanning images selected by a + :class:`UIImagePickerController` either captured manually using the camera, + or selected from the Photo Library. For more information, see + :doc:`picker`. + + It can support automatic capture from the camera only if the library is + re-built to use private APIs (see :doc:`compat`). + + +Properties +---------- + + .. member:: ZBarImageScanner *scanner + + Access to the image scanner for configuration. (read-only) + + .. member:: id readerDelegate + + The delegate that will be notified when new barcode results are + available. + + .. member:: BOOL showsZBarControls + + Whether to display a default control set consisting of cancel, scan and + info buttons. Disable these if you provide your own controls using the + :member:`cameraOverlayView`. Enabling this automatically disables the + system controls :member:`showsCameraControls`. (Default ``YES``). + + .. member:: BOOL showsHelpOnFail + + Whether to automatically display the integrated help viewer when an + image fails to decode. Even if this is disabled, the integrated help + may still be presented manually using ``showHelpWithReason:``. + (Default ``YES``) + + .. member:: ZBarReaderControllerCameraMode cameraMode + + Scanning mode to use with the camera. It is generally appropriate to + leave this at the default. + + .. member:: BOOL tracksSymbols + + Whether to display the tracking rectangle around detected barcodes. + + .. member:: BOOL takesPicture + + Whether to take a full picture (with ``takePicture``) when a barcode + is detected with ``ZBarReaderControllerCameraModeSampling``. The + resulting image will be delayed from the actual decode. + + .. member:: BOOL enableCache + + This property is deprecated and should not be modified. + + .. member:: CGRect scanCrop + + Crop images before scanning. The original image will be cropped to this + rectangle, which should be in normalized image coordinates, x-axis + major. Defaults to the full image ``{{0, 0}, {1, 1}}``. + + .. member:: NSInteger maxScanDimension + + Scale image to scan. After cropping, the image will be scaled if + necessary, such that neither of its dimensions exceed this value. + Defaults to 640. + + .. note:: + + The remaining properties are inherited from + :class:`UIImagePickerController`. + + .. member:: UIImagePickerControllerSourceType sourceType + + Image source. Use to select between the camera and photo library. + + .. member:: BOOL showsCameraControls + + Whether to display the system camera controls. Overridden to ``NO`` + when :member:`showsZBarControls` is ``YES``. + + .. member:: UIView *cameraOverlayView + + A custom view to display over the camera preview. The tracking layer + and default controls will be added to this view if they are enabled. + + .. member:: CGAffineTransform cameraViewTransform + + A transform to apply to the camera preview. Ignored by the reader. + Possibly useful for eg, a digital zoom effect. + + .. member:: BOOL allowsEditing + + Whether to enable the system image editing dialog after a picture is + taken. Possibly useful to improve reader results in some cases using + manual intervention. + + +Instance Methods +---------------- + + .. _`showHelpWithReason:`: + .. describe:: - (void) showHelpWithReason:(NSString*)reason + + Display the integrated help browser. Use this with custom overlays if + you don't also want to create your own help view. Should only be called + when the reader is displayed. The ``reason`` argument will be passed to + the :func:`onZBarHelp` javascript function. + + :reason: A string parameter passed to javascript. + + .. _`scanImage:`: + .. describe:: - (id ) scanImage:(CGImageRef)image + + Scan an image for barcodes. This is a wrapper around + ``scanner.scanImage`` that applies scanCrop and maxScanDimension. Some + additional result filtering is also performed. + + :image: A :class:`CGImage` to scan. + :Returns: The result set containing :class:`ZBarSymbol` objects. + + +Constants +--------- + +.. type:: ZBarReaderControllerCameraMode + + The scanning mode to use with the camera. + + ZBarReaderControllerCameraModeDefault + The standard mode provided by UIImagePickerController - the user + manually captures an image by tapping a control. This is the default + unless private APIs are enabled. + + ZBarReaderControllerCameraModeSampling + Automatically capture by taking screenshots with + :func:`UIGetScreenImage`. Resolution is limited to the screen + resolution, so this mode is inappropriate for longer codes. Only + available when private APIs are enabled, and becomes the default mode in + that case. + + ZBarReaderControllerCameraModeSequence + Experimental mode that automatically scans by "rapidly" scanning + pictures captured with ``takePicture``. Not recommended for serious + use. + +.. c:var:: NSString *ZBarReaderControllerResults + + The info dictionary key used to return decode results to + ``imagePickerController:didFinishPickingMediaWithInfo:`` diff --git a/iphone/doc/ZBarReaderDelegate.rst b/iphone/doc/ZBarReaderDelegate.rst new file mode 100644 index 0000000..34b52c7 --- /dev/null +++ b/iphone/doc/ZBarReaderDelegate.rst @@ -0,0 +1,70 @@ +ZBarReaderDelegate Protocol Reference +===================================== + +.. class:: ZBarReaderDelegate + + :Inherits from: :class:`UIImagePickerControllerDelegate` + + This protocol must be implemented by the + :member:`~ZBarReaderViewController::readerDelegate` provided to a + :class:`ZBarReaderViewController` or :class:`ZBarReaderController`. It is + used to notify the delegate of new decode results, when an image fails to + decode, or when the user dismisses the reader with the built-in controls. + + +Instance Methods +---------------- + + .. describe:: - (void) imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info + + This inherited delegate method is called when a barcode is successfully + decoded. The decoded symbols are available from the dictionary as a + :class:`ZBarSymbolSet` using the :c:data:`ZBarReaderControllerResults` + key. The image from which the barcodes were scanned is available using + the :c:data:`UIImagePickerControllerOriginalImage` key. No other keys + are guaranteed to be valid. + + .. note:: + + The ``picker`` parameter will be the reader controller instance that + read the barcodes - not necessarily a + :class:`UIImagePickerController` instance. You should cast it to the + correct type for anything other than basic view controller access. + + :picker: The reader controller that scanned the barcode(s). + :info: A dictionary containing the image and decode results. + + .. describe:: - (void) imagePickerControllerDidCancel:(UIImagePickerController*)picker + + Called when the user taps the "Cancel" button provided by the built-in + controls (when :member:`showsZBarControls`\ ``=YES``). The default + implementation dismisses the reader. If this method is implemented, it + should do the same. + + .. note:: + + The ``picker`` parameter will be the reader controller instance that + read the barcodes - not necessarily a + :class:`UIImagePickerController` instance. You should cast it to the + correct type for anything other than basic view controller access. + + :picker: The reader controller that scanned the barcode(s). + + .. describe:: - (void) readerControllerDidFailToRead:(ZBarReaderController*)reader withRetry:(BOOL)retry + + Called when an image, manually captured or selected from the photo + library, is scanned and no barcodes were detected. + + If the ``retry`` parameter is ``NO``, the controller must be dismissed + before this method returns. Otherwise, another scan may be attempted + without re-presenting the controller. + + If the :member:`~ZBarReaderController::showsHelpOnFail` is ``YES`` *and* + ``retry`` is ``YES``, the integrated help viewer will already be + presenting. + + If this method is not implemented, the controller will be dismissed iff + ``retry`` is ``NO``. + + :reader: The :class:`ZBarReaderController` that scanned the barcode(s). + :retry: Whether another scan may be attempted. diff --git a/iphone/doc/ZBarReaderView.rst b/iphone/doc/ZBarReaderView.rst new file mode 100644 index 0000000..d434215 --- /dev/null +++ b/iphone/doc/ZBarReaderView.rst @@ -0,0 +1,126 @@ +ZBarReaderView Class Reference +============================== + +.. class:: ZBarReaderView + + :Inherits from: :class:`UIView` + + This is a barcode reader encapsulted in a UIView. It manages an + :class:`AVCaptureSession` with a camera device and a + :class:`ZBarCaptureReader`, presents the video preview and optionally + tracks detected barcode symbols. A delegate will usually be assigned for + notification of new decode results. + + +Properties +---------- + + .. member:: id readerDelegate + + The delegate that will be notified of new decode results. + + .. member:: ZBarImageScanner *scanner + + Access to the image scanner is provided for configuration. (read-only) + + .. member:: BOOL tracksSymbols + + Whether to display the tracking annotation (default ``YES``). + + .. member:: UIColor *trackingColor + + The color of the tracking annotation (default green). + + .. member:: BOOL allowsPinchZoom + + Enable pinch gesture recognition for manually zooming the preview/decode + (default ``YES``). + + .. member:: NSInteger torchMode + + An :type:`AVCaptureTorchMode` value that will be applied if/when + appropriate. (default Auto) + + .. member:: BOOL showsFPS + + Overlay the decode frame rate on the preview to help with performance + optimization. This is for *debug only* and should not be set for + production. (default ``NO``) + + .. member:: CGFloat zoom + + Zoom scale factor applied to the video preview *and* scanCrop. This + value is also updated by the pinch-zoom gesture. Valid values are in + the range [1,maxZoom]. (default 1.25) + + .. member:: CGFloat maxZoom + + Maximum settable zoom level. The zoom property will be clipped to this + value. + + .. member:: CGRect scanCrop + + The region of the video image that will be scanned, in normalized image + coordinates. Note that the video image is in landscape mode (default + {{0, 0}, {1, 1}}) + + .. member:: CGAffineTransform previewTransform + + Additional transform that will be applied to the video preview. Note + that this transform is *not* applied to scanCrop. + + .. member:: AVCaptureDevice *device + + The capture device may be manipulated or replaced. + + .. member:: AVCaptureSession *session + + Direct access to the capture session. Warranty void if opened. + (read-only) + + .. member:: ZBarCaptureReader *captureReader + + Direct access to the capture reader. Warranty void if opened. + (read-only) + + .. member:: BOOL enableCache + + :Deprecated: + + Whether to use the inter-frame consistency cache. This should always be + set to ``YES``. + + +Instance Methods +---------------- + + .. describe:: - (id) initWithImageScanner:(ZBarImageScanner*)imageScanner + + :imageScanner: A pre-configured :class:`ZBarImageScanner` to use for scanning + :Returns: The initialized :class:`ZBarReaderView` + + .. describe:: - (void) start + + Begin/resume scanning after a call to ``stop``. + + .. describe:: - (void) stop + + Stop scanning and pause the video feed. + + .. describe:: - (void) flushCache + + Flush the inter-frame consistency cache. Any barcodes in the frame will + be re-recognized in subsequent frames. + + .. _`setZoom:animated:`: + .. describe:: - (void) setZoom:(CGFloat)zoom animated:(BOOL)animated + + Set the zoom property with optional animation. + + .. _`willRotateTointerfaceOrientation:duration:`: + .. describe:: - (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration + + Compensate for device / camera / interface orientation. Must be called + by containing view controller that supports any non-portrait orientation + to restore the camera preview to the correct orientation. Call from + view controller method of the same name for correct animation. diff --git a/iphone/doc/ZBarReaderViewController.rst b/iphone/doc/ZBarReaderViewController.rst new file mode 100644 index 0000000..4366079 --- /dev/null +++ b/iphone/doc/ZBarReaderViewController.rst @@ -0,0 +1,190 @@ +ZBarReaderViewController Class Reference +======================================== + +.. class:: ZBarReaderViewController + + :Inherits from: :class:`UIViewController` + + This is the controller to use for live scanning from the camera feed with + automatic capture. For scanning from image files or with manual capture, + see :class:`ZBarReaderController`. + + +Properties +---------- + + .. member:: ZBarImageScanner *scanner + + Access to the image scanner for configuration. (read-only) + + .. member:: id readerDelegate + + The delegate that will be notified when new barcode results are + available. + + .. member:: BOOL showsZBarControls + + Whether to display a default control set consisting of cancel, scan and + info buttons. Disable these if you provide your own controls using the + :member:`cameraOverlayView`. (Default ``YES``). + + .. member:: BOOL tracksSymbols + + Whether to display the tracking rectangle around detected barcodes. + + .. member:: NSUInteger supportedOrientationsMask + + Set of interface orientations that the controller should support. Use + :func:`ZBarOrientationMask` or ``ZBarOrientationMaskAll`` to + generate the mask. + + .. member:: CGRect scanCrop + + Crop images before scanning. The original image will be cropped to this + rectangle, which should be in normalized image coordinates (NB the + camera image x-axis is *vertical* on the screen). Defaults to the full + image ``{{0, 0}, {1, 1}}``. + + .. member:: UIView *cameraOverlayView + + A custom view to display over the camera preview. + + .. member:: CGAffineTransform cameraViewTransform + + A transform to apply to the camera preview. Ignored by the reader. + + .. member:: UIImagePickerControllerCameraDevice cameraDevice + + The camera device to use for scanning. Defaults to the system default + camera. + + .. member:: UIImagePickerControllerCameraFlashMode cameraFlashMode + + The "flash" (aka torch) mode to use while scanning. Defaults to + UIImagePickerControllerCameraFlashModeAuto. + + .. member:: UIImagePickerControllerQualityType videoQuality + + The resolution to use while scanning. Defaults to + UIImagePickerControllerQuality640x480. + + .. member:: ZBarReaderView *readerView + + View that presents the camera preview and performs the scanning. This + view has other properties you may use to control the appearance and + behavior of the reader. + + Note that this view may be released when it is not displayed (eg, under + low memory conditions). You should apply any configuration just before + you present the reader. + + .. member:: BOOL enableCache + + This property is deprecated and should not be modified. + + .. warning:: + + The remaining properties are deprecated, they are only present for + backward compatibility with :class:`ZBarReaderController` and will raise + an exception if inappropriate/unsupported values are set. + + .. member:: UIImagePickerControllerSourceType sourceType + + Raises an exception if anything other than + ``UIImagePickerControllerSourceTypeCamera`` is set. If you want to scan + images, use a :class:`ZBarReaderController` instead of this class. + + .. member:: UIImagePickerControllerCameraCaptureMode cameraCaptureMode + + Raises an exception if anything other than + ``UIImagePickerControllerCameraCaptureModeVideo`` is set. + + .. member:: BOOL allowsEditing + + Raises an exception if anything other than ``NO`` is set. + + .. member:: BOOL showsCameraControls + + Raises an exception if anything other than ``NO`` is set. Use + :member:`showsZBarControls` to disable the buit-in overlay. + + .. member:: BOOL showsHelpOnFail + + Any value set to this property is ignored. It is only useful for + scanning images, for which you should use :class:`ZBarReaderController`. + + .. member:: ZBarReaderControllerCameraMode cameraMode + + This reader only supports scanning from the camera feed. If you want to + scan manually captured images, use a :class:`ZBarReaderController` + instead of this class. + + .. member:: BOOL takesPicture + + Raises an exception if anything other than ``NO`` is set. This + controller automatically returns the scanned camera frame and does not + support capturing a separate image. + + .. member:: NSInteger maxScanDimension + + Any value set to this property is ignored. It is only useful for + scanning images, for which you should use :class:`ZBarReaderController`. + + +Class Methods +------------- + + .. describe:: + (BOOL) isSourceTypeAvailable:(UIImagePickerControllerSourceType)source + + Returns ``YES`` only if ``source`` is ``Camera`` and the + :class:`UImagePickerController` method of the same name also returns + ``YES``. + + .. describe:: + (BOOL) isCameraDeviceAvailable:(UIImagePickerControllerCameraDevice)cameraDevice + + See the :class:`UImagePickerController` method of the same name. + + .. describe:: + (BOOL) isFlashAvailableForCameraDevice:(UIImagePickerControllerCameraDevice)cameraDevice + + See the :class:`UImagePickerController` method of the same name. + + .. describe:: + (NSArray*) availableCaptureModesForCameraDevice:(UIImagePickerControllerCameraDevice)cameraDevice + + Returns an array with the single element + ``UIImagePickerControllerCameraCaptureModeVideo`` if the device is + available, otherwise returns an empty array. + + +Instance Methods +---------------- + + .. _`showHelpWithReason:`: + .. describe:: - (void) showHelpWithReason:(NSString*)reason + + Display the integrated help browser. Use this with custom overlays if + you don't also want to create your own help view. Should only be called + when the reader is displayed. The ``reason`` argument will be passed to + the :func:`onZBarHelp` javascript function. + + :reason: A string parameter passed to javascript. + + .. _`takePicture`: + .. describe:: - (void) takePicture + + Capture the next available frame and send it over the usual delegate + path. + + +Macros +------ + + .. function:: ZBarOrientationMask(interfaceOrientation) + + Generate a bit-mask for the specified interface orientation, suitable + for setting :member:`supportedOrientationsMask`. + + .. describe:: ZBarOrientationMaskAll + + Combination of :func:`ZBarOrientationMask` for all interface + orientations (Portrait, PortraitUpsideDown, LandscapeLeft and + LandscapeRight) diff --git a/iphone/doc/ZBarReaderViewDelegate.rst b/iphone/doc/ZBarReaderViewDelegate.rst new file mode 100644 index 0000000..e6730cb --- /dev/null +++ b/iphone/doc/ZBarReaderViewDelegate.rst @@ -0,0 +1,26 @@ +ZBarReaderViewDelegate Protocol Reference +========================================= + +.. class:: ZBarReaderViewDelegate + + :Inherits from: :class:`NSObject` + + This protocol, which must be implemented by the `readerDelegate` provided + to a :class:`ZBarReaderView`, is used to notify the delegate of new decode + results. + + +Instance Methods +---------------- + + .. describe:: - (void) readerView:(ZBarReaderView*)readerView didReadSymbols:(ZBarSymbolSet*)symbols fromImage:(UIImage*)image + + Called to notify the delegate of new decode results. + + Note that the referenced image is a proxy for a video buffer that is + asynchronously being converted to a :class:`UIImage`, attempting to + access the data will block until the conversion is complete. + + :readerView: :class:`ZBarReaderView` that scanned the barcode(s). + :symbols: :class:`ZBarSymbolSet` containing the decode results. + :image: :class:`UIImage` from which the barcode(s) were scanned. diff --git a/iphone/doc/ZBarSymbol.rst b/iphone/doc/ZBarSymbol.rst new file mode 100644 index 0000000..058a7b1 --- /dev/null +++ b/iphone/doc/ZBarSymbol.rst @@ -0,0 +1,186 @@ +ZBarSymbol Class Reference +========================== + +.. class:: ZBarSymbol + + :Inherits from: :class:`NSObject` + + A symbol wraps all of the information the library has about a decoded + barcode. Use the available properties to retrieve the barcode data, the + symbology (type of barcode), location and more. + + This class is a simple wrapper around a :type:`zbar_symbol_t` C object + (q.v.) + + +Properties +---------- + + .. member:: zbar_symbol_type_t type + + The type of symbology that was decoded. (read-only) + + .. member:: NSString *typeName + + The canonical name used by the library to represent the symbology. + (read-only) + + .. member:: NSUInteger configMask + + Bitmask of symbology config settings used during decode. + + .. member:: NSUInteger modifierMask + + Bitmask of symbology characteristics detected during decode. See + :type:`zbar_modifier_t` for the currently defined modifier bits. + + .. member:: NSString *data + + The raw decoded barcode data. (read-only) + + .. member:: int quality + + A relative metric indicating rough confidence in the decoded value. + Larger values are better than smaller values. (read-only) + + .. member:: zbar_orientation_t orientation + + The general, axis-aligned orientation of the symbol, or + ZBAR_ORIENT_UNKNOWN if unknown. (read-only) + + .. member:: ZBarSymbolSet *components + + The components of a composite symbol. (read-only) + + .. member:: const zbar_symbol_t *zbarSymbol + + Retrieve the underlying C object instance. (read-only) + + .. member:: CGRect bounds + + Calculate a rough bounding box for the symbol. (read-only) + + .. note:: + + Coordinates are relative to the image *data*, which may not match a + displayed UIImage. Make sure to account for the UIImage orientation + when using these values. + + +Class Methods +------------- + + .. _`nameForType:`: + .. describe:: + (NSString*) nameForType:(zbar_symbol_type_t)type + + Retrieve the canonical name for a symbology used by the library, given + its enumerated value. + + :type: The :type:`zbar_symbol_type_t` enumerated symbology value. + :Returns: A short string name for the symbology. + + +Instance Methods +---------------- + + .. _`initWithSymbol:`: + .. describe:: - (id) initWithSymbol:(const zbar_symbol_t*)symbol + + Initialize a symbol wrapper, given the C object to wrap. + + :symbol: The C object to wrap. + :Returns: The initialized symbol, or nil if an error occurred. + + +Constants +--------- + +.. type:: zbar_symbol_type_t + + Symbology identifiers. + + ZBAR_NONE + No symbol was decoded. + + ZBAR_PARTIAL + Intermediate status. + + ZBAR_EAN8 + EAN-8 + + ZBAR_UPCE + UPC-E + + ZBAR_ISBN10 + ISBN-10, converted from EAN-13 + + ZBAR_UPCA + UPC-A + + ZBAR_EAN13 + EAN-13 + + ZBAR_ISBN13 + ISBN-13, converted from EAN-13 + + ZBAR_I25 + Interleaved 2 of 5 + + ZBAR_DATABAR + GS1 DataBar (RSS) + + ZBAR_DATABAR_EXP + GS1 DataBar Expanded + + ZBAR_CODABAR + Codabar + + ZBAR_CODE39 + Code 39 (3 of 9) + + ZBAR_QRCODE + QR Code + + ZBAR_CODE128 + Code 128 + +.. type:: zbar_orientation_t + + The coarse orientation of a symbol. + + .. note:: + + Orientation is relative to the image *data*, which may not match a + displayed UIImage. Make sure to account for the UIImage orientation + when using these values. + + ZBAR_ORIENT_UNKNOWN + Unable to determine orientation. + + ZBAR_ORIENT_UP + Upright, read left to right + + ZBAR_ORIENT_RIGHT + Sideways, read top to bottom + + ZBAR_ORIENT_DOWN + Upside-down, read right to left + + ZBAR_ORIENT_LEFT + Sideways, read bottom to top + +.. type:: zbar_modifier_t + + Decoder symbology modifier flags. + + .. note:: + + These are bit indices, use eg, (1 << ZBAR_MOD_GS1) to test the + modifierMask property. + + ZBAR_MOD_GS1 + Barcode tagged as GS1 (EAN.UCC) reserved (eg, FNC1 before first data + character). Data may be parsed as a sequence of GS1 AIs. + + ZBAR_MOD_AIM + Barcode tagged as AIM reserved. diff --git a/iphone/doc/ZBarSymbolSet.rst b/iphone/doc/ZBarSymbolSet.rst new file mode 100644 index 0000000..7983869 --- /dev/null +++ b/iphone/doc/ZBarSymbolSet.rst @@ -0,0 +1,43 @@ +ZBarSymbolSet Class Reference +============================= + +.. class:: ZBarSymbolSet + + :Inherits from: :class:`NSObject` + :Conforms to: :class:`NSFastEnumeration` + + A symbol set is a simple container for the symbols scanned from an image. + It supports :class:`NSFastEnumeration`, and not much else... Use it to + iterate through the :class:`ZBarSymbol` objects in a decode result set:: + + ZBarSymbolSet *symbols = image.symbols; + for(ZBarSymbol *symbol in symbols) { + // process result + } + + This class is a simple wrapper around a :type:`zbar_symbol_set_t` C object + (q.v.) + + +Properties +---------- + + .. member:: int count + + The number of symbols in the set. (read-only) + + .. member:: const zbar_symbol_set_t *zbarSymbolSet + + Retrieve the underlying C object instance. (read-only) + + +Instance Methods +---------------- + + .. _`initWithSymbolSet:`: + .. describe:: - (id) initWithSymbolSet:(const zbar_symbol_set_t*)set + + Initialize a symbol set wrapper, given the C object to wrap. + + :set: The C object to wrap. + :Returns: The initialized symbol set, or nil if an error occurred. diff --git a/iphone/doc/apiref.rst b/iphone/doc/apiref.rst new file mode 100644 index 0000000..92920c0 --- /dev/null +++ b/iphone/doc/apiref.rst @@ -0,0 +1,16 @@ +******************* + API Reference +******************* + +.. toctree:: + :maxdepth: 1 + + ZBarImage + ZBarImageScanner + ZBarReaderController + ZBarReaderDelegate + ZBarReaderView + ZBarReaderViewController + ZBarReaderViewDelegate + ZBarSymbol + ZBarSymbolSet diff --git a/iphone/doc/camera.rst b/iphone/doc/camera.rst new file mode 100644 index 0000000..9f283dd --- /dev/null +++ b/iphone/doc/camera.rst @@ -0,0 +1,130 @@ +Scanning From the Camera Feed +============================= + +Many iOS developers want their application to support automatic recognition of +barcodes from the camera feed in real-time. ZBar makes this easy! + +There are three levels that you may choose to integrate at, from least complex +(recommended) to most complex these are: + +* Use the fully integrated view controller - this is very easy to implement + and is the recommended approach. +* Use the reader view with your own controller - this more advanced approach + allows you to embed the view directly in your view hierarchy. +* Use the capture component with your own AVCapture session - this is not + supported and only provided for advanced developers with special needs who + are already familiar with AVCapture. + + +Using a ZBarReaderViewController +-------------------------------- + +This is the fastest, easiest and recommend way to get the barcode reader into +your application. The procedure is the same as using a +UIImagePickerController to take a picture with the camera, so it will help if +you are familiar with that. Basically you: + +1. Create the reader. + + This is as simple as creating a new :class:`ZBarReaderViewController`:: + + ZBarReaderViewController *reader = [[ZBarReaderViewController alloc] init]; + +2. Setup a delegate to receive the results. + + The delegate should implement the :class:`ZBarReaderDelegate` protocol, + which inherits from :class:`UIImagePickerControllerDelegate`:: + + reader.readerDelegate = self; + +3. Configure the reader. + + Aside from the properties of the reader itself, you can configure the + decoder via the :member:`~ZBarReaderViewController::scanner` property and + further customize the view via the + :member:`~ZBarReaderViewController::readerView` property:: + + // disable QR Code + [reader.scanner setSymbology: ZBAR_QRCODE + config: ZBAR_CFG_ENABLE + to: 0]; + reader.readerView.zoom = 1.0; + + See :doc:`custom` and :doc:`optimizing` for more details. + +4. Present the reader to the user. + + Typically the controller is presented modally:: + + [self presentModalViewController: reader + animated: YES]; + + Alternatively, it may be added to a container controller. + +5. Process the results. + + The controller will call the + ``imagePickerController:didFinishPickingMediaWithInfo:`` method of + your delegate every time new results become available. The barcode data + can be obtained using the :c:data:`ZBarReaderControllerResults` key of the + info dictionary. This key will return "something enumerable"; keep in mind + that there may be multiple results. You may also retrieve the + corresponding image with :c:data:`UIImagePickerControllerOriginalImage` as + usual:: + + - (void) imagePickerController: (UIImagePickerController*) reader + didFinishPickingMediaWithInfo: (NSDictionary*) info + { + id results = + [info objectForKey: ZBarReaderControllerResults]; + UIImage *image = + [info objectForKey: UIImagePickerControllerOriginalImage]; + ... + + The ``reader`` parameter will be the actual type of the reader (not + necessarily a :class:`UIImagePickerController`). + + .. note:: + + The delegate method should queue the interface response and return as + soon as possible; any processing of the results should be deferred until + later, otherwise the user will experience unacceptable latency between + the actual scan completion and the visual interface feedback. + +6. Dismiss the reader (or not). + + Once you have the results you may dismiss the reader:: + + [reader dismissModalViewControllerAnimated: YES]; + + .. warning:: + + It is very important to dismiss from the *reader* (not the presenting + controller) to avoid corrupting the interface. + + Alternatively, you may choose to continue scanning and provide visual + feedback another way (eg, maybe by updating your custom overlay with the + results). The "continuous" mode of the readertest example does this. + + +Using a ZBarReaderView +---------------------- + +:class:`ZBarReaderViewController` is a relatively thin wrapper around a +:class:`ZBarReaderView`; it is possible to use the view directly, even from +Interface Builder. You lose only some of the simulator and rotation hooks. +The documentation is also less complete, so you need to be able to UTSL. See +the :file:`EmbedReader` sample for a working example. + + +Using the ZBarCaptureReader +--------------------------- + +If you have special requirements for the capture session or just want to use +your own preview, you can add your own :class:`ZBarCaptureReader` to your +session. You must have a solid understanding of the AVCapture infrastructure +if you plan to use this approach. + +.. admonition:: TBD + + sorry, you're on your own here - UTSL :) diff --git a/iphone/doc/compat.rst b/iphone/doc/compat.rst new file mode 100644 index 0000000..5fb808e --- /dev/null +++ b/iphone/doc/compat.rst @@ -0,0 +1,190 @@ +Backward Compatibility +====================== + +Generally speaking, we take great care to ensure that each release of the +library is backward compatible with previous versions - upgrading the library +should not require any changes to your code and will continue to provide +equivalent functionality. The notable exception to this is the iOS 4 upgrade +and associated "deprecation" of the former automatic capture method by our +vendor. + + +.. warning:: + + Versions before iOS 4 are no longer supported by the library. We are no + longer able to test anything in this section, so you're on your own if you + try to make use of it. + + +The Private API +--------------- + +The API that we use for automatic capture with iOS 3.x (namely +:func:`UIGetScreenImage`) has an interesting history. It has changed status +several times, starting with "Private, unless we like you" moving to +"reluctantly Public but undocumeted" by popular demand and reverting to +"strictly Private" as of iOS 4. The current story: if you want to distribute +on the App Store, you had better not be using it - IOW, no automatic capture +for you with iOS 3.x. + +Since App Store distribution is the most common use for the library, the +default configuration, and thus the binary SDK, does *not* use any private +APIs. + +Users targeting ad-hoc or enterprise distribution may not care about the +status of the API and may prefer to continue supporting automatic capture for +iOS 3.x. To do this you will need to rebuild the library with the following +define set for all configurations: + +.. sourcecode:: sh + + USE_PRIVATE_APIS=1 + +For reference, you can check whether your app refers to the offensive function +with this command: + +.. sourcecode:: sh + + $ otool -vI MyApp.app/MyApp | grep UIGetScreenImage + +If there is any output, then the executable includes the private API and is +bound to be rejected if submitted for review. Otherwise it is "clean" as far +as this library is concerned. + + +Upgrading to iOS 4 +------------------ + +If you were using the reader before iOS 4 was introduced, you will want to +upgrade to the new reader controller. The performance has improved quite a +bit, and you can continue to support automatic capture on the App Store. + +.. note:: + + This discussion only applies to automatic capture from the camera. If you + are only scanning image files, or prefer/need to use manual capture, you + should not change anything. + +Basically just replace your old :class:`ZBarReaderController` with a new +:class:`ZBarReaderViewController` and you're done! See the reference and the +next section for compatibility between the two classes. + +Also see the :doc:`install` instructions for details about upgrading the +header references to use the SDK. + + +Supporting iOS 3.x +------------------ + +The new :class:`ZBarReaderViewController` is intentionally designed to be +compatible with the old :class:`ZBarReaderController` in most aspects that +relate to reading barcodes. When a :class:`ZBarReaderViewController` is +initialized under iOS 3.x, it will *replace* itself with a +:class:`ZBarReaderController`. You can leverage the compatibility of these +controllers to continue supporting iOS 3.x. + +The following properties and methods should be equivalent across +implementations. You may use them without regard for the actual instance +type. + +======================================================== ==== +Equivalent Members +======================================================== ==== +:member:`~ZBarReaderViewController::cameraOverlayView` +:member:`~ZBarReaderViewController::cameraViewTransform` +:member:`~ZBarReaderViewController::enableCache` +:member:`~ZBarReaderViewController::scanner` +:member:`~ZBarReaderViewController::readerDelegate` +:member:`~ZBarReaderViewController::scanCrop` +``showHelpWithReason:`` +:member:`~ZBarReaderViewController::showsZBarControls` +:member:`~ZBarReaderViewController::tracksSymbols` +======================================================== ==== + +Some properties are available with :class:`ZBarReaderViewController` only for +backward compatibility. If these are configured, they must be set as +indicated; attempts to set another value will raise an exception. + +==================================================== ======================================= +:class:`ZBarReaderController` Property :class:`ZBarReaderViewController` Value +==================================================== ======================================= +:member:`~ZBarReaderController::allowsEditing` ``NO`` +:member:`~ZBarReaderController::cameraMode` ``Sampling`` +:member:`~ZBarReaderController::maxScanDimension` (ignored) +:member:`~ZBarReaderController::showsCameraControls` ``NO`` +:member:`~ZBarReaderController::showsHelpOnFail` (ignored) +:member:`~ZBarReaderController::sourceType` ``Camera`` +:member:`~ZBarReaderController::takesPicture` ``NO`` +==================================================== ======================================= + +Also, the ``isSourceTypeAvailable:`` class method of +:class:`ZBarReaderViewController` will return ``YES`` only for the ``Camera`` +source. + +All other members of :class:`ZBarReaderController`, including those inherited +from :class:`UIImagePickerController` are not supported by +:class:`ZBarReaderViewController`. This includes ``takePicture`` and +``scanImage:``, among others. + +Remaining members of :class:`ZBarReaderViewController`: are only available +with the new implementation. At the moment this is only +:member:`~ZBarReaderViewController::readerView`, but any new properties or +methods not listed here will also fall in this category. + +To access settings that may not be available in a potential fallback +environment, you must verify that they exist and may be set as desired - eg, +by testing the specific reader subtype. + +Weak Linking +^^^^^^^^^^^^ + +When leveraging fallbacks to iOS 3.x, it is important that features introduced +in iOS 4 are referenced using *weak* links. You must configure your project +correctly to support this: + +* Make sure the iOS 4 frameworks are set to *Weak*. Specifically, these are + AVCapture, CoreMedia and CoreVideo. + +* Build with the latest SDK - do *not* use the "Base SDK" setting to target + earlier devices. + +* Set the correct iOS 3.x version for the "iPhone OS Deployment Target" + build setting. + + +Example: Fallback to Manual Capture +----------------------------------- + +This code example will configure the reader for automatic capture from the +camera for iOS 4 and fall back to manual or automatic capture for iOS 3.x, +depending on whether the library was compiled to use private APIs:: + + if(![ZBarReaderController isSourceTypeAvailable: + UIImagePickerControllerSourceTypeCamera]) { + // camera unavailable: display warning and abort + // or resort to keypad entry, etc... + return; + } + + ZBarReaderViewController *reader = [ZBarReaderViewController new]; + // reader will be a ZBarReaderController for iOS 3.x + // or a ZBarReaderViewController for iOS 4 + + reader.readerDelegate = self; + reader.sourceType = UIImagePickerControllerSourceTypeCamera; + reader.showsZBarControls = YES; + + if(reader.cameraMode == ZBarReaderControllerCameraModeSampling) { + // additional automatic capture configuration here + } + else { + // additional manual capture configuration here + } + + [self presentModalViewController: reader + animated: YES]; + +If you are using a custom control set +(:member:`~ZBarReaderViewController::showsZBarControls`\ ``=NO``), you will +want to provide a button attached to ``takePicture`` for the manual capture +case. The built-in controls do this automatically. diff --git a/iphone/doc/conf.py b/iphone/doc/conf.py new file mode 100644 index 0000000..950defb --- /dev/null +++ b/iphone/doc/conf.py @@ -0,0 +1,77 @@ +import sys, os +from plistlib import readPlist + +# General configuration + +extensions = [] +templates_path = ['ext'] +source_suffix = '.rst' +master_doc = 'index' +exclude_patterns = ['.#*'] + +project = u'ZBar iPhone SDK' +copyright = u'2010-2012, Jeff Brown et al' + +today_fmt = '%Y-%m-%d' +info = readPlist('../res/ZBarSDK-Info.plist') +version = 'X.Y' +if info: + version = info['CFBundleVersion'] +release = version + +#add_module_names = False + +pygments_style = 'sphinx' +highlight_language = 'objc' +primary_domain = 'cpp' + +# Options for HTML output + +html_theme = 'default' +html_theme_options = { + 'bgcolor': 'white', + 'textcolor': 'black', + 'linkcolor': '#247', + 'headbgcolor': '#edeff0', + 'headtextcolor': '#247', + 'headlinkcolor': '#c11', + 'sidebarbgcolor': '#247', + 'sidebartextcolor': 'white', + 'sidebarlinkcolor': '#cde', + 'relbarbgcolor': '#247', + 'relbartextcolor': '#ccc', + 'relbarlinkcolor': 'white', + 'footerbgcolor': 'white', + 'footertextcolor': 'black', + 'codebgcolor': '#dfe', + 'codetextcolor': 'black', +} + +html_short_title = 'ZBarSDK ' + version +html_title = 'ZBar iPhone SDK Documentation' +html_static_path = ['static'] +html_favicon = '../../zbar.ico' +html_style = 'style.css' +html_use_modindex = False +html_use_index = False +html_copy_source = False +html_show_sourcelink = False +htmlhelp_basename = 'doc' + +# Options for LaTeX output + +latex_paper_size = 'letter' +latex_font_size = '10pt' + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass [howto/manual]) +latex_documents = [ + ('index', 'ZBarSDK.tex', u'ZBar iPhone SDK Documentation', + u'Jeff Brown', 'manual'), +] + +#latex_logo = '' +#latex_use_parts = False +#latex_preamble = '' +#latex_appendices = [] +#latex_use_modindex = False diff --git a/iphone/doc/custom.rst b/iphone/doc/custom.rst new file mode 100644 index 0000000..17f337f --- /dev/null +++ b/iphone/doc/custom.rst @@ -0,0 +1,70 @@ +Customizing the Interface +========================= + +The reader supports customization of the camera overlay and the integrated +help that is displayed. + + +Customizing the Overlay +----------------------- + +If you are scanning with the camera, whether using a +:class:`ZBarReaderViewController` for automatic capture or manually with +:class:`ZBarReaderController`, you may want to customize the appearance of the +reader. You do this mainly by setting a +:member:`~ZBarReaderViewController::cameraOverlayView`. + +Note that if you are scanning images from the photo library, there is no +customization - you are limited to the system picker interface provided by the +:class:`UIImagePickerController`. + +If you are using a :class:`ZBarReaderViewController` and just want to add to +the existing controls, you can simply set your overlay to include the +additional view hierarchy:: + + reader.cameraOverlayView = myLogoImageView; + +Otherwise, if you are using a :class:`ZBarReaderController` or prefer to +completely replace the default controls, you should disable those first. Note +that you will need to provide your own controls, which should at least include +a way to dismiss the reader:: + + reader.showsCameraControls = NO; // for UIImagePickerController + reader.showsZBarControls = NO; + reader.cameraOverlayView = myControlView; + +For manual capture with :class:`ZBarReaderController`, you should also include +a control connected to :member:`~ZBarReaderController::takePicture`. + +In either case, the overlay view may be loaded from a NIB, or simply created +programmatically. + +You can also disable the tracking rectangle that highlights barcodes with +:member:`~ZBarReaderViewController::tracksSymbols`. + + +Presenting Help +--------------- + +If you have set ``showsZBarControls = NO`` and replaced the default controls, +you may still present the built-in help viewer. Just hook your custom control +to the ``showsHelpWithReason:`` method of the controller. You should only +call this method when the reader is actually presented. + +The default reader controls invoke ``showsHelpWithReason:`` with a reason +parameter of ``"INFO"`` when the info button is tapped. + + +Customizing the Help Content +---------------------------- + +Whether you use the default controls or provide your own, you can still +customize the content of the help that is displayed. The integrated viewer +uses a UIWebView to display the contents of :file:`zbar-help.html` that we +copied into your Resources. You should hack this up as you see fit to give +your users the best help experience. + +To allow for runtime customization based on the reason for presenting help, +the javascript function ``onZBarHelp`` will be called just before the page is +displayed, with the ``reason`` argument set as provided to +``showsHelpWithReason:``. diff --git a/iphone/doc/devguide.rst b/iphone/doc/devguide.rst new file mode 100644 index 0000000..d794e2f --- /dev/null +++ b/iphone/doc/devguide.rst @@ -0,0 +1,13 @@ +*********************** + Developer's Guide +*********************** + +.. toctree:: + :maxdepth: 2 + + camera + picker + custom + optimizing + compat + licensing diff --git a/iphone/doc/faq.rst b/iphone/doc/faq.rst new file mode 100644 index 0000000..7689fd3 --- /dev/null +++ b/iphone/doc/faq.rst @@ -0,0 +1,101 @@ +Frequently Asked Questions (FAQ) +================================ + +This is the ever-growing list of answers to commonly asked questions. Please +feel free to post you question in our `iPhone Developers forum`_ if you do not +find the information you need in this documentation. + +.. _`iPhone Developers Forum`: + http://sourceforge.net/projects/zbar/forums/forum/1072195 + + +General +------- + +This looks great... Where can I get it? + You can download the latest version of the SDK from + http://zbar.sf.net/iphone + + +Compatibility +------------- + +Which iPhone devices does this library support? + The library works *only* with iOS devices that have an auto-focus camera. + Currently, the iPhone 3GS, iPhone 4 and newer devices. The iPad 2 and iPad + 3 will also work in many cases, *iff* the barcode is printed large enough + to achieve good focus. + +Will you make it work with the iPhone 3G? + *No* - the 3G it is not supported and is unlikely to ever be supported. + + To be fair, you *can* use the 3G to scan image files, as long as they're in + focus (ie, *not* images taken by the built-in fixed-focus camera). There + is at least one application that found a use for this... + +What target iOS versions does this library work with? + iOS 4, 5 and 6 are fully supported, including the latest video streaming + interfaces. Since Apple has dropped support for earlier versions of iOS on + the App Store, we recommend that you target only iOS 4 and later for reading + barcodes. + + Note that iOS 3.1 is no longer supported; if you really think you need + that, you should still be able to get it working... See :doc:`compat` for + details about iOS version fallbacks. + + In all cases you should use the latest SDK to build. + +Are any private APIs in use? + No - the binary release of the SDK does not use any private APIs. + +Does this support "automatic" barcode capture? + Yes - with recent iOS versions, the default configuration will capture + barcodes automatically from the video stream. + + +Building +-------- + +I get "Undefined symbols" errors when I try to build? + Most likely you did not add all of the necessary framework dependencies. + See :doc:`tutorial` or :doc:`install` for the list of frameworks you need + to link against. + + +Licensing +--------- + +Please refer to :doc:`licensing` for questions about licensing. + + +Barcodes +-------- + +Why do my UPC barcodes have an extra 0 at the front? + The UPC-A_ symbology is the subset of EAN-13_ that starts with a leading 0. + The ZBar decoder enables only EAN-13_ by default, so GTIN-13_ product codes + are consistently reported. You can choose to receive the 12-digit results + instead by explicitly enabling UPC-A_. + + The :member:`~ZBarSymbol::type` property of the symbol can be used to see + which type of barcode is reported. + + See EAN-13_ and UPC-A_ for more information. + +Why does my UPC-E (short version) barcode data look completely wrong? + UPC-E_ is a "zero compressed" version of UPC-A_; certain of the zeros are + removed from the UPC-A_ data to generate the UPC-E_ barcode. The ZBar + decoder *expands* this compression by default, again to consistently report + GTIN-13_ product codes. You can choose to receive the compressed 8-digit + results instead by explicitly enabling UPC-E_. + + The :member:`~ZBarSymbol::type` property of the symbol can be used to see + which type of barcode is reported. + + See UPC-E_ for more information. + +.. _GTIN-13: +.. _GTIN: http://wikipedia.org/wiki/GTIN +.. _EAN-13: http://wikipedia.org/wiki/EAN-13 +.. _UPC-A: http://wikipedia.org/wiki/UPC-A +.. _UPC-E: http://wikipedia.org/wiki/UPC-E#UPC-E diff --git a/iphone/doc/getstarted.rst b/iphone/doc/getstarted.rst new file mode 100644 index 0000000..29cf9e4 --- /dev/null +++ b/iphone/doc/getstarted.rst @@ -0,0 +1,12 @@ +********************* + Getting Started +********************* + +.. toctree:: + :maxdepth: 2 + :numbered: + + install + tutorial + faq + support diff --git a/iphone/doc/index.rst b/iphone/doc/index.rst new file mode 100644 index 0000000..6ded7c8 --- /dev/null +++ b/iphone/doc/index.rst @@ -0,0 +1,20 @@ +################ + ZBar iOS SDK +################ + +Welcome to the ZBar SDK for iOS! + +This documentation covers all aspects of developing with the SDK: from adding +the SDK to your project, to writing code that uses it, even licensing the +library with your app. + +Please let us know if you find anything inaccurate or lacking (even better, +send doc patches!) + +.. toctree:: + :maxdepth: 2 + :numbered: + + getstarted + devguide + apiref diff --git a/iphone/doc/install.rst b/iphone/doc/install.rst new file mode 100644 index 0000000..b86ac45 --- /dev/null +++ b/iphone/doc/install.rst @@ -0,0 +1,141 @@ +Installing the SDK +================== + +These are the basic instructions for obtaining the SDK and adding it to an +Xcode project. + +You may want to try things out with the :doc:`tutorial` before hacking at your +own project. + + +Requirements +------------ + +You will need *all* of the following to develop iPhone applications +using this SDK: + +* Mac OS X >= 10.6.x (Snow Leopard) +* Xcode >= 4.5.1 +* iPhone SDK >= 4.0 +* An iPhone 3GS, iPhone 4 or newer iOS device with an auto-focus camera +* iOS >= 4.0 running on the device + +.. warning:: + + *Only* the iPhone 3GS, iPhone 4 and newer models are supported, as they + have a camera with auto-focus. The iPad 2 and iPad 3 will also work, *iff* + the barcode is printed large enough to achieve good focus. The ZBar + library does not support the iPhone 3G and is unlikely to ever support it. + + +Downloading +----------- + +Download the latest binary release of the ZBar SDK from + +http://zbar.sourceforge.net/iphone + + +Integration +----------- + +The recommended installation method is to simply copy the SDK into your +Xcode project: + +1. Open ZBarSDK-|version|.dmg in the Finder. + +2. Drag the :file:`ZBarSDK` folder into your Xcode project. In the dialog + that appears, you should choose to **copy** the SDK into your project by + checking the box. The target that you want to link with the library should + also be selected in the target list. + +3. Link the following additional frameworks to any targets that link with the + ZBarSDK. You should set the first three to use weak references and + configure an appropriate deployment target if you still need to support + iOS 3: + + * :file:`AVFoundation.framework` (weak) + * :file:`CoreMedia.framework` (weak) + * :file:`CoreVideo.framework` (weak) + * :file:`QuartzCore.framework` + * :file:`libiconv.dylib` + + If you check "Link Binary With Libraries" for the target(s), you should see + all of these frameworks followed by :file:`libzbar.a`. + + .. note:: + + Link order may be important for some versions of Xcode; the referenced + libraries should be listed *before* :file:`libzbar.a` in the link order. + +4. Import the SDK header from your prefix header to make the barcode reader + APIs available:: + + #import "ZBarSDK.h" + +Proceed to :doc:`camera` or :doc:`picker` to learn about using the reader APIs +to scan barcodes. Use the :doc:`apiref` for specific interface details. + + +Upgrading from an Older Version +------------------------------- + +If you are using an older version of the *SDK* (NB, skip to the next section +if you are currently using Mercurial), upgrading is straightforward: + +1. Delete the current ZBarSDK group from your project. You should choose + to delete the files if you copied them into your project. +2. Drag the new ZBarSDK from the DMG into your project. + +Clean out and rebuild your project with the new version. + + +Upgrading a Pre-SDK Integration +------------------------------- + +If your project was using the library directly from the Mercurial repository, +before the SDK was introduced, there are a few incompatibilities that you must +resolve in order to upgrade. Don't worry - all of your source stays the same, +you just need to update how the library is included in the project and how the +headers are imported. + +Switching to the Binary Distribution +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This approach is recommended - the binary releases provide you with a stable +development platform, isolating you from temporary instability and transient +problems that may occur at the bleeding edge. + +The first task is to reverse the previous ZBar integration: + +1. Remove the reference to zbar.xcodeproj from your project. +2. Remove any :file:`zbar-*` files from your Resources. +3. In the target build settings, remove any "Header Search Paths" that + reference zbar. +4. Remove any references to zbar headers in your :file:`prefix.pch` or source + files. + +Now just continue with the `integration`_ instructions above and you should be +back up and running! + +Continuing with Mercurial +^^^^^^^^^^^^^^^^^^^^^^^^^ + +Alternatively, you may still prefer to select Mercurial revisions. You have a +few choices for this: + +* You may build your own ZBarSDK and copy/link it into your project. This is + the same as `Switching to the Binary Distribution`_, except that you use + your own version of the SDK. In this case you need to manually rebuild the + SDK when you update it. +* You may leave zbar.xcodeproj as a project dependency and pull the SDK into + your project. This is not well tested, so ymmv. +* You may leave zbar.xcodeproj as a project dependency and just link libzbar.a + into your project, as before. You will need to update the target dependency + (the library target changed names to libzbar) and add the + :file:`iphone/include/ZBarSDK` directory to "Header Search Paths" + +In any case, you should remove the references to the zbar headers from +:file:`prefix.pch` (or your source files) and replace them with:: + + #import "ZBarSDK.h" diff --git a/iphone/doc/licensing.rst b/iphone/doc/licensing.rst new file mode 100644 index 0000000..075ccd4 --- /dev/null +++ b/iphone/doc/licensing.rst @@ -0,0 +1,187 @@ +Licensing the Library +===================== + +First of all, the big disclaimer: + +.. warning:: + + We are *not* lawyers; we cannot help you decide if you should use the + library or how to apply the license, only your lawyer can advise you + concerning legal matters. + +That said, it should also be noted that we have neither the resources (time, +cash, etc) nor the patience to enforce the license (at all); the reality is +that all of this is left to your discretion. + +If you prefer to leave the lawyers out of it, the rest of this section will +help you apply the license to your application. + + +Licensing FAQ +------------- + +Can I use this library with my proprietary (closed source) application? + Yes, that is our intent and we do not believe there is any problem + regarding the license. + +Will I need to open source my entire app? + No, it is not required by the license. + +Will I need to distribute all of my "object files" on the App Store? + No, this is also not required by the license, although you should offer to + provide them upon request. See below for more detail. + +But I read somewhere that "iPhone apps may not use LGPL code"? + That statement is an over-generalization that does not apply in this case. + Most likely your source is either: + + * referring to the GPL, which is significantly different from the + *L*\ GPL + * referring to a different version of the LGPL; we intentionally use + version 2.1, which has specific static linking exceptions. + * not a lawyer either and too lazy to read the whole license + + Basically, if you leverage the appropriate sections of the license, it + should be fully compatible with the App Store restrictions and + requirements. + +This is too complicated, can I just pay for an easier license? + No, it is not possible. There are multiple problems with this approach, + some brief highlights: + + * Most open source projects (including this one) do not have a single + author. Tracking down every contributor and getting their approval could + be quite a challenge. + * The license is meant to protect users' rights to the software. Giving + you special treatment bypasses the protection we offered them, + effectively revoking their rights. This would be a violation of their + trust and completely defeats the purpose of the license. + + You may think of this as the "price" you pay for using our open source + library. If you want to make your life easier, you should be petitioning + Apple for shared library support... + +What if you add a clause that lets me do whatever I want? + No, also not possible. In addition to the problems mentioned above, there + are even more problems with this: + + * Sourceforge requires an OSI approved license for hosting our project; + an altered license would no longer be approved. + * Again we are not lawyers and therefore not qualified to change the + license, we would have to pay one of those slimy buggers to do it. + +Do I need to add an "about" dialog to display your copyright/license? + No, not as such. We won't discourage you from plugging the library if you + like, but it is not a requirement. You should think of our license as a + supplement to your own software license, therefore it is appropriate to + display it where (and only where) you display your own: + + * If you follow Apple's recommendation, the App Store is the only place + that the user accesses your license, so it should also be the only place + where the library supplement is available. + * If your app already has some kind of "about" view that displays your + copyright/license information, it is also appropriate to display the same + information for the library. + +Do I need to include the entire library in my application bundle? + No, it is not necessary: + + * If you have not modified the library, it is sufficient to provide a link + to the project and the version information. + * If you are using a modified version, you may provide a link to download + that instead of including it in the bundle. + + +Modifications +------------- + +What is a "modification"? Again, we leave it to your discretion with this +guidance: + +* If you use the distributed binary SDK you have certainly not modified the + library. +* If you are working from Mercurial, *any* change you have made to the + "source code" of the library is a modification, it does not matter how + trivial. You can see what changes have been made by running + ``hg status -mard``; if this command outputs anything, you have modified + the library. + +If you find that you have made changes to the library, you should carefully +consider how far you want to proceed down that path. Once you publish your +changes you have created a "fork" of the project which you now need to +maintain. Are you prepared to merge every time the library is updated? + +If your change adds a useful feature to the library, we absolutely encourage +you to submit patches. Assuming you can get your patch into the project, then +you will no longer need to use a modified version! When submitting patches, +ensure that your changes are appropriate for all of our users. Specifically, +we are not interested in patches that simply hack up the library to work the +way you want. Compare a patch that changes the default behavior to your +preference (probably not acceptable), to a patch that adds a new configuration +to support the feature you have added (probably fine). + + +Object File Distribution +------------------------ + +Section 6 of the LGPL v2.1 specifically permits static linking with the +library. If your project is not open source, this section does require that +you make your object files available to your users. The intent, as indicated +in the license, is that a user who has obtained your software may exercise +their right to modify the library and then re-link their modified version into +your application. + +We recommend that you apply Subsection 6c, which only requires that you make a +written offer to provide the object files. Now...if you consider the actual +utility of this mechanism - that it is only applicable to developers, and only +those with in depth knowledge of the tools, the time required for development +- all to have a new barcode reader in a specific version of your application +that only they can use, the reality is that no one is going to request this. +You probably should not even waste time preparing for it until a request is +made. + +Additionally, to avoid "casual requests" from nefarious types that just want +to inconvenience you, also consider charging a fee for the distribution of +this material (as permitted by the license); just add up the cost of burning +and shipping a disk. If this cost is "large" compared to the price of your +app, the likelihood of a request is reduced even further. + + +Using the Unmodified Library +---------------------------- + +Applying the license in this case is somewhat simpler. These are the basic +steps you can follow: + +1. Verify that the rest of your software license is compatible with the LGPL. + You cannot use the library if they are incompatible. + + For those using the default App Store license, we have reviewed this and + believe it is compatible with the LGPL. + +2. At the end of your license text, in an annex or supplement, start by + declaring your use of the library and offering a link to the project. + Something like this: + + This software uses the open source ZBar Barcode Reader library, version + |version|, which is available from http://zbar.sourceforge.net/iphone + + If you built your own version of the library, replace the version callout + with eg, "cloned from Mercurial revision xxxxxxxx" + +3. Then append the contents of the text file COPYING, included with the + library. This is all of the copyright information for the library. + +4. Then append the contents of the text file LICENSE.md, also included with the + library. This is just the LGPL version 2.1 which you may also obtain from + http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + +5. You may choose to make the written offer for the object files explicit. + Provide some text and whatever link or email address is appropriate. + + +Using a Modified Library +------------------------ + +We intentionally leave this option vague and force you to refer to the license +as an underhanded way of encouraging you to contribute back to the project ;) diff --git a/iphone/doc/optimizing.rst b/iphone/doc/optimizing.rst new file mode 100644 index 0000000..a823fd6 --- /dev/null +++ b/iphone/doc/optimizing.rst @@ -0,0 +1,435 @@ +Optimizing the Reader +===================== + +As good as the iPhone performance is for a mobile device, the reality from an +image processing perspective is that it represents a lower performance target. +While the default configuration of the iPhone reader has been carefully tuned +for the general case, you can often obtain much better results if you optimize +for your specific application. + +.. note:: + + Performance is a complex topic. The only way to tune performance is by + changing settings and comparing measured results. If you are not + comfortable with the concepts presented here, it is recommended that you + leave the settings at the defaults and avoid compromising reliability. + +Performance of the barcode reader is generally evaluated by two factors: + +* The **latency** - how quickly it "recognizes" a barcode. Specifically this + is the time from when the user puts a barcode in the frame or selects an + image until a response is indicated back to the them. + +* The **reliability** - it does not matter how quickly an image is scanned if + an incorrect result is returned. That may seem obvious, but bad decodes + *are* possible and you need to keep this in mind when changing settings that + affect the reliability of the reader. + +Basically our goal is to optimize the latency without sacrificing reliability. +There are several factors that contribue to latency: + +* The **quality** of the barcode image. Quality includes the available + resolution, focus, lighting, noise, etc. We have more control over some of + these than others. + +* The **camera**. When scanning from the camera, the time for the + autoexposure and autofocus to converge on an image that can be decoded is a + significant contribution to the overall latency. + +* The **frame rate** of the reader - this translates to the time it takes the + scanner to process an image. + +* The **effort level** of the reader - some of the available settings control + "how hard" the reader tries to find barcodes in each frame. + +* The **delegate latency** - the time spent in your application after a + barcode has been detected until the user is notified. + +Most of these factors are interrelated. We will discuss those we can control +in detail, as well the settings you use to affect them. Then we will provide +a few specific case examples. + + +Measuring Performance +--------------------- + +Subjective response times are a good place to start (does it "feel" responsive +to you?), and possibly the only way to evaluate the overall experience, but to +compare incremental changes to interrelated settings and have meaningful +performance discussions with others, we need a more quantitative approach. + +The :func:`mach_absolute_time` function is a good tool for accurately +measuring small delays. Research this function and learn how to apply it. As +when measuring any real-world value, keep in mind that some variance is to be +expected - even if you perform exactly the same operation multiple times, you +will not see exactly the same measurement. You should collect several +samples, discard any obvious outliers, and average the remaining measurements. + +One way that the overall reader latency may be evaluated is by manually +marking the time when the barcode is presented to the reader. Add a control +to your overlay that captures the start time when tapped and compare this to +the end time, just before your delegate returns. + +The reader continually monitors the frame rate at which it is running. The +measured value may be displayed for debugging purposes by enabling the +:member:`~ZBarReaderView::showsFPS` property. The readertest example does +this and also provides control over many of the available settings, so you can +quickly test how each setting affects the frame rate. You should target your +optimization efforts to achieve a frame rate of at least 8-10fps, although +12-15fps is preferable. + +You can measure the latency of your delegate using :func:`mach_absolute_time`. +The measured value should be less than about 100ms, the smaller the better, to +avoid noticeable lag. + +The readertest is a good tool for testing the performance of the reader. You +can tune the settings appropriately for your application and evaluate the +effect each change has on the performance. + + +Delegate Latency +---------------- + +This latency contributor is the easiest for you to effect (and sometimes the +easiest to overlook). Your delegate method should update the interface - +dismiss the controller or update your overlay to indicate success - and +*nothing* else. All other processing should be deferred until after the +animations have started. + + +Image Quality +------------- + +Resolution +^^^^^^^^^^ + +One might think that "more is better" in terms of resolution, but this is not +necessarily the case. Given average image quality, the ideal resolution for +scanning is right around three pixels per barcode "module" (the width of the +smallest bar or space). Note that this measure is not an absolute image size +or even a measure of the physical dimensions represented by a pixel sample, it +*only* describes the sampled size of the barcode in the image. + +As the resolution decreases below about two pixels per module, edge fidelity +is lost and the bars and spaces start to merge together, making it impossible +(for this library) to scan. This affects the density (feature size) and +maximum size (data capacity) of the barcodes that can be detected. +Conversely, as the resolution increases above about 4 pixels per module, noise +can interfere with the edge detection and images will take longer to process. + +Other quality factors, such as poor focus, bad lighting or even excessive +noise, can increase (or decrease) the resolution requirement. + +When scanning from the camera, the reader defaults to 640x480, which is good +for most applications. On newer devices, you can increase this using a capture +:member:`~ZBarReaderView::session` preset. Some older devices do not have a +higher resolution option available. + +For scanning images, you can use +:member:`~ZBarReaderController::maxScanDimension` to control the scaled size +of the converted image, or resort to converting them yourself. + +If you want to read long linear barcodes or dense 2-D symbols, you will +probably want to increase the resolution by adjusting these settings. + +Keep in mind that more pixels will take longer to scan, refer to the `frame +rate`_ discussion for ways to compensate. + +Focus +^^^^^ + +Ideally we would fix the focus at a calculated optimum distance and optimize +the aperture selection to maximize the depth of field. Unfortunately the APIs +do not currently give us control over any of these settings, the best we can +do (as of iOS 4) is continuous auto-focus mode - this mode is configured by +the reader automatically. It can still take the device as long as 1-2 seconds +to find the appropriate macro focus setting, but again, there is currently no +way to reduce this delay. + +Lighting and Exposure +^^^^^^^^^^^^^^^^^^^^^ + +An image that is too bright or overexposed can completely wash out any +barcodes. An image that is too dark or underexposed will not provide +sufficient contrast for the scanner. Low light levels also tend to produce +noisier images, possibly because the driver uses a faster "ISO" setting to +compensate for the lighting. + +The camera defaults to continuous automatic exposure and white balance. Since +there are no other useful values, the reader leaves these unchanged from their +default setting. + +For some devices, the "torch" can be enabled to provide additional +illumination for the camera in low-light conditions. The reader sets the +torch to automatic by default, so it should turn on only when needed... +There have been some reports that the torch turns on inappropriately, washing +out the image. If you find that this occurs, you should instead set the +:member:`~ZBarReaderView::torchMode` property of the :class:`ZBarReaderView` +to ``Off``. + +For scanning images from another source, you are again stuck with the +available image quality. If you have any control over the image source, you +should do what you can to fix quality problems there. + +Noise +^^^^^ + +Some level of noise is filtered by the reader, but excessive noise levels +create additional edges in the image which corrupt barcodes and increase +scanning time (decreasing the frame rate). + +As mentioned with `lighting and exposure`_, noise mostly becomes a problem +when the light-level is too low, but high-resolution images may also increase +exposure to sensor noise. + +We compensate for noise by *reducing* the `resolution`_ from the sensor +maximum. Scaling the image down has the effect of averaging several pixels +into one value, filtering out the high-frequency noise component. + + +Frame Rate +---------- + +The time it takes to scan and decode an image/frame is roughly proportional to +the number of pixels that are processed. The number and type of enabled +symbologies and image noise can also affect the processing time. + +We have several knobs available that affect the frame rate. Most of these are +geared toward reducing the number of image pixels that are scanned. + +Decrease the Resolution +^^^^^^^^^^^^^^^^^^^^^^^ + +Adjusting the resolution of the image is an easy way to quickly reduce the +number of pixels. Smaller images also mean there is less data to carry +around, which helps performance in other ways. For example, reducing each +image dimension by 30% (eg, from 640x480 to 448x336) will about double the +speed of the reader (to a point). [FIXME verify!] + +Adjusting the resolution is `described above `_. As mentioned +there, reducing the resolution will negatively impact the minimum feature size +and maximum barcode size that can be scanned, but it will help filter noise. + +Crop the Scan Region +^^^^^^^^^^^^^^^^^^^^ + +It may not always be necessary for an application to scan all the way to the +edges of the image. By cropping the scan area, you can get most of the +benefits of reduced resolution without sacrificing the minimum feature size. +Cropping will also not affect image noise, but similar to decreasing the +resolution, it does affect the maximum size barcode that can be scanned. + +For all cases you set the crop rectangle +:class:`~ZBarReaderViewController::scanCrop` property. Note that the +rectangle provided to the controller is *normalized* across image size and +rotation. This means that the coordinates range from 0 to 1 and the axes will +be arranged such that the x-axis of the crop rectangle corresponds to the +major (longer) image axis. + +Your interface will typically need to indicate the cropped scan area to the +user with visual queues. Use the +:class:`~ZBarReaderViewController::cameraOverlayView` to provide this. + +By default, the :class:`ZBarReaderView` recognizes a pinch gesture to +digitally zoom the preview around the center of the image. This zoom does not +affect the resolution of the image, but it does crop the scan region to the +visible area. You can also disable the pinch gesture and set the +:class:`~ZBarReaderView::zoom` programmatically. + +Limit the Scan Density +^^^^^^^^^^^^^^^^^^^^^^ + +The scanner works by making scan passes across the pixel rows and colums of +the image. The density of the passes is configured at the scanner as a pixel +stride for each axis. ``ZBAR_CFG_Y_DENSITY`` (``ZBAR_CFG_X_DENSITY``) +controls the number of pixel rows (columns) that are skipped between +successive horizontal (vertical) scan passes. (Note that "density" is really +not a good name for the configuration settings... "stride" might be more +appropriate.) + +Decreasing the scan density (by increasing the stride setting) is a great way +to limit the processing (increasing the frame rate) without sacrificing scan +resolution - each scan pass is still made at full image resolution, there are +just fewer passes (less redundancy). + +Setting the stride value to 0 completely disables scanning in that direction. +This is very useful when reading linear codes with a visual alignment guide - +scanning parallel to the bars is a waste of cycles which may be better applied +to support higher resolution or increased density of scans across the symbol. +Note that some 2-D symbologies (QR Code) require scans in both directions. + +Setting the stride to a very large value will generate a single scan pass +through the center of the image. Note that some symbologies will not be +detected without multiple successful passes; it is usually better to combine +this setting with cropping to generate a number of closely clustered scan +passes in the target area. + +Note that the density also affects the aspect ratio and rotation that can be +tolerated. If you set it too large, some barcodes will become more difficult +to read. + +In general, 2 to 4 is a good target for the stride setting, unless you have +very high or low resolution images. + +Disable unused symbologies +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Limiting the symbologies to the set of interest should provide a small +performance boost. It also improves decode reliability - it is impossible to +receive an incorrect or unexpected decode result from a symbology that is +disabled. + +The reader does support full auto-discrimination among the supported +symbologies, but with all of them enabled you may need to compensate elsewhere +to get a good frame rate. + +For example, if you are only interested in QR codes, disable the others. The +robust way to do this is by disabling *all* symbologies and then reenabling +only those you want. This helps isolate you from encountering new symbologies +that may be added in future versions of the library until you are ready to +handle them:: + + [scanner setSymbology: 0 + config: ZBAR_CFG_ENABLE + to: 0]; + [scanner setSymbology: ZBAR_QRCODE + config: ZBAR_CFG_ENABLE + to: 1]; + +Even if you would like your application to support multiple symbologies, you +may consider if there is a way to limit the enabled subset based on the +scanning context, etc... + + +Examples +-------- + +These examples demonstrate several scenarios for scanning from the camera with +automatic capture. You can try them yourself using the readertest. For each +example, start with the default settings (by tapping the +``ZBarReaderViewController`` class), then enable continuous mode and the +custom overlay (by disabling +:member:`~ZBarReaderViewController::showsZBarControls`). You should also use +a release build and avoid running in the debugger. + +Frame rates are approximate, measured on an iPhone 3GS running iOS 4.0.1 in a +well lit room. Two measurements are taken for each sample: the rate with the +camera pointed at a blank white page such that it fills the frame, and the +rate while continuously decoding the provided example. For best results, it +is recommended that you print the examples rather than scanning them from the +screen. + +For reference, the base frame rates with default settings are 12fps for a +blank white page, 7.5fps for this `basic EAN symbol`_ and 2.2fps for this +`basic QR symbol`_. + +.. _`basic EAN symbol`: + http://zbar.sf.net/test/ean13/9876543210128.png +.. _`basic QR symbol`: + http://chart.apis.google.com/chart?cht=qr&chs=512x512&chl=http://zbar.sf.net/iphone + +Long Linear Symbols +^^^^^^^^^^^^^^^^^^^ + +For this example, we will use a relatively `long Code 128 barcode`_. + +.. _`long Code 128 barcode`: + http://zbar.sf.net/test/code128/ALPHA.png + +While it should be possible to read this symbol with the default settings, you +may notice that it is not very reliable. You will have to stretch the symbol +across the entire screen, and even then the default settings will only give +you about 1.6 pixels per module, well below the ideal target of 3. To improve +these results, we want to maximize scanning resolution for the long image +axis. + +1. Disable the default zoom/crop - zoom all the way out by hitting "Scan" and + pinching the preview; the frame rate immediately drops to 8fps / 4.8fps. + +We should compensate for this reduction in the frame rate: + +2. Crop the image to a long, skinny rectangle - set the + :member:`~ZBarReaderViewController::scanCrop` setting to + ``{{0, 0.3}, {1, 0.4}}``; The frame rate jumps up to 18fps / 8.7fps. + +3. Disable scans across the short image axis - set the ``CFG_X_DENSITY`` + setting to 0. The frame rate goes all the way to 30fps / 13fps. + +Since we have plenty of margin with the frame rate, we can minimize the total +decode latency by performing more scan passes through the symbol: + +4. Increase the scan density - set the ``CFG_Y_DENSITY`` setting to 1 (13.5fps + / 5fps) or 2 (24fps / 9fps). + +You should now be able to quickly and reliably decode long linear symbols. + +If have a newer device, you may also try increasing the resolution to support +even longer symbols. You may have to compensate elsewhere to bring the frame +rate back to a reasonable level. + +High Density QR Symbols +^^^^^^^^^^^^^^^^^^^^^^^ + +For this example we will use a `version 29 QR Code symbol`_. + +.. _`version 29 QR Code symbol`: + http://www.qrcomic.com/images/5.png + +In this case we still want to maximize the resolution, but we also need to +increase the scan density to reliably pick up the small finder patterns: + +1. Maximize scan density in both directions - set the ``CFG_X_DENSITY`` and + ``CFG_Y_DENSITY`` settings both to 1. You should be able to scan the symbol + now, although the frame rate drops to 4.5fps / 1fps + +2. Disable the default zoom/crop - zoom all the way out by hitting "Scan" and + pinching the preview; the frame rate drops further to 3fps / 0.7fps + +We can compensate somewhat for the reduced frame rate: + +3. Crop the image to a square - set ``scanCrop`` to ``{{0.125, 0}, {.75, 1}}``. + This boosts the frame rate slightly to 3.7fps / 0.75fps. + +4. Disable linear symbologies - set the symbologies such that only QR Code is + enabled (4fps / 1fps) + +Even though the frame rate is still pretty bad, the QR recognition latency +should be acceptable. + +If have an iPhone 4, you may also try increasing the resolution to support +even denser QR symbols. You may have to compensate elsewhere to bring the +frame rate back to a reasonable level. + +Small DataBar Symbols +^^^^^^^^^^^^^^^^^^^^^ + +For this example we will use a `DataBar symbol`_ printed with a small feature +size, typical of the stickers used to tag produce. Scale it when printing +such that the printed dimensions are about 1cm square. This symbol should +scan with the default settings, but we will attempt to optimize the scan +latency for this case. + +.. _`DataBar symbol`: + http://zbar.sf.net/test/databar/0109876543210128-so.png + +As well as high barcode resolution, we also want high density passes in both +directions to minimize sensitivity to rotation: + +1. Maximize scan density in both directions - set the ``CFG_X_DENSITY`` and + ``CFG_Y_DENSITY`` settings both to 1. The frame rate drops to 4.5fps / + 3fps. + +Compensate for the reduction in frame rate by zooming in on the small symbol, +which crops the scanned image. Zooming also helps the user see the small +barcode: + +2. Zoom all the way in - hit "Scan" and un-pinch the preview. The frame rate + recovers to 11fps / 6.2fps. + +3. Crop the image to a square - set ``scanCrop`` to ``{{0.125, 0}, {0.75, 1}}`` + (14fps / 7.5fps) + +4. Disable all symbologies except DataBar and DataBar Expanded (14.5fps / 9fps) + +The reader should now be very sensitive to DataBar, even when scanned at an +angle. diff --git a/iphone/doc/picker.rst b/iphone/doc/picker.rst new file mode 100644 index 0000000..fe1ba58 --- /dev/null +++ b/iphone/doc/picker.rst @@ -0,0 +1,104 @@ +Scanning a User-Selected Image +============================== + +Some applications may need the full resolution offered by camera snapshots, or +need to scan an image or document from the user's photo library. In these +cases you use a :class:`ZBarReaderController`. This reader is a *subclass* of +:class:`UIImagePickerController`, and you use it the same way. See the +documentation for :class:`UIImagePickerController` for more detais. + +1. Create the reader. + + This is as simple as creating a new :class:`ZBarReaderController`:: + + ZBarReaderController *reader = [[ZBarReaderController alloc] init]; + +2. Setup a delegate to receive the results. + + The delegate should implement the :class:`ZBarReaderDelegate` protocol, + which inherits from :class:`UIImagePickerControllerDelegate`:: + + reader.readerDelegate = self; + +3. Configure the reader. + + You will need to set the :member:`~ZBarReaderController::sourceType` + appropriately. Aside from the properties of the reader itself, you can + configure the decoder via the :member:`~ZBarReaderController::scanner` + property:: + + if([ZBarReaderController isSourceTypeAvailable: + UIImagePickerControllerSourceTypeCamera]) + reader.sourceType = UIImagePickerControllerSourceTypeCamera; + [reader.scanner setSymbology: ZBAR_I25 + config: ZBAR_CFG_ENABLE + to: 0]; + + See :doc:`custom` and :doc:`optimizing` for more details. + +4. Present the reader to the user. + + As the reader is a UIImagePickerController, it must be presented modally:: + + [self presentModalViewController: reader + animated: YES]; + +5. Process the results. + + The controller will call the + ``imagePickerController:didFinishPickingMediaWithInfo:`` method of + your delegate for a successful decode (NB *not* every time the user takes a + picture or selects an image). The barcode data can be obtained using the + :c:data:`ZBarReaderControllerResults` key of the info dictionary. This key + will return "something enumerable"; keep in mind that there may be multiple + results. You may also retrieve the corresponding image with + :c:data:`UIImagePickerControllerOriginalImage` as usual:: + + - (void) imagePickerController: (UIImagePickerController*) reader + didFinishPickingMediaWithInfo: (NSDictionary*) info + { + id results = + [info objectForKey: ZBarReaderControllerResults]; + UIImage *image = + [info objectForKey: UIImagePickerControllerOriginalImage]; + ... + + The ``reader`` parameter will be the actual :class:`ZBarReaderController` + (again, a subclass :class:`UIImagePickerController`). + + .. note:: + + The delegate method should dismiss the reader and return as soon as + possible; any processing of the results should be deferred until later, + otherwise the user will experience unacceptable latency between the + actual scan completion and the visual interface feedback. + +6. Dismiss the reader. + + Once you have the results you should dismiss the reader:: + + [reader dismissModalViewControllerAnimated: YES]; + + .. warning:: + + It is very important to dismiss from the *reader* (not the presenting + controller) to avoid corrupting the interface. + + +Handling Failure +---------------- + +It is always possible the user selects/takes an image that does not contain +barcodes, or that the image quality is not sufficient for the ZBar library to +scan successfully. + +In this case, and if :member:`~ZBarReaderController::showsHelpOnFail` is +``YES``, the integrated help controller will automatically be displayed with +reason set to ``"FAIL"``. + +Your delegate may also choose to implement the optional +``readerControllerDidFailToRead:withRetry:`` method to explicitly handle +failures. If the ``retry`` parameter is ``NO``, you *must* dismiss the reader +before returning, otherwise you may continue and allow the user to retry the +operation. Note that, if it is enabled, the integrated help will be displayed +when this delegate method is invoked. diff --git a/iphone/doc/static/style.css b/iphone/doc/static/style.css new file mode 100644 index 0000000..721b5fb --- /dev/null +++ b/iphone/doc/static/style.css @@ -0,0 +1,36 @@ +@import url("default.css"); + +h1, h2, h3, h4, h5, h6 { + clear: both; +} + +img.logo { + vertical-align: middle; +} + +img.floatright { + float: right; + clear: both; + margin-left: 2em; + margin-right: 2em; +} + +dl.docutils dt { + font-weight: bold; +} +dl.docutils dd { + margin-top: 1em; + margin-bottom: 1em; +} + +table.docutils { + margin-left: auto; + margin-right: auto; +} +table.docutils th, table.docutils td { + padding: .25em .5em; +} + +table.docutils.field-list { + margin-left: 0; +} diff --git a/iphone/doc/support.rst b/iphone/doc/support.rst new file mode 100644 index 0000000..7cf8b55 --- /dev/null +++ b/iphone/doc/support.rst @@ -0,0 +1,19 @@ +Obtaining Support +================= + +If this documentation does not address your question/problem and you need +support, please feel free to post in our `iPhone Developers Forum`_. + +.. _`iPhone Developers Forum`: + http://sourceforge.net/projects/zbar/forums/forum/1072195 + +When posting, please: + +* Check the :doc:`faq` and the rest of this documentation first. +* Start a new thread for a new question - do not "hijack" an unrelated thread. +* Post complete details of your problem - complete error messages as well as + relevant source code and images. +* Log-in to receive email, or check back within a day or so - you will almost + always get a response. + +For the latest support information, please see http://zbar.sf.net/iphone diff --git a/iphone/doc/tutorial.rst b/iphone/doc/tutorial.rst new file mode 100644 index 0000000..3e10ade --- /dev/null +++ b/iphone/doc/tutorial.rst @@ -0,0 +1,228 @@ +ZBar SDK Integration Tutorial +============================= + +.. image:: ReaderSample.png + :alt: Screenshot of the ReaderSample app + :width: 414 + :height: 770 + :scale: 40 + :class: floatright + +This tutorial will quickly get you up and running with the ZBar iPhone SDK. + +We will develop a very simple app that presents a button the user can tap to +invoke the barcode reader and then displays the results. Interface Builder +will be used to create the interface. + +The completed project is also available with the distributed SDK under +:file:`Examples/ReaderSample`. + + +Create the App +-------------- + +1. Open Xcode; you must have version 4.5.1 or later. + +2. Create a new project using the "View-based Application" template. Name the + project "ReaderSample". Save it wherever you like. + +3. Open :file:`ReaderSampleViewController.xib` + +4. Drag a Round Rect Button onto the view and title it "Scan". Customize the + placement and appearance as you like. + +5. Drag an Image View onto the view. Size it to fill about half of the + remaining space. Change the view mode to Aspect Fit. + +6. Drag a Text View onto the view and size it to fill the remaining space. + Change the default text to "No barcode scanned" or something. De-select + "Editable" + +7. Add connections to the interface elements in the code; open + :file:`ReaderSampleViewController.h` and change the interface to:: + + @interface ReaderSampleViewController : UIViewController + { + UIImageView *resultImage; + UITextView *resultText; + } + @property (nonatomic, retain) IBOutlet UIImageView *resultImage; + @property (nonatomic, retain) IBOutlet UITextView *resultText; + - (IBAction) scanButtonTapped; + @end + +8. Now we can finish the interface connections - open + :file:`ReaderSampleViewController.xib` and make these connections: + + * Connect ReaderSampleViewController ``resultImage`` outlet to the + ImageView. + * Connect ReaderSampleViewController ``resultText`` outlet to the TextView. + * Connect ReaderSampleViewController ``scanButtonTapped`` action to the + RoundedRectButton(Scan) event ``TouchUpInside``. + + Consult the Xcode documentation if you need help making these connections. + Make sure you save the XIB once they are finished. + +9. Finish the implementation in :file:`ReaderSampleViewController.m`:: + + @synthesize resultImage, resultText; + + - (IBAction) scanButtonTapped + { + NSLog(@"TBD: scan barcode here..."); + } + + - (void) dealloc + { + self.resultImage = nil; + self.resultText = nil; + [super dealloc]; + } + + - (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation + { + return(YES); + } + + This stub for scanButtonTapped is temporary, we'll fix it in a minute... + +Although it doesn't do much yet, you should now have a working skeleton app +that you can build and run. + + +Integrate the Reader +-------------------- + +Now for the exciting part - let's add a barcode reader! + +1. If you have not done so already, download the latest SDK from + http://zbar.sourceforge.net/iphone + +2. Double-click the disk image, ZBarSDK-|version|.dmg in the Finder to open it. + +3. Drag the :file:`ZBarSDK` folder into your Xcode project. Make sure that + the "Copy Items into destination group's folder" checkbox is checked. + +4. Open the target build settings and find ``Link Binary With Libraries``. + Click the ``+`` and add each of these (NB hold down command for multiple + selection): + + * AVFoundation.framework + * CoreMedia.framework + * CoreVideo.framework + * QuartzCore.framework + * libiconv.dylib + + .. warning:: + + Link order may be important for some versions of Xcode; the libraries + referenced above should be listed *before* :file:`libzbar.a` in the + link order. + +5. Import the SDK header. You will usually want to prefix it, so add it to + :file:`ReaderSample-prefix.pch`:: + + // ADD: import barcode reader APIs + #import "ZBarSDK.h" + +6. Declare support for the delegate protocol in + :file:`ReaderSampleViewController.h`:: + + @interface ReaderSampleViewController : UIViewController + // ADD: delegate protocol + < ZBarReaderDelegate > + { + ... + +7. Re-implement scanButtonTapped to present a barcode reader when the user + taps the Scan button. In :file:`ReaderSampleViewController.m`:: + + - (IBAction) scanButtonTapped + { + // ADD: present a barcode reader that scans from the camera feed + ZBarReaderViewController *reader = [[ZBarReaderViewController alloc] init]; + reader.readerDelegate = self; + reader.supportedOrientationsMask = ZBarOrientationMaskAll; + + ZBarImageScanner *scanner = reader.scanner; + // TODO: (optional) additional reader configuration here + + // EXAMPLE: disable rarely used I2/5 to improve performance + [scanner setSymbology: ZBAR_I25 + config: ZBAR_CFG_ENABLE + to: 0]; + + // present and release the controller + [self presentModalViewController: reader + animated: YES]; + [reader release]; + } + +8. Finally, implement the delegate method to do something useful with the + results. Still in :file:`ReaderSampleViewController.m`:: + + - (void) imagePickerController: (UIImagePickerController*) reader + didFinishPickingMediaWithInfo: (NSDictionary*) info + { + // ADD: get the decode results + id results = + [info objectForKey: ZBarReaderControllerResults]; + ZBarSymbol *symbol = nil; + for(symbol in results) + // EXAMPLE: just grab the first barcode + break; + + // EXAMPLE: do something useful with the barcode data + resultText.text = symbol.data; + + // EXAMPLE: do something useful with the barcode image + resultImage.image = + [info objectForKey: UIImagePickerControllerOriginalImage]; + + // ADD: dismiss the controller (NB dismiss from the *reader*!) + [reader dismissModalViewControllerAnimated: YES]; + } + +And that's it! + + +Testing +------- + +1. Save everything (don't forget to save MyAppViewController.xib). + +2. Build and Run the project. + +3. Tap the Scan button. + +4. Aim at barcode. + +5. Enjoy the sweet fruits of your minimal labor + + +Where to go from here +--------------------- + +You can learn more about using the reader APIs to scan barcodes from +:doc:`camera` or :doc:`picker`. Use the :doc:`apiref` to find details about a +particular interface. + + +Troubleshooting +--------------- + +We take great care to ensure this tutorial is working as described. However, +if you do have a problem + +1. Make sure you followed the instructions exactly - every detail is + important. +2. Start from scratch with a new project and follow the instructions + *exactly*. +3. Try the ReaderSample distributed with the SDK and compare your work with + that. +4. If you are unable to get things working, you may post your frustrations in + the project `iPhone Developers Forum`_. Please be very specific about your + problem, post the complete text of any errors, etc. + +.. _`iPhone Developers Forum`: + http://sourceforge.net/projects/zbar/forums/forum/1072195 diff --git a/iphone/examples/EmbedReader/EmbedReader.xcodeproj/project.pbxproj b/iphone/examples/EmbedReader/EmbedReader.xcodeproj/project.pbxproj new file mode 100644 index 0000000..52183f7 --- /dev/null +++ b/iphone/examples/EmbedReader/EmbedReader.xcodeproj/project.pbxproj @@ -0,0 +1,416 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + DC824612162B5E140010B2E6 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DC824611162B5E140010B2E6 /* Default-568h@2x.png */; }; + DCFB4494136F7202004B3EE0 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCFB4493136F7202004B3EE0 /* UIKit.framework */; }; + DCFB4496136F7202004B3EE0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCFB4495136F7202004B3EE0 /* Foundation.framework */; }; + DCFB4498136F7202004B3EE0 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCFB4497136F7202004B3EE0 /* CoreGraphics.framework */; }; + DCFB449E136F7203004B3EE0 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = DCFB449C136F7203004B3EE0 /* InfoPlist.strings */; }; + DCFB44A1136F7203004B3EE0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DCFB44A0136F7203004B3EE0 /* main.m */; }; + DCFB44A4136F7203004B3EE0 /* EmbedReaderAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DCFB44A3136F7203004B3EE0 /* EmbedReaderAppDelegate.m */; }; + DCFB44A7136F7203004B3EE0 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = DCFB44A5136F7203004B3EE0 /* MainWindow.xib */; }; + DCFB44AA136F7203004B3EE0 /* EmbedReaderViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DCFB44A9136F7203004B3EE0 /* EmbedReaderViewController.m */; }; + DCFB44AD136F7203004B3EE0 /* EmbedReaderViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = DCFB44AB136F7203004B3EE0 /* EmbedReaderViewController.xib */; }; + DCFB44D0136F722A004B3EE0 /* libzbar.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DCFB44CA136F722A004B3EE0 /* libzbar.a */; }; + DCFB44D1136F722A004B3EE0 /* zbar-back.png in Resources */ = {isa = PBXBuildFile; fileRef = DCFB44CC136F722A004B3EE0 /* zbar-back.png */; }; + DCFB44D2136F722A004B3EE0 /* zbar-help.html in Resources */ = {isa = PBXBuildFile; fileRef = DCFB44CD136F722A004B3EE0 /* zbar-help.html */; }; + DCFB44D3136F722A004B3EE0 /* zbar-helpicons.png in Resources */ = {isa = PBXBuildFile; fileRef = DCFB44CE136F722A004B3EE0 /* zbar-helpicons.png */; }; + DCFB44D4136F722A004B3EE0 /* zbar-samples.png in Resources */ = {isa = PBXBuildFile; fileRef = DCFB44CF136F722A004B3EE0 /* zbar-samples.png */; }; + DCFB44DA136F72D3004B3EE0 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCFB44D5136F72D3004B3EE0 /* AVFoundation.framework */; }; + DCFB44DB136F72D3004B3EE0 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCFB44D6136F72D3004B3EE0 /* CoreMedia.framework */; }; + DCFB44DC136F72D3004B3EE0 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCFB44D7136F72D3004B3EE0 /* CoreVideo.framework */; }; + DCFB44DD136F72D3004B3EE0 /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = DCFB44D8136F72D3004B3EE0 /* libiconv.dylib */; }; + DCFB44DE136F72D3004B3EE0 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCFB44D9136F72D3004B3EE0 /* QuartzCore.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + DC824611162B5E140010B2E6 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = SOURCE_ROOT; }; + DCFB448F136F7202004B3EE0 /* EmbedReader.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EmbedReader.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DCFB4493136F7202004B3EE0 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + DCFB4495136F7202004B3EE0 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + DCFB4497136F7202004B3EE0 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + DCFB449B136F7202004B3EE0 /* EmbedReader-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "EmbedReader-Info.plist"; sourceTree = ""; }; + DCFB449D136F7203004B3EE0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + DCFB449F136F7203004B3EE0 /* EmbedReader-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "EmbedReader-Prefix.pch"; sourceTree = ""; }; + DCFB44A0136F7203004B3EE0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + DCFB44A2136F7203004B3EE0 /* EmbedReaderAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EmbedReaderAppDelegate.h; sourceTree = ""; }; + DCFB44A3136F7203004B3EE0 /* EmbedReaderAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EmbedReaderAppDelegate.m; sourceTree = ""; }; + DCFB44A6136F7203004B3EE0 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = ""; }; + DCFB44A8136F7203004B3EE0 /* EmbedReaderViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EmbedReaderViewController.h; sourceTree = ""; }; + DCFB44A9136F7203004B3EE0 /* EmbedReaderViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EmbedReaderViewController.m; sourceTree = ""; }; + DCFB44AC136F7203004B3EE0 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/EmbedReaderViewController.xib; sourceTree = ""; }; + DCFB44B7136F722A004B3EE0 /* Decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decoder.h; sourceTree = ""; }; + DCFB44B8136F722A004B3EE0 /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Exception.h; sourceTree = ""; }; + DCFB44B9136F722A004B3EE0 /* Image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Image.h; sourceTree = ""; }; + DCFB44BA136F722A004B3EE0 /* ImageScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageScanner.h; sourceTree = ""; }; + DCFB44BB136F722A004B3EE0 /* Processor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Processor.h; sourceTree = ""; }; + DCFB44BC136F722A004B3EE0 /* Scanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Scanner.h; sourceTree = ""; }; + DCFB44BD136F722A004B3EE0 /* Symbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Symbol.h; sourceTree = ""; }; + DCFB44BE136F722A004B3EE0 /* Video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Video.h; sourceTree = ""; }; + DCFB44BF136F722A004B3EE0 /* Window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Window.h; sourceTree = ""; }; + DCFB44C0136F722A004B3EE0 /* zbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zbar.h; sourceTree = ""; }; + DCFB44C1136F722A004B3EE0 /* ZBarCaptureReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarCaptureReader.h; sourceTree = ""; }; + DCFB44C2136F722A004B3EE0 /* ZBarHelpController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarHelpController.h; sourceTree = ""; }; + DCFB44C3136F722A004B3EE0 /* ZBarImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarImage.h; sourceTree = ""; }; + DCFB44C4136F722A004B3EE0 /* ZBarImageScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarImageScanner.h; sourceTree = ""; }; + DCFB44C5136F722A004B3EE0 /* ZBarReaderController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarReaderController.h; sourceTree = ""; }; + DCFB44C6136F722A004B3EE0 /* ZBarReaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarReaderView.h; sourceTree = ""; }; + DCFB44C7136F722A004B3EE0 /* ZBarReaderViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarReaderViewController.h; sourceTree = ""; }; + DCFB44C8136F722A004B3EE0 /* ZBarSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarSDK.h; sourceTree = ""; }; + DCFB44C9136F722A004B3EE0 /* ZBarSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarSymbol.h; sourceTree = ""; }; + DCFB44CA136F722A004B3EE0 /* libzbar.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libzbar.a; sourceTree = ""; }; + DCFB44CC136F722A004B3EE0 /* zbar-back.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zbar-back.png"; sourceTree = ""; }; + DCFB44CD136F722A004B3EE0 /* zbar-help.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "zbar-help.html"; sourceTree = ""; }; + DCFB44CE136F722A004B3EE0 /* zbar-helpicons.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zbar-helpicons.png"; sourceTree = ""; }; + DCFB44CF136F722A004B3EE0 /* zbar-samples.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zbar-samples.png"; sourceTree = ""; }; + DCFB44D5136F72D3004B3EE0 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + DCFB44D6136F72D3004B3EE0 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; + DCFB44D7136F72D3004B3EE0 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; + DCFB44D8136F72D3004B3EE0 /* libiconv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.dylib; path = usr/lib/libiconv.dylib; sourceTree = SDKROOT; }; + DCFB44D9136F72D3004B3EE0 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + DCFB448C136F7202004B3EE0 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + DCFB4494136F7202004B3EE0 /* UIKit.framework in Frameworks */, + DCFB4496136F7202004B3EE0 /* Foundation.framework in Frameworks */, + DCFB4498136F7202004B3EE0 /* CoreGraphics.framework in Frameworks */, + DCFB44DE136F72D3004B3EE0 /* QuartzCore.framework in Frameworks */, + DCFB44DB136F72D3004B3EE0 /* CoreMedia.framework in Frameworks */, + DCFB44DC136F72D3004B3EE0 /* CoreVideo.framework in Frameworks */, + DCFB44DA136F72D3004B3EE0 /* AVFoundation.framework in Frameworks */, + DCFB44DD136F72D3004B3EE0 /* libiconv.dylib in Frameworks */, + DCFB44D0136F722A004B3EE0 /* libzbar.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + DCFB4484136F7202004B3EE0 = { + isa = PBXGroup; + children = ( + DCFB4499136F7202004B3EE0 /* EmbedReader */, + DCFB44B3136F722A004B3EE0 /* ZBarSDK */, + DCFB4492136F7202004B3EE0 /* Frameworks */, + DCFB4490136F7202004B3EE0 /* Products */, + ); + sourceTree = ""; + }; + DCFB4490136F7202004B3EE0 /* Products */ = { + isa = PBXGroup; + children = ( + DCFB448F136F7202004B3EE0 /* EmbedReader.app */, + ); + name = Products; + sourceTree = ""; + }; + DCFB4492136F7202004B3EE0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + DCFB4493136F7202004B3EE0 /* UIKit.framework */, + DCFB4495136F7202004B3EE0 /* Foundation.framework */, + DCFB4497136F7202004B3EE0 /* CoreGraphics.framework */, + DCFB44D9136F72D3004B3EE0 /* QuartzCore.framework */, + DCFB44D6136F72D3004B3EE0 /* CoreMedia.framework */, + DCFB44D7136F72D3004B3EE0 /* CoreVideo.framework */, + DCFB44D5136F72D3004B3EE0 /* AVFoundation.framework */, + DCFB44D8136F72D3004B3EE0 /* libiconv.dylib */, + ); + name = Frameworks; + sourceTree = ""; + }; + DCFB4499136F7202004B3EE0 /* EmbedReader */ = { + isa = PBXGroup; + children = ( + DCFB44A2136F7203004B3EE0 /* EmbedReaderAppDelegate.h */, + DCFB44A3136F7203004B3EE0 /* EmbedReaderAppDelegate.m */, + DCFB44A5136F7203004B3EE0 /* MainWindow.xib */, + DCFB44A8136F7203004B3EE0 /* EmbedReaderViewController.h */, + DCFB44A9136F7203004B3EE0 /* EmbedReaderViewController.m */, + DCFB44AB136F7203004B3EE0 /* EmbedReaderViewController.xib */, + DCFB449A136F7202004B3EE0 /* Supporting Files */, + ); + path = EmbedReader; + sourceTree = ""; + }; + DCFB449A136F7202004B3EE0 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + DCFB449B136F7202004B3EE0 /* EmbedReader-Info.plist */, + DCFB449C136F7203004B3EE0 /* InfoPlist.strings */, + DC824611162B5E140010B2E6 /* Default-568h@2x.png */, + DCFB449F136F7203004B3EE0 /* EmbedReader-Prefix.pch */, + DCFB44A0136F7203004B3EE0 /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + DCFB44B3136F722A004B3EE0 /* ZBarSDK */ = { + isa = PBXGroup; + children = ( + DCFB44B4136F722A004B3EE0 /* Headers */, + DCFB44CA136F722A004B3EE0 /* libzbar.a */, + DCFB44CB136F722A004B3EE0 /* Resources */, + ); + path = ZBarSDK; + sourceTree = ""; + }; + DCFB44B4136F722A004B3EE0 /* Headers */ = { + isa = PBXGroup; + children = ( + DCFB44B5136F722A004B3EE0 /* ZBarSDK */, + ); + path = Headers; + sourceTree = ""; + }; + DCFB44B5136F722A004B3EE0 /* ZBarSDK */ = { + isa = PBXGroup; + children = ( + DCFB44B6136F722A004B3EE0 /* zbar */, + DCFB44C0136F722A004B3EE0 /* zbar.h */, + DCFB44C1136F722A004B3EE0 /* ZBarCaptureReader.h */, + DCFB44C2136F722A004B3EE0 /* ZBarHelpController.h */, + DCFB44C3136F722A004B3EE0 /* ZBarImage.h */, + DCFB44C4136F722A004B3EE0 /* ZBarImageScanner.h */, + DCFB44C5136F722A004B3EE0 /* ZBarReaderController.h */, + DCFB44C6136F722A004B3EE0 /* ZBarReaderView.h */, + DCFB44C7136F722A004B3EE0 /* ZBarReaderViewController.h */, + DCFB44C8136F722A004B3EE0 /* ZBarSDK.h */, + DCFB44C9136F722A004B3EE0 /* ZBarSymbol.h */, + ); + path = ZBarSDK; + sourceTree = ""; + }; + DCFB44B6136F722A004B3EE0 /* zbar */ = { + isa = PBXGroup; + children = ( + DCFB44B7136F722A004B3EE0 /* Decoder.h */, + DCFB44B8136F722A004B3EE0 /* Exception.h */, + DCFB44B9136F722A004B3EE0 /* Image.h */, + DCFB44BA136F722A004B3EE0 /* ImageScanner.h */, + DCFB44BB136F722A004B3EE0 /* Processor.h */, + DCFB44BC136F722A004B3EE0 /* Scanner.h */, + DCFB44BD136F722A004B3EE0 /* Symbol.h */, + DCFB44BE136F722A004B3EE0 /* Video.h */, + DCFB44BF136F722A004B3EE0 /* Window.h */, + ); + path = zbar; + sourceTree = ""; + }; + DCFB44CB136F722A004B3EE0 /* Resources */ = { + isa = PBXGroup; + children = ( + DCFB44CC136F722A004B3EE0 /* zbar-back.png */, + DCFB44CD136F722A004B3EE0 /* zbar-help.html */, + DCFB44CE136F722A004B3EE0 /* zbar-helpicons.png */, + DCFB44CF136F722A004B3EE0 /* zbar-samples.png */, + ); + path = Resources; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + DCFB448E136F7202004B3EE0 /* EmbedReader */ = { + isa = PBXNativeTarget; + buildConfigurationList = DCFB44B0136F7203004B3EE0 /* Build configuration list for PBXNativeTarget "EmbedReader" */; + buildPhases = ( + DCFB448B136F7202004B3EE0 /* Sources */, + DCFB448C136F7202004B3EE0 /* Frameworks */, + DCFB448D136F7202004B3EE0 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = EmbedReader; + productName = EmbedReader; + productReference = DCFB448F136F7202004B3EE0 /* EmbedReader.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + DCFB4486136F7202004B3EE0 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = DCFB4489136F7202004B3EE0 /* Build configuration list for PBXProject "EmbedReader" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = DCFB4484136F7202004B3EE0; + productRefGroup = DCFB4490136F7202004B3EE0 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + DCFB448E136F7202004B3EE0 /* EmbedReader */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + DCFB448D136F7202004B3EE0 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DCFB449E136F7203004B3EE0 /* InfoPlist.strings in Resources */, + DCFB44A7136F7203004B3EE0 /* MainWindow.xib in Resources */, + DCFB44AD136F7203004B3EE0 /* EmbedReaderViewController.xib in Resources */, + DCFB44D1136F722A004B3EE0 /* zbar-back.png in Resources */, + DCFB44D2136F722A004B3EE0 /* zbar-help.html in Resources */, + DCFB44D3136F722A004B3EE0 /* zbar-helpicons.png in Resources */, + DCFB44D4136F722A004B3EE0 /* zbar-samples.png in Resources */, + DC824612162B5E140010B2E6 /* Default-568h@2x.png in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + DCFB448B136F7202004B3EE0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DCFB44A1136F7203004B3EE0 /* main.m in Sources */, + DCFB44A4136F7203004B3EE0 /* EmbedReaderAppDelegate.m in Sources */, + DCFB44AA136F7203004B3EE0 /* EmbedReaderViewController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + DCFB449C136F7203004B3EE0 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + DCFB449D136F7203004B3EE0 /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + DCFB44A5136F7203004B3EE0 /* MainWindow.xib */ = { + isa = PBXVariantGroup; + children = ( + DCFB44A6136F7203004B3EE0 /* en */, + ); + name = MainWindow.xib; + sourceTree = ""; + }; + DCFB44AB136F7203004B3EE0 /* EmbedReaderViewController.xib */ = { + isa = PBXVariantGroup; + children = ( + DCFB44AC136F7203004B3EE0 /* en */, + ); + name = EmbedReaderViewController.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + DCFB44AE136F7203004B3EE0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = DEBUG; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; + SDKROOT = iphoneos; + }; + name = Debug; + }; + DCFB44AF136F7203004B3EE0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + SDKROOT = iphoneos; + }; + name = Release; + }; + DCFB44B1136F7203004B3EE0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "EmbedReader/EmbedReader-Prefix.pch"; + INFOPLIST_FILE = "EmbedReader/EmbedReader-Info.plist"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/ZBarSDK\"", + ); + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + DCFB44B2136F7203004B3EE0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "EmbedReader/EmbedReader-Prefix.pch"; + INFOPLIST_FILE = "EmbedReader/EmbedReader-Info.plist"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/ZBarSDK\"", + ); + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + DCFB4489136F7202004B3EE0 /* Build configuration list for PBXProject "EmbedReader" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DCFB44AE136F7203004B3EE0 /* Debug */, + DCFB44AF136F7203004B3EE0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + DCFB44B0136F7203004B3EE0 /* Build configuration list for PBXNativeTarget "EmbedReader" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DCFB44B1136F7203004B3EE0 /* Debug */, + DCFB44B2136F7203004B3EE0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = DCFB4486136F7202004B3EE0 /* Project object */; +} diff --git a/iphone/examples/EmbedReader/EmbedReader.xcodeproj/xcshareddata/xcschemes/EmbedReader.xcscheme b/iphone/examples/EmbedReader/EmbedReader.xcodeproj/xcshareddata/xcschemes/EmbedReader.xcscheme new file mode 100644 index 0000000..7f08e65 --- /dev/null +++ b/iphone/examples/EmbedReader/EmbedReader.xcodeproj/xcshareddata/xcschemes/EmbedReader.xcscheme @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iphone/examples/EmbedReader/EmbedReader/EmbedReader-Info.plist b/iphone/examples/EmbedReader/EmbedReader/EmbedReader-Info.plist new file mode 100644 index 0000000..fd80eb6 --- /dev/null +++ b/iphone/examples/EmbedReader/EmbedReader/EmbedReader-Info.plist @@ -0,0 +1,39 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + net.sourceforge.zbar.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + NSMainNibFile + MainWindow + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + UIInterfaceOrientationPortraitUpsideDown + + + diff --git a/iphone/examples/EmbedReader/EmbedReader/EmbedReader-Prefix.pch b/iphone/examples/EmbedReader/EmbedReader/EmbedReader-Prefix.pch new file mode 100644 index 0000000..ed6587b --- /dev/null +++ b/iphone/examples/EmbedReader/EmbedReader/EmbedReader-Prefix.pch @@ -0,0 +1,11 @@ +#import + +#ifndef __IPHONE_3_0 +#warning "This project uses features only available in iPhone SDK 3.0 and later." +#endif + +#ifdef __OBJC__ +# import +# import +# import "ZBarSDK.h" +#endif diff --git a/iphone/examples/EmbedReader/EmbedReader/EmbedReaderAppDelegate.h b/iphone/examples/EmbedReader/EmbedReader/EmbedReaderAppDelegate.h new file mode 100644 index 0000000..ab79042 --- /dev/null +++ b/iphone/examples/EmbedReader/EmbedReader/EmbedReaderAppDelegate.h @@ -0,0 +1,19 @@ +// +// EmbedReaderAppDelegate.h +// EmbedReader +// +// Created by spadix on 5/2/11. +// + +#import + +@class EmbedReaderViewController; + +@interface EmbedReaderAppDelegate : NSObject { +} + +@property (nonatomic, retain) IBOutlet UIWindow *window; +@property (nonatomic, retain) + IBOutlet EmbedReaderViewController *viewController; + +@end diff --git a/iphone/examples/EmbedReader/EmbedReader/EmbedReaderAppDelegate.m b/iphone/examples/EmbedReader/EmbedReader/EmbedReaderAppDelegate.m new file mode 100644 index 0000000..5db5649 --- /dev/null +++ b/iphone/examples/EmbedReader/EmbedReader/EmbedReaderAppDelegate.m @@ -0,0 +1,34 @@ +// +// EmbedReaderAppDelegate.m +// EmbedReader +// +// Created by spadix on 5/2/11. +// + +#import "EmbedReaderAppDelegate.h" +#import "EmbedReaderViewController.h" + +@implementation EmbedReaderAppDelegate +@synthesize window=_window; +@synthesize viewController=_viewController; + +- (BOOL) application: (UIApplication*) application + didFinishLaunchingWithOptions: (NSDictionary*) launchOptions +{ + self.window.rootViewController = self.viewController; + [self.window makeKeyAndVisible]; + + // force view class to load so it may be referenced directly from NIB + [ZBarReaderView class]; + + return(YES); +} + +- (void) dealloc +{ + [_window release]; + [_viewController release]; + [super dealloc]; +} + +@end diff --git a/iphone/examples/EmbedReader/EmbedReader/EmbedReaderViewController.h b/iphone/examples/EmbedReader/EmbedReader/EmbedReaderViewController.h new file mode 100644 index 0000000..100dc03 --- /dev/null +++ b/iphone/examples/EmbedReader/EmbedReader/EmbedReaderViewController.h @@ -0,0 +1,20 @@ +// +// EmbedReaderViewController.h +// EmbedReader +// +// Created by spadix on 5/2/11. +// + +#import + +@interface EmbedReaderViewController + : UIViewController { + ZBarReaderView *readerView; + UITextView *resultText; + ZBarCameraSimulator *cameraSim; +} + +@property (nonatomic, retain) IBOutlet ZBarReaderView *readerView; +@property (nonatomic, retain) IBOutlet UITextView *resultText; + +@end diff --git a/iphone/examples/EmbedReader/EmbedReader/EmbedReaderViewController.m b/iphone/examples/EmbedReader/EmbedReader/EmbedReaderViewController.m new file mode 100644 index 0000000..177c190 --- /dev/null +++ b/iphone/examples/EmbedReader/EmbedReader/EmbedReaderViewController.m @@ -0,0 +1,101 @@ +// +// EmbedReaderViewController.m +// EmbedReader +// +// Created by spadix on 5/2/11. +// + +#import "EmbedReaderViewController.h" + +@implementation EmbedReaderViewController + +@synthesize readerView, resultText; + +- (void) cleanup +{ + [cameraSim release]; + cameraSim = nil; + readerView.readerDelegate = nil; + [readerView release]; + readerView = nil; + [resultText release]; + resultText = nil; +} + +- (void) dealloc +{ + [self cleanup]; + [super dealloc]; +} + +- (void) viewDidLoad +{ + [super viewDidLoad]; + + // the delegate receives decode results + readerView.readerDelegate = self; + + // ensure initial camera orientation is correctly set + UIApplication *app = [UIApplication sharedApplication]; + [readerView willRotateToInterfaceOrientation: app.statusBarOrientation + duration: 0]; + + // you can use this to support the simulator + if(TARGET_IPHONE_SIMULATOR) { + cameraSim = [[ZBarCameraSimulator alloc] + initWithViewController: self]; + cameraSim.readerView = readerView; + } +} + +- (void) viewDidUnload +{ + [self cleanup]; + [super viewDidUnload]; +} + +- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) orient +{ + // auto-rotation is supported + return(YES); +} + +- (void) willRotateToInterfaceOrientation: (UIInterfaceOrientation) orient + duration: (NSTimeInterval) duration +{ + // compensate for view rotation so camera preview is not rotated + [readerView willRotateToInterfaceOrientation: orient + duration: duration]; +} + +- (void) willAnimateRotationToInterfaceOrientation: (UIInterfaceOrientation) orient + duration: (NSTimeInterval) duration +{ + // perform rotation in animation loop so camera preview does not move + // wrt device orientation + [readerView setNeedsLayout]; +} + +- (void) viewDidAppear: (BOOL) animated +{ + // run the reader when the view is visible + [readerView start]; +} + +- (void) viewWillDisappear: (BOOL) animated +{ + [readerView stop]; +} + +- (void) readerView: (ZBarReaderView*) view + didReadSymbols: (ZBarSymbolSet*) syms + fromImage: (UIImage*) img +{ + // do something useful with results + for(ZBarSymbol *sym in syms) { + resultText.text = sym.data; + break; + } +} + +@end diff --git a/iphone/examples/EmbedReader/EmbedReader/en.lproj/EmbedReaderViewController.xib b/iphone/examples/EmbedReader/EmbedReader/en.lproj/EmbedReaderViewController.xib new file mode 100644 index 0000000..8f4e9dc --- /dev/null +++ b/iphone/examples/EmbedReader/EmbedReader/en.lproj/EmbedReaderViewController.xib @@ -0,0 +1,336 @@ + + + + 1056 + 10J869 + 1306 + 1038.35 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 301 + + + YES + IBUINavigationItem + IBUIToolbar + IBUITextView + IBUIView + IBUINavigationBar + IBProxyObject + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + + YES + + + 306 + {{8, 52}, {304, 228}} + + + + + 3 + MAA + + YES + YES + IBCocoaTouchFramework + + + + 290 + {320, 44} + + + + IBCocoaTouchFramework + + YES + + + EmbedReader + IBCocoaTouchFramework + + + + + + 266 + {{0, 416}, {320, 44}} + + + + NO + NO + IBCocoaTouchFramework + + YES + + + + + 314 + {{8, 300}, {304, 94}} + + + + + 3 + MCAwAA + + YES + YES + IBCocoaTouchFramework + NO + No barcode scanned... + + Helvetica + 17 + 16 + + + IBCocoaTouchFramework + + + + {{0, 20}, {320, 460}} + + + + + 3 + MC43NQA + + 2 + + + NO + + IBCocoaTouchFramework + + + + + YES + + + view + + + + 7 + + + + readerView + + + + 16 + + + + resultText + + + + 17 + + + + + YES + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 6 + + + YES + + + + + + + + + 8 + + + + + 11 + + + YES + + + + + + 12 + + + + + 13 + + + YES + + + + + 15 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 11.IBPluginDependency + 12.IBPluginDependency + 13.IBPluginDependency + 15.IBPluginDependency + 6.IBEditorWindowLastContentRect + 6.IBPluginDependency + 8.CustomClassName + 8.IBPluginDependency + + + YES + EmbedReaderViewController + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{239, 654}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + ZBarReaderView + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + + + + YES + + + + + 18 + + + + YES + + EmbedReaderViewController + UIViewController + + YES + + YES + readerView + resultText + + + YES + ZBarReaderView + UITextView + + + + YES + + YES + readerView + resultText + + + YES + + readerView + ZBarReaderView + + + resultText + UITextView + + + + + IBProjectSource + ./Classes/EmbedReaderViewController.h + + + + ZBarReaderView + UIView + + IBProjectSource + ./Classes/ZBarReaderView.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + 3 + 301 + + diff --git a/iphone/examples/EmbedReader/EmbedReader/en.lproj/InfoPlist.strings b/iphone/examples/EmbedReader/EmbedReader/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/iphone/examples/EmbedReader/EmbedReader/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/iphone/examples/EmbedReader/EmbedReader/en.lproj/MainWindow.xib b/iphone/examples/EmbedReader/EmbedReader/en.lproj/MainWindow.xib new file mode 100644 index 0000000..dea1ac4 --- /dev/null +++ b/iphone/examples/EmbedReader/EmbedReader/en.lproj/MainWindow.xib @@ -0,0 +1,444 @@ + + + + 1024 + 10D571 + 786 + 1038.29 + 460.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 112 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + IBCocoaTouchFramework + + + EmbedReaderViewController + + + 1 + + IBCocoaTouchFramework + NO + + + + 292 + {320, 480} + + 1 + MSAxIDEAA + + NO + NO + + IBCocoaTouchFramework + YES + + + + + YES + + + delegate + + + + 4 + + + + viewController + + + + 11 + + + + window + + + + 14 + + + + + YES + + 0 + + + + + + -1 + + + File's Owner + + + 3 + + + EmbedReader App Delegate + + + -2 + + + + + 10 + + + + + 12 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 10.CustomClassName + 10.IBEditorWindowLastContentRect + 10.IBPluginDependency + 12.IBEditorWindowLastContentRect + 12.IBPluginDependency + 3.CustomClassName + 3.IBPluginDependency + + + YES + UIApplication + UIResponder + EmbedReaderViewController + {{234, 376}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{525, 346}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + EmbedReaderAppDelegate + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 15 + + + + YES + + UIWindow + UIView + + IBUserSource + + + + + EmbedReaderAppDelegate + NSObject + + YES + + YES + viewController + window + + + YES + EmbedReaderViewController + UIWindow + + + + YES + + YES + viewController + window + + + YES + + viewController + EmbedReaderViewController + + + window + UIWindow + + + + + IBProjectSource + EmbedReaderAppDelegate.h + + + + EmbedReaderAppDelegate + NSObject + + IBUserSource + + + + + EmbedReaderViewController + UIViewController + + IBProjectSource + EmbedReaderViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIApplication + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIApplication.h + + + + UIResponder + NSObject + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + UIWindow + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIWindow.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + EmbedReader.xcodeproj + 3 + 112 + + diff --git a/iphone/examples/EmbedReader/EmbedReader/main.m b/iphone/examples/EmbedReader/EmbedReader/main.m new file mode 100644 index 0000000..e91e4ba --- /dev/null +++ b/iphone/examples/EmbedReader/EmbedReader/main.m @@ -0,0 +1,16 @@ +// +// main.m +// EmbedReader +// +// Created by spadix on 5/2/11. +// + +#import + +int main(int argc, char *argv[]) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + int retVal = UIApplicationMain(argc, argv, nil, nil); + [pool release]; + return retVal; +} diff --git a/iphone/examples/EmbedReader/ZBarSDK b/iphone/examples/EmbedReader/ZBarSDK new file mode 100644 index 0000000..7a373ea --- /dev/null +++ b/iphone/examples/EmbedReader/ZBarSDK @@ -0,0 +1 @@ +../../build/Debug-iphoneos/ZBarSDK \ No newline at end of file diff --git a/iphone/examples/EmbedReader/build b/iphone/examples/EmbedReader/build new file mode 100644 index 0000000..534f8d4 --- /dev/null +++ b/iphone/examples/EmbedReader/build @@ -0,0 +1 @@ +/tmp/EmbedReader.build \ No newline at end of file diff --git a/iphone/examples/ReaderSample/ReaderSample.xcodeproj/project.pbxproj b/iphone/examples/ReaderSample/ReaderSample.xcodeproj/project.pbxproj new file mode 100644 index 0000000..0a0db3e --- /dev/null +++ b/iphone/examples/ReaderSample/ReaderSample.xcodeproj/project.pbxproj @@ -0,0 +1,419 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + DC8245F5162B549F0010B2E6 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DC8245F4162B549F0010B2E6 /* Default-568h@2x.png */; }; + DC8F289413579EFF005B8862 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC8F289313579EFF005B8862 /* UIKit.framework */; }; + DC8F289613579EFF005B8862 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC8F289513579EFF005B8862 /* Foundation.framework */; }; + DC8F289813579EFF005B8862 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC8F289713579EFF005B8862 /* CoreGraphics.framework */; }; + DC8F289E13579EFF005B8862 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = DC8F289C13579EFF005B8862 /* InfoPlist.strings */; }; + DC8F28A113579EFF005B8862 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DC8F28A013579EFF005B8862 /* main.m */; }; + DC8F28A413579EFF005B8862 /* ReaderSampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DC8F28A313579EFF005B8862 /* ReaderSampleAppDelegate.m */; }; + DC8F28A713579EFF005B8862 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = DC8F28A513579EFF005B8862 /* MainWindow.xib */; }; + DC8F28AA13579EFF005B8862 /* ReaderSampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DC8F28A913579EFF005B8862 /* ReaderSampleViewController.m */; }; + DC8F28AD13579F00005B8862 /* ReaderSampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = DC8F28AB13579EFF005B8862 /* ReaderSampleViewController.xib */; }; + DC8F28D01357A29D005B8862 /* libzbar.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DC8F28CA1357A29D005B8862 /* libzbar.a */; }; + DC8F28D11357A29D005B8862 /* zbar-back.png in Resources */ = {isa = PBXBuildFile; fileRef = DC8F28CC1357A29D005B8862 /* zbar-back.png */; }; + DC8F28D21357A29D005B8862 /* zbar-help.html in Resources */ = {isa = PBXBuildFile; fileRef = DC8F28CD1357A29D005B8862 /* zbar-help.html */; }; + DC8F28D31357A29D005B8862 /* zbar-helpicons.png in Resources */ = {isa = PBXBuildFile; fileRef = DC8F28CE1357A29D005B8862 /* zbar-helpicons.png */; }; + DC8F28D41357A29D005B8862 /* zbar-samples.png in Resources */ = {isa = PBXBuildFile; fileRef = DC8F28CF1357A29D005B8862 /* zbar-samples.png */; }; + DC8F28DA1357A42E005B8862 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC8F28D51357A42E005B8862 /* AVFoundation.framework */; }; + DC8F28DB1357A42E005B8862 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC8F28D61357A42E005B8862 /* CoreMedia.framework */; }; + DC8F28DC1357A42E005B8862 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC8F28D71357A42E005B8862 /* CoreVideo.framework */; }; + DC8F28DD1357A42E005B8862 /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = DC8F28D81357A42E005B8862 /* libiconv.dylib */; }; + DC8F28DE1357A42E005B8862 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC8F28D91357A42E005B8862 /* QuartzCore.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + DC8245F4162B549F0010B2E6 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = SOURCE_ROOT; }; + DC8F288F13579EFF005B8862 /* ReaderSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ReaderSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DC8F289313579EFF005B8862 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + DC8F289513579EFF005B8862 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + DC8F289713579EFF005B8862 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + DC8F289B13579EFF005B8862 /* ReaderSample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ReaderSample-Info.plist"; sourceTree = ""; }; + DC8F289D13579EFF005B8862 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + DC8F289F13579EFF005B8862 /* ReaderSample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ReaderSample-Prefix.pch"; sourceTree = ""; }; + DC8F28A013579EFF005B8862 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + DC8F28A213579EFF005B8862 /* ReaderSampleAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReaderSampleAppDelegate.h; sourceTree = ""; }; + DC8F28A313579EFF005B8862 /* ReaderSampleAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReaderSampleAppDelegate.m; sourceTree = ""; }; + DC8F28A613579EFF005B8862 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = ""; }; + DC8F28A813579EFF005B8862 /* ReaderSampleViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReaderSampleViewController.h; sourceTree = ""; }; + DC8F28A913579EFF005B8862 /* ReaderSampleViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReaderSampleViewController.m; sourceTree = ""; }; + DC8F28AC13579F00005B8862 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ReaderSampleViewController.xib; sourceTree = ""; }; + DC8F28B71357A29D005B8862 /* Decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decoder.h; sourceTree = ""; }; + DC8F28B81357A29D005B8862 /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Exception.h; sourceTree = ""; }; + DC8F28B91357A29D005B8862 /* Image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Image.h; sourceTree = ""; }; + DC8F28BA1357A29D005B8862 /* ImageScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageScanner.h; sourceTree = ""; }; + DC8F28BB1357A29D005B8862 /* Processor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Processor.h; sourceTree = ""; }; + DC8F28BC1357A29D005B8862 /* Scanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Scanner.h; sourceTree = ""; }; + DC8F28BD1357A29D005B8862 /* Symbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Symbol.h; sourceTree = ""; }; + DC8F28BE1357A29D005B8862 /* Video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Video.h; sourceTree = ""; }; + DC8F28BF1357A29D005B8862 /* Window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Window.h; sourceTree = ""; }; + DC8F28C01357A29D005B8862 /* zbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zbar.h; sourceTree = ""; }; + DC8F28C11357A29D005B8862 /* ZBarCaptureReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarCaptureReader.h; sourceTree = ""; }; + DC8F28C21357A29D005B8862 /* ZBarHelpController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarHelpController.h; sourceTree = ""; }; + DC8F28C31357A29D005B8862 /* ZBarImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarImage.h; sourceTree = ""; }; + DC8F28C41357A29D005B8862 /* ZBarImageScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarImageScanner.h; sourceTree = ""; }; + DC8F28C51357A29D005B8862 /* ZBarReaderController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarReaderController.h; sourceTree = ""; }; + DC8F28C61357A29D005B8862 /* ZBarReaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarReaderView.h; sourceTree = ""; }; + DC8F28C71357A29D005B8862 /* ZBarReaderViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarReaderViewController.h; sourceTree = ""; }; + DC8F28C81357A29D005B8862 /* ZBarSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarSDK.h; sourceTree = ""; }; + DC8F28C91357A29D005B8862 /* ZBarSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarSymbol.h; sourceTree = ""; }; + DC8F28CA1357A29D005B8862 /* libzbar.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libzbar.a; sourceTree = ""; }; + DC8F28CC1357A29D005B8862 /* zbar-back.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zbar-back.png"; sourceTree = ""; }; + DC8F28CD1357A29D005B8862 /* zbar-help.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "zbar-help.html"; sourceTree = ""; }; + DC8F28CE1357A29D005B8862 /* zbar-helpicons.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zbar-helpicons.png"; sourceTree = ""; }; + DC8F28CF1357A29D005B8862 /* zbar-samples.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zbar-samples.png"; sourceTree = ""; }; + DC8F28D51357A42E005B8862 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + DC8F28D61357A42E005B8862 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; + DC8F28D71357A42E005B8862 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; + DC8F28D81357A42E005B8862 /* libiconv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.dylib; path = usr/lib/libiconv.dylib; sourceTree = SDKROOT; }; + DC8F28D91357A42E005B8862 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + DC8F288C13579EFF005B8862 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + DC8F28DA1357A42E005B8862 /* AVFoundation.framework in Frameworks */, + DC8F28DB1357A42E005B8862 /* CoreMedia.framework in Frameworks */, + DC8F28DC1357A42E005B8862 /* CoreVideo.framework in Frameworks */, + DC8F28DD1357A42E005B8862 /* libiconv.dylib in Frameworks */, + DC8F28DE1357A42E005B8862 /* QuartzCore.framework in Frameworks */, + DC8F289413579EFF005B8862 /* UIKit.framework in Frameworks */, + DC8F289613579EFF005B8862 /* Foundation.framework in Frameworks */, + DC8F289813579EFF005B8862 /* CoreGraphics.framework in Frameworks */, + DC8F28D01357A29D005B8862 /* libzbar.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + DC8F288413579EFF005B8862 = { + isa = PBXGroup; + children = ( + DC8F289913579EFF005B8862 /* ReaderSample */, + DC8F28B31357A29D005B8862 /* ZBarSDK */, + DC8F289213579EFF005B8862 /* Frameworks */, + DC8F289013579EFF005B8862 /* Products */, + ); + sourceTree = ""; + }; + DC8F289013579EFF005B8862 /* Products */ = { + isa = PBXGroup; + children = ( + DC8F288F13579EFF005B8862 /* ReaderSample.app */, + ); + name = Products; + sourceTree = ""; + }; + DC8F289213579EFF005B8862 /* Frameworks */ = { + isa = PBXGroup; + children = ( + DC8F289313579EFF005B8862 /* UIKit.framework */, + DC8F289513579EFF005B8862 /* Foundation.framework */, + DC8F289713579EFF005B8862 /* CoreGraphics.framework */, + DC8F28D91357A42E005B8862 /* QuartzCore.framework */, + DC8F28D61357A42E005B8862 /* CoreMedia.framework */, + DC8F28D71357A42E005B8862 /* CoreVideo.framework */, + DC8F28D51357A42E005B8862 /* AVFoundation.framework */, + DC8F28D81357A42E005B8862 /* libiconv.dylib */, + ); + name = Frameworks; + sourceTree = ""; + }; + DC8F289913579EFF005B8862 /* ReaderSample */ = { + isa = PBXGroup; + children = ( + DC8F28A213579EFF005B8862 /* ReaderSampleAppDelegate.h */, + DC8F28A313579EFF005B8862 /* ReaderSampleAppDelegate.m */, + DC8F28A513579EFF005B8862 /* MainWindow.xib */, + DC8F28A813579EFF005B8862 /* ReaderSampleViewController.h */, + DC8F28A913579EFF005B8862 /* ReaderSampleViewController.m */, + DC8F28AB13579EFF005B8862 /* ReaderSampleViewController.xib */, + DC8F289A13579EFF005B8862 /* Supporting Files */, + ); + path = ReaderSample; + sourceTree = ""; + }; + DC8F289A13579EFF005B8862 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + DC8F289B13579EFF005B8862 /* ReaderSample-Info.plist */, + DC8F289C13579EFF005B8862 /* InfoPlist.strings */, + DC8245F4162B549F0010B2E6 /* Default-568h@2x.png */, + DC8F289F13579EFF005B8862 /* ReaderSample-Prefix.pch */, + DC8F28A013579EFF005B8862 /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + DC8F28B31357A29D005B8862 /* ZBarSDK */ = { + isa = PBXGroup; + children = ( + DC8F28B41357A29D005B8862 /* Headers */, + DC8F28CA1357A29D005B8862 /* libzbar.a */, + DC8F28CB1357A29D005B8862 /* Resources */, + ); + path = ZBarSDK; + sourceTree = ""; + }; + DC8F28B41357A29D005B8862 /* Headers */ = { + isa = PBXGroup; + children = ( + DC8F28B51357A29D005B8862 /* ZBarSDK */, + ); + path = Headers; + sourceTree = ""; + }; + DC8F28B51357A29D005B8862 /* ZBarSDK */ = { + isa = PBXGroup; + children = ( + DC8F28B61357A29D005B8862 /* zbar */, + DC8F28C01357A29D005B8862 /* zbar.h */, + DC8F28C11357A29D005B8862 /* ZBarCaptureReader.h */, + DC8F28C21357A29D005B8862 /* ZBarHelpController.h */, + DC8F28C31357A29D005B8862 /* ZBarImage.h */, + DC8F28C41357A29D005B8862 /* ZBarImageScanner.h */, + DC8F28C51357A29D005B8862 /* ZBarReaderController.h */, + DC8F28C61357A29D005B8862 /* ZBarReaderView.h */, + DC8F28C71357A29D005B8862 /* ZBarReaderViewController.h */, + DC8F28C81357A29D005B8862 /* ZBarSDK.h */, + DC8F28C91357A29D005B8862 /* ZBarSymbol.h */, + ); + path = ZBarSDK; + sourceTree = ""; + }; + DC8F28B61357A29D005B8862 /* zbar */ = { + isa = PBXGroup; + children = ( + DC8F28B71357A29D005B8862 /* Decoder.h */, + DC8F28B81357A29D005B8862 /* Exception.h */, + DC8F28B91357A29D005B8862 /* Image.h */, + DC8F28BA1357A29D005B8862 /* ImageScanner.h */, + DC8F28BB1357A29D005B8862 /* Processor.h */, + DC8F28BC1357A29D005B8862 /* Scanner.h */, + DC8F28BD1357A29D005B8862 /* Symbol.h */, + DC8F28BE1357A29D005B8862 /* Video.h */, + DC8F28BF1357A29D005B8862 /* Window.h */, + ); + path = zbar; + sourceTree = ""; + }; + DC8F28CB1357A29D005B8862 /* Resources */ = { + isa = PBXGroup; + children = ( + DC8F28CC1357A29D005B8862 /* zbar-back.png */, + DC8F28CD1357A29D005B8862 /* zbar-help.html */, + DC8F28CE1357A29D005B8862 /* zbar-helpicons.png */, + DC8F28CF1357A29D005B8862 /* zbar-samples.png */, + ); + path = Resources; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + DC8F288E13579EFF005B8862 /* ReaderSample */ = { + isa = PBXNativeTarget; + buildConfigurationList = DC8F28B013579F00005B8862 /* Build configuration list for PBXNativeTarget "ReaderSample" */; + buildPhases = ( + DC8F288B13579EFF005B8862 /* Sources */, + DC8F288C13579EFF005B8862 /* Frameworks */, + DC8F288D13579EFF005B8862 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ReaderSample; + productName = ReaderSample; + productReference = DC8F288F13579EFF005B8862 /* ReaderSample.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + DC8F288613579EFF005B8862 /* Project object */ = { + isa = PBXProject; + attributes = { + ORGANIZATIONNAME = "ZBar Consulting Services"; + }; + buildConfigurationList = DC8F288913579EFF005B8862 /* Build configuration list for PBXProject "ReaderSample" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = DC8F288413579EFF005B8862; + productRefGroup = DC8F289013579EFF005B8862 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + DC8F288E13579EFF005B8862 /* ReaderSample */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + DC8F288D13579EFF005B8862 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DC8F289E13579EFF005B8862 /* InfoPlist.strings in Resources */, + DC8F28A713579EFF005B8862 /* MainWindow.xib in Resources */, + DC8F28AD13579F00005B8862 /* ReaderSampleViewController.xib in Resources */, + DC8F28D11357A29D005B8862 /* zbar-back.png in Resources */, + DC8F28D21357A29D005B8862 /* zbar-help.html in Resources */, + DC8F28D31357A29D005B8862 /* zbar-helpicons.png in Resources */, + DC8F28D41357A29D005B8862 /* zbar-samples.png in Resources */, + DC8245F5162B549F0010B2E6 /* Default-568h@2x.png in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + DC8F288B13579EFF005B8862 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DC8F28A113579EFF005B8862 /* main.m in Sources */, + DC8F28A413579EFF005B8862 /* ReaderSampleAppDelegate.m in Sources */, + DC8F28AA13579EFF005B8862 /* ReaderSampleViewController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + DC8F289C13579EFF005B8862 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + DC8F289D13579EFF005B8862 /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + DC8F28A513579EFF005B8862 /* MainWindow.xib */ = { + isa = PBXVariantGroup; + children = ( + DC8F28A613579EFF005B8862 /* en */, + ); + name = MainWindow.xib; + sourceTree = ""; + }; + DC8F28AB13579EFF005B8862 /* ReaderSampleViewController.xib */ = { + isa = PBXVariantGroup; + children = ( + DC8F28AC13579F00005B8862 /* en */, + ); + name = ReaderSampleViewController.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + DC8F28AE13579F00005B8862 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = DEBUG; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; + SDKROOT = iphoneos; + }; + name = Debug; + }; + DC8F28AF13579F00005B8862 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + SDKROOT = iphoneos; + }; + name = Release; + }; + DC8F28B113579F00005B8862 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "ReaderSample/ReaderSample-Prefix.pch"; + INFOPLIST_FILE = "ReaderSample/ReaderSample-Info.plist"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/ZBarSDK\"", + ); + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + DC8F28B213579F00005B8862 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "ReaderSample/ReaderSample-Prefix.pch"; + INFOPLIST_FILE = "ReaderSample/ReaderSample-Info.plist"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/ZBarSDK\"", + ); + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + DC8F288913579EFF005B8862 /* Build configuration list for PBXProject "ReaderSample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DC8F28AE13579F00005B8862 /* Debug */, + DC8F28AF13579F00005B8862 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + DC8F28B013579F00005B8862 /* Build configuration list for PBXNativeTarget "ReaderSample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DC8F28B113579F00005B8862 /* Debug */, + DC8F28B213579F00005B8862 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = DC8F288613579EFF005B8862 /* Project object */; +} diff --git a/iphone/examples/ReaderSample/ReaderSample.xcodeproj/xcshareddata/xcschemes/ReaderSample.xcscheme b/iphone/examples/ReaderSample/ReaderSample.xcodeproj/xcshareddata/xcschemes/ReaderSample.xcscheme new file mode 100644 index 0000000..12fb1da --- /dev/null +++ b/iphone/examples/ReaderSample/ReaderSample.xcodeproj/xcshareddata/xcschemes/ReaderSample.xcscheme @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iphone/examples/ReaderSample/ReaderSample/ReaderSample-Info.plist b/iphone/examples/ReaderSample/ReaderSample/ReaderSample-Info.plist new file mode 100644 index 0000000..4ceba32 --- /dev/null +++ b/iphone/examples/ReaderSample/ReaderSample/ReaderSample-Info.plist @@ -0,0 +1,38 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + NSMainNibFile + MainWindow + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/iphone/examples/ReaderSample/ReaderSample/ReaderSample-Prefix.pch b/iphone/examples/ReaderSample/ReaderSample/ReaderSample-Prefix.pch new file mode 100644 index 0000000..2b3e510 --- /dev/null +++ b/iphone/examples/ReaderSample/ReaderSample/ReaderSample-Prefix.pch @@ -0,0 +1,16 @@ +// +// Prefix header for all source files of the 'ReaderSample' target in the 'ReaderSample' project +// + +#import + +#ifndef __IPHONE_3_0 +#warning "This project uses features only available in iPhone SDK 3.0 and later." +#endif + +#ifdef __OBJC__ + #import + #import + // ADD: import barcode reader APIs + #import "ZBarSDK.h" +#endif diff --git a/iphone/examples/ReaderSample/ReaderSample/ReaderSampleAppDelegate.h b/iphone/examples/ReaderSample/ReaderSample/ReaderSampleAppDelegate.h new file mode 100644 index 0000000..9666cd2 --- /dev/null +++ b/iphone/examples/ReaderSample/ReaderSample/ReaderSampleAppDelegate.h @@ -0,0 +1,20 @@ +// +// ReaderSampleAppDelegate.h +// ReaderSample +// +// Created by spadix on 4/14/11. +// + +#import + +@class ReaderSampleViewController; + +@interface ReaderSampleAppDelegate : NSObject { +} + +@property (nonatomic, retain) IBOutlet UIWindow *window; + +@property (nonatomic, retain) + IBOutlet ReaderSampleViewController *viewController; + +@end diff --git a/iphone/examples/ReaderSample/ReaderSample/ReaderSampleAppDelegate.m b/iphone/examples/ReaderSample/ReaderSample/ReaderSampleAppDelegate.m new file mode 100644 index 0000000..c5c2d29 --- /dev/null +++ b/iphone/examples/ReaderSample/ReaderSample/ReaderSampleAppDelegate.m @@ -0,0 +1,67 @@ +// +// ReaderSampleAppDelegate.m +// ReaderSample +// +// Created by spadix on 4/14/11. +// + +#import "ReaderSampleAppDelegate.h" + +#import "ReaderSampleViewController.h" + +@implementation ReaderSampleAppDelegate + + +@synthesize window=_window; + +@synthesize viewController=_viewController; + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ + // Override point for customization after application launch. + + self.window.rootViewController = self.viewController; + [self.window makeKeyAndVisible]; + return YES; +} + +- (void)applicationWillResignActive:(UIApplication *)application +{ + /* + Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. + */ +} + +- (void)applicationDidEnterBackground:(UIApplication *)application +{ + /* + Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + */ +} + +- (void)applicationWillEnterForeground:(UIApplication *)application +{ + /* + Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. + */ +} + +- (void)applicationDidBecomeActive:(UIApplication *)application +{ + /* + Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + */ +} + +- (void)applicationWillTerminate:(UIApplication *)application +{ + /* + Called when the application is about to terminate. + Save data if appropriate. + See also applicationDidEnterBackground:. + */ +} + +@end diff --git a/iphone/examples/ReaderSample/ReaderSample/ReaderSampleViewController.h b/iphone/examples/ReaderSample/ReaderSample/ReaderSampleViewController.h new file mode 100644 index 0000000..54abd91 --- /dev/null +++ b/iphone/examples/ReaderSample/ReaderSample/ReaderSampleViewController.h @@ -0,0 +1,19 @@ +// +// ReaderSampleViewController.h +// ReaderSample +// +// Created by spadix on 4/14/11. +// + +#import + +@interface ReaderSampleViewController : UIViewController + // ADD: delegate protocol + { + UIImageView *resultImage; + UITextView *resultText; +} +@property (nonatomic, retain) IBOutlet UIImageView *resultImage; +@property (nonatomic, retain) IBOutlet UITextView *resultText; +- (IBAction)scanButtonTapped; +@end diff --git a/iphone/examples/ReaderSample/ReaderSample/ReaderSampleViewController.m b/iphone/examples/ReaderSample/ReaderSample/ReaderSampleViewController.m new file mode 100644 index 0000000..67ddd6d --- /dev/null +++ b/iphone/examples/ReaderSample/ReaderSample/ReaderSampleViewController.m @@ -0,0 +1,68 @@ +// +// ReaderSampleViewController.m +// ReaderSample +// +// Created by spadix on 4/14/11. +// + +#import "ReaderSampleViewController.h" + +@implementation ReaderSampleViewController + +@synthesize resultImage, resultText; + +- (IBAction) scanButtonTapped +{ + // ADD: present a barcode reader that scans from the camera feed + ZBarReaderViewController *reader = [[ZBarReaderViewController alloc] init]; + reader.readerDelegate = self; + reader.supportedOrientationsMask = ZBarOrientationMaskAll; + + ZBarImageScanner *scanner = reader.scanner; + // TODO: (optional) additional reader configuration here + + // EXAMPLE: disable rarely used I2/5 to improve performance + [scanner setSymbology: ZBAR_I25 + config: ZBAR_CFG_ENABLE + to: 0]; + + // present and release the controller + [self presentModalViewController: reader + animated: YES]; + [reader release]; +} + +- (void) imagePickerController: (UIImagePickerController*) reader + didFinishPickingMediaWithInfo: (NSDictionary*) info +{ + // ADD: get the decode results + id results = + [info objectForKey: ZBarReaderControllerResults]; + ZBarSymbol *symbol = nil; + for(symbol in results) + // EXAMPLE: just grab the first barcode + break; + + // EXAMPLE: do something useful with the barcode data + resultText.text = symbol.data; + + // EXAMPLE: do something useful with the barcode image + resultImage.image = + [info objectForKey: UIImagePickerControllerOriginalImage]; + + // ADD: dismiss the controller (NB dismiss from the *reader*!) + [reader dismissModalViewControllerAnimated: YES]; +} + +- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) orient +{ + return(YES); +} + +- (void) dealloc { + self.resultImage = nil; + self.resultText = nil; + [super dealloc]; +} + +@end diff --git a/iphone/examples/ReaderSample/ReaderSample/en.lproj/InfoPlist.strings b/iphone/examples/ReaderSample/ReaderSample/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/iphone/examples/ReaderSample/ReaderSample/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/iphone/examples/ReaderSample/ReaderSample/en.lproj/MainWindow.xib b/iphone/examples/ReaderSample/ReaderSample/en.lproj/MainWindow.xib new file mode 100644 index 0000000..3b45763 --- /dev/null +++ b/iphone/examples/ReaderSample/ReaderSample/en.lproj/MainWindow.xib @@ -0,0 +1,444 @@ + + + + 1024 + 10D571 + 786 + 1038.29 + 460.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 112 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + IBCocoaTouchFramework + + + ReaderSampleViewController + + + 1 + + IBCocoaTouchFramework + NO + + + + 292 + {320, 480} + + 1 + MSAxIDEAA + + NO + NO + + IBCocoaTouchFramework + YES + + + + + YES + + + delegate + + + + 4 + + + + viewController + + + + 11 + + + + window + + + + 14 + + + + + YES + + 0 + + + + + + -1 + + + File's Owner + + + 3 + + + ReaderSample App Delegate + + + -2 + + + + + 10 + + + + + 12 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 10.CustomClassName + 10.IBEditorWindowLastContentRect + 10.IBPluginDependency + 12.IBEditorWindowLastContentRect + 12.IBPluginDependency + 3.CustomClassName + 3.IBPluginDependency + + + YES + UIApplication + UIResponder + ReaderSampleViewController + {{234, 376}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{525, 346}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + ReaderSampleAppDelegate + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 15 + + + + YES + + UIWindow + UIView + + IBUserSource + + + + + ReaderSampleAppDelegate + NSObject + + YES + + YES + viewController + window + + + YES + ReaderSampleViewController + UIWindow + + + + YES + + YES + viewController + window + + + YES + + viewController + ReaderSampleViewController + + + window + UIWindow + + + + + IBProjectSource + ReaderSampleAppDelegate.h + + + + ReaderSampleAppDelegate + NSObject + + IBUserSource + + + + + ReaderSampleViewController + UIViewController + + IBProjectSource + ReaderSampleViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIApplication + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIApplication.h + + + + UIResponder + NSObject + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + UIWindow + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIWindow.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ReaderSample.xcodeproj + 3 + 112 + + diff --git a/iphone/examples/ReaderSample/ReaderSample/en.lproj/ReaderSampleViewController.xib b/iphone/examples/ReaderSample/ReaderSample/en.lproj/ReaderSampleViewController.xib new file mode 100644 index 0000000..16d9167 --- /dev/null +++ b/iphone/examples/ReaderSample/ReaderSample/en.lproj/ReaderSampleViewController.xib @@ -0,0 +1,319 @@ + + + + 1056 + 10J869 + 1306 + 1038.35 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 301 + + + YES + IBUITextView + IBUIButton + IBUIImageView + IBUIView + IBProxyObject + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + + YES + + + 282 + {{20, 396}, {280, 44}} + + + NO + IBCocoaTouchFramework + 0 + 0 + + Helvetica-Bold + 19 + 16 + + 1 + Scan + + 3 + MQA + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + 3 + MC41AA + + + + + 311 + {{20, 20}, {280, 210}} + + + + 1 + NO + IBCocoaTouchFramework + + + + 282 + {{20, 238}, {280, 150}} + + + + + 3 + MCAwAA + + YES + YES + IBCocoaTouchFramework + NO + No barcode scanned... + + Helvetica + 17 + 16 + + + 2 + IBCocoaTouchFramework + + + + {{0, 20}, {320, 460}} + + + + + 3 + MC43NQA + + 2 + + + NO + + IBCocoaTouchFramework + + + + + YES + + + view + + + + 7 + + + + resultImage + + + + 11 + + + + resultText + + + + 12 + + + + scanButtonTapped + + + 7 + + 13 + + + + + YES + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 6 + + + YES + + + + + + + + 8 + + + + + 9 + + + + + 10 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 10.IBPluginDependency + 6.IBEditorWindowLastContentRect + 6.IBPluginDependency + 8.IBPluginDependency + 9.IBPluginDependency + + + YES + ReaderSampleViewController + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{239, 654}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + + + + YES + + + + + 13 + + + + YES + + ReaderSampleViewController + UIViewController + + scanButtonTapped + id + + + scanButtonTapped + + scanButtonTapped + id + + + + YES + + YES + resultImage + resultText + + + YES + UIImageView + UITextView + + + + YES + + YES + resultImage + resultText + + + YES + + resultImage + UIImageView + + + resultText + UITextView + + + + + IBProjectSource + ./Classes/ReaderSampleViewController.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + 3 + 301 + + diff --git a/iphone/examples/ReaderSample/ReaderSample/main.m b/iphone/examples/ReaderSample/ReaderSample/main.m new file mode 100644 index 0000000..4a373e4 --- /dev/null +++ b/iphone/examples/ReaderSample/ReaderSample/main.m @@ -0,0 +1,16 @@ +// +// main.m +// ReaderSample +// +// Created by spadix on 4/14/11. +// + +#import + +int main(int argc, char *argv[]) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + int retVal = UIApplicationMain(argc, argv, nil, nil); + [pool release]; + return retVal; +} diff --git a/iphone/examples/ReaderSample/ZBarSDK b/iphone/examples/ReaderSample/ZBarSDK new file mode 100644 index 0000000..7a373ea --- /dev/null +++ b/iphone/examples/ReaderSample/ZBarSDK @@ -0,0 +1 @@ +../../build/Debug-iphoneos/ZBarSDK \ No newline at end of file diff --git a/iphone/examples/ReaderSample/build b/iphone/examples/ReaderSample/build new file mode 100644 index 0000000..1e5c306 --- /dev/null +++ b/iphone/examples/ReaderSample/build @@ -0,0 +1 @@ +/tmp/ReaderSample.build \ No newline at end of file diff --git a/iphone/examples/TabReader/TabReader.xcodeproj/project.pbxproj b/iphone/examples/TabReader/TabReader.xcodeproj/project.pbxproj new file mode 100644 index 0000000..5c5bb27 --- /dev/null +++ b/iphone/examples/TabReader/TabReader.xcodeproj/project.pbxproj @@ -0,0 +1,420 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + DC52DED31370F5340048DADA /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC52DECE1370F5340048DADA /* AVFoundation.framework */; }; + DC52DED41370F5340048DADA /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC52DECF1370F5340048DADA /* CoreMedia.framework */; }; + DC52DED51370F5340048DADA /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC52DED01370F5340048DADA /* CoreVideo.framework */; }; + DC52DED61370F5340048DADA /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = DC52DED11370F5340048DADA /* libiconv.dylib */; }; + DC52DED71370F5340048DADA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC52DED21370F5340048DADA /* QuartzCore.framework */; }; + DC5D76D71370EE8F0069AEF5 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC5D76D61370EE8F0069AEF5 /* UIKit.framework */; }; + DC5D76D91370EE8F0069AEF5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC5D76D81370EE8F0069AEF5 /* Foundation.framework */; }; + DC5D76DB1370EE8F0069AEF5 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC5D76DA1370EE8F0069AEF5 /* CoreGraphics.framework */; }; + DC5D76E11370EE8F0069AEF5 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = DC5D76DF1370EE8F0069AEF5 /* InfoPlist.strings */; }; + DC5D76E41370EE8F0069AEF5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5D76E31370EE8F0069AEF5 /* main.m */; }; + DC5D76E71370EE8F0069AEF5 /* TabReaderAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5D76E61370EE8F0069AEF5 /* TabReaderAppDelegate.m */; }; + DC5D76EA1370EE8F0069AEF5 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = DC5D76E81370EE8F0069AEF5 /* MainWindow.xib */; }; + DC5D76F01370EE8F0069AEF5 /* ResultsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5D76EF1370EE8F0069AEF5 /* ResultsViewController.m */; }; + DC5D76F61370EE8F0069AEF5 /* ResultsView.xib in Resources */ = {isa = PBXBuildFile; fileRef = DC5D76F41370EE8F0069AEF5 /* ResultsView.xib */; }; + DC5D771A1370F0E30069AEF5 /* libzbar.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DC5D77141370F0E30069AEF5 /* libzbar.a */; }; + DC5D771B1370F0E30069AEF5 /* zbar-back.png in Resources */ = {isa = PBXBuildFile; fileRef = DC5D77161370F0E30069AEF5 /* zbar-back.png */; }; + DC5D771C1370F0E30069AEF5 /* zbar-help.html in Resources */ = {isa = PBXBuildFile; fileRef = DC5D77171370F0E30069AEF5 /* zbar-help.html */; }; + DC5D771D1370F0E30069AEF5 /* zbar-helpicons.png in Resources */ = {isa = PBXBuildFile; fileRef = DC5D77181370F0E30069AEF5 /* zbar-helpicons.png */; }; + DC5D771E1370F0E30069AEF5 /* zbar-samples.png in Resources */ = {isa = PBXBuildFile; fileRef = DC5D77191370F0E30069AEF5 /* zbar-samples.png */; }; + DC82460B162B5A1D0010B2E6 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DC82460A162B5A1D0010B2E6 /* Default-568h@2x.png */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + DC52DECE1370F5340048DADA /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + DC52DECF1370F5340048DADA /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; + DC52DED01370F5340048DADA /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; + DC52DED11370F5340048DADA /* libiconv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.dylib; path = usr/lib/libiconv.dylib; sourceTree = SDKROOT; }; + DC52DED21370F5340048DADA /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + DC5D76D21370EE8F0069AEF5 /* TabReader.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TabReader.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DC5D76D61370EE8F0069AEF5 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + DC5D76D81370EE8F0069AEF5 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + DC5D76DA1370EE8F0069AEF5 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + DC5D76DE1370EE8F0069AEF5 /* TabReader-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TabReader-Info.plist"; sourceTree = ""; }; + DC5D76E01370EE8F0069AEF5 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + DC5D76E21370EE8F0069AEF5 /* TabReader-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TabReader-Prefix.pch"; sourceTree = ""; }; + DC5D76E31370EE8F0069AEF5 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + DC5D76E51370EE8F0069AEF5 /* TabReaderAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TabReaderAppDelegate.h; sourceTree = ""; }; + DC5D76E61370EE8F0069AEF5 /* TabReaderAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TabReaderAppDelegate.m; sourceTree = ""; }; + DC5D76E91370EE8F0069AEF5 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = ""; }; + DC5D76EE1370EE8F0069AEF5 /* ResultsViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ResultsViewController.h; sourceTree = ""; }; + DC5D76EF1370EE8F0069AEF5 /* ResultsViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ResultsViewController.m; sourceTree = ""; }; + DC5D76F51370EE8F0069AEF5 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ResultsView.xib; sourceTree = ""; }; + DC5D77001370F0E30069AEF5 /* Decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decoder.h; sourceTree = ""; }; + DC5D77011370F0E30069AEF5 /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Exception.h; sourceTree = ""; }; + DC5D77021370F0E30069AEF5 /* Image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Image.h; sourceTree = ""; }; + DC5D77031370F0E30069AEF5 /* ImageScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageScanner.h; sourceTree = ""; }; + DC5D77041370F0E30069AEF5 /* Processor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Processor.h; sourceTree = ""; }; + DC5D77051370F0E30069AEF5 /* Scanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Scanner.h; sourceTree = ""; }; + DC5D77061370F0E30069AEF5 /* Symbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Symbol.h; sourceTree = ""; }; + DC5D77071370F0E30069AEF5 /* Video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Video.h; sourceTree = ""; }; + DC5D77081370F0E30069AEF5 /* Window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Window.h; sourceTree = ""; }; + DC5D77091370F0E30069AEF5 /* zbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zbar.h; sourceTree = ""; }; + DC5D770A1370F0E30069AEF5 /* ZBarCameraSimulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarCameraSimulator.h; sourceTree = ""; }; + DC5D770B1370F0E30069AEF5 /* ZBarCaptureReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarCaptureReader.h; sourceTree = ""; }; + DC5D770C1370F0E30069AEF5 /* ZBarHelpController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarHelpController.h; sourceTree = ""; }; + DC5D770D1370F0E30069AEF5 /* ZBarImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarImage.h; sourceTree = ""; }; + DC5D770E1370F0E30069AEF5 /* ZBarImageScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarImageScanner.h; sourceTree = ""; }; + DC5D770F1370F0E30069AEF5 /* ZBarReaderController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarReaderController.h; sourceTree = ""; }; + DC5D77101370F0E30069AEF5 /* ZBarReaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarReaderView.h; sourceTree = ""; }; + DC5D77111370F0E30069AEF5 /* ZBarReaderViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarReaderViewController.h; sourceTree = ""; }; + DC5D77121370F0E30069AEF5 /* ZBarSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarSDK.h; sourceTree = ""; }; + DC5D77131370F0E30069AEF5 /* ZBarSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarSymbol.h; sourceTree = ""; }; + DC5D77141370F0E30069AEF5 /* libzbar.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libzbar.a; sourceTree = ""; }; + DC5D77161370F0E30069AEF5 /* zbar-back.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zbar-back.png"; sourceTree = ""; }; + DC5D77171370F0E30069AEF5 /* zbar-help.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "zbar-help.html"; sourceTree = ""; }; + DC5D77181370F0E30069AEF5 /* zbar-helpicons.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zbar-helpicons.png"; sourceTree = ""; }; + DC5D77191370F0E30069AEF5 /* zbar-samples.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zbar-samples.png"; sourceTree = ""; }; + DC82460A162B5A1D0010B2E6 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = SOURCE_ROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + DC5D76CF1370EE8F0069AEF5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + DC52DED31370F5340048DADA /* AVFoundation.framework in Frameworks */, + DC52DED41370F5340048DADA /* CoreMedia.framework in Frameworks */, + DC52DED51370F5340048DADA /* CoreVideo.framework in Frameworks */, + DC52DED61370F5340048DADA /* libiconv.dylib in Frameworks */, + DC52DED71370F5340048DADA /* QuartzCore.framework in Frameworks */, + DC5D76D71370EE8F0069AEF5 /* UIKit.framework in Frameworks */, + DC5D76D91370EE8F0069AEF5 /* Foundation.framework in Frameworks */, + DC5D76DB1370EE8F0069AEF5 /* CoreGraphics.framework in Frameworks */, + DC5D771A1370F0E30069AEF5 /* libzbar.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + DC5D76C71370EE8D0069AEF5 = { + isa = PBXGroup; + children = ( + DC5D76DC1370EE8F0069AEF5 /* TabReader */, + DC5D76FC1370F0E30069AEF5 /* ZBarSDK */, + DC5D76D51370EE8F0069AEF5 /* Frameworks */, + DC5D76D31370EE8F0069AEF5 /* Products */, + ); + sourceTree = ""; + }; + DC5D76D31370EE8F0069AEF5 /* Products */ = { + isa = PBXGroup; + children = ( + DC5D76D21370EE8F0069AEF5 /* TabReader.app */, + ); + name = Products; + sourceTree = ""; + }; + DC5D76D51370EE8F0069AEF5 /* Frameworks */ = { + isa = PBXGroup; + children = ( + DC5D76D61370EE8F0069AEF5 /* UIKit.framework */, + DC5D76D81370EE8F0069AEF5 /* Foundation.framework */, + DC5D76DA1370EE8F0069AEF5 /* CoreGraphics.framework */, + DC52DECE1370F5340048DADA /* AVFoundation.framework */, + DC52DECF1370F5340048DADA /* CoreMedia.framework */, + DC52DED01370F5340048DADA /* CoreVideo.framework */, + DC52DED11370F5340048DADA /* libiconv.dylib */, + DC52DED21370F5340048DADA /* QuartzCore.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + DC5D76DC1370EE8F0069AEF5 /* TabReader */ = { + isa = PBXGroup; + children = ( + DC5D76E51370EE8F0069AEF5 /* TabReaderAppDelegate.h */, + DC5D76E61370EE8F0069AEF5 /* TabReaderAppDelegate.m */, + DC5D76E81370EE8F0069AEF5 /* MainWindow.xib */, + DC5D76EE1370EE8F0069AEF5 /* ResultsViewController.h */, + DC5D76EF1370EE8F0069AEF5 /* ResultsViewController.m */, + DC5D76F41370EE8F0069AEF5 /* ResultsView.xib */, + DC5D76DD1370EE8F0069AEF5 /* Supporting Files */, + ); + path = TabReader; + sourceTree = ""; + }; + DC5D76DD1370EE8F0069AEF5 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + DC5D76DE1370EE8F0069AEF5 /* TabReader-Info.plist */, + DC5D76DF1370EE8F0069AEF5 /* InfoPlist.strings */, + DC82460A162B5A1D0010B2E6 /* Default-568h@2x.png */, + DC5D76E21370EE8F0069AEF5 /* TabReader-Prefix.pch */, + DC5D76E31370EE8F0069AEF5 /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + DC5D76FC1370F0E30069AEF5 /* ZBarSDK */ = { + isa = PBXGroup; + children = ( + DC5D76FD1370F0E30069AEF5 /* Headers */, + DC5D77141370F0E30069AEF5 /* libzbar.a */, + DC5D77151370F0E30069AEF5 /* Resources */, + ); + path = ZBarSDK; + sourceTree = ""; + }; + DC5D76FD1370F0E30069AEF5 /* Headers */ = { + isa = PBXGroup; + children = ( + DC5D76FE1370F0E30069AEF5 /* ZBarSDK */, + ); + path = Headers; + sourceTree = ""; + }; + DC5D76FE1370F0E30069AEF5 /* ZBarSDK */ = { + isa = PBXGroup; + children = ( + DC5D76FF1370F0E30069AEF5 /* zbar */, + DC5D77091370F0E30069AEF5 /* zbar.h */, + DC5D770A1370F0E30069AEF5 /* ZBarCameraSimulator.h */, + DC5D770B1370F0E30069AEF5 /* ZBarCaptureReader.h */, + DC5D770C1370F0E30069AEF5 /* ZBarHelpController.h */, + DC5D770D1370F0E30069AEF5 /* ZBarImage.h */, + DC5D770E1370F0E30069AEF5 /* ZBarImageScanner.h */, + DC5D770F1370F0E30069AEF5 /* ZBarReaderController.h */, + DC5D77101370F0E30069AEF5 /* ZBarReaderView.h */, + DC5D77111370F0E30069AEF5 /* ZBarReaderViewController.h */, + DC5D77121370F0E30069AEF5 /* ZBarSDK.h */, + DC5D77131370F0E30069AEF5 /* ZBarSymbol.h */, + ); + path = ZBarSDK; + sourceTree = ""; + }; + DC5D76FF1370F0E30069AEF5 /* zbar */ = { + isa = PBXGroup; + children = ( + DC5D77001370F0E30069AEF5 /* Decoder.h */, + DC5D77011370F0E30069AEF5 /* Exception.h */, + DC5D77021370F0E30069AEF5 /* Image.h */, + DC5D77031370F0E30069AEF5 /* ImageScanner.h */, + DC5D77041370F0E30069AEF5 /* Processor.h */, + DC5D77051370F0E30069AEF5 /* Scanner.h */, + DC5D77061370F0E30069AEF5 /* Symbol.h */, + DC5D77071370F0E30069AEF5 /* Video.h */, + DC5D77081370F0E30069AEF5 /* Window.h */, + ); + path = zbar; + sourceTree = ""; + }; + DC5D77151370F0E30069AEF5 /* Resources */ = { + isa = PBXGroup; + children = ( + DC5D77161370F0E30069AEF5 /* zbar-back.png */, + DC5D77171370F0E30069AEF5 /* zbar-help.html */, + DC5D77181370F0E30069AEF5 /* zbar-helpicons.png */, + DC5D77191370F0E30069AEF5 /* zbar-samples.png */, + ); + path = Resources; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + DC5D76D11370EE8F0069AEF5 /* TabReader */ = { + isa = PBXNativeTarget; + buildConfigurationList = DC5D76F91370EE900069AEF5 /* Build configuration list for PBXNativeTarget "TabReader" */; + buildPhases = ( + DC5D76CE1370EE8F0069AEF5 /* Sources */, + DC5D76CF1370EE8F0069AEF5 /* Frameworks */, + DC5D76D01370EE8F0069AEF5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = TabReader; + productName = TabReader; + productReference = DC5D76D21370EE8F0069AEF5 /* TabReader.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + DC5D76C91370EE8D0069AEF5 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = DC5D76CC1370EE8D0069AEF5 /* Build configuration list for PBXProject "TabReader" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = DC5D76C71370EE8D0069AEF5; + productRefGroup = DC5D76D31370EE8F0069AEF5 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + DC5D76D11370EE8F0069AEF5 /* TabReader */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + DC5D76D01370EE8F0069AEF5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DC5D76E11370EE8F0069AEF5 /* InfoPlist.strings in Resources */, + DC5D76EA1370EE8F0069AEF5 /* MainWindow.xib in Resources */, + DC5D76F61370EE8F0069AEF5 /* ResultsView.xib in Resources */, + DC5D771B1370F0E30069AEF5 /* zbar-back.png in Resources */, + DC5D771C1370F0E30069AEF5 /* zbar-help.html in Resources */, + DC5D771D1370F0E30069AEF5 /* zbar-helpicons.png in Resources */, + DC5D771E1370F0E30069AEF5 /* zbar-samples.png in Resources */, + DC82460B162B5A1D0010B2E6 /* Default-568h@2x.png in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + DC5D76CE1370EE8F0069AEF5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DC5D76E41370EE8F0069AEF5 /* main.m in Sources */, + DC5D76E71370EE8F0069AEF5 /* TabReaderAppDelegate.m in Sources */, + DC5D76F01370EE8F0069AEF5 /* ResultsViewController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + DC5D76DF1370EE8F0069AEF5 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + DC5D76E01370EE8F0069AEF5 /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + DC5D76E81370EE8F0069AEF5 /* MainWindow.xib */ = { + isa = PBXVariantGroup; + children = ( + DC5D76E91370EE8F0069AEF5 /* en */, + ); + name = MainWindow.xib; + sourceTree = ""; + }; + DC5D76F41370EE8F0069AEF5 /* ResultsView.xib */ = { + isa = PBXVariantGroup; + children = ( + DC5D76F51370EE8F0069AEF5 /* en */, + ); + name = ResultsView.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + DC5D76F71370EE900069AEF5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = DEBUG; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 4.3; + SDKROOT = iphoneos; + }; + name = Debug; + }; + DC5D76F81370EE900069AEF5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 4.3; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + SDKROOT = iphoneos; + }; + name = Release; + }; + DC5D76FA1370EE900069AEF5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "TabReader/TabReader-Prefix.pch"; + INFOPLIST_FILE = "TabReader/TabReader-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/ZBarSDK\"", + ); + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + DC5D76FB1370EE900069AEF5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "TabReader/TabReader-Prefix.pch"; + INFOPLIST_FILE = "TabReader/TabReader-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/ZBarSDK\"", + ); + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + DC5D76CC1370EE8D0069AEF5 /* Build configuration list for PBXProject "TabReader" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DC5D76F71370EE900069AEF5 /* Debug */, + DC5D76F81370EE900069AEF5 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + DC5D76F91370EE900069AEF5 /* Build configuration list for PBXNativeTarget "TabReader" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DC5D76FA1370EE900069AEF5 /* Debug */, + DC5D76FB1370EE900069AEF5 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = DC5D76C91370EE8D0069AEF5 /* Project object */; +} diff --git a/iphone/examples/TabReader/TabReader.xcodeproj/xcshareddata/xcschemes/TabReader.xcscheme b/iphone/examples/TabReader/TabReader.xcodeproj/xcshareddata/xcschemes/TabReader.xcscheme new file mode 100644 index 0000000..ae63da8 --- /dev/null +++ b/iphone/examples/TabReader/TabReader.xcodeproj/xcshareddata/xcschemes/TabReader.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iphone/examples/TabReader/TabReader/ResultsViewController.h b/iphone/examples/TabReader/TabReader/ResultsViewController.h new file mode 100644 index 0000000..c7b3115 --- /dev/null +++ b/iphone/examples/TabReader/TabReader/ResultsViewController.h @@ -0,0 +1,16 @@ +// +// SecondViewController.h +// TabReader +// +// Created by spadix on 5/3/11. +// + +#import + +@interface ResultsViewController : UIViewController { +} + +@property (nonatomic, retain) IBOutlet UIImageView *resultImage; +@property (nonatomic, retain) IBOutlet UITextView *resultText; + +@end diff --git a/iphone/examples/TabReader/TabReader/ResultsViewController.m b/iphone/examples/TabReader/TabReader/ResultsViewController.m new file mode 100644 index 0000000..e1ee41f --- /dev/null +++ b/iphone/examples/TabReader/TabReader/ResultsViewController.m @@ -0,0 +1,20 @@ +// +// SecondViewController.m +// TabReader +// +// Created by spadix on 5/3/11. +// + +#import "ResultsViewController.h" + + +@implementation ResultsViewController + +@synthesize resultImage, resultText; + +- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) orient +{ + return(YES); +} + +@end diff --git a/iphone/examples/TabReader/TabReader/TabReader-Info.plist b/iphone/examples/TabReader/TabReader/TabReader-Info.plist new file mode 100644 index 0000000..1e72cf2 --- /dev/null +++ b/iphone/examples/TabReader/TabReader/TabReader-Info.plist @@ -0,0 +1,38 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + net.sourceforge.zbar.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + NSMainNibFile + MainWindow + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/iphone/examples/TabReader/TabReader/TabReader-Prefix.pch b/iphone/examples/TabReader/TabReader/TabReader-Prefix.pch new file mode 100644 index 0000000..701a5b1 --- /dev/null +++ b/iphone/examples/TabReader/TabReader/TabReader-Prefix.pch @@ -0,0 +1,15 @@ +// +// Prefix header for all source files of the 'TabReader' target in the 'TabReader' project +// + +#import + +#ifndef __IPHONE_3_0 +#warning "This project uses features only available in iPhone SDK 3.0 and later." +#endif + +#ifdef __OBJC__ +# import +# import +# import "ZBarSDK.h" +#endif diff --git a/iphone/examples/TabReader/TabReader/TabReaderAppDelegate.h b/iphone/examples/TabReader/TabReader/TabReaderAppDelegate.h new file mode 100644 index 0000000..fa43cc3 --- /dev/null +++ b/iphone/examples/TabReader/TabReader/TabReaderAppDelegate.h @@ -0,0 +1,18 @@ +// +// TabReaderAppDelegate.h +// TabReader +// +// Created by spadix on 5/3/11. +// + +#import + +@interface TabReaderAppDelegate + : NSObject { +} + +@property (nonatomic, retain) IBOutlet UIWindow *window; +@property (nonatomic, retain) IBOutlet UITabBarController *tabBarController; + +@end diff --git a/iphone/examples/TabReader/TabReader/TabReaderAppDelegate.m b/iphone/examples/TabReader/TabReader/TabReaderAppDelegate.m new file mode 100644 index 0000000..0168f4e --- /dev/null +++ b/iphone/examples/TabReader/TabReader/TabReaderAppDelegate.m @@ -0,0 +1,62 @@ +// +// TabReaderAppDelegate.m +// TabReader +// +// Created by spadix on 5/3/11. +// + +#import "TabReaderAppDelegate.h" +#import "ResultsViewController.h" + +@implementation TabReaderAppDelegate + +@synthesize window=_window; +@synthesize tabBarController=_tabBarController; + +- (BOOL) application: (UIApplication*) application + didFinishLaunchingWithOptions: (NSDictionary*) options +{ + // force class to load so it may be referenced directly from nib + [ZBarReaderViewController class]; + + ZBarReaderViewController *reader = + [self.tabBarController.viewControllers objectAtIndex: 0]; + reader.readerDelegate = self; + reader.showsZBarControls = NO; + reader.supportedOrientationsMask = ZBarOrientationMaskAll; + + self.window.rootViewController = self.tabBarController; + [self.window makeKeyAndVisible]; + + return(YES); +} + +- (void) dealloc +{ + [_window release]; + [_tabBarController release]; + [super dealloc]; +} + + +// ZBarReaderDelegate + +- (void) imagePickerController: (UIImagePickerController*) picker + didFinishPickingMediaWithInfo: (NSDictionary*) info +{ + // do something useful with results + UITabBarController *tabs = self.tabBarController; + tabs.selectedIndex = 1; + ResultsViewController *results = [tabs.viewControllers objectAtIndex: 1]; + UIImage *image = [info objectForKey: UIImagePickerControllerOriginalImage]; + results.resultImage.image = image; + + id syms = + [info objectForKey: ZBarReaderControllerResults]; + for(ZBarSymbol *sym in syms) { + results.resultText.text = sym.data; + break; + } +} + +@end diff --git a/iphone/examples/TabReader/TabReader/en.lproj/InfoPlist.strings b/iphone/examples/TabReader/TabReader/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/iphone/examples/TabReader/TabReader/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/iphone/examples/TabReader/TabReader/en.lproj/MainWindow.xib b/iphone/examples/TabReader/TabReader/en.lproj/MainWindow.xib new file mode 100644 index 0000000..4875de8 --- /dev/null +++ b/iphone/examples/TabReader/TabReader/en.lproj/MainWindow.xib @@ -0,0 +1,411 @@ + + + + 1024 + 10J869 + 1306 + 1038.35 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 301 + + + YES + IBProxyObject + IBUITabBarItem + IBUIViewController + IBUICustomObject + IBUITabBarController + IBUIWindow + IBUITabBar + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + IBCocoaTouchFramework + + + + 1316 + + {320, 480} + + + + 1 + MSAxIDEAA + + NO + NO + + IBCocoaTouchFramework + YES + + + + + + 1 + 1 + + IBCocoaTouchFramework + NO + + + Scan + IBCocoaTouchFramework + + + + + + 1 + 1 + + IBCocoaTouchFramework + NO + + + YES + + + + Results + IBCocoaTouchFramework + + + + ResultsView + + 1 + 1 + + IBCocoaTouchFramework + NO + + + + + 266 + {{0, 431}, {320, 49}} + + + + 3 + MCAwAA + + NO + IBCocoaTouchFramework + + YES + + + + + + + + + + YES + + + window + + + + 9 + + + + delegate + + + + 99 + + + + tabBarController + + + + 113 + + + + delegate + + + + 127 + + + + + YES + + 0 + + + + + + 2 + + + YES + + + + + -1 + + + File's Owner + + + 3 + + + + + 106 + + + YES + + + + + + + + 107 + + + + + -2 + + + + + 125 + + + YES + + + + Barcode Reader Controller + + + 126 + + + + + 109 + + + YES + + + + Barcode Results Controller + + + 110 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 106.IBEditorWindowLastContentRect + 106.IBPluginDependency + 107.IBPluginDependency + 109.CustomClassName + 109.IBPluginDependency + 110.IBPluginDependency + 125.CustomClassName + 125.IBPluginDependency + 126.IBPluginDependency + 2.IBAttributePlaceholdersKey + 2.IBEditorWindowLastContentRect + 2.IBPluginDependency + 3.CustomClassName + 3.IBPluginDependency + + + YES + UIApplication + UIResponder + {{1323, 676}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + ResultsViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + ZBarReaderViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + YES + + + + {{229, 373}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + TabReaderAppDelegate + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + + + + YES + + + + + 127 + + + + YES + + ResultsViewController + UIViewController + + YES + + YES + resultImage + resultText + + + YES + UIImageView + UITextView + + + + YES + + YES + resultImage + resultText + + + YES + + resultImage + UIImageView + + + resultText + UITextView + + + + + IBProjectSource + ./Classes/ResultsViewController.h + + + + TabReaderAppDelegate + NSObject + + YES + + YES + tabBarController + window + + + YES + UITabBarController + UIWindow + + + + YES + + YES + tabBarController + window + + + YES + + tabBarController + UITabBarController + + + window + UIWindow + + + + + IBProjectSource + ./Classes/TabReaderAppDelegate.h + + + + ZBarReaderViewController + UIViewController + + IBProjectSource + ./Classes/ZBarReaderViewController.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + 3 + 301 + + diff --git a/iphone/examples/TabReader/TabReader/en.lproj/ResultsView.xib b/iphone/examples/TabReader/TabReader/en.lproj/ResultsView.xib new file mode 100644 index 0000000..c9c77bc --- /dev/null +++ b/iphone/examples/TabReader/TabReader/en.lproj/ResultsView.xib @@ -0,0 +1,303 @@ + + + + 1024 + 10J869 + 1306 + 1038.35 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 301 + + + YES + IBUITextView + IBUIImageView + IBUIView + IBUILabel + IBProxyObject + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + + YES + + + 306 + {{20, 20}, {280, 28}} + + + + + 3 + MQA + + 2 + + + NO + YES + NO + IBCocoaTouchFramework + Results Tab + + Helvetica + 24 + 16 + + + 1 + MCAwIDAAA + + + 1 + 10 + 1 + + + + 282 + {{20, 274}, {280, 117}} + + + NO + YES + YES + NO + IBCocoaTouchFramework + NO + NO + NO + 0.0 + 0.0 + NO + NO + No barcode scanned. + + IBCocoaTouchFramework + + + + + 306 + {{20, 56}, {280, 210}} + + + 1 + NO + IBCocoaTouchFramework + + + {{0, 20}, {320, 411}} + + + + + 3 + MQA + + + + IBCocoaTouchFramework + + + + + YES + + + view + + + + 3 + + + + resultImage + + + + 9 + + + + resultText + + + + 10 + + + + + YES + + 0 + + + + + + 1 + + + YES + + + + + + + + -1 + + + File's Owner + + + -2 + + + + + 5 + + + + + 7 + + + + + 8 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 5.IBPluginDependency + 7.IBPluginDependency + 7.IBViewBoundsToFrameTransform + 8.IBPluginDependency + + + YES + ResultsViewController + UIResponder + {{187, 376}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABA4AAAw7GAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + + + + YES + + + + + 10 + + + + YES + + ResultsViewController + UIViewController + + YES + + YES + resultImage + resultText + + + YES + UIImageView + UITextView + + + + YES + + YES + resultImage + resultText + + + YES + + resultImage + UIImageView + + + resultText + UITextView + + + + + IBProjectSource + ./Classes/ResultsViewController.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + 3 + 301 + + diff --git a/iphone/examples/TabReader/TabReader/main.m b/iphone/examples/TabReader/TabReader/main.m new file mode 100644 index 0000000..5505e3a --- /dev/null +++ b/iphone/examples/TabReader/TabReader/main.m @@ -0,0 +1,16 @@ +// +// main.m +// TabReader +// +// Created by spadix on 5/3/11. +// + +#import + +int main(int argc, char *argv[]) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + int retVal = UIApplicationMain(argc, argv, nil, nil); + [pool release]; + return retVal; +} diff --git a/iphone/examples/TabReader/ZBarSDK b/iphone/examples/TabReader/ZBarSDK new file mode 100644 index 0000000..7a373ea --- /dev/null +++ b/iphone/examples/TabReader/ZBarSDK @@ -0,0 +1 @@ +../../build/Debug-iphoneos/ZBarSDK \ No newline at end of file diff --git a/iphone/examples/TabReader/build b/iphone/examples/TabReader/build new file mode 100644 index 0000000..fc13333 --- /dev/null +++ b/iphone/examples/TabReader/build @@ -0,0 +1 @@ +/tmp/TabReader.build \ No newline at end of file diff --git a/iphone/examples/readertest/ZBarSDK b/iphone/examples/readertest/ZBarSDK new file mode 100644 index 0000000..7a373ea --- /dev/null +++ b/iphone/examples/readertest/ZBarSDK @@ -0,0 +1 @@ +../../build/Debug-iphoneos/ZBarSDK \ No newline at end of file diff --git a/iphone/examples/readertest/build b/iphone/examples/readertest/build new file mode 100644 index 0000000..bd23a51 --- /dev/null +++ b/iphone/examples/readertest/build @@ -0,0 +1 @@ +/tmp/readertest.build \ No newline at end of file diff --git a/iphone/examples/readertest/entitlements.plist b/iphone/examples/readertest/entitlements.plist new file mode 100644 index 0000000..ce373e1 --- /dev/null +++ b/iphone/examples/readertest/entitlements.plist @@ -0,0 +1,8 @@ + + + + + get-task-allow + + + diff --git a/iphone/examples/readertest/prefix.pch b/iphone/examples/readertest/prefix.pch new file mode 100644 index 0000000..9efda98 --- /dev/null +++ b/iphone/examples/readertest/prefix.pch @@ -0,0 +1,11 @@ +#ifdef __OBJC__ +# import +# import +# import +# import +# import +# import +# import +# import +# import "ZBarSDK.h" +#endif diff --git a/iphone/examples/readertest/readertest.m b/iphone/examples/readertest/readertest.m new file mode 100644 index 0000000..21ffc28 --- /dev/null +++ b/iphone/examples/readertest/readertest.m @@ -0,0 +1,991 @@ +enum { + CLASS_SECTION = 0, + SOURCE_SECTION, + CAMODE_SECTION, + DEVICE_SECTION, + FLASH_SECTION, + QUALITY_SECTION, + CONFIG_SECTION, + CUSTOM_SECTION, + SYMBOL_SECTION, + RESULT_SECTION, + NUM_SECTIONS +}; + +static NSString* const section_titles[] = { + @"Classes", + @"SourceType", + @"CameraMode", + @"CaptureDevice", + @"CameraFlashMode", + @"VideoQuality", + @"Reader Configuration", + nil, + @"Enabled Symbologies", + @"Decode Results", +}; + +static const CGRect const crop_choices[] = { + { { 0, 0 }, { 1, 1 } }, + { { .125, 0 }, { .75, 1 } }, + { { 0, .3 }, { 1, .4 } }, + { { 0, 0 }, { 0, 0 } } +}; + +static const NSInteger const density_choices[] = { + 3, 2, 1, 0, 4, -1 +}; + +static const CGFloat const zoom_choices[] = { + 1, 10/9., 10/8., 8/6., 10/7., 9/6., 10/6., 7/4., 2, 0, -1 +}; + +@interface AppDelegate + : UITableViewController + < UIApplicationDelegate, + UINavigationControllerDelegate, + UITableViewDelegate, + UITableViewDataSource, + UIActionSheetDelegate, + ZBarReaderDelegate > +{ + UIWindow *window; + UINavigationController *nav; + + NSSet *defaultSymbologies; + CGFloat zoom; + + NSMutableArray *sections, *symbolEnables; + NSInteger xDensity, yDensity; + + BOOL found, paused, continuous; + NSInteger dataHeight; + UILabel *typeLabel, *dataLabel; + UIImageView *imageView; + + ZBarReaderViewController *reader; + UIView *overlay; + UIBarButtonItem *manualBtn; + UILabel *typeOvl, *dataOvl; + NSArray *masks; +} + +@end + + +@implementation AppDelegate + +- (id) init +{ + return([super initWithStyle: UITableViewStyleGrouped]); +} + +- (void) initReader: (NSString*) clsName +{ + [reader release]; + Class cls = [[NSBundle mainBundle] + classNamed: clsName]; + assert(cls); + reader = [cls new]; + assert(reader); + reader.readerDelegate = self; + xDensity = yDensity = 3; + +#if 0 + // apply defaults for demo + ZBarImageScanner *scanner = reader.scanner; + continuous = NO; + zoom = 1; + reader.showsZBarControls = NO; + reader.scanCrop = CGRectMake(0, .35, 1, .3); + + [defaultSymbologies release]; + defaultSymbologies = + [[NSSet alloc] + initWithObjects: + [NSNumber numberWithInteger: ZBAR_CODE128], + nil]; + [scanner setSymbology: 0 + config: ZBAR_CFG_ENABLE + to: 0]; + for(NSNumber *sym in defaultSymbologies) + [scanner setSymbology: sym.integerValue + config: ZBAR_CFG_ENABLE + to: 1]; + + [scanner setSymbology: 0 + config: ZBAR_CFG_X_DENSITY + to: (xDensity = 0)]; + [scanner setSymbology: 0 + config: ZBAR_CFG_Y_DENSITY + to: (yDensity = 1)]; +#endif +} + +- (void) initOverlay +{ + overlay = [[UIView alloc] + initWithFrame: CGRectMake(0, 426, 320, 54)]; + overlay.backgroundColor = [UIColor clearColor]; + + masks = [[NSArray alloc] + initWithObjects: + [[[UIView alloc] + initWithFrame: CGRectMake(0, -426, 320, 0)] + autorelease], + [[[UIView alloc] + initWithFrame: CGRectMake(0, -426, 0, 426)] + autorelease], + [[[UIView alloc] + initWithFrame: CGRectMake(0, 0, 320, 0)] + autorelease], + [[[UIView alloc] + initWithFrame: CGRectMake(320, -426, 0, 426)] + autorelease], + nil]; + for(UIView *mask in masks) { + mask.backgroundColor = [UIColor colorWithWhite: 0 + alpha: .5]; + [overlay addSubview: mask]; + } + + UILabel *label = + [[UILabel alloc] + initWithFrame: CGRectMake(0, -426, 320, 48)]; + label.backgroundColor = [UIColor clearColor]; + label.textColor = [UIColor whiteColor]; + label.font = [UIFont boldSystemFontOfSize: 24]; + label.text = @"Custom Overlay"; + [overlay addSubview: label]; + [label release]; + + typeOvl = [[UILabel alloc] + initWithFrame: CGRectMake(0, -378, 80, 24)]; + typeOvl.backgroundColor = [UIColor clearColor]; + typeOvl.textColor = [UIColor whiteColor]; + typeOvl.font = [UIFont systemFontOfSize: 16]; + typeOvl.textAlignment = UITextAlignmentCenter; + [overlay addSubview: typeOvl]; + + dataOvl = [[UILabel alloc] + initWithFrame: CGRectMake(96, -378, 224, 24)]; + dataOvl.backgroundColor = [UIColor clearColor]; + dataOvl.textColor = [UIColor whiteColor]; + dataOvl.font = [UIFont systemFontOfSize: 16]; + [overlay addSubview: dataOvl]; + + UIToolbar *toolbar = + [[UIToolbar alloc] + initWithFrame: CGRectMake(0, 0, 320, 54)]; + toolbar.tintColor = [UIColor colorWithRed: .5 + green: 0 + blue: 0 + alpha: 1]; + [manualBtn release]; + manualBtn = [[UIBarButtonItem alloc] + initWithBarButtonSystemItem: UIBarButtonSystemItemCamera + target: self + action: @selector(manualCapture)]; + + + UIButton *info = + [UIButton buttonWithType: UIButtonTypeInfoLight]; + [info addTarget: self + action: @selector(info) + forControlEvents: UIControlEventTouchUpInside]; + + toolbar.items = + [NSArray arrayWithObjects: + [[[UIBarButtonItem alloc] + initWithTitle: @"X" + style: UIBarButtonItemStylePlain + target: self + action: @selector(imagePickerControllerDidCancel:)] + autorelease], + [[[UIBarButtonItem alloc] + initWithBarButtonSystemItem: UIBarButtonSystemItemFlexibleSpace + target: nil + action: nil] + autorelease], + manualBtn, + [[[UIBarButtonItem alloc] + initWithBarButtonSystemItem: UIBarButtonSystemItemFlexibleSpace + target: nil + action: nil] + autorelease], + [[[UIBarButtonItem alloc] + initWithBarButtonSystemItem: UIBarButtonSystemItemPause + target: self + action: @selector(pause)] + autorelease], + [[[UIBarButtonItem alloc] + initWithBarButtonSystemItem: UIBarButtonSystemItemFlexibleSpace + target: nil + action: nil] + autorelease], + [[[UIBarButtonItem alloc] + initWithCustomView: info] + autorelease], + nil]; + [overlay addSubview: toolbar]; + [toolbar release]; +} + +- (void) updateCropMask +{ + CGRect r = reader.scanCrop; + r.origin.x *= 426; + r.origin.y *= 320; + r.size.width *= 426; + r.size.height *= 320; + UIView *mask = [masks objectAtIndex: 0]; + mask.frame = CGRectMake(0, -426, 320, r.origin.x); + mask = [masks objectAtIndex: 1]; + mask.frame = CGRectMake(0, r.origin.x - 426, r.origin.y, r.size.width); + + r.origin.y += r.size.height; + mask = [masks objectAtIndex: 2]; + mask.frame = CGRectMake(r.origin.y, r.origin.x - 426, + 320 - r.origin.y, r.size.width); + + r.origin.x += r.size.width; + mask = [masks objectAtIndex: 3]; + mask.frame = CGRectMake(0, r.origin.x - 426, 320, 426 - r.origin.x); +} + +- (void) setCheck: (BOOL) state + forCell: (UITableViewCell*) cell +{ + cell.accessoryType = + ((state) + ? UITableViewCellAccessoryCheckmark + : UITableViewCellAccessoryNone); +} + +- (void) setCheckForTag: (int) tag + inSection: (int) section +{ + for(UITableViewCell *cell in [sections objectAtIndex: section]) + [self setCheck: (cell.tag == tag) + forCell: cell]; +} + +- (void) setCheckForName: (NSString*) name + inSection: (int) section +{ + for(UITableViewCell *cell in [sections objectAtIndex: section]) + [self setCheck: [name isEqualToString: cell.textLabel.text] + forCell: cell]; +} + +- (void) applicationDidFinishLaunching: (UIApplication*) application +{ + self.title = @"ZBar Reader Test"; + + nav = [[UINavigationController alloc] + initWithRootViewController: self]; + nav.delegate = self; + + window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]]; + [window addSubview: nav.view]; + [window makeKeyAndVisible]; + + [self initReader: @"ZBarReaderViewController"]; +} + +- (UITableViewCell*) cellWithTitle: (NSString*) title + tag: (NSInteger) tag + checked: (BOOL) checked +{ + UITableViewCell *cell = [UITableViewCell new]; + cell.textLabel.text = title; + cell.tag = tag; + [self setCheck: checked + forCell: cell]; + return([cell autorelease]); +} + +- (void) initControlCells +{ + // NB don't need SourceTypeSavedPhotosAlbum + static NSString* const sourceNames[] = { + @"Library", @"Camera", @"Album", nil + }; + NSMutableArray *sources = [NSMutableArray array]; + for(int i = 0; sourceNames[i]; i++) + if([[reader class] isSourceTypeAvailable: i]) + [sources addObject: + [self cellWithTitle: sourceNames[i] + tag: i + checked: (reader.sourceType == i)]]; + [sections replaceObjectAtIndex: SOURCE_SECTION + withObject: sources]; + + static NSString* const modeNames[] = { + @"Default", @"Sampling", @"Sequence", nil + }; + NSMutableArray *modes = [NSMutableArray array]; + for(int i = 0; modeNames[i]; i++) + [modes addObject: + [self cellWithTitle: modeNames[i] + tag: i + checked: (reader.cameraMode == i)]]; + [sections replaceObjectAtIndex: CAMODE_SECTION + withObject: modes]; + + static NSString *const deviceNames[] = { + @"Rear", @"Front", nil + }; + NSMutableArray *devices = [NSMutableArray array]; + for(int i = 0; deviceNames[i]; i++) + if([[reader class] + isCameraDeviceAvailable: i]) + [devices addObject: + [self cellWithTitle: deviceNames[i] + tag: i + checked: (reader.cameraDevice == i)]]; + assert(devices.count); + [sections replaceObjectAtIndex: DEVICE_SECTION + withObject: devices]; + + static NSString *const flashNames[] = { + @"Off", @"Auto", @"On", nil + }; + NSMutableArray *flashModes = [NSMutableArray array]; + for(int i = 0; flashNames[i]; i++) + [flashModes addObject: + [self cellWithTitle: flashNames[i] + tag: i - 1 + checked: (reader.cameraFlashMode == i - 1)]]; + [sections replaceObjectAtIndex: FLASH_SECTION + withObject: flashModes]; + + static NSString *const qualityNames[] = { + @"High", @"Medium", @"Low", @"640x480", nil + }; + NSMutableArray *qualities = [NSMutableArray array]; + for(int i = 0; qualityNames[i]; i++) + [qualities addObject: + [self cellWithTitle: qualityNames[i] + tag: i + checked: (reader.videoQuality == i)]]; + [sections replaceObjectAtIndex: QUALITY_SECTION + withObject: qualities]; + + static NSString* const configNames[] = { + @"showsCameraControls", @"showsZBarControls", @"tracksSymbols", + @"enableCache", @"showsHelpOnFail", @"takesPicture", + nil + }; + NSMutableArray *configs = [NSMutableArray array]; + for(int i = 0; configNames[i]; i++) + @try { + BOOL checked = [[reader valueForKey: configNames[i]] boolValue]; + [configs addObject: + [self cellWithTitle: configNames[i] + tag: i + checked: checked]]; + } + @catch(...) { } + [sections replaceObjectAtIndex: CONFIG_SECTION + withObject: configs]; + + UITableViewCell *xDensityCell = + [[[UITableViewCell alloc] + initWithStyle: UITableViewCellStyleValue1 + reuseIdentifier: nil] + autorelease]; + xDensityCell.textLabel.text = @"CFG_X_DENSITY"; + xDensityCell.detailTextLabel.tag = ZBAR_CFG_X_DENSITY; + xDensityCell.detailTextLabel.text = + [NSString stringWithFormat: @"%d", xDensity]; + + UITableViewCell *yDensityCell = + [[[UITableViewCell alloc] + initWithStyle: UITableViewCellStyleValue1 + reuseIdentifier: nil] + autorelease]; + yDensityCell.textLabel.text = @"CFG_Y_DENSITY"; + yDensityCell.detailTextLabel.tag = ZBAR_CFG_Y_DENSITY; + yDensityCell.detailTextLabel.text = + [NSString stringWithFormat: @"%d", yDensity]; + + UITableViewCell *cropCell = + [[[UITableViewCell alloc] + initWithStyle: UITableViewCellStyleValue1 + reuseIdentifier: nil] + autorelease]; + cropCell.textLabel.text = @"scanCrop"; + cropCell.detailTextLabel.text = NSStringFromCGRect(reader.scanCrop); + + UITableViewCell *zoomCell = + [[[UITableViewCell alloc] + initWithStyle: UITableViewCellStyleValue1 + reuseIdentifier: nil] + autorelease]; + zoomCell.textLabel.text = @"zoom"; + zoomCell.detailTextLabel.text = + [NSString stringWithFormat: @"%g", zoom]; + + [sections replaceObjectAtIndex: CUSTOM_SECTION + withObject: [NSArray arrayWithObjects: + xDensityCell, + yDensityCell, + cropCell, + zoomCell, + [self cellWithTitle: @"continuous" + tag: 1 + checked: continuous], + nil]]; + + static const zbar_symbol_type_t allSymbologies[] = { + ZBAR_QRCODE, ZBAR_CODE128, ZBAR_CODE93, ZBAR_CODE39, ZBAR_CODABAR, + ZBAR_I25, ZBAR_DATABAR, ZBAR_DATABAR_EXP, + ZBAR_EAN13, ZBAR_EAN8, + ZBAR_EAN2, ZBAR_EAN5, ZBAR_COMPOSITE, + ZBAR_UPCA, ZBAR_UPCE, + ZBAR_ISBN13, ZBAR_ISBN10, + 0 + }; + NSMutableArray *symbols = [NSMutableArray array]; + [symbolEnables release]; + symbolEnables = [NSMutableArray new]; + BOOL en = YES; + for(int i = 0; allSymbologies[i]; i++) { + zbar_symbol_type_t sym = allSymbologies[i]; + if(defaultSymbologies) + en = !![defaultSymbologies member: + [NSNumber numberWithInteger: sym]]; + else + /* symbologies after ZBAR_EAN5 are disabled by default */ + en = en && (sym != ZBAR_EAN2); + [symbols addObject: + [self cellWithTitle: [ZBarSymbol nameForType: sym] + tag: sym + checked: en]]; + [symbolEnables addObject: [NSNumber numberWithBool: en]]; + } + [sections replaceObjectAtIndex: SYMBOL_SECTION + withObject: symbols]; + + [self.tableView reloadData]; +} + +- (void) viewDidLoad +{ + [super viewDidLoad]; + + UITableView *view = self.tableView; + view.delegate = self; + view.dataSource = self; + + [self initOverlay]; + [self updateCropMask]; + + sections = [[NSMutableArray alloc] + initWithCapacity: NUM_SECTIONS]; + for(int i = 0; i < NUM_SECTIONS; i++) + [sections addObject: [NSNull null]]; + + NSArray *classes = + [NSArray arrayWithObjects: + [self cellWithTitle: @"ZBarReaderViewController" + tag: 0 + checked: YES], + [self cellWithTitle: @"ZBarReaderController" + tag: 1 + checked: NO], + nil]; + [sections replaceObjectAtIndex: CLASS_SECTION + withObject: classes]; + + UITableViewCell *typeCell = [UITableViewCell new]; + typeLabel = [typeCell.textLabel retain]; + UITableViewCell *dataCell = [UITableViewCell new]; + dataLabel = [dataCell.textLabel retain]; + dataLabel.numberOfLines = 0; + dataLabel.lineBreakMode = UILineBreakModeCharacterWrap; + UITableViewCell *imageCell = [UITableViewCell new]; + imageView = [UIImageView new]; + imageView.contentMode = UIViewContentModeScaleAspectFit; + imageView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | + UIViewAutoresizingFlexibleHeight); + UIView *content = imageCell.contentView; + imageView.frame = content.bounds; + [content addSubview: imageView]; + [imageView release]; + NSArray *results = + [NSArray arrayWithObjects: typeCell, dataCell, imageCell, nil]; + [sections replaceObjectAtIndex: RESULT_SECTION + withObject: results]; + + [self initControlCells]; +} + +- (void) viewDidUnload +{ + [sections release]; + sections = nil; + [symbolEnables release]; + symbolEnables = nil; + [manualBtn release]; + manualBtn = nil; + [typeLabel release]; + typeLabel = nil; + [dataLabel release]; + dataLabel = nil; + [imageView release]; + imageView = nil; + [typeOvl release]; + typeOvl = nil; + [dataOvl release]; + dataOvl = nil; + [overlay release]; + overlay = nil; + [masks release]; + masks = nil; + [super viewDidUnload]; +} + +- (void) dealloc +{ + [reader release]; + reader = nil; + [nav release]; + nav = nil; + [window release]; + window = nil; + [super dealloc]; +} + +- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) orient +{ + return(YES); +} + +- (void) scan +{ + found = paused = NO; + imageView.image = nil; + typeLabel.text = nil; + dataLabel.text = nil; + typeOvl.text = nil; + dataOvl.text = nil; + [self.tableView reloadData]; + if(reader.sourceType == UIImagePickerControllerSourceTypeCamera) + reader.cameraOverlayView = (reader.showsZBarControls) ? nil : overlay; + if([reader respondsToSelector: @selector(readerView)]) { + reader.readerView.showsFPS = YES; + if(zoom) + reader.readerView.zoom = zoom; + reader.supportedOrientationsMask = (reader.showsZBarControls) + ? ZBarOrientationMaskAll + : ZBarOrientationMask(UIInterfaceOrientationPortrait); // tmp disable + } + manualBtn.enabled = TARGET_IPHONE_SIMULATOR || + (reader.cameraMode == ZBarReaderControllerCameraModeDefault) || + [reader isKindOfClass: [ZBarReaderViewController class]]; + [self presentModalViewController: reader + animated: YES]; +} + +- (void) help +{ + ZBarHelpController *help = + [[ZBarHelpController alloc] + initWithReason: @"TEST"]; + [self presentModalViewController: help + animated: YES]; + [help release]; +} + +- (void) info +{ + [reader showHelpWithReason: @"INFO"]; +} + +- (void) pause +{ + if(![reader respondsToSelector: @selector(readerView)]) + return; + paused = !paused; + if(paused) + [reader.readerView stop]; + else + [reader.readerView start]; +} + +- (void) manualCapture +{ + [(UIImagePickerController*)reader takePicture]; +} + +// UINavigationControllerDelegate + +- (void) navigationController: (UINavigationController*) _nav + willShowViewController: (UIViewController*) vc + animated: (BOOL) animated +{ + self.navigationItem.leftBarButtonItem = + [[[UIBarButtonItem alloc] + initWithTitle: @"Help" + style: UIBarButtonItemStyleDone + target: self + action: @selector(help)] + autorelease]; + self.navigationItem.rightBarButtonItem = + [[[UIBarButtonItem alloc] + initWithTitle: @"Scan!" + style: UIBarButtonItemStyleDone + target: self + action: @selector(scan)] + autorelease]; +} + +// UITableViewDataSource + +- (NSInteger) numberOfSectionsInTableView: (UITableView*) view +{ + return(sections.count - !found); +} + +- (NSInteger) tableView: (UITableView*) view + numberOfRowsInSection: (NSInteger) idx +{ + NSArray *section = [sections objectAtIndex: idx]; + return(section.count); +} + +- (UITableViewCell*) tableView: (UITableView*) view + cellForRowAtIndexPath: (NSIndexPath*) path +{ + return([[sections objectAtIndex: path.section] + objectAtIndex: path.row]); +} + +- (NSString*) tableView: (UITableView*) view + titleForHeaderInSection: (NSInteger) idx +{ + assert(idx < NUM_SECTIONS); + return(section_titles[idx]); +} + +// UITableViewDelegate + +- (NSIndexPath*) tableView: (UITableView*) view + willSelectRowAtIndexPath: (NSIndexPath*) path +{ + if(path.section == RESULT_SECTION && path.row != 2) + return(nil); + return(path); +} + +- (void) alertUnsupported +{ + UIAlertView *alert = + [[UIAlertView alloc] + initWithTitle: @"Unsupported" + message: @"Setting not available for this reader" + @" (or with this OS on this device)" + delegate: nil + cancelButtonTitle: @"Cancel" + otherButtonTitles: nil]; + [alert show]; + [alert release]; +} + +- (void) advanceCrop: (UILabel*) label +{ + CGRect r = CGRectFromString(label.text); + int i; + for(i = 0; crop_choices[i].size.width;) + if(CGRectEqualToRect(r, crop_choices[i++])) + break; + if(!crop_choices[i].size.width) + i = 0; + r = crop_choices[i]; + reader.scanCrop = r; + label.text = NSStringFromCGRect(r); + + [self updateCropMask]; +} + +- (void) advanceZoom: (UILabel*) label +{ + int i; + for(i = 0; zoom_choices[i] >= 0;) + if(zoom == zoom_choices[i++]) + break; + if(zoom_choices[i] < 0) + i = 0; + zoom = zoom_choices[i]; + assert(zoom >= 0); + label.text = [NSString stringWithFormat: @"%g", zoom]; +} + +- (void) advanceDensity: (UILabel*) label + value: (NSInteger*) value +{ + NSInteger d = *value; + int i; + for(i = 0; density_choices[i] >= 0;) + if(d == density_choices[i++]) + break; + if(density_choices[i] < 0) + i = 0; + *value = d = density_choices[i]; + assert(d >= 0); + [reader.scanner setSymbology: 0 + config: label.tag + to: d]; + label.text = [NSString stringWithFormat: @"%d", d]; +} + +- (void) tableView: (UITableView*) view + didSelectRowAtIndexPath: (NSIndexPath*) path +{ + [view deselectRowAtIndexPath: path + animated: YES]; + + UITableViewCell *cell = [view cellForRowAtIndexPath: path]; + + switch(path.section) + { + case CLASS_SECTION: { + NSString *name = cell.textLabel.text; + [self initReader: name]; + [self updateCropMask]; + [self initControlCells]; + [self setCheckForName: name + inSection: CLASS_SECTION]; + break; + } + + case SOURCE_SECTION: + [self setCheckForTag: reader.sourceType = cell.tag + inSection: SOURCE_SECTION]; + break; + + case CAMODE_SECTION: + @try { + reader.cameraMode = cell.tag; + } + @catch (...) { + [self alertUnsupported]; + } + [self setCheckForTag: reader.cameraMode + inSection: CAMODE_SECTION]; + break; + + case DEVICE_SECTION: + reader.cameraDevice = cell.tag; + [self setCheckForTag: reader.cameraDevice + inSection: DEVICE_SECTION]; + break; + + case FLASH_SECTION: + reader.cameraFlashMode = cell.tag; + [self setCheckForTag: reader.cameraFlashMode + inSection: FLASH_SECTION]; + break; + + case QUALITY_SECTION: + reader.videoQuality = cell.tag; + [self setCheckForTag: reader.videoQuality + inSection: QUALITY_SECTION]; + break; + + case CONFIG_SECTION: { + BOOL state; + NSString *key = cell.textLabel.text; + state = ![[reader valueForKey: key] boolValue]; + @try { + [reader setValue: [NSNumber numberWithBool: state] + forKey: key]; + } + @catch (...) { + [self alertUnsupported]; + } + + // read back and update current state + state = [[reader valueForKey: key] boolValue]; + [self setCheck: state + forCell: cell]; + break; + } + + case CUSTOM_SECTION: + switch(path.row) + { + case 0: + [self advanceDensity: cell.detailTextLabel + value: &xDensity]; + break; + case 1: + [self advanceDensity: cell.detailTextLabel + value: &yDensity]; + break; + case 2: + [self advanceCrop: cell.detailTextLabel]; + break; + case 3: + [self advanceZoom: cell.detailTextLabel]; + break; + case 4: + [self setCheck: continuous = !continuous + forCell: cell]; + break; + default: + assert(0); + } + break; + + case SYMBOL_SECTION: { + BOOL state = ![[symbolEnables objectAtIndex: path.row] boolValue]; + [symbolEnables replaceObjectAtIndex: path.row + withObject: [NSNumber numberWithBool: state]]; + [reader.scanner setSymbology: cell.tag + config: ZBAR_CFG_ENABLE + to: state]; + [self setCheck: state + forCell: cell]; + break; + } + case RESULT_SECTION: + if(path.row == 2) + [[[[UIActionSheet alloc] + initWithTitle: nil + delegate: self + cancelButtonTitle: @"Cancel" + destructiveButtonTitle: nil + otherButtonTitles: @"Save Image", nil] + autorelease] + showInView: self.view]; + break; + default: + assert(0); + } +} + +- (CGFloat) tableView: (UITableView*) view + heightForRowAtIndexPath: (NSIndexPath*) path +{ + if(path.section < RESULT_SECTION) + return(44); + + switch(path.row) { + case 0: return(44); + case 1: return(dataHeight); + case 2: return(300); + default: assert(0); + } + return(44); +} + +// UIActionSheetDelegate + +- (void) actionSheet: (UIActionSheet*) sheet + clickedButtonAtIndex: (NSInteger) idx +{ + if(idx == sheet.cancelButtonIndex) + return; + idx -= sheet.firstOtherButtonIndex; + if(!idx) { + UIImage *img = + [UIImage imageWithData: + UIImagePNGRepresentation(imageView.image)]; + UIImageWriteToSavedPhotosAlbum(img, nil, NULL, NULL); + } +} + +// ZBarReaderDelegate + +- (void) imagePickerController: (UIImagePickerController*) picker + didFinishPickingMediaWithInfo: (NSDictionary*) info +{ + id results = + [info objectForKey: ZBarReaderControllerResults]; + assert(results); + + UIImage *image = [info objectForKey: UIImagePickerControllerOriginalImage]; + assert(image); + if(image) + imageView.image = image; + + int quality = 0; + ZBarSymbol *bestResult = nil; + for(ZBarSymbol *sym in results) { + int q = sym.quality; + if(quality < q) { + quality = q; + bestResult = sym; + } + } + + [self performSelector: @selector(presentResult:) + withObject: bestResult + afterDelay: .001]; + if(!continuous) + [picker dismissModalViewControllerAnimated: YES]; +} + +- (void) presentResult: (ZBarSymbol*) sym +{ + found = sym || imageView.image; + NSString *typeName = @"NONE"; + NSString *data = @""; + if(sym) { + typeName = sym.typeName; + data = sym.data; + } + typeLabel.text = typeName; + dataLabel.text = data; + + if(continuous) { + typeOvl.text = typeName; + dataOvl.text = data; + } + + NSLog(@"imagePickerController:didFinishPickingMediaWithInfo:\n"); + NSLog(@" type=%@ data=%@\n", typeName, data); + + CGSize size = [data sizeWithFont: [UIFont systemFontOfSize: 17] + constrainedToSize: CGSizeMake(288, 2000) + lineBreakMode: UILineBreakModeCharacterWrap]; + dataHeight = size.height + 26; + if(dataHeight > 2000) + dataHeight = 2000; + + [self.tableView reloadData]; + [self.tableView scrollToRowAtIndexPath: + [NSIndexPath indexPathForRow: 0 + inSection: RESULT_SECTION] + atScrollPosition:UITableViewScrollPositionTop + animated: NO]; +} + +- (void) imagePickerControllerDidCancel: (UIImagePickerController*) picker +{ + NSLog(@"imagePickerControllerDidCancel:\n"); + [reader dismissModalViewControllerAnimated: YES]; +} + +- (void) readerControllerDidFailToRead: (ZBarReaderController*) _reader + withRetry: (BOOL) retry +{ + NSLog(@"readerControllerDidFailToRead: retry=%s\n", + (retry) ? "YES" : "NO"); + if(!retry) + [_reader dismissModalViewControllerAnimated: YES]; +} + +@end + + +int main (int argc, char *argv[]) +{ + NSAutoreleasePool *pool = [NSAutoreleasePool new]; + int rc = UIApplicationMain(argc, argv, nil, @"AppDelegate"); + [pool release]; + return(rc); +} diff --git a/iphone/examples/readertest/readertest.plist b/iphone/examples/readertest/readertest.plist new file mode 100644 index 0000000..62a8126 --- /dev/null +++ b/iphone/examples/readertest/readertest.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + net.sourceforge.zbar.test.readertest + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + + diff --git a/iphone/examples/readertest/readertest.xcodeproj/project.pbxproj b/iphone/examples/readertest/readertest.xcodeproj/project.pbxproj new file mode 100644 index 0000000..5d30670 --- /dev/null +++ b/iphone/examples/readertest/readertest.xcodeproj/project.pbxproj @@ -0,0 +1,351 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXBuildFile section */ + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; + 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; }; + DC48C4D61219E5F70047193B /* libzbar.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DC48C4D01219E5F70047193B /* libzbar.a */; }; + DC48C4D71219E5F70047193B /* zbar-back.png in Resources */ = {isa = PBXBuildFile; fileRef = DC48C4D21219E5F70047193B /* zbar-back.png */; }; + DC48C4D81219E5F70047193B /* zbar-help.html in Resources */ = {isa = PBXBuildFile; fileRef = DC48C4D31219E5F70047193B /* zbar-help.html */; }; + DC48C4D91219E5F70047193B /* zbar-helpicons.png in Resources */ = {isa = PBXBuildFile; fileRef = DC48C4D41219E5F70047193B /* zbar-helpicons.png */; }; + DC48C4DA1219E5F70047193B /* zbar-samples.png in Resources */ = {isa = PBXBuildFile; fileRef = DC48C4D51219E5F70047193B /* zbar-samples.png */; }; + DC824600162B568A0010B2E6 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DC8245FF162B568A0010B2E6 /* Default-568h@2x.png */; }; + DCB9118510BC5DA200B907F0 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCB9118410BC5DA200B907F0 /* QuartzCore.framework */; }; + DCB9118810BC5DB500B907F0 /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = DCD6E13B10B0AFD4002005CD /* libiconv.dylib */; }; + DCD6E0D010B0AD41002005CD /* readertest.m in Sources */ = {isa = PBXBuildFile; fileRef = DCD6E0CF10B0AD41002005CD /* readertest.m */; }; + DCDC6D9B11ACA23000021380 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCDC6D9A11ACA23000021380 /* CoreVideo.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + DCDC6D9F11ACA23900021380 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCDC6D9E11ACA23900021380 /* CoreMedia.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + DCDC6DEC11ACA5B400021380 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCDC6DEB11ACA5B400021380 /* AVFoundation.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 1D6058910D05DD3D006BFB54 /* readertest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = readertest.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + DC48C4BE1219E5F70047193B /* Decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decoder.h; sourceTree = ""; }; + DC48C4BF1219E5F70047193B /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Exception.h; sourceTree = ""; }; + DC48C4C01219E5F70047193B /* Image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Image.h; sourceTree = ""; }; + DC48C4C11219E5F70047193B /* ImageScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageScanner.h; sourceTree = ""; }; + DC48C4C21219E5F70047193B /* Processor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Processor.h; sourceTree = ""; }; + DC48C4C31219E5F70047193B /* Scanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Scanner.h; sourceTree = ""; }; + DC48C4C41219E5F70047193B /* Symbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Symbol.h; sourceTree = ""; }; + DC48C4C51219E5F70047193B /* Video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Video.h; sourceTree = ""; }; + DC48C4C61219E5F70047193B /* Window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Window.h; sourceTree = ""; }; + DC48C4C71219E5F70047193B /* zbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zbar.h; sourceTree = ""; }; + DC48C4C81219E5F70047193B /* ZBarCaptureReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarCaptureReader.h; sourceTree = ""; }; + DC48C4C91219E5F70047193B /* ZBarImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarImage.h; sourceTree = ""; }; + DC48C4CA1219E5F70047193B /* ZBarImageScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarImageScanner.h; sourceTree = ""; }; + DC48C4CB1219E5F70047193B /* ZBarReaderController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarReaderController.h; sourceTree = ""; }; + DC48C4CC1219E5F70047193B /* ZBarReaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarReaderView.h; sourceTree = ""; }; + DC48C4CD1219E5F70047193B /* ZBarReaderViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarReaderViewController.h; sourceTree = ""; }; + DC48C4CE1219E5F70047193B /* ZBarSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarSDK.h; sourceTree = ""; }; + DC48C4CF1219E5F70047193B /* ZBarSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarSymbol.h; sourceTree = ""; }; + DC48C4D01219E5F70047193B /* libzbar.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libzbar.a; sourceTree = ""; }; + DC48C4D21219E5F70047193B /* zbar-back.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zbar-back.png"; sourceTree = ""; }; + DC48C4D31219E5F70047193B /* zbar-help.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "zbar-help.html"; sourceTree = ""; }; + DC48C4D41219E5F70047193B /* zbar-helpicons.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zbar-helpicons.png"; sourceTree = ""; }; + DC48C4D51219E5F70047193B /* zbar-samples.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zbar-samples.png"; sourceTree = ""; }; + DC8245FF162B568A0010B2E6 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; + DCB9118410BC5DA200B907F0 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + DCD6E0CE10B0AD41002005CD /* prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = prefix.pch; sourceTree = ""; }; + DCD6E0CF10B0AD41002005CD /* readertest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = readertest.m; sourceTree = ""; }; + DCD6E0D810B0AD55002005CD /* readertest.plist */ = {isa = PBXFileReference; explicitFileType = text.plist.info; fileEncoding = 4; path = readertest.plist; sourceTree = ""; }; + DCD6E13B10B0AFD4002005CD /* libiconv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.dylib; path = usr/lib/libiconv.dylib; sourceTree = SDKROOT; }; + DCDC6D9A11ACA23000021380 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; + DCDC6D9E11ACA23900021380 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; + DCDC6DEB11ACA5B400021380 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, + 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */, + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, + DCB9118510BC5DA200B907F0 /* QuartzCore.framework in Frameworks */, + DCDC6DEC11ACA5B400021380 /* AVFoundation.framework in Frameworks */, + DCDC6D9F11ACA23900021380 /* CoreMedia.framework in Frameworks */, + DCDC6D9B11ACA23000021380 /* CoreVideo.framework in Frameworks */, + DCB9118810BC5DB500B907F0 /* libiconv.dylib in Frameworks */, + DC48C4D61219E5F70047193B /* libzbar.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 1D6058910D05DD3D006BFB54 /* readertest.app */, + ); + name = Products; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { + isa = PBXGroup; + children = ( + DCD6E0CE10B0AD41002005CD /* prefix.pch */, + DCD6E0CF10B0AD41002005CD /* readertest.m */, + DC48C4BA1219E5F70047193B /* ZBarSDK */, + DC3CEAC61209C07400D7A786 /* Resources */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = CustomTemplate; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 1D30AB110D05D00D00671497 /* Foundation.framework */, + 288765FC0DF74451002DB57D /* CoreGraphics.framework */, + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, + DCB9118410BC5DA200B907F0 /* QuartzCore.framework */, + DCDC6DEB11ACA5B400021380 /* AVFoundation.framework */, + DCDC6D9A11ACA23000021380 /* CoreVideo.framework */, + DCDC6D9E11ACA23900021380 /* CoreMedia.framework */, + DCD6E13B10B0AFD4002005CD /* libiconv.dylib */, + ); + name = Frameworks; + sourceTree = ""; + }; + DC3CEAC61209C07400D7A786 /* Resources */ = { + isa = PBXGroup; + children = ( + DCD6E0D810B0AD55002005CD /* readertest.plist */, + DC8245FF162B568A0010B2E6 /* Default-568h@2x.png */, + ); + name = Resources; + sourceTree = ""; + }; + DC48C4BA1219E5F70047193B /* ZBarSDK */ = { + isa = PBXGroup; + children = ( + DC48C4BB1219E5F70047193B /* Headers */, + DC48C4D01219E5F70047193B /* libzbar.a */, + DC48C4D11219E5F70047193B /* Resources */, + ); + path = ZBarSDK; + sourceTree = ""; + }; + DC48C4BB1219E5F70047193B /* Headers */ = { + isa = PBXGroup; + children = ( + DC48C4BC1219E5F70047193B /* ZBarSDK */, + ); + path = Headers; + sourceTree = ""; + }; + DC48C4BC1219E5F70047193B /* ZBarSDK */ = { + isa = PBXGroup; + children = ( + DC48C4BD1219E5F70047193B /* zbar */, + DC48C4C71219E5F70047193B /* zbar.h */, + DC48C4C81219E5F70047193B /* ZBarCaptureReader.h */, + DC48C4C91219E5F70047193B /* ZBarImage.h */, + DC48C4CA1219E5F70047193B /* ZBarImageScanner.h */, + DC48C4CB1219E5F70047193B /* ZBarReaderController.h */, + DC48C4CC1219E5F70047193B /* ZBarReaderView.h */, + DC48C4CD1219E5F70047193B /* ZBarReaderViewController.h */, + DC48C4CE1219E5F70047193B /* ZBarSDK.h */, + DC48C4CF1219E5F70047193B /* ZBarSymbol.h */, + ); + path = ZBarSDK; + sourceTree = ""; + }; + DC48C4BD1219E5F70047193B /* zbar */ = { + isa = PBXGroup; + children = ( + DC48C4BE1219E5F70047193B /* Decoder.h */, + DC48C4BF1219E5F70047193B /* Exception.h */, + DC48C4C01219E5F70047193B /* Image.h */, + DC48C4C11219E5F70047193B /* ImageScanner.h */, + DC48C4C21219E5F70047193B /* Processor.h */, + DC48C4C31219E5F70047193B /* Scanner.h */, + DC48C4C41219E5F70047193B /* Symbol.h */, + DC48C4C51219E5F70047193B /* Video.h */, + DC48C4C61219E5F70047193B /* Window.h */, + ); + path = zbar; + sourceTree = ""; + }; + DC48C4D11219E5F70047193B /* Resources */ = { + isa = PBXGroup; + children = ( + DC48C4D21219E5F70047193B /* zbar-back.png */, + DC48C4D31219E5F70047193B /* zbar-help.html */, + DC48C4D41219E5F70047193B /* zbar-helpicons.png */, + DC48C4D51219E5F70047193B /* zbar-samples.png */, + ); + path = Resources; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 1D6058900D05DD3D006BFB54 /* readertest */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "readertest" */; + buildPhases = ( + 1D60588D0D05DD3D006BFB54 /* Resources */, + 1D60588E0D05DD3D006BFB54 /* Sources */, + 1D60588F0D05DD3D006BFB54 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = readertest; + productName = readertest; + productReference = 1D6058910D05DD3D006BFB54 /* readertest.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "readertest" */; + compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + ); + mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 1D6058900D05DD3D006BFB54 /* readertest */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 1D60588D0D05DD3D006BFB54 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DC48C4D71219E5F70047193B /* zbar-back.png in Resources */, + DC48C4D81219E5F70047193B /* zbar-help.html in Resources */, + DC48C4D91219E5F70047193B /* zbar-helpicons.png in Resources */, + DC48C4DA1219E5F70047193B /* zbar-samples.png in Resources */, + DC824600162B568A0010B2E6 /* Default-568h@2x.png in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 1D60588E0D05DD3D006BFB54 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DCD6E0D010B0AD41002005CD /* readertest.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1D6058940D05DD3E006BFB54 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = prefix.pch; + INFOPLIST_FILE = readertest.plist; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/ZBarSDK\"", + ); + PRODUCT_NAME = readertest; + }; + name = Debug; + }; + 1D6058950D05DD3E006BFB54 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = prefix.pch; + INFOPLIST_FILE = readertest.plist; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/ZBarSDK\"", + ); + PRODUCT_NAME = readertest; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 3.1; + OTHER_LDFLAGS = "-all_load"; + PREBINDING = NO; + SDKROOT = iphoneos; + SYMROOT = /tmp/readertest.build; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 3.1; + OTHER_LDFLAGS = "-all_load"; + PREBINDING = NO; + SDKROOT = iphoneos; + SYMROOT = /tmp/readertest.build; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "readertest" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1D6058940D05DD3E006BFB54 /* Debug */, + 1D6058950D05DD3E006BFB54 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "readertest" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/iphone/examples/readertest/readertest.xcodeproj/xcshareddata/xcschemes/readertest.xcscheme b/iphone/examples/readertest/readertest.xcodeproj/xcshareddata/xcschemes/readertest.xcscheme new file mode 100644 index 0000000..9264466 --- /dev/null +++ b/iphone/examples/readertest/readertest.xcodeproj/xcshareddata/xcschemes/readertest.xcscheme @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iphone/include/ZBarSDK/ZBarCameraSimulator.h b/iphone/include/ZBarSDK/ZBarCameraSimulator.h new file mode 100644 index 0000000..7351d92 --- /dev/null +++ b/iphone/include/ZBarSDK/ZBarCameraSimulator.h @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------ +// Copyright 2010-2011 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +@class ZBarReaderView; + +// hack around missing simulator support for AVCapture interfaces + +@interface ZBarCameraSimulator + : NSObject { + UIViewController *viewController; + ZBarReaderView *readerView; + UIImagePickerController *picker; + UIPopoverController *pickerPopover; +} + +- (id)initWithViewController:(UIViewController *)viewController; +- (void)takePicture; + +@property (nonatomic, assign) ZBarReaderView *readerView; + +@end diff --git a/iphone/include/ZBarSDK/ZBarCaptureReader.h b/iphone/include/ZBarSDK/ZBarCaptureReader.h new file mode 100644 index 0000000..e496819 --- /dev/null +++ b/iphone/include/ZBarSDK/ZBarCaptureReader.h @@ -0,0 +1,109 @@ +//------------------------------------------------------------------------ +// Copyright 2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import "ZBarImageScanner.h" + +@class AVCaptureVideoDataOutput, AVCaptureOutput; +@class ZBarCaptureReader, ZBarCVImage; + +@protocol ZBarCaptureDelegate + +// called when a new barcode is detected. the image refers to the +// video buffer and must not be retained for long +- (void)captureReader:(ZBarCaptureReader *)captureReader + didReadNewSymbolsFromImage:(ZBarImage *)image; + +@optional +// called when a potential/uncertain barcode is detected. will also +// be called *after* captureReader:didReadNewSymbolsFromImage: +// when good barcodes are detected +- (void)captureReader:(ZBarCaptureReader *)captureReader + didTrackSymbols:(ZBarSymbolSet *)symbols; + +@end + +@interface ZBarCaptureReader : NSObject { +#if !TARGET_IPHONE_SIMULATOR + AVCaptureVideoDataOutput *captureOutput; + id captureDelegate; + ZBarImageScanner *scanner; + CGRect scanCrop; + CGSize size; + CGFloat framesPerSecond; + BOOL enableCache; + + dispatch_queue_t queue; + ZBarImage *image; + ZBarCVImage *result; + volatile uint32_t state; + int framecnt; + unsigned width, height; + uint64_t t_frame, t_fps, t_scan; + CGFloat dt_frame; +#endif +} + +// supply a pre-configured image scanner +- (id)initWithImageScanner:(ZBarImageScanner *)imageScanner; + +// this must be called before the session is started +- (void)willStartRunning; + +// this must be called *before* the session is stopped +- (void)willStopRunning; + +// clear the internal result cache +- (void)flushCache; + +// capture the next frame after processing. the captured image will +// follow the same delegate path as an image with decoded symbols. +- (void)captureFrame; + +// the capture output. add this to an instance of AVCaptureSession +@property (nonatomic, readonly) AVCaptureOutput *captureOutput; + +// delegate is notified of decode results and symbol tracking. +@property (nonatomic, assign) id captureDelegate; + +// access to image scanner for configuration. +@property (nonatomic, readonly) ZBarImageScanner *scanner; + +// region of image to scan in normalized coordinates. +// NB horizontal crop currently ignored... +@property (nonatomic, assign) CGRect scanCrop; + +// size of video frames. +@property (nonatomic, readonly) CGSize size; + +// (quickly) gate the reader function without interrupting the video +// stream. also flushes the cache when enabled. defaults to *NO* +@property (nonatomic) BOOL enableReader; + +// current frame rate (for debug/optimization). +// only valid when running +@property (nonatomic, readonly) CGFloat framesPerSecond; + +@property (nonatomic) BOOL enableCache; + +@end diff --git a/iphone/include/ZBarSDK/ZBarHelpController.h b/iphone/include/ZBarSDK/ZBarHelpController.h new file mode 100644 index 0000000..1733ebd --- /dev/null +++ b/iphone/include/ZBarSDK/ZBarHelpController.h @@ -0,0 +1,59 @@ +//------------------------------------------------------------------------ +// Copyright 2009-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import + +@class ZBarHelpController; + +@protocol ZBarHelpDelegate +@optional + +- (void)helpControllerDidFinish:(ZBarHelpController *)help; + +@end + +// failure dialog w/a few useful tips + +@interface ZBarHelpController + : UIViewController { + NSString *reason; + id delegate; + WKWebView *webView; + UIToolbar *toolbar; + UIBarButtonItem *doneBtn, *backBtn, *space; + NSURL *linkURL; + NSUInteger orientations; + UIView *controls; +} + +@property (nonatomic, assign) id delegate; + +// designated initializer +- (id)initWithReason:(NSString *)reason; + +- (BOOL)isInterfaceOrientationSupported:(UIInterfaceOrientation)orientation; +- (void)setInterfaceOrientation:(UIInterfaceOrientation)orientation + supported:(BOOL)supported; + +@end diff --git a/iphone/include/ZBarSDK/ZBarImage.h b/iphone/include/ZBarSDK/ZBarImage.h new file mode 100644 index 0000000..5a9e5bc --- /dev/null +++ b/iphone/include/ZBarSDK/ZBarImage.h @@ -0,0 +1,64 @@ +//------------------------------------------------------------------------ +// Copyright 2009 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import "zbar.h" +#import "ZBarSymbol.h" + +#ifdef __cplusplus +using namespace zbar; +#endif + +// Obj-C wrapper for ZBar image + +@interface ZBarImage : NSObject { + zbar_image_t *zimg; + double t_convert; +} + +@property (nonatomic) unsigned long format; +@property (nonatomic) unsigned sequence; +@property (nonatomic) CGSize size; +@property (nonatomic) CGRect crop; +@property (readonly, nonatomic) const void *data; +@property (readonly, nonatomic) unsigned long dataLength; +@property (copy, nonatomic) ZBarSymbolSet *symbols; +@property (readonly, nonatomic) zbar_image_t *zbarImage; +@property (readonly, nonatomic) UIImage *UIImage; + +- (id)initWithImage:(zbar_image_t *)image; +- (id)initWithCGImage:(CGImageRef)image; +- (id)initWithCGImage:(CGImageRef)image size:(CGSize)size; +- (id)initWithCGImage:(CGImageRef)image crop:(CGRect)crop size:(CGSize)size; + +- (void)setData:(const void *)data withLength:(unsigned long)length; +- (UIImage *)UIImageWithOrientation:(UIImageOrientation)imageOrientation; +- (void)cleanup; + ++ (unsigned long)fourcc:(NSString *)format; + +#if 0 +- convertToFormat: (unsigned long) format; +#endif + +@end diff --git a/iphone/include/ZBarSDK/ZBarImageScanner.h b/iphone/include/ZBarSDK/ZBarImageScanner.h new file mode 100644 index 0000000..c3ce1a9 --- /dev/null +++ b/iphone/include/ZBarSDK/ZBarImageScanner.h @@ -0,0 +1,50 @@ +//------------------------------------------------------------------------ +// Copyright 2009 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import "zbar.h" +#import "ZBarImage.h" + +#ifdef __cplusplus +using namespace zbar; +#endif + +// Obj-C wrapper for ZBar image scanner + +@interface ZBarImageScanner : NSObject { + zbar_image_scanner_t *scanner; +} + +@property (nonatomic) BOOL enableCache; +@property (readonly, nonatomic) ZBarSymbolSet *results; + +// decoder configuration +- (void)parseConfig:(NSString *)configStr; +- (void)setSymbology:(zbar_symbol_type_t)symbology + config:(zbar_config_t)config + to:(int)value; + +// image scanning interface +- (NSInteger)scanImage:(ZBarImage *)image; + +@end diff --git a/iphone/include/ZBarSDK/ZBarReaderController.h b/iphone/include/ZBarSDK/ZBarReaderController.h new file mode 100644 index 0000000..84015b1 --- /dev/null +++ b/iphone/include/ZBarSDK/ZBarReaderController.h @@ -0,0 +1,139 @@ +//------------------------------------------------------------------------ +// Copyright 2009-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import "ZBarImageScanner.h" + +#ifdef __cplusplus +using namespace zbar; +#endif + +typedef enum +{ + // default interface provided by UIImagePickerController - user manually + // captures an image by pressing a button + ZBarReaderControllerCameraModeDefault = 0, + + // automatically scan by taking screenshots with UIGetScreenImage(). + // resolution is limited by the screen, so this is inappropriate for + // longer codes + ZBarReaderControllerCameraModeSampling, + + // automatically scan by rapidly taking pictures with takePicture. + // tradeoff resolution with frame rate by adjusting the crop, and size + // properties of the reader along with the density configs of the image + // scanner + ZBarReaderControllerCameraModeSequence, + +} ZBarReaderControllerCameraMode; + +@class ZBarReaderController, ZBarHelpController; + +@protocol ZBarReaderDelegate +@optional + +// called when no barcode is found in an image selected by the user. +// if retry is NO, the delegate *must* dismiss the controller +- (void)readerControllerDidFailToRead:(ZBarReaderController *)reader + withRetry:(BOOL)retry; + +@end + +@interface ZBarReaderController + : UIImagePickerController { + ZBarImageScanner *scanner; + ZBarHelpController *help; + UIView *overlay, *boxView; + CALayer *boxLayer; + + UIToolbar *toolbar; + UIBarButtonItem *cancelBtn, *scanBtn, *space[3]; + UIButton *infoBtn; + + id readerDelegate; + BOOL showsZBarControls, showsHelpOnFail, takesPicture, enableCache; + ZBarReaderControllerCameraMode cameraMode; + CGRect scanCrop; + NSInteger maxScanDimension; + + BOOL hasOverlay, sampling; + uint64_t t_frame; + double dt_frame; + + ZBarSymbol *symbol; +} + +// access to configure image scanner +@property (readonly, nonatomic) ZBarImageScanner *scanner; + +// barcode result recipient (NB don't use delegate) +@property (nonatomic, assign) id readerDelegate; + +// whether to use alternate control set +@property (nonatomic) BOOL showsZBarControls; + +// whether to display helpful information when decoding fails +@property (nonatomic) BOOL showsHelpOnFail; + +// how to use the camera (when sourceType == Camera) +@property (nonatomic) ZBarReaderControllerCameraMode cameraMode; + +// whether to outline symbols with the green tracking box. +@property (nonatomic) BOOL tracksSymbols; + +// whether to automatically take a full picture when a barcode is detected +// (when cameraMode == Sampling) +@property (nonatomic) BOOL takesPicture; + +// whether to use the "cache" for realtime modes (default YES). this can be +// used to safely disable the inter-frame consistency and duplicate checks, +// speeding up recognition, iff: +// 1. the controller is dismissed when a barcode is read and +// 2. unreliable symbologies are disabled (all EAN/UPC variants and I2/5) +@property (nonatomic) BOOL enableCache; + +// crop images for scanning. the original image will be cropped to this +// rectangle before scanning. the rectangle is normalized to the image size +// and aspect ratio; useful values will place the rectangle between 0 and 1 +// on each axis, where the x-axis corresponds to the image major axis. +// defaults to the full image (0, 0, 1, 1). +@property (nonatomic) CGRect scanCrop; + +// scale image to scan. after cropping, the image will be scaled if +// necessary, such that neither of its dimensions exceed this value. +// defaults to 640. +@property (nonatomic) NSInteger maxScanDimension; + +// display the built-in help browser. for use with custom overlays if +// you don't also want to create your own help view. only send this +// message when the reader is displayed. the argument will be passed +// to the onZBarHelp() javascript function. +- (void)showHelpWithReason:(NSString *)reason; + +// direct scanner interface - scan UIImage and return something enumerable +- (id)scanImage:(CGImageRef)image; + +@end + +extern NSString *const ZBarReaderControllerResults; diff --git a/iphone/include/ZBarSDK/ZBarReaderView.h b/iphone/include/ZBarSDK/ZBarReaderView.h new file mode 100644 index 0000000..f07878b --- /dev/null +++ b/iphone/include/ZBarSDK/ZBarReaderView.h @@ -0,0 +1,137 @@ +//------------------------------------------------------------------------ +// Copyright 2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import "ZBarImageScanner.h" + +@class AVCaptureSession, AVCaptureDevice; +@class CALayer; +@class ZBarImageScanner, ZBarCaptureReader, ZBarReaderView; + +// delegate is notified of decode results. + +@protocol ZBarReaderViewDelegate + +- (void)readerView:(ZBarReaderView *)readerView + didReadSymbols:(ZBarSymbolSet *)symbols + fromImage:(UIImage *)image; + +@optional +- (void)readerViewDidStart:(ZBarReaderView *)readerView; +- (void)readerView:(ZBarReaderView *)readerView + didStopWithError:(NSError *)error; + +@end + +// read barcodes from the displayed video preview. the view maintains +// a complete video capture session feeding a ZBarCaptureReader and +// presents the associated preview with symbol tracking annotations. + +@interface ZBarReaderView : UIView { + id readerDelegate; + ZBarCaptureReader *captureReader; + CGRect scanCrop, effectiveCrop; + CGAffineTransform previewTransform; + CGFloat zoom, zoom0, maxZoom; + UIColor *trackingColor; + BOOL tracksSymbols, showsFPS; + NSInteger torchMode; + UIInterfaceOrientation interfaceOrientation; + NSTimeInterval animationDuration; + + CALayer *preview, *overlay, *tracking, *cropLayer; + UIView *fpsView; + UILabel *fpsLabel; + UIPinchGestureRecognizer *pinch; + CGFloat imageScale; + CGSize imageSize; + BOOL started, running, locked; +} + +// supply a pre-configured image scanner. +- (id)initWithImageScanner:(ZBarImageScanner *)imageScanner; + +// start the video stream and barcode reader. +- (void)start; + +// stop the video stream and barcode reader. +- (void)stop; + +// clear the internal result cache +- (void)flushCache; + +// compensate for device/camera/interface orientation +- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orient + duration:(NSTimeInterval)duration; + +// delegate is notified of decode results. +@property (nonatomic, assign) id readerDelegate; + +// access to image scanner for configuration. +@property (nonatomic, readonly) ZBarImageScanner *scanner; + +// whether to display the tracking annotation for uncertain barcodes +// (default YES). +@property (nonatomic) BOOL tracksSymbols; + +// color of the tracking box (default green) +@property (nonatomic, retain) UIColor *trackingColor; + +// enable pinch gesture recognition for zooming the preview/decode +// (default YES). +@property (nonatomic) BOOL allowsPinchZoom; + +// torch mode to set automatically (default Auto). +@property (nonatomic) NSInteger torchMode; + +// whether to display the frame rate for debug/configuration +// (default NO). +@property (nonatomic) BOOL showsFPS; + +// zoom scale factor applied to video preview *and* scanCrop. +// also updated by pinch-zoom gesture. clipped to range [1,maxZoom], +// defaults to 1.25 +@property (nonatomic) CGFloat zoom; +- (void)setZoom:(CGFloat)zoom animated:(BOOL)animated; + +// maximum settable zoom factor. +@property (nonatomic) CGFloat maxZoom; + +// the region of the image that will be scanned. normalized coordinates. +@property (nonatomic) CGRect scanCrop; + +// additional transform applied to video preview. +// (NB *not* applied to scan crop) +@property (nonatomic) CGAffineTransform previewTransform; + +// specify an alternate capture device. +@property (nonatomic, retain) AVCaptureDevice *device; + +// direct access to the capture session. warranty void if opened... +@property (nonatomic, readonly) AVCaptureSession *session; +@property (nonatomic, readonly) ZBarCaptureReader *captureReader; + +// this flag still works, but its use is deprecated +@property (nonatomic) BOOL enableCache; + +@end diff --git a/iphone/include/ZBarSDK/ZBarReaderViewController.h b/iphone/include/ZBarSDK/ZBarReaderViewController.h new file mode 100644 index 0000000..643ff1e --- /dev/null +++ b/iphone/include/ZBarSDK/ZBarReaderViewController.h @@ -0,0 +1,132 @@ +//------------------------------------------------------------------------ +// Copyright 2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import "ZBarReaderController.h" + +// orientation set support +#define ZBarOrientationMask(orient) (1 << orient) +#define ZBarOrientationMaskAll \ + (ZBarOrientationMask(UIInterfaceOrientationPortrait) | \ + ZBarOrientationMask(UIInterfaceOrientationPortraitUpsideDown) | \ + ZBarOrientationMask(UIInterfaceOrientationLandscapeLeft) | \ + ZBarOrientationMask(UIInterfaceOrientationLandscapeRight)) + +@class ZBarReaderView, ZBarCameraSimulator; + +// drop in video scanning replacement for ZBarReaderController. +// this is a thin controller around a ZBarReaderView that adds the UI +// controls and select functionality offered by ZBarReaderController. +// Automatically falls back to a ZBarReaderController if video APIs +// are unavailable (eg for OS < 4.0) + +@interface ZBarReaderViewController : UIViewController { + ZBarImageScanner *scanner; + id readerDelegate; + ZBarReaderView *readerView; + UIView *cameraOverlayView; + CGAffineTransform cameraViewTransform; + CGRect scanCrop; + NSUInteger supportedOrientationsMask; + UIImagePickerControllerCameraDevice cameraDevice; + UIImagePickerControllerCameraFlashMode cameraFlashMode; + UIImagePickerControllerQualityType videoQuality; + BOOL showsZBarControls, tracksSymbols, enableCache; + + ZBarHelpController *helpController; + UIView *controls, *shutter; + BOOL didHideStatusBar, rotating; + ZBarCameraSimulator *cameraSim; +} + +// access to configure image scanner +@property (nonatomic, readonly) ZBarImageScanner *scanner; + +// barcode result recipient +@property (nonatomic, assign) id readerDelegate; + +// whether to use alternate control set +@property (nonatomic) BOOL showsZBarControls; + +// whether to show the green tracking box. note that, even when +// enabled, the box will only be visible when scanning EAN and I2/5. +@property (nonatomic) BOOL tracksSymbols; + +// interface orientation support. bit-mask of accepted orientations. +// see eg ZBarOrientationMask() and ZBarOrientationMaskAll +@property (nonatomic) NSUInteger supportedOrientationsMask; + +// crop images for scanning. the image will be cropped to this +// rectangle before scanning. the rectangle is normalized to the +// image size and aspect ratio; useful values will place the rectangle +// between 0 and 1 on each axis, where the x-axis corresponds to the +// image major axis. defaults to the full image (0, 0, 1, 1). +@property (nonatomic) CGRect scanCrop; + +// provide a custom overlay. note that this can be used with +// showsZBarControls enabled (but not if you want backward compatibility) +@property (nonatomic, retain) UIView *cameraOverlayView; + +// transform applied to the preview image. +@property (nonatomic) CGAffineTransform cameraViewTransform; + +// display the built-in help browser. the argument will be passed to +// the onZBarHelp() javascript function. +- (void)showHelpWithReason:(NSString *)reason; + +// capture the next frame and send it over the usual delegate path. +- (void)takePicture; + +// these attempt to emulate UIImagePickerController ++ (BOOL)isCameraDeviceAvailable: + (UIImagePickerControllerCameraDevice)cameraDevice; ++ (BOOL)isFlashAvailableForCameraDevice: + (UIImagePickerControllerCameraDevice)cameraDevice; ++ (NSArray *)availableCaptureModesForCameraDevice: + (UIImagePickerControllerCameraDevice)cameraDevice; +@property (nonatomic) UIImagePickerControllerCameraDevice cameraDevice; +@property (nonatomic) UIImagePickerControllerCameraFlashMode cameraFlashMode; +@property (nonatomic) + UIImagePickerControllerCameraCaptureMode cameraCaptureMode; +@property (nonatomic) UIImagePickerControllerQualityType videoQuality; + +// direct access to the ZBarReaderView +@property (nonatomic, readonly) ZBarReaderView *readerView; + +// this flag still works, but its use is deprecated +@property (nonatomic) BOOL enableCache; + +// these are present only for backward compatibility. +// they will error if inappropriate/unsupported values are set +@property (nonatomic) UIImagePickerControllerSourceType sourceType; // Camera +@property (nonatomic) BOOL allowsEditing; // NO +@property (nonatomic) BOOL allowsImageEditing; // NO +@property (nonatomic) BOOL showsCameraControls; // NO +@property (nonatomic) BOOL showsHelpOnFail; // ignored +@property (nonatomic) ZBarReaderControllerCameraMode cameraMode; // Sampling +@property (nonatomic) BOOL takesPicture; // NO +@property (nonatomic) NSInteger maxScanDimension; // ignored + ++ (BOOL)isSourceTypeAvailable:(UIImagePickerControllerSourceType)sourceType; + +@end diff --git a/iphone/include/ZBarSDK/ZBarSDK.h b/iphone/include/ZBarSDK/ZBarSDK.h new file mode 100644 index 0000000..902552b --- /dev/null +++ b/iphone/include/ZBarSDK/ZBarSDK.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------ + * Copyright 2010 (c) Jeff Brown + * + * This file is part of the ZBar Bar Code Reader. + * + * The ZBar Bar Code Reader is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * The ZBar Bar Code Reader is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser Public License for more details. + * + * You should have received a copy of the GNU Lesser Public License + * along with the ZBar Bar Code Reader; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + * + * http://sourceforge.net/projects/zbar + *------------------------------------------------------------------------*/ + +#import "zbar.h" + +#import "ZBarCameraSimulator.h" +#import "ZBarCaptureReader.h" +#import "ZBarHelpController.h" +#import "ZBarImage.h" +#import "ZBarImageScanner.h" +#import "ZBarReaderController.h" +#import "ZBarReaderView.h" +#import "ZBarReaderViewController.h" +#import "ZBarSymbol.h" diff --git a/iphone/include/ZBarSDK/ZBarSymbol.h b/iphone/include/ZBarSDK/ZBarSymbol.h new file mode 100644 index 0000000..ab0557f --- /dev/null +++ b/iphone/include/ZBarSDK/ZBarSymbol.h @@ -0,0 +1,67 @@ +//------------------------------------------------------------------------ +// Copyright 2009-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import +#import "zbar.h" + +#ifdef __cplusplus +using namespace zbar; +#endif + +// Obj-C wrapper for ZBar result types + +@interface ZBarSymbolSet : NSObject { + const zbar_symbol_set_t *set; + BOOL filterSymbols; +} + +@property (readonly, nonatomic) int count; +@property (readonly, nonatomic) const zbar_symbol_set_t *zbarSymbolSet; +@property (nonatomic) BOOL filterSymbols; + +- (id)initWithSymbolSet:(const zbar_symbol_set_t *)set; + +@end + +@interface ZBarSymbol : NSObject { + const zbar_symbol_t *symbol; +} + +@property (readonly, nonatomic) zbar_symbol_type_t type; +@property (readonly, nonatomic) NSString *typeName; +@property (readonly, nonatomic) NSUInteger configMask; +@property (readonly, nonatomic) NSUInteger modifierMask; +@property (readonly, nonatomic) NSString *data; +@property (readonly, nonatomic) int quality; +@property (readonly, nonatomic) int count; +@property (readonly, nonatomic) zbar_orientation_t orientation; +@property (readonly, nonatomic) ZBarSymbolSet *components; +@property (readonly, nonatomic) const zbar_symbol_t *zbarSymbol; +@property (readonly, nonatomic) CGRect bounds; + +- (id)initWithSymbol:(const zbar_symbol_t *)symbol; + ++ (NSString *)nameForType:(zbar_symbol_type_t)type; + +@end diff --git a/iphone/include/config.h b/iphone/include/config.h new file mode 100644 index 0000000..0267780 --- /dev/null +++ b/iphone/include/config.h @@ -0,0 +1,236 @@ +/* manually customized for iPhone platform */ + +/* whether to build support for Code 128 symbology */ +#define ENABLE_CODE128 1 + +/* whether to build support for Code 93 symbology */ +#define ENABLE_CODE93 1 + +/* whether to build support for Code 39 symbology */ +#define ENABLE_CODE39 1 + +/* whether to build support for Codabar symbology */ +#define ENABLE_CODABAR 1 + +/* whether to build support for DataBar symbology */ +#define ENABLE_DATABAR 1 + +/* whether to build support for EAN symbologies */ +#define ENABLE_EAN 1 + +/* whether to build support for Interleaved 2 of 5 symbology */ +#define ENABLE_I25 1 + +/* whether to build support for PDF417 symbology */ +#undef ENABLE_PDF417 + +/* whether to build support for QR Code */ +#define ENABLE_QRCODE 1 + +/* Define to 1 if you have the `atexit' function. */ +#undef HAVE_ATEXIT + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FEATURES_H + +/* Define to 1 if you have the `getpagesize' function. */ +#undef HAVE_GETPAGESIZE + +/* Define if you have the iconv() function and it works. */ +#undef HAVE_ICONV + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_JPEGLIB_H + +/* Define to 1 if you have the `jpeg' library (-ljpeg). */ +#undef HAVE_LIBJPEG + +/* Define to 1 if you have the `pthread' library (-lpthread). */ +#undef HAVE_LIBPTHREAD + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_VIDEODEV2_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_VIDEODEV_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `memset' function. */ +#define HAVE_MEMSET 1 + +/* Define to 1 if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define to 1 if you have the header file. */ +#undef HAVE_POLL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_PTHREAD_H + +/* Define to 1 if you have the `setenv' function. */ +#undef HAVE_SETENV + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IPC_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MMAN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SHM_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIMES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if the system has the type `uintptr_t'. */ +#define HAVE_UINTPTR_T 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_VFW_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_X11_EXTENSIONS_XSHM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_X11_EXTENSIONS_XVLIB_H + +/* Define as const if the declaration of iconv() needs const. */ +#undef ICONV_CONST + +/* Library major version */ +#define LIB_VERSION_MAJOR 0 + +/* Library minor version */ +#define LIB_VERSION_MINOR 2 + +/* Library revision */ +#define LIB_VERSION_REVISION 0 + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define to 1 if assertions should be disabled. */ +//#undef NDEBUG + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + +/* Name of package */ +#define PACKAGE "zbar" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "spadix@users.sourceforge.net" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "zbar" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "zbar 0.10" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "zbar" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "0.10" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "0.10" + +/* Define to 1 if the X Window System is missing or not being used. */ +#define X_DISPLAY_MISSING 1 + +/* Program major version (before the '.') as a number */ +#define ZBAR_VERSION_MAJOR 0 + +/* Program minor version (after '.') as a number */ +#define ZBAR_VERSION_MINOR 10 + +/* Program minor version (after the second '.') as a number */ +#define ZBAR_VERSION_PATCH 0 + +/* Define for Solaris 2.5.1 so the uint32_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT32_T + +/* Define for Solaris 2.5.1 so the uint8_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT8_T + +/* Minimum Windows API version */ +#undef _WIN32_WINNT + +/* used only for pthread debug attributes */ +#undef __USE_UNIX98 + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to the type of a signed integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#undef int32_t + +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#undef uint32_t + +/* Define to the type of an unsigned integer type of width exactly 8 bits if + such a type exists and the standard includes do not define it. */ +#undef uint8_t + +/* Define to the type of an unsigned integer type wide enough to hold a + pointer, if such a type exists, and if the system does not define it. */ +#undef uintptr_t + +#ifndef X_DISPLAY_MISSING +#define HAVE_X +#endif diff --git a/iphone/include/prefix.pch b/iphone/include/prefix.pch new file mode 100644 index 0000000..a7bdae5 --- /dev/null +++ b/iphone/include/prefix.pch @@ -0,0 +1,10 @@ +#ifdef __OBJC__ +# import +# import +# import +# import +# import +# import +# import +# import +#endif diff --git a/iphone/res/ZBarSDK-Info.plist b/iphone/res/ZBarSDK-Info.plist new file mode 100644 index 0000000..0902ddb --- /dev/null +++ b/iphone/res/ZBarSDK-Info.plist @@ -0,0 +1,16 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleName + ZBarSDK + CFBundleVersion + 1.3.1 + CFBundleSignature + ???? + NSHumanReadableCopyright + Copyright 2010 © Jeff Brown et al + + diff --git a/iphone/res/ZBarSDK-bg.svg b/iphone/res/ZBarSDK-bg.svg new file mode 100644 index 0000000..59485e1 --- /dev/null +++ b/iphone/res/ZBarSDK-bg.svg @@ -0,0 +1,78 @@ + + + + + + + + ZBar iPhone SDK DMG Folder Background Image + + + + + + + + + + + + + + + + + + + + + + + Read this first + + + Then drag this + into your + Xcode project + + + + + + diff --git a/iphone/res/buttondown.svg b/iphone/res/buttondown.svg new file mode 100644 index 0000000..799d5fc --- /dev/null +++ b/iphone/res/buttondown.svg @@ -0,0 +1,57 @@ + + + + + + + + rounded button overlay + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iphone/res/buttonmask.svg b/iphone/res/buttonmask.svg new file mode 100644 index 0000000..55f0e29 --- /dev/null +++ b/iphone/res/buttonmask.svg @@ -0,0 +1,26 @@ + + + + + + + + mask for button overlays + + + + + + + diff --git a/iphone/res/buttonup.svg b/iphone/res/buttonup.svg new file mode 100644 index 0000000..861ca9a --- /dev/null +++ b/iphone/res/buttonup.svg @@ -0,0 +1,57 @@ + + + + + + + + rounded button overlay + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iphone/res/lightbulb.svg b/iphone/res/lightbulb.svg new file mode 100644 index 0000000..1f8628c --- /dev/null +++ b/iphone/res/lightbulb.svg @@ -0,0 +1,108 @@ + + + + + + + + lit light bulb icon + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iphone/res/shakyhand.svg b/iphone/res/shakyhand.svg new file mode 100644 index 0000000..2e3c594 --- /dev/null +++ b/iphone/res/shakyhand.svg @@ -0,0 +1,108 @@ + + + + + + + + unstable hand icon + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iphone/res/shakyphone.svg b/iphone/res/shakyphone.svg new file mode 100644 index 0000000..96db019 --- /dev/null +++ b/iphone/res/shakyphone.svg @@ -0,0 +1,51 @@ + + + + + + + + iPhone shake gesture icon + + + + + + + + + + + + + + + + + + + + + + diff --git a/iphone/res/stopwatch.svg b/iphone/res/stopwatch.svg new file mode 100644 index 0000000..186f2e9 --- /dev/null +++ b/iphone/res/stopwatch.svg @@ -0,0 +1,88 @@ + + + + + + + + stopwatch icon + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iphone/res/zbar-back.png b/iphone/res/zbar-back.png new file mode 100644 index 0000000..6a0681d Binary files /dev/null and b/iphone/res/zbar-back.png differ diff --git a/iphone/res/zbar-back.svg b/iphone/res/zbar-back.svg new file mode 100644 index 0000000..64f1aba --- /dev/null +++ b/iphone/res/zbar-back.svg @@ -0,0 +1,31 @@ + + + + + + + + left pointing arrow toolbar icon + + + + + + + + + + + diff --git a/iphone/res/zbar-help.html b/iphone/res/zbar-help.html new file mode 100644 index 0000000..886cbb2 --- /dev/null +++ b/iphone/res/zbar-help.html @@ -0,0 +1,90 @@ + + + + + + +Barcode Reader Help + + + +

Barcode Reader Help

+
+

Recognized barcodes should look like

+ +
+ +

QR Codes

+
+

Also recognized, but not shown: +Code 128, +DataBar (RSS), +Code 93, +Code 39 and +Codabar and +Interleaved 2 of 5

+
+

Hints for successful scanning

+
+
+

Ensure there is plenty of

+

Light

+
+
+
4"
+

Distance

+

should be about 3 to 5 inches

+
+
+
+

Shake

+

to force the camera to focus

+
+
+
+

Wait

+

for the autofocus to finish

+
+
+
+

Hold Still

+

while the barcode is scanned

+
+ + + diff --git a/iphone/res/zbar-helpicons.png b/iphone/res/zbar-helpicons.png new file mode 100644 index 0000000..2a07e7c Binary files /dev/null and b/iphone/res/zbar-helpicons.png differ diff --git a/iphone/res/zbar-samples.png b/iphone/res/zbar-samples.png new file mode 100644 index 0000000..7c805e2 Binary files /dev/null and b/iphone/res/zbar-samples.png differ diff --git a/iphone/zbar.xcodeproj/project.pbxproj b/iphone/zbar.xcodeproj/project.pbxproj new file mode 100644 index 0000000..6732f6d --- /dev/null +++ b/iphone/zbar.xcodeproj/project.pbxproj @@ -0,0 +1,1196 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXAggregateTarget section */ + DC1A4A4E11FF5D0500BCDA30 /* ZBarSDK.dmg */ = { + isa = PBXAggregateTarget; + buildConfigurationList = DC1A4A5311FF5D3D00BCDA30 /* Build configuration list for PBXAggregateTarget "ZBarSDK.dmg" */; + buildPhases = ( + DC3CF2061218355900D7A786 /* Copy SDK */, + DC48C585121AC7C20047193B /* Build Documentation */, + DC3CF025121720B600D7A786 /* Copy Examples */, + DC1A4A4D11FF5D0500BCDA30 /* Make Disk Image */, + ); + dependencies = ( + DC3CF01F1216366200D7A786 /* PBXTargetDependency */, + ); + name = ZBarSDK.dmg; + productName = Package; + }; + DC3CEE821215C7EF00D7A786 /* ZBarSDK */ = { + isa = PBXAggregateTarget; + buildConfigurationList = DC3CEE851215C83500D7A786 /* Build configuration list for PBXAggregateTarget "ZBarSDK" */; + buildPhases = ( + DC3CEE891215C88000D7A786 /* Build Universal Library */, + DC3CEE811215C7EF00D7A786 /* Copy Headers */, + DC3CEE9E1215C9B800D7A786 /* Copy Headers */, + DC3CEE9F1215C9B800D7A786 /* Copy Resources */, + ); + dependencies = ( + DC3CEE871215C85400D7A786 /* PBXTargetDependency */, + ); + name = ZBarSDK; + productName = ZBarSDK; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 56286C3324385403000B3E6B /* LICENSE.md in Resources */ = {isa = PBXBuildFile; fileRef = 56286C3224385403000B3E6B /* LICENSE.md */; }; + 56286C342438540C000B3E6B /* LICENSE.md in Copy SDK */ = {isa = PBXBuildFile; fileRef = 56286C3224385403000B3E6B /* LICENSE.md */; }; + DC26004C118631C200FA987B /* ZBarCaptureReader.m in Sources */ = {isa = PBXBuildFile; fileRef = DC26004B118631C200FA987B /* ZBarCaptureReader.m */; }; + DC290E281351496400A9B857 /* codabar.c in Sources */ = {isa = PBXBuildFile; fileRef = DC290E261351496400A9B857 /* codabar.c */; }; + DC299A9D1208B5E8006A023C /* libzbar.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D2AAC07E0554694100DB518D /* libzbar.a */; }; + DC299AA01208B61C006A023C /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC50453D1203396B009FF359 /* AVFoundation.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + DC299AA11208B61C006A023C /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC50453F1203396B009FF359 /* CoreMedia.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + DC299AA21208B61C006A023C /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC5045411203396B009FF359 /* CoreVideo.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + DC299AA31208B61C006A023C /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC1A49C111FF537000BCDA30 /* QuartzCore.framework */; }; + DC299AA41208B61C006A023C /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = DC5045431203396B009FF359 /* libiconv.dylib */; }; + DC299AA51208B63C006A023C /* zbar-help.html in Resources */ = {isa = PBXBuildFile; fileRef = DC1A49A211FF33B300BCDA30 /* zbar-help.html */; }; + DC299AA61208B63C006A023C /* zbar-helpicons.png in Resources */ = {isa = PBXBuildFile; fileRef = DC1A49A311FF33B300BCDA30 /* zbar-helpicons.png */; }; + DC299AA71208B63C006A023C /* zbar-samples.png in Resources */ = {isa = PBXBuildFile; fileRef = DC1A49A411FF33B300BCDA30 /* zbar-samples.png */; }; + DC299B061208FC11006A023C /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC299B051208FC11006A023C /* CoreGraphics.framework */; }; + DC299B311208FCA3006A023C /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC67C08210A079BE0033B702 /* UIKit.framework */; }; + DC299B841208FCAB006A023C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; }; + DC3AAB4F11B71A040021C7B1 /* ZBarCVImage.m in Sources */ = {isa = PBXBuildFile; fileRef = DC3AAB4D11B71A040021C7B1 /* ZBarCVImage.m */; }; + DC3CE47811FA1622008FAF88 /* ZBarReaderViewImpl_Capture.m in Sources */ = {isa = PBXBuildFile; fileRef = DC3CE47611FA1622008FAF88 /* ZBarReaderViewImpl_Capture.m */; }; + DC3CE47911FA1622008FAF88 /* ZBarReaderViewImpl_Simulator.m in Sources */ = {isa = PBXBuildFile; fileRef = DC3CE47711FA1622008FAF88 /* ZBarReaderViewImpl_Simulator.m */; }; + DC3CEE921215C93200D7A786 /* zbar.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = DC67C11710A07A810033B702 /* zbar.h */; }; + DC3CEE941215C97F00D7A786 /* Decoder.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = DC50463512034A4C009FF359 /* Decoder.h */; }; + DC3CEE951215C97F00D7A786 /* Exception.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = DC50463612034A4C009FF359 /* Exception.h */; }; + DC3CEE961215C97F00D7A786 /* Image.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = DC50463712034A4C009FF359 /* Image.h */; }; + DC3CEE971215C97F00D7A786 /* ImageScanner.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = DC50463812034A4C009FF359 /* ImageScanner.h */; }; + DC3CEE981215C97F00D7A786 /* Processor.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = DC50463912034A4C009FF359 /* Processor.h */; }; + DC3CEE991215C97F00D7A786 /* Scanner.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = DC50463A12034A4C009FF359 /* Scanner.h */; }; + DC3CEE9A1215C97F00D7A786 /* Symbol.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = DC50463B12034A4C009FF359 /* Symbol.h */; }; + DC3CEE9B1215C97F00D7A786 /* Video.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = DC50463C12034A4C009FF359 /* Video.h */; }; + DC3CEE9C1215C97F00D7A786 /* Window.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = DC50463D12034A4C009FF359 /* Window.h */; }; + DC3CEEA01215C9C000D7A786 /* zbar-help.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = DC1A49A211FF33B300BCDA30 /* zbar-help.html */; }; + DC3CEEA11215C9C000D7A786 /* zbar-helpicons.png in Copy Resources */ = {isa = PBXBuildFile; fileRef = DC1A49A311FF33B300BCDA30 /* zbar-helpicons.png */; }; + DC3CEEA21215C9C000D7A786 /* zbar-samples.png in Copy Resources */ = {isa = PBXBuildFile; fileRef = DC1A49A411FF33B300BCDA30 /* zbar-samples.png */; }; + DC3CEFB51216349700D7A786 /* ZBarCaptureReader.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = DC3CEFA51216347100D7A786 /* ZBarCaptureReader.h */; }; + DC3CEFB61216349700D7A786 /* ZBarImage.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = DC3CEFA61216347100D7A786 /* ZBarImage.h */; }; + DC3CEFB71216349700D7A786 /* ZBarImageScanner.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = DC3CEFA71216347100D7A786 /* ZBarImageScanner.h */; }; + DC3CEFB81216349700D7A786 /* ZBarReaderController.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = DC3CEFA81216347100D7A786 /* ZBarReaderController.h */; }; + DC3CEFB91216349700D7A786 /* ZBarReaderView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = DC3CEFA91216347100D7A786 /* ZBarReaderView.h */; }; + DC3CEFBA1216349700D7A786 /* ZBarReaderViewController.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = DC3CEFAA1216347100D7A786 /* ZBarReaderViewController.h */; }; + DC3CEFBB1216349700D7A786 /* ZBarSDK.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = DC3CEFAB1216347100D7A786 /* ZBarSDK.h */; }; + DC3CEFBC1216349700D7A786 /* ZBarSymbol.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = DC3CEFAC1216347100D7A786 /* ZBarSymbol.h */; }; + DC3CF2021218353B00D7A786 /* README in Copy SDK */ = {isa = PBXBuildFile; fileRef = DC50467B12034D60009FF359 /* README */; }; + DC3CF2031218353B00D7A786 /* ChangeLog in Copy SDK */ = {isa = PBXBuildFile; fileRef = DC3CF141121721A100D7A786 /* ChangeLog */; }; + DC3CF2041218353B00D7A786 /* COPYING in Copy SDK */ = {isa = PBXBuildFile; fileRef = DC50467C12034D71009FF359 /* COPYING */; }; + DC3CF29A1218359400D7A786 /* ReaderSample in Copy Examples */ = {isa = PBXBuildFile; fileRef = DC3CF2081218358C00D7A786 /* ReaderSample */; }; + DC3CF29B1218359400D7A786 /* readertest in Copy Examples */ = {isa = PBXBuildFile; fileRef = DC3CF2651218358C00D7A786 /* readertest */; }; + DC3CF2A312197A8C00D7A786 /* zbar-back.png in Copy Resources */ = {isa = PBXBuildFile; fileRef = DC3CF2A212197A7200D7A786 /* zbar-back.png */; }; + DC3EBB2D119DDB2100107EE9 /* ZBarReaderViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DC3EBB2C119DDB2100107EE9 /* ZBarReaderViewController.m */; }; + DC48C5341219FDDE0047193B /* zbar-back.png in Resources */ = {isa = PBXBuildFile; fileRef = DC3CF2A212197A7200D7A786 /* zbar-back.png */; }; + DC48C5411219FE550047193B /* readertest.m in Sources */ = {isa = PBXBuildFile; fileRef = DC48C5401219FE550047193B /* readertest.m */; }; + DC48C57D121A1F410047193B /* ZBarSDK in Copy SDK */ = {isa = PBXBuildFile; fileRef = DC48C55F121A1E7F0047193B /* ZBarSDK */; }; + DC48C5A8121B1F910047193B /* Documentation.html in Copy SDK */ = {isa = PBXBuildFile; fileRef = DC48C5A7121B1F840047193B /* Documentation.html */; }; + DC4920EE10A70475000E4D43 /* ZBarImage.m in Sources */ = {isa = PBXBuildFile; fileRef = DC4920EC10A70475000E4D43 /* ZBarImage.m */; }; + DC4920EF10A70475000E4D43 /* ZBarImageScanner.m in Sources */ = {isa = PBXBuildFile; fileRef = DC4920ED10A70475000E4D43 /* ZBarImageScanner.m */; }; + DC5D76C3136FA8C40069AEF5 /* ZBarCameraSimulator.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5D76C2136FA8C40069AEF5 /* ZBarCameraSimulator.m */; }; + DC5D76C6136FA94B0069AEF5 /* ZBarCameraSimulator.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = DC5D76C5136FA8F20069AEF5 /* ZBarCameraSimulator.h */; }; + DC67C17110A07AD30033B702 /* config.c in Sources */ = {isa = PBXBuildFile; fileRef = DC67C11F10A07AD30033B702 /* config.c */; }; + DC67C17410A07AD30033B702 /* code128.c in Sources */ = {isa = PBXBuildFile; fileRef = DC67C12310A07AD30033B702 /* code128.c */; }; + DC67C17610A07AD30033B702 /* code39.c in Sources */ = {isa = PBXBuildFile; fileRef = DC67C12510A07AD30033B702 /* code39.c */; }; + DC67C17810A07AD30033B702 /* ean.c in Sources */ = {isa = PBXBuildFile; fileRef = DC67C12710A07AD30033B702 /* ean.c */; }; + DC67C17A10A07AD30033B702 /* i25.c in Sources */ = {isa = PBXBuildFile; fileRef = DC67C12910A07AD30033B702 /* i25.c */; }; + DC67C17F10A07AD30033B702 /* qr_finder.c in Sources */ = {isa = PBXBuildFile; fileRef = DC67C12E10A07AD30033B702 /* qr_finder.c */; }; + DC67C18110A07AD30033B702 /* decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = DC67C13010A07AD30033B702 /* decoder.c */; }; + DC67C18310A07AD30033B702 /* error.c in Sources */ = {isa = PBXBuildFile; fileRef = DC67C13210A07AD30033B702 /* error.c */; }; + DC67C18610A07AD30033B702 /* image.c in Sources */ = {isa = PBXBuildFile; fileRef = DC67C13510A07AD30033B702 /* image.c */; }; + DC67C18810A07AD30033B702 /* img_scanner.c in Sources */ = {isa = PBXBuildFile; fileRef = DC67C13710A07AD30033B702 /* img_scanner.c */; }; + DC67C19510A07AD30033B702 /* bch15_5.c in Sources */ = {isa = PBXBuildFile; fileRef = DC67C14710A07AD30033B702 /* bch15_5.c */; }; + DC67C19710A07AD30033B702 /* binarize.c in Sources */ = {isa = PBXBuildFile; fileRef = DC67C14910A07AD30033B702 /* binarize.c */; }; + DC67C19910A07AD30033B702 /* isaac.c in Sources */ = {isa = PBXBuildFile; fileRef = DC67C14B10A07AD30033B702 /* isaac.c */; }; + DC67C19B10A07AD30033B702 /* qrdec.c in Sources */ = {isa = PBXBuildFile; fileRef = DC67C14D10A07AD30033B702 /* qrdec.c */; }; + DC67C19D10A07AD30033B702 /* qrdectxt.c in Sources */ = {isa = PBXBuildFile; fileRef = DC67C14F10A07AD30033B702 /* qrdectxt.c */; }; + DC67C19E10A07AD30033B702 /* rs.c in Sources */ = {isa = PBXBuildFile; fileRef = DC67C15010A07AD30033B702 /* rs.c */; }; + DC67C1A010A07AD30033B702 /* util.c in Sources */ = {isa = PBXBuildFile; fileRef = DC67C15210A07AD30033B702 /* util.c */; }; + DC67C1A310A07AD30033B702 /* refcnt.c in Sources */ = {isa = PBXBuildFile; fileRef = DC67C15510A07AD30033B702 /* refcnt.c */; }; + DC67C1A510A07AD30033B702 /* scanner.c in Sources */ = {isa = PBXBuildFile; fileRef = DC67C15710A07AD30033B702 /* scanner.c */; }; + DC67C1A810A07AD30033B702 /* symbol.c in Sources */ = {isa = PBXBuildFile; fileRef = DC67C15A10A07AD30033B702 /* symbol.c */; }; + DC67C1C210A07B6B0033B702 /* ZBarHelpController.m in Sources */ = {isa = PBXBuildFile; fileRef = DC67C1BE10A07B6B0033B702 /* ZBarHelpController.m */; }; + DC67C1C310A07B6B0033B702 /* ZBarReaderController.m in Sources */ = {isa = PBXBuildFile; fileRef = DC67C1BF10A07B6B0033B702 /* ZBarReaderController.m */; }; + DC67C1C410A07B6B0033B702 /* ZBarSymbol.m in Sources */ = {isa = PBXBuildFile; fileRef = DC67C1C010A07B6B0033B702 /* ZBarSymbol.m */; }; + DC8245EF1629DC340010B2E6 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DC8245EE1629DC140010B2E6 /* Default-568h@2x.png */; }; + DCB3789B12A43CAC0059B07B /* ZBarHelpController.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = DCB3789A12A43C7E0059B07B /* ZBarHelpController.h */; }; + DCC93259137B50CB0040A82D /* EmbedReader in Copy Examples */ = {isa = PBXBuildFile; fileRef = DCC9324E137B509B0040A82D /* EmbedReader */; }; + DCC9325A137B50CB0040A82D /* TabReader in Copy Examples */ = {isa = PBXBuildFile; fileRef = DCC9324F137B509B0040A82D /* TabReader */; }; + DCDC6E3011ADCA8E00021380 /* ZBarReaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = DCDC6E2F11ADCA8E00021380 /* ZBarReaderView.m */; }; + DCE9900D129719F100D2655C /* code93.c in Sources */ = {isa = PBXBuildFile; fileRef = DCE9900B129719F100D2655C /* code93.c */; }; + DCF5C9AD11EA3AD100E7DC21 /* databar.c in Sources */ = {isa = PBXBuildFile; fileRef = DCF5C9AB11EA3AD100E7DC21 /* databar.c */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + DC299A9E1208B5F1006A023C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = D2AAC07D0554694100DB518D; + remoteInfo = libzbar; + }; + DC3CEE861215C85400D7A786 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = D2AAC07D0554694100DB518D; + remoteInfo = libzbar; + }; + DC3CF01E1216366200D7A786 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = DC3CEE821215C7EF00D7A786; + remoteInfo = ZBarSDK; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + DC3CEE811215C7EF00D7A786 /* Copy Headers */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = Headers/ZBarSDK; + dstSubfolderSpec = 1; + files = ( + DC5D76C6136FA94B0069AEF5 /* ZBarCameraSimulator.h in Copy Headers */, + DC3CEFB51216349700D7A786 /* ZBarCaptureReader.h in Copy Headers */, + DCB3789B12A43CAC0059B07B /* ZBarHelpController.h in Copy Headers */, + DC3CEFB61216349700D7A786 /* ZBarImage.h in Copy Headers */, + DC3CEFB71216349700D7A786 /* ZBarImageScanner.h in Copy Headers */, + DC3CEFB81216349700D7A786 /* ZBarReaderController.h in Copy Headers */, + DC3CEFB91216349700D7A786 /* ZBarReaderView.h in Copy Headers */, + DC3CEFBA1216349700D7A786 /* ZBarReaderViewController.h in Copy Headers */, + DC3CEFBB1216349700D7A786 /* ZBarSDK.h in Copy Headers */, + DC3CEFBC1216349700D7A786 /* ZBarSymbol.h in Copy Headers */, + DC3CEE921215C93200D7A786 /* zbar.h in Copy Headers */, + ); + name = "Copy Headers"; + runOnlyForDeploymentPostprocessing = 0; + }; + DC3CEE9E1215C9B800D7A786 /* Copy Headers */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = Headers/ZBarSDK/zbar; + dstSubfolderSpec = 1; + files = ( + DC3CEE941215C97F00D7A786 /* Decoder.h in Copy Headers */, + DC3CEE951215C97F00D7A786 /* Exception.h in Copy Headers */, + DC3CEE961215C97F00D7A786 /* Image.h in Copy Headers */, + DC3CEE971215C97F00D7A786 /* ImageScanner.h in Copy Headers */, + DC3CEE981215C97F00D7A786 /* Processor.h in Copy Headers */, + DC3CEE991215C97F00D7A786 /* Scanner.h in Copy Headers */, + DC3CEE9A1215C97F00D7A786 /* Symbol.h in Copy Headers */, + DC3CEE9B1215C97F00D7A786 /* Video.h in Copy Headers */, + DC3CEE9C1215C97F00D7A786 /* Window.h in Copy Headers */, + ); + name = "Copy Headers"; + runOnlyForDeploymentPostprocessing = 0; + }; + DC3CEE9F1215C9B800D7A786 /* Copy Resources */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = Resources; + dstSubfolderSpec = 1; + files = ( + DC3CF2A312197A8C00D7A786 /* zbar-back.png in Copy Resources */, + DC3CEEA01215C9C000D7A786 /* zbar-help.html in Copy Resources */, + DC3CEEA11215C9C000D7A786 /* zbar-helpicons.png in Copy Resources */, + DC3CEEA21215C9C000D7A786 /* zbar-samples.png in Copy Resources */, + ); + name = "Copy Resources"; + runOnlyForDeploymentPostprocessing = 0; + }; + DC3CF025121720B600D7A786 /* Copy Examples */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = Examples; + dstSubfolderSpec = 1; + files = ( + DC3CF29A1218359400D7A786 /* ReaderSample in Copy Examples */, + DC3CF29B1218359400D7A786 /* readertest in Copy Examples */, + DCC93259137B50CB0040A82D /* EmbedReader in Copy Examples */, + DCC9325A137B50CB0040A82D /* TabReader in Copy Examples */, + ); + name = "Copy Examples"; + runOnlyForDeploymentPostprocessing = 0; + }; + DC3CF2061218355900D7A786 /* Copy SDK */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 1; + files = ( + 56286C342438540C000B3E6B /* LICENSE.md in Copy SDK */, + DC48C57D121A1F410047193B /* ZBarSDK in Copy SDK */, + DC3CF2021218353B00D7A786 /* README in Copy SDK */, + DC3CF2031218353B00D7A786 /* ChangeLog in Copy SDK */, + DC3CF2041218353B00D7A786 /* COPYING in Copy SDK */, + DC48C5A8121B1F910047193B /* Documentation.html in Copy SDK */, + ); + name = "Copy SDK"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 56286C3224385403000B3E6B /* LICENSE.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = LICENSE.md; path = ../LICENSE.md; sourceTree = ""; }; + AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + D2AAC07E0554694100DB518D /* libzbar.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libzbar.a; sourceTree = BUILT_PRODUCTS_DIR; }; + DC1A49A211FF33B300BCDA30 /* zbar-help.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = "zbar-help.html"; path = "res/zbar-help.html"; sourceTree = ""; }; + DC1A49A311FF33B300BCDA30 /* zbar-helpicons.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "zbar-helpicons.png"; path = "res/zbar-helpicons.png"; sourceTree = ""; }; + DC1A49A411FF33B300BCDA30 /* zbar-samples.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "zbar-samples.png"; path = "res/zbar-samples.png"; sourceTree = ""; }; + DC1A49C111FF537000BCDA30 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + DC26004B118631C200FA987B /* ZBarCaptureReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZBarCaptureReader.m; sourceTree = ""; usesTabs = 0; }; + DC290E261351496400A9B857 /* codabar.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = codabar.c; sourceTree = ""; }; + DC290E271351496400A9B857 /* codabar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = codabar.h; sourceTree = ""; }; + DC299AF51208B7BD006A023C /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = config.h; path = include/config.h; sourceTree = ""; }; + DC299B051208FC11006A023C /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + DC299BEC1208FE40006A023C /* prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = prefix.pch; path = include/prefix.pch; sourceTree = ""; }; + DC3AAB4C11B71A040021C7B1 /* ZBarCVImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarCVImage.h; sourceTree = ""; usesTabs = 0; }; + DC3AAB4D11B71A040021C7B1 /* ZBarCVImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZBarCVImage.m; sourceTree = ""; usesTabs = 0; }; + DC3CE47611FA1622008FAF88 /* ZBarReaderViewImpl_Capture.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZBarReaderViewImpl_Capture.m; sourceTree = ""; usesTabs = 0; }; + DC3CE47711FA1622008FAF88 /* ZBarReaderViewImpl_Simulator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZBarReaderViewImpl_Simulator.m; sourceTree = ""; usesTabs = 0; }; + DC3CEF9D121633C500D7A786 /* readertest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = readertest.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DC3CEFA51216347100D7A786 /* ZBarCaptureReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZBarCaptureReader.h; path = include/ZBarSDK/ZBarCaptureReader.h; sourceTree = ""; }; + DC3CEFA61216347100D7A786 /* ZBarImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZBarImage.h; path = include/ZBarSDK/ZBarImage.h; sourceTree = ""; }; + DC3CEFA71216347100D7A786 /* ZBarImageScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZBarImageScanner.h; path = include/ZBarSDK/ZBarImageScanner.h; sourceTree = ""; }; + DC3CEFA81216347100D7A786 /* ZBarReaderController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZBarReaderController.h; path = include/ZBarSDK/ZBarReaderController.h; sourceTree = ""; }; + DC3CEFA91216347100D7A786 /* ZBarReaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZBarReaderView.h; path = include/ZBarSDK/ZBarReaderView.h; sourceTree = ""; }; + DC3CEFAA1216347100D7A786 /* ZBarReaderViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZBarReaderViewController.h; path = include/ZBarSDK/ZBarReaderViewController.h; sourceTree = ""; }; + DC3CEFAB1216347100D7A786 /* ZBarSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZBarSDK.h; path = include/ZBarSDK/ZBarSDK.h; sourceTree = ""; }; + DC3CEFAC1216347100D7A786 /* ZBarSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZBarSymbol.h; path = include/ZBarSDK/ZBarSymbol.h; sourceTree = ""; }; + DC3CF141121721A100D7A786 /* ChangeLog */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ChangeLog; sourceTree = ""; }; + DC3CF2081218358C00D7A786 /* ReaderSample */ = {isa = PBXFileReference; lastKnownFileType = folder; name = ReaderSample; path = examples/ReaderSample; sourceTree = ""; }; + DC3CF2651218358C00D7A786 /* readertest */ = {isa = PBXFileReference; lastKnownFileType = folder; name = readertest; path = examples/readertest; sourceTree = ""; }; + DC3CF2A212197A7200D7A786 /* zbar-back.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "zbar-back.png"; path = "res/zbar-back.png"; sourceTree = ""; }; + DC3EBB2C119DDB2100107EE9 /* ZBarReaderViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZBarReaderViewController.m; sourceTree = ""; usesTabs = 0; }; + DC48C5401219FE550047193B /* readertest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = readertest.m; path = examples/readertest/readertest.m; sourceTree = ""; }; + DC48C55F121A1E7F0047193B /* ZBarSDK */ = {isa = PBXFileReference; lastKnownFileType = folder; path = ZBarSDK; sourceTree = BUILT_PRODUCTS_DIR; }; + DC48C5A7121B1F840047193B /* Documentation.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = Documentation.html; path = doc/Documentation.html; sourceTree = ""; }; + DC4920EC10A70475000E4D43 /* ZBarImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZBarImage.m; sourceTree = ""; usesTabs = 0; }; + DC4920ED10A70475000E4D43 /* ZBarImageScanner.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZBarImageScanner.m; sourceTree = ""; usesTabs = 0; }; + DC50453D1203396B009FF359 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + DC50453F1203396B009FF359 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; + DC5045411203396B009FF359 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; + DC5045431203396B009FF359 /* libiconv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.dylib; path = usr/lib/libiconv.dylib; sourceTree = SDKROOT; }; + DC50463512034A4C009FF359 /* Decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Decoder.h; path = ../include/zbar/Decoder.h; sourceTree = SOURCE_ROOT; }; + DC50463612034A4C009FF359 /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Exception.h; path = ../include/zbar/Exception.h; sourceTree = SOURCE_ROOT; }; + DC50463712034A4C009FF359 /* Image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Image.h; path = ../include/zbar/Image.h; sourceTree = SOURCE_ROOT; }; + DC50463812034A4C009FF359 /* ImageScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ImageScanner.h; path = ../include/zbar/ImageScanner.h; sourceTree = SOURCE_ROOT; }; + DC50463912034A4C009FF359 /* Processor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Processor.h; path = ../include/zbar/Processor.h; sourceTree = SOURCE_ROOT; }; + DC50463A12034A4C009FF359 /* Scanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Scanner.h; path = ../include/zbar/Scanner.h; sourceTree = SOURCE_ROOT; }; + DC50463B12034A4C009FF359 /* Symbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Symbol.h; path = ../include/zbar/Symbol.h; sourceTree = SOURCE_ROOT; }; + DC50463C12034A4C009FF359 /* Video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Video.h; path = ../include/zbar/Video.h; sourceTree = SOURCE_ROOT; }; + DC50463D12034A4C009FF359 /* Window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Window.h; path = ../include/zbar/Window.h; sourceTree = SOURCE_ROOT; }; + DC50467B12034D60009FF359 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; + DC50467C12034D71009FF359 /* COPYING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = COPYING; path = ../COPYING; sourceTree = SOURCE_ROOT; }; + DC50467D12034D71009FF359 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = SOURCE_ROOT; }; + DC5D76C2136FA8C40069AEF5 /* ZBarCameraSimulator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZBarCameraSimulator.m; sourceTree = ""; }; + DC5D76C5136FA8F20069AEF5 /* ZBarCameraSimulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZBarCameraSimulator.h; path = include/ZBarSDK/ZBarCameraSimulator.h; sourceTree = ""; }; + DC67C08210A079BE0033B702 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + DC67C11710A07A810033B702 /* zbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zbar.h; path = ../include/zbar.h; sourceTree = SOURCE_ROOT; usesTabs = 0; }; + DC67C11F10A07AD30033B702 /* config.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = config.c; sourceTree = ""; usesTabs = 0; }; + DC67C12110A07AD30033B702 /* debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = debug.h; sourceTree = ""; usesTabs = 0; }; + DC67C12310A07AD30033B702 /* code128.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = code128.c; sourceTree = ""; }; + DC67C12410A07AD30033B702 /* code128.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = code128.h; sourceTree = ""; }; + DC67C12510A07AD30033B702 /* code39.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = code39.c; sourceTree = ""; }; + DC67C12610A07AD30033B702 /* code39.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = code39.h; sourceTree = ""; }; + DC67C12710A07AD30033B702 /* ean.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ean.c; sourceTree = ""; }; + DC67C12810A07AD30033B702 /* ean.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ean.h; sourceTree = ""; }; + DC67C12910A07AD30033B702 /* i25.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = i25.c; sourceTree = ""; }; + DC67C12A10A07AD30033B702 /* i25.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = i25.h; sourceTree = ""; }; + DC67C12E10A07AD30033B702 /* qr_finder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = qr_finder.c; sourceTree = ""; }; + DC67C12F10A07AD30033B702 /* qr_finder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = qr_finder.h; sourceTree = ""; }; + DC67C13010A07AD30033B702 /* decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = decoder.c; sourceTree = ""; usesTabs = 0; }; + DC67C13110A07AD30033B702 /* decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = decoder.h; sourceTree = ""; usesTabs = 0; }; + DC67C13210A07AD30033B702 /* error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = error.c; sourceTree = ""; usesTabs = 0; }; + DC67C13310A07AD30033B702 /* error.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = error.h; sourceTree = ""; usesTabs = 0; }; + DC67C13510A07AD30033B702 /* image.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = image.c; sourceTree = ""; usesTabs = 0; }; + DC67C13610A07AD30033B702 /* image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = image.h; sourceTree = ""; usesTabs = 0; }; + DC67C13710A07AD30033B702 /* img_scanner.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = img_scanner.c; sourceTree = ""; usesTabs = 0; }; + DC67C13810A07AD30033B702 /* img_scanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = img_scanner.h; sourceTree = ""; usesTabs = 0; }; + DC67C14710A07AD30033B702 /* bch15_5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bch15_5.c; sourceTree = ""; }; + DC67C14810A07AD30033B702 /* bch15_5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bch15_5.h; sourceTree = ""; }; + DC67C14910A07AD30033B702 /* binarize.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = binarize.c; sourceTree = ""; }; + DC67C14A10A07AD30033B702 /* binarize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = binarize.h; sourceTree = ""; }; + DC67C14B10A07AD30033B702 /* isaac.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = isaac.c; sourceTree = ""; }; + DC67C14C10A07AD30033B702 /* isaac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = isaac.h; sourceTree = ""; }; + DC67C14D10A07AD30033B702 /* qrdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = qrdec.c; sourceTree = ""; }; + DC67C14E10A07AD30033B702 /* qrdec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = qrdec.h; sourceTree = ""; }; + DC67C14F10A07AD30033B702 /* qrdectxt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = qrdectxt.c; sourceTree = ""; }; + DC67C15010A07AD30033B702 /* rs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rs.c; sourceTree = ""; }; + DC67C15110A07AD30033B702 /* rs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rs.h; sourceTree = ""; }; + DC67C15210A07AD30033B702 /* util.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = util.c; sourceTree = ""; }; + DC67C15310A07AD30033B702 /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = ""; }; + DC67C15410A07AD30033B702 /* qrcode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = qrcode.h; sourceTree = ""; usesTabs = 0; }; + DC67C15510A07AD30033B702 /* refcnt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = refcnt.c; sourceTree = ""; usesTabs = 0; }; + DC67C15610A07AD30033B702 /* refcnt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = refcnt.h; sourceTree = ""; usesTabs = 0; }; + DC67C15710A07AD30033B702 /* scanner.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = scanner.c; sourceTree = ""; usesTabs = 0; }; + DC67C15A10A07AD30033B702 /* symbol.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = symbol.c; sourceTree = ""; usesTabs = 0; }; + DC67C15B10A07AD30033B702 /* symbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = symbol.h; sourceTree = ""; usesTabs = 0; }; + DC67C1BE10A07B6B0033B702 /* ZBarHelpController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZBarHelpController.m; sourceTree = ""; usesTabs = 0; }; + DC67C1BF10A07B6B0033B702 /* ZBarReaderController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZBarReaderController.m; sourceTree = ""; usesTabs = 0; }; + DC67C1C010A07B6B0033B702 /* ZBarSymbol.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZBarSymbol.m; sourceTree = ""; usesTabs = 0; }; + DC67C1CB10A07BEE0033B702 /* svg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svg.h; sourceTree = ""; usesTabs = 0; }; + DC8245EE1629DC140010B2E6 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "examples/readertest/Default-568h@2x.png"; sourceTree = ""; }; + DCB3789A12A43C7E0059B07B /* ZBarHelpController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZBarHelpController.h; path = include/ZBarSDK/ZBarHelpController.h; sourceTree = ""; }; + DCC9324E137B509B0040A82D /* EmbedReader */ = {isa = PBXFileReference; lastKnownFileType = folder; name = EmbedReader; path = examples/EmbedReader; sourceTree = ""; }; + DCC9324F137B509B0040A82D /* TabReader */ = {isa = PBXFileReference; lastKnownFileType = folder; name = TabReader; path = examples/TabReader; sourceTree = ""; }; + DCDC6E2F11ADCA8E00021380 /* ZBarReaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZBarReaderView.m; sourceTree = ""; usesTabs = 0; }; + DCE9900B129719F100D2655C /* code93.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = code93.c; sourceTree = ""; }; + DCE9900C129719F100D2655C /* code93.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = code93.h; sourceTree = ""; }; + DCF5C9AB11EA3AD100E7DC21 /* databar.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = databar.c; sourceTree = ""; }; + DCF5C9AC11EA3AD100E7DC21 /* databar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = databar.h; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + DC299A931208B5D4006A023C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + DC299B841208FCAB006A023C /* Foundation.framework in Frameworks */, + DC299B061208FC11006A023C /* CoreGraphics.framework in Frameworks */, + DC299B311208FCA3006A023C /* UIKit.framework in Frameworks */, + DC299AA31208B61C006A023C /* QuartzCore.framework in Frameworks */, + DC299AA01208B61C006A023C /* AVFoundation.framework in Frameworks */, + DC299AA11208B61C006A023C /* CoreMedia.framework in Frameworks */, + DC299AA21208B61C006A023C /* CoreVideo.framework in Frameworks */, + DC299AA41208B61C006A023C /* libiconv.dylib in Frameworks */, + DC299A9D1208B5E8006A023C /* libzbar.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 034768DFFF38A50411DB9C8B /* Products */ = { + isa = PBXGroup; + children = ( + D2AAC07E0554694100DB518D /* libzbar.a */, + DC3CEF9D121633C500D7A786 /* readertest.app */, + DC48C55F121A1E7F0047193B /* ZBarSDK */, + ); + name = Products; + sourceTree = ""; + }; + 0867D691FE84028FC02AAC07 /* zbar */ = { + isa = PBXGroup; + children = ( + DC50467B12034D60009FF359 /* README */, + DC3CF141121721A100D7A786 /* ChangeLog */, + DC50467C12034D71009FF359 /* COPYING */, + DC50467D12034D71009FF359 /* LICENSE */, + 56286C3224385403000B3E6B /* LICENSE.md */, + DC48C5A7121B1F840047193B /* Documentation.html */, + DC299BED1208FE49006A023C /* src */, + DC1A49A111FF338B00BCDA30 /* Resources */, + DC67C11610A07A670033B702 /* include */, + DC3CF2071218356F00D7A786 /* Examples */, + DC48C5361219FE2F0047193B /* readertest */, + 0867D69AFE84028FC02AAC07 /* Frameworks */, + 034768DFFF38A50411DB9C8B /* Products */, + ); + name = zbar; + sourceTree = ""; + }; + 0867D69AFE84028FC02AAC07 /* Frameworks */ = { + isa = PBXGroup; + children = ( + AACBBE490F95108600F1A2B1 /* Foundation.framework */, + DC299B051208FC11006A023C /* CoreGraphics.framework */, + DC67C08210A079BE0033B702 /* UIKit.framework */, + DC1A49C111FF537000BCDA30 /* QuartzCore.framework */, + DC50453D1203396B009FF359 /* AVFoundation.framework */, + DC50453F1203396B009FF359 /* CoreMedia.framework */, + DC5045411203396B009FF359 /* CoreVideo.framework */, + DC5045431203396B009FF359 /* libiconv.dylib */, + ); + name = Frameworks; + sourceTree = ""; + }; + DC1A49A111FF338B00BCDA30 /* Resources */ = { + isa = PBXGroup; + children = ( + DC3CF2A212197A7200D7A786 /* zbar-back.png */, + DC1A49A211FF33B300BCDA30 /* zbar-help.html */, + DC1A49A311FF33B300BCDA30 /* zbar-helpicons.png */, + DC1A49A411FF33B300BCDA30 /* zbar-samples.png */, + ); + name = Resources; + sourceTree = ""; + usesTabs = 0; + }; + DC299BE41208FE09006A023C /* ZBarSDK */ = { + isa = PBXGroup; + children = ( + DC5D76C5136FA8F20069AEF5 /* ZBarCameraSimulator.h */, + DC3CEFA51216347100D7A786 /* ZBarCaptureReader.h */, + DCB3789A12A43C7E0059B07B /* ZBarHelpController.h */, + DC3CEFA61216347100D7A786 /* ZBarImage.h */, + DC3CEFA71216347100D7A786 /* ZBarImageScanner.h */, + DC3CEFA81216347100D7A786 /* ZBarReaderController.h */, + DC3CEFA91216347100D7A786 /* ZBarReaderView.h */, + DC3CEFAA1216347100D7A786 /* ZBarReaderViewController.h */, + DC3CEFAB1216347100D7A786 /* ZBarSDK.h */, + DC3CEFAC1216347100D7A786 /* ZBarSymbol.h */, + DC67C11710A07A810033B702 /* zbar.h */, + DC50463412034A1E009FF359 /* zbar */, + ); + name = ZBarSDK; + sourceTree = ""; + }; + DC299BED1208FE49006A023C /* src */ = { + isa = PBXGroup; + children = ( + DC67C1C010A07B6B0033B702 /* ZBarSymbol.m */, + DC4920EC10A70475000E4D43 /* ZBarImage.m */, + DC4920ED10A70475000E4D43 /* ZBarImageScanner.m */, + DC3AAB4D11B71A040021C7B1 /* ZBarCVImage.m */, + DC26004B118631C200FA987B /* ZBarCaptureReader.m */, + DCDC6E2F11ADCA8E00021380 /* ZBarReaderView.m */, + DC3CE47611FA1622008FAF88 /* ZBarReaderViewImpl_Capture.m */, + DC3CE47711FA1622008FAF88 /* ZBarReaderViewImpl_Simulator.m */, + DC5D76C2136FA8C40069AEF5 /* ZBarCameraSimulator.m */, + DC67C1BE10A07B6B0033B702 /* ZBarHelpController.m */, + DC3EBB2C119DDB2100107EE9 /* ZBarReaderViewController.m */, + DC67C1BF10A07B6B0033B702 /* ZBarReaderController.m */, + DC67C11E10A07AD30033B702 /* zbar */, + ); + name = src; + sourceTree = ""; + }; + DC3CF2071218356F00D7A786 /* Examples */ = { + isa = PBXGroup; + children = ( + DC3CF2081218358C00D7A786 /* ReaderSample */, + DC3CF2651218358C00D7A786 /* readertest */, + DCC9324E137B509B0040A82D /* EmbedReader */, + DCC9324F137B509B0040A82D /* TabReader */, + ); + name = Examples; + sourceTree = ""; + }; + DC48C5361219FE2F0047193B /* readertest */ = { + isa = PBXGroup; + children = ( + DC8245EE1629DC140010B2E6 /* Default-568h@2x.png */, + DC48C5401219FE550047193B /* readertest.m */, + ); + name = readertest; + sourceTree = ""; + }; + DC50463412034A1E009FF359 /* zbar */ = { + isa = PBXGroup; + children = ( + DC50463512034A4C009FF359 /* Decoder.h */, + DC50463612034A4C009FF359 /* Exception.h */, + DC50463712034A4C009FF359 /* Image.h */, + DC50463812034A4C009FF359 /* ImageScanner.h */, + DC50463912034A4C009FF359 /* Processor.h */, + DC50463A12034A4C009FF359 /* Scanner.h */, + DC50463B12034A4C009FF359 /* Symbol.h */, + DC50463C12034A4C009FF359 /* Video.h */, + DC50463D12034A4C009FF359 /* Window.h */, + ); + name = zbar; + sourceTree = ""; + }; + DC67C11610A07A670033B702 /* include */ = { + isa = PBXGroup; + children = ( + DC299BEC1208FE40006A023C /* prefix.pch */, + DC299AF51208B7BD006A023C /* config.h */, + DC3AAB4C11B71A040021C7B1 /* ZBarCVImage.h */, + DC299BE41208FE09006A023C /* ZBarSDK */, + ); + name = include; + sourceTree = ""; + usesTabs = 0; + }; + DC67C11E10A07AD30033B702 /* zbar */ = { + isa = PBXGroup; + children = ( + DC67C11F10A07AD30033B702 /* config.c */, + DC67C12110A07AD30033B702 /* debug.h */, + DC67C12210A07AD30033B702 /* decoder */, + DC67C13010A07AD30033B702 /* decoder.c */, + DC67C13110A07AD30033B702 /* decoder.h */, + DC67C13210A07AD30033B702 /* error.c */, + DC67C13310A07AD30033B702 /* error.h */, + DC67C13510A07AD30033B702 /* image.c */, + DC67C13610A07AD30033B702 /* image.h */, + DC67C13710A07AD30033B702 /* img_scanner.c */, + DC67C13810A07AD30033B702 /* img_scanner.h */, + DC67C14610A07AD30033B702 /* qrcode */, + DC67C15410A07AD30033B702 /* qrcode.h */, + DC67C15510A07AD30033B702 /* refcnt.c */, + DC67C15610A07AD30033B702 /* refcnt.h */, + DC67C15710A07AD30033B702 /* scanner.c */, + DC67C1CB10A07BEE0033B702 /* svg.h */, + DC67C15A10A07AD30033B702 /* symbol.c */, + DC67C15B10A07AD30033B702 /* symbol.h */, + ); + name = zbar; + path = ../zbar; + sourceTree = SOURCE_ROOT; + usesTabs = 0; + }; + DC67C12210A07AD30033B702 /* decoder */ = { + isa = PBXGroup; + children = ( + DCF5C9AB11EA3AD100E7DC21 /* databar.c */, + DCF5C9AC11EA3AD100E7DC21 /* databar.h */, + DC67C12310A07AD30033B702 /* code128.c */, + DC67C12410A07AD30033B702 /* code128.h */, + DCE9900B129719F100D2655C /* code93.c */, + DCE9900C129719F100D2655C /* code93.h */, + DC67C12510A07AD30033B702 /* code39.c */, + DC67C12610A07AD30033B702 /* code39.h */, + DC67C12710A07AD30033B702 /* ean.c */, + DC67C12810A07AD30033B702 /* ean.h */, + DC290E261351496400A9B857 /* codabar.c */, + DC290E271351496400A9B857 /* codabar.h */, + DC67C12910A07AD30033B702 /* i25.c */, + DC67C12A10A07AD30033B702 /* i25.h */, + DC67C12E10A07AD30033B702 /* qr_finder.c */, + DC67C12F10A07AD30033B702 /* qr_finder.h */, + ); + path = decoder; + sourceTree = ""; + usesTabs = 0; + }; + DC67C14610A07AD30033B702 /* qrcode */ = { + isa = PBXGroup; + children = ( + DC67C14710A07AD30033B702 /* bch15_5.c */, + DC67C14810A07AD30033B702 /* bch15_5.h */, + DC67C14910A07AD30033B702 /* binarize.c */, + DC67C14A10A07AD30033B702 /* binarize.h */, + DC67C14B10A07AD30033B702 /* isaac.c */, + DC67C14C10A07AD30033B702 /* isaac.h */, + DC67C14D10A07AD30033B702 /* qrdec.c */, + DC67C14E10A07AD30033B702 /* qrdec.h */, + DC67C14F10A07AD30033B702 /* qrdectxt.c */, + DC67C15010A07AD30033B702 /* rs.c */, + DC67C15110A07AD30033B702 /* rs.h */, + DC67C15210A07AD30033B702 /* util.c */, + DC67C15310A07AD30033B702 /* util.h */, + ); + path = qrcode; + sourceTree = ""; + usesTabs = 0; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + D2AAC07D0554694100DB518D /* libzbar */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "libzbar" */; + buildPhases = ( + D2AAC07B0554694100DB518D /* Sources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = libzbar; + productName = zbar; + productReference = D2AAC07E0554694100DB518D /* libzbar.a */; + productType = "com.apple.product-type.library.static"; + }; + DC299A941208B5D4006A023C /* readertest */ = { + isa = PBXNativeTarget; + buildConfigurationList = DC299A9A1208B5D5006A023C /* Build configuration list for PBXNativeTarget "readertest" */; + buildPhases = ( + DC299A911208B5D4006A023C /* Resources */, + DC299A921208B5D4006A023C /* Sources */, + DC299A931208B5D4006A023C /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + DC299A9F1208B5F1006A023C /* PBXTargetDependency */, + ); + name = readertest; + productName = readertest; + productReference = DC3CEF9D121633C500D7A786 /* readertest.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 0867D690FE84028FC02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1130; + }; + buildConfigurationList = 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "zbar" */; + compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + ); + mainGroup = 0867D691FE84028FC02AAC07 /* zbar */; + productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + D2AAC07D0554694100DB518D /* libzbar */, + DC3CEE821215C7EF00D7A786 /* ZBarSDK */, + DC1A4A4E11FF5D0500BCDA30 /* ZBarSDK.dmg */, + DC299A941208B5D4006A023C /* readertest */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + DC299A911208B5D4006A023C /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DC299AA51208B63C006A023C /* zbar-help.html in Resources */, + DC299AA61208B63C006A023C /* zbar-helpicons.png in Resources */, + DC299AA71208B63C006A023C /* zbar-samples.png in Resources */, + DC48C5341219FDDE0047193B /* zbar-back.png in Resources */, + 56286C3324385403000B3E6B /* LICENSE.md in Resources */, + DC8245EF1629DC340010B2E6 /* Default-568h@2x.png in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + DC1A4A4D11FF5D0500BCDA30 /* Make Disk Image */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Make Disk Image"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec $SOURCE_ROOT/bin/CreateDMG.sh ZBarSDK\n"; + }; + DC3CEE891215C88000D7A786 /* Build Universal Library */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILD_DIR)/$(CONFIGURATION)-iphoneos/libzbar.a", + "$(BUILD_DIR)/$(CONFIGURATION)-iphonesimulator/libzbar.a", + ); + name = "Build Universal Library"; + outputPaths = ( + "$(TARGET_BUILD_DIR)/libzbar.a", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec $SOURCE_ROOT/bin/BuildUniversal.sh libzbar\n"; + }; + DC48C585121AC7C20047193B /* Build Documentation */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Build Documentation"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "PATH=${PATH}:/usr/local/bin:/sw/bin\nsphinx-build -W -d $TEMP_DIR $SOURCE_ROOT/doc $TARGET_BUILD_DIR/Documentation"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + D2AAC07B0554694100DB518D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DC67C17110A07AD30033B702 /* config.c in Sources */, + DC67C17410A07AD30033B702 /* code128.c in Sources */, + DC67C17610A07AD30033B702 /* code39.c in Sources */, + DC67C17810A07AD30033B702 /* ean.c in Sources */, + DC67C17A10A07AD30033B702 /* i25.c in Sources */, + DC67C17F10A07AD30033B702 /* qr_finder.c in Sources */, + DC67C18110A07AD30033B702 /* decoder.c in Sources */, + DC67C18310A07AD30033B702 /* error.c in Sources */, + DC67C18610A07AD30033B702 /* image.c in Sources */, + DC67C18810A07AD30033B702 /* img_scanner.c in Sources */, + DC67C19510A07AD30033B702 /* bch15_5.c in Sources */, + DC67C19710A07AD30033B702 /* binarize.c in Sources */, + DC67C19910A07AD30033B702 /* isaac.c in Sources */, + DC67C19B10A07AD30033B702 /* qrdec.c in Sources */, + DC67C19D10A07AD30033B702 /* qrdectxt.c in Sources */, + DC67C19E10A07AD30033B702 /* rs.c in Sources */, + DC67C1A010A07AD30033B702 /* util.c in Sources */, + DC67C1A310A07AD30033B702 /* refcnt.c in Sources */, + DC67C1A510A07AD30033B702 /* scanner.c in Sources */, + DC67C1A810A07AD30033B702 /* symbol.c in Sources */, + DC67C1C210A07B6B0033B702 /* ZBarHelpController.m in Sources */, + DC67C1C310A07B6B0033B702 /* ZBarReaderController.m in Sources */, + DC67C1C410A07B6B0033B702 /* ZBarSymbol.m in Sources */, + DC4920EE10A70475000E4D43 /* ZBarImage.m in Sources */, + DC4920EF10A70475000E4D43 /* ZBarImageScanner.m in Sources */, + DC26004C118631C200FA987B /* ZBarCaptureReader.m in Sources */, + DC3EBB2D119DDB2100107EE9 /* ZBarReaderViewController.m in Sources */, + DCDC6E3011ADCA8E00021380 /* ZBarReaderView.m in Sources */, + DC3AAB4F11B71A040021C7B1 /* ZBarCVImage.m in Sources */, + DCF5C9AD11EA3AD100E7DC21 /* databar.c in Sources */, + DC3CE47811FA1622008FAF88 /* ZBarReaderViewImpl_Capture.m in Sources */, + DC3CE47911FA1622008FAF88 /* ZBarReaderViewImpl_Simulator.m in Sources */, + DCE9900D129719F100D2655C /* code93.c in Sources */, + DC5D76C3136FA8C40069AEF5 /* ZBarCameraSimulator.m in Sources */, + DC290E281351496400A9B857 /* codabar.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + DC299A921208B5D4006A023C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DC48C5411219FE550047193B /* readertest.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + DC299A9F1208B5F1006A023C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D2AAC07D0554694100DB518D /* libzbar */; + targetProxy = DC299A9E1208B5F1006A023C /* PBXContainerItemProxy */; + }; + DC3CEE871215C85400D7A786 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D2AAC07D0554694100DB518D /* libzbar */; + targetProxy = DC3CEE861215C85400D7A786 /* PBXContainerItemProxy */; + }; + DC3CF01F1216366200D7A786 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = DC3CEE821215C7EF00D7A786 /* ZBarSDK */; + targetProxy = DC3CF01E1216366200D7A786 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 1DEB921F08733DC00010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_WEAK = YES; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = include/prefix.pch; + HEADER_SEARCH_PATHS = ( + include, + ../include, + ../zbar, + ); + INSTALL_PATH = /usr/local/lib; + OTHER_LDFLAGS = ""; + PRODUCT_NAME = zbar; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 1DEB922008733DC00010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_WEAK = YES; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = include/prefix.pch; + HEADER_SEARCH_PATHS = ( + include, + ../include, + ../zbar, + ); + INSTALL_PATH = /usr/local/lib; + OTHER_LDFLAGS = ""; + PRODUCT_NAME = zbar; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 1DEB922308733DC00010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + EXCLUDED_SOURCE_FILE_NAMES = ""; + "EXCLUDED_SOURCE_FILE_NAMES[sdk=iphoneos*][arch=*]" = ZBarReaderViewImpl_Simulator.m; + "EXCLUDED_SOURCE_FILE_NAMES[sdk=iphonesimulator*][arch=*]" = ( + ZBarReaderViewImpl_Capture.m, + ZBarCaptureReader.m, + ); + GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = "DEBUG_OBJC=1"; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = "-all_load"; + PROVISIONING_PROFILE = ""; + RUN_CLANG_STATIC_ANALYZER = NO; + SDKROOT = iphoneos; + USE_HEADERMAP = NO; + }; + name = Debug; + }; + 1DEB922408733DC00010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + EXCLUDED_SOURCE_FILE_NAMES = ""; + "EXCLUDED_SOURCE_FILE_NAMES[sdk=iphoneos*][arch=*]" = ZBarReaderViewImpl_Simulator.m; + "EXCLUDED_SOURCE_FILE_NAMES[sdk=iphonesimulator*][arch=*]" = ( + ZBarReaderViewImpl_Capture.m, + ZBarCaptureReader.m, + ); + GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREPROCESSOR_DEFINITIONS = "NDEBUG=1"; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + OTHER_LDFLAGS = "-all_load"; + PROVISIONING_PROFILE = ""; + RUN_CLANG_STATIC_ANALYZER = NO; + SDKROOT = iphoneos; + USE_HEADERMAP = NO; + }; + name = Release; + }; + DC1A4A4F11FF5D0500BCDA30 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + COPY_PHASE_STRIP = NO; + PRODUCT_NAME = ZBarSDK.dmg; + TARGETED_DEVICE_FAMILY = "1,2"; + TARGET_BUILD_DIR = "$(TARGET_BUILD_DIR)/$(PRODUCT_NAME)"; + }; + name = Debug; + }; + DC1A4A5011FF5D0500BCDA30 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + COPY_PHASE_STRIP = NO; + PRODUCT_NAME = ZBarSDK.dmg; + TARGETED_DEVICE_FAMILY = "1,2"; + TARGET_BUILD_DIR = "$(TARGET_BUILD_DIR)/$(PRODUCT_NAME)"; + }; + name = Release; + }; + DC299A981208B5D5006A023C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_WEAK = YES; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = examples/readertest/prefix.pch; + HEADER_SEARCH_PATHS = ( + include/ZBarSDK, + ../include, + ); + INFOPLIST_FILE = examples/readertest/readertest.plist; + INSTALL_PATH = "$(HOME)/Applications"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + PRODUCT_BUNDLE_IDENTIFIER = net.sourceforge.zbar.test.readertest; + PRODUCT_NAME = readertest; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + DC299A991208B5D5006A023C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_WEAK = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = examples/readertest/prefix.pch; + HEADER_SEARCH_PATHS = ( + include/ZBarSDK, + ../include, + ); + INFOPLIST_FILE = examples/readertest/readertest.plist; + INSTALL_PATH = "$(HOME)/Applications"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + PRODUCT_BUNDLE_IDENTIFIER = net.sourceforge.zbar.test.readertest; + PRODUCT_NAME = readertest; + TARGETED_DEVICE_FAMILY = "1,2"; + ZERO_LINK = NO; + }; + name = Release; + }; + DC3748D71357BC69004E69D6 /* Distribution */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Distribution"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + EXCLUDED_SOURCE_FILE_NAMES = ""; + "EXCLUDED_SOURCE_FILE_NAMES[sdk=iphoneos*][arch=*]" = ZBarReaderViewImpl_Simulator.m; + "EXCLUDED_SOURCE_FILE_NAMES[sdk=iphonesimulator*][arch=*]" = ( + ZBarReaderViewImpl_Capture.m, + ZBarCaptureReader.m, + ); + GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREPROCESSOR_DEFINITIONS = "NDEBUG=1"; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + OTHER_LDFLAGS = "-all_load"; + PROVISIONING_PROFILE = ""; + RUN_CLANG_STATIC_ANALYZER = NO; + SDKROOT = iphoneos; + USE_HEADERMAP = NO; + }; + name = Distribution; + }; + DC3748D81357BC69004E69D6 /* Distribution */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_WEAK = YES; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = include/prefix.pch; + HEADER_SEARCH_PATHS = ( + include, + ../include, + ../zbar, + ); + INSTALL_PATH = /usr/local/lib; + OTHER_LDFLAGS = ""; + PRODUCT_NAME = zbar; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Distribution; + }; + DC3748D91357BC69004E69D6 /* Distribution */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + PRODUCT_NAME = ZBarSDK; + TARGET_BUILD_DIR = "$(TARGET_BUILD_DIR)/$(PRODUCT_NAME)"; + ZERO_LINK = NO; + }; + name = Distribution; + }; + DC3748DA1357BC69004E69D6 /* Distribution */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + COPY_PHASE_STRIP = NO; + PRODUCT_NAME = ZBarSDK.dmg; + TARGETED_DEVICE_FAMILY = "1,2"; + TARGET_BUILD_DIR = "$(TARGET_BUILD_DIR)/$(PRODUCT_NAME)"; + }; + name = Distribution; + }; + DC3748DB1357BC69004E69D6 /* Distribution */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_WEAK = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = examples/readertest/prefix.pch; + HEADER_SEARCH_PATHS = ( + include/ZBarSDK, + ../include, + ); + INFOPLIST_FILE = examples/readertest/readertest.plist; + INSTALL_PATH = "$(HOME)/Applications"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + PRODUCT_BUNDLE_IDENTIFIER = net.sourceforge.zbar.test.readertest; + PRODUCT_NAME = readertest; + TARGETED_DEVICE_FAMILY = "1,2"; + ZERO_LINK = NO; + }; + name = Distribution; + }; + DC3CEE831215C7EF00D7A786 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + PRODUCT_NAME = ZBarSDK; + TARGET_BUILD_DIR = "$(TARGET_BUILD_DIR)/$(PRODUCT_NAME)"; + }; + name = Debug; + }; + DC3CEE841215C7EF00D7A786 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + PRODUCT_NAME = ZBarSDK; + TARGET_BUILD_DIR = "$(TARGET_BUILD_DIR)/$(PRODUCT_NAME)"; + ZERO_LINK = NO; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "libzbar" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB921F08733DC00010E9CD /* Debug */, + 1DEB922008733DC00010E9CD /* Release */, + DC3748D81357BC69004E69D6 /* Distribution */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Distribution; + }; + 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "zbar" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB922308733DC00010E9CD /* Debug */, + 1DEB922408733DC00010E9CD /* Release */, + DC3748D71357BC69004E69D6 /* Distribution */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Distribution; + }; + DC1A4A5311FF5D3D00BCDA30 /* Build configuration list for PBXAggregateTarget "ZBarSDK.dmg" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DC1A4A4F11FF5D0500BCDA30 /* Debug */, + DC1A4A5011FF5D0500BCDA30 /* Release */, + DC3748DA1357BC69004E69D6 /* Distribution */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Distribution; + }; + DC299A9A1208B5D5006A023C /* Build configuration list for PBXNativeTarget "readertest" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DC299A981208B5D5006A023C /* Debug */, + DC299A991208B5D5006A023C /* Release */, + DC3748DB1357BC69004E69D6 /* Distribution */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Distribution; + }; + DC3CEE851215C83500D7A786 /* Build configuration list for PBXAggregateTarget "ZBarSDK" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DC3CEE831215C7EF00D7A786 /* Debug */, + DC3CEE841215C7EF00D7A786 /* Release */, + DC3748D91357BC69004E69D6 /* Distribution */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Distribution; + }; +/* End XCConfigurationList section */ + }; + rootObject = 0867D690FE84028FC02AAC07 /* Project object */; +} diff --git a/iphone/zbar.xcodeproj/xcshareddata/xcschemes/ZBarSDK.dmg.xcscheme b/iphone/zbar.xcodeproj/xcshareddata/xcschemes/ZBarSDK.dmg.xcscheme new file mode 100644 index 0000000..e18d450 --- /dev/null +++ b/iphone/zbar.xcodeproj/xcshareddata/xcschemes/ZBarSDK.dmg.xcscheme @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iphone/zbar.xcodeproj/xcshareddata/xcschemes/ZBarSDK.xcscheme b/iphone/zbar.xcodeproj/xcshareddata/xcschemes/ZBarSDK.xcscheme new file mode 100644 index 0000000..1abb409 --- /dev/null +++ b/iphone/zbar.xcodeproj/xcshareddata/xcschemes/ZBarSDK.xcscheme @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iphone/zbar.xcodeproj/xcshareddata/xcschemes/libzbar.xcscheme b/iphone/zbar.xcodeproj/xcshareddata/xcschemes/libzbar.xcscheme new file mode 100644 index 0000000..07cb0e8 --- /dev/null +++ b/iphone/zbar.xcodeproj/xcshareddata/xcschemes/libzbar.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iphone/zbar.xcodeproj/xcshareddata/xcschemes/readertest.xcscheme b/iphone/zbar.xcodeproj/xcshareddata/xcschemes/readertest.xcscheme new file mode 100644 index 0000000..e50c0e3 --- /dev/null +++ b/iphone/zbar.xcodeproj/xcshareddata/xcschemes/readertest.xcscheme @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3