diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-09 00:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-09 00:06:44 +0000 |
commit | 44cf8ec67278bd1ab6c7f83a9993f7a5686a9541 (patch) | |
tree | 5eec4b0d1a3f163d279c3c27c03324ba49fa235a /iphone/include | |
parent | Initial commit. (diff) | |
download | zbar-44cf8ec67278bd1ab6c7f83a9993f7a5686a9541.tar.xz zbar-44cf8ec67278bd1ab6c7f83a9993f7a5686a9541.zip |
Adding upstream version 0.23.93.upstream/0.23.93upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'iphone/include')
-rw-r--r-- | iphone/include/ZBarSDK/ZBarCameraSimulator.h | 42 | ||||
-rw-r--r-- | iphone/include/ZBarSDK/ZBarCaptureReader.h | 109 | ||||
-rw-r--r-- | iphone/include/ZBarSDK/ZBarHelpController.h | 59 | ||||
-rw-r--r-- | iphone/include/ZBarSDK/ZBarImage.h | 64 | ||||
-rw-r--r-- | iphone/include/ZBarSDK/ZBarImageScanner.h | 50 | ||||
-rw-r--r-- | iphone/include/ZBarSDK/ZBarReaderController.h | 139 | ||||
-rw-r--r-- | iphone/include/ZBarSDK/ZBarReaderView.h | 137 | ||||
-rw-r--r-- | iphone/include/ZBarSDK/ZBarReaderViewController.h | 132 | ||||
-rw-r--r-- | iphone/include/ZBarSDK/ZBarSDK.h | 34 | ||||
-rw-r--r-- | iphone/include/ZBarSDK/ZBarSymbol.h | 67 | ||||
-rw-r--r-- | iphone/include/config.h | 236 | ||||
-rw-r--r-- | iphone/include/prefix.pch | 10 |
12 files changed, 1079 insertions, 0 deletions
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 <spadix@users.sourceforge.net> +// +// 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 <UINavigationControllerDelegate, UIImagePickerControllerDelegate, + UIPopoverControllerDelegate> { + 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 <spadix@users.sourceforge.net> +// +// 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 <CoreGraphics/CoreGraphics.h> +#import "ZBarImageScanner.h" + +@class AVCaptureVideoDataOutput, AVCaptureOutput; +@class ZBarCaptureReader, ZBarCVImage; + +@protocol ZBarCaptureDelegate <NSObject> + +// 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<ZBarCaptureDelegate> 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<ZBarCaptureDelegate> 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 <spadix@users.sourceforge.net> +// +// 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 <UIKit/UIKit.h> +#import <WebKit/WebKit.h> + +@class ZBarHelpController; + +@protocol ZBarHelpDelegate +@optional + +- (void)helpControllerDidFinish:(ZBarHelpController *)help; + +@end + +// failure dialog w/a few useful tips + +@interface ZBarHelpController + : UIViewController <WKNavigationDelegate, UIAlertViewDelegate> { + NSString *reason; + id delegate; + WKWebView *webView; + UIToolbar *toolbar; + UIBarButtonItem *doneBtn, *backBtn, *space; + NSURL *linkURL; + NSUInteger orientations; + UIView *controls; +} + +@property (nonatomic, assign) id<ZBarHelpDelegate> 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 <spadix@users.sourceforge.net> +// +// 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 <UIKit/UIKit.h> +#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 <spadix@users.sourceforge.net> +// +// 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 <Foundation/Foundation.h> +#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 <spadix@users.sourceforge.net> +// +// 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 <UIKit/UIKit.h> +#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 <UIImagePickerControllerDelegate> +@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 <UINavigationControllerDelegate, + UIImagePickerControllerDelegate> { + ZBarImageScanner *scanner; + ZBarHelpController *help; + UIView *overlay, *boxView; + CALayer *boxLayer; + + UIToolbar *toolbar; + UIBarButtonItem *cancelBtn, *scanBtn, *space[3]; + UIButton *infoBtn; + + id<ZBarReaderDelegate> 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<ZBarReaderDelegate> 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<NSFastEnumeration>)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 <spadix@users.sourceforge.net> +// +// 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 <UIKit/UIKit.h> +#import "ZBarImageScanner.h" + +@class AVCaptureSession, AVCaptureDevice; +@class CALayer; +@class ZBarImageScanner, ZBarCaptureReader, ZBarReaderView; + +// delegate is notified of decode results. + +@protocol ZBarReaderViewDelegate <NSObject> + +- (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<ZBarReaderViewDelegate> 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<ZBarReaderViewDelegate> 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 <spadix@users.sourceforge.net> +// +// 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 <UIKit/UIKit.h> +#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<ZBarReaderDelegate> 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<ZBarReaderDelegate> 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 <spadix@users.sourceforge.net> + * + * 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 <spadix@users.sourceforge.net> +// +// 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 <CoreGraphics/CoreGraphics.h> +#import <Foundation/Foundation.h> +#import "zbar.h" + +#ifdef __cplusplus +using namespace zbar; +#endif + +// Obj-C wrapper for ZBar result types + +@interface ZBarSymbolSet : NSObject <NSFastEnumeration> { + 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 <dlfcn.h> header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the <fcntl.h> header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the <features.h> 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 <inttypes.h> header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the <jpeglib.h> 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 <linux/videodev2.h> header file. */ +#undef HAVE_LINUX_VIDEODEV2_H + +/* Define to 1 if you have the <linux/videodev.h> header file. */ +#undef HAVE_LINUX_VIDEODEV_H + +/* Define to 1 if you have the <memory.h> 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 <poll.h> header file. */ +#undef HAVE_POLL_H + +/* Define to 1 if you have the <pthread.h> 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 <stdint.h> header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the <strings.h> header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the <sys/ioctl.h> header file. */ +#undef HAVE_SYS_IOCTL_H + +/* Define to 1 if you have the <sys/ipc.h> header file. */ +#undef HAVE_SYS_IPC_H + +/* Define to 1 if you have the <sys/mman.h> header file. */ +#undef HAVE_SYS_MMAN_H + +/* Define to 1 if you have the <sys/shm.h> header file. */ +#undef HAVE_SYS_SHM_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/times.h> header file. */ +#define HAVE_SYS_TIMES_H 1 + +/* Define to 1 if you have the <sys/time.h> header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the <sys/types.h> 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 <unistd.h> header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the <vfw.h> header file. */ +#undef HAVE_VFW_H + +/* Define to 1 if you have the <X11/extensions/XShm.h> header file. */ +#undef HAVE_X11_EXTENSIONS_XSHM_H + +/* Define to 1 if you have the <X11/extensions/Xvlib.h> 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 <sys/synch.h>, + <pthread.h>, or <semaphore.h> 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 <sys/synch.h>, + <pthread.h>, or <semaphore.h> 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 <Foundation/Foundation.h> +# import <CoreFoundation/CoreFoundation.h> +# import <CoreGraphics/CoreGraphics.h> +# import <UIKit/UIKit.h> +# import <QuartzCore/QuartzCore.h> +# import <AVFoundation/AVFoundation.h> +# import <CoreMedia/CoreMedia.h> +# import <CoreVideo/CoreVideo.h> +#endif |