[SCM] Multi-format 1D/2D barcode image processing library branch, upstream, updated. 24d4480bc48cf9eabf7b2bd2f528248b0e458809
ftylitak
ftylitak at 59b500cc-1b3d-0410-9834-0bbf25fbcc57
Wed Aug 4 01:31:23 UTC 2010
The following commit has been merged in the upstream branch:
commit 147ed943d31eb6ccb14cd2c6e0a6c27a7fb9f800
Author: ftylitak <ftylitak at 59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Date: Thu May 6 11:18:01 2010 +0000
Added a project written on Qt framework for Symbian and added tutorials for both ZXingBarcodeReader and QQrDecoder
git-svn-id: http://zxing.googlecode.com/svn/trunk@1339 59b500cc-1b3d-0410-9834-0bbf25fbcc57
diff --git a/AUTHORS b/AUTHORS
index e2f33f5..b30e0c3 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -30,6 +30,7 @@ Mateusz Jędrasik
Matthew Schulkind (Google)
Matt York (LifeMarks)
Mohamad Fairol
+Nikolaos Ftylitakis
Paul Hackenberger
Randy Shen (Acer)
Rasmus Schrøder Sørensen
diff --git a/symbian/QQrDecoder/CameraImageWrapper.cpp b/symbian/QQrDecoder/CameraImageWrapper.cpp
new file mode 100644
index 0000000..e8ac50f
--- /dev/null
+++ b/symbian/QQrDecoder/CameraImageWrapper.cpp
@@ -0,0 +1,77 @@
+#include "CameraImageWrapper.h"
+#include <QColor>
+#include <QApplication>
+#include <QDesktopWidget>
+
+CameraImageWrapper::CameraImageWrapper() : LuminanceSource()
+{
+}
+
+CameraImageWrapper::CameraImageWrapper(CameraImageWrapper& otherInstance) : LuminanceSource()
+{
+ image = otherInstance.getOriginalImage().copy();
+}
+
+CameraImageWrapper::~CameraImageWrapper()
+{
+}
+
+int CameraImageWrapper::getWidth()
+{
+ return image.width();
+}
+
+int CameraImageWrapper::getHeight()
+{
+ return image.height();
+}
+
+unsigned char CameraImageWrapper::getPixel(int x, int y)
+{
+ QRgb pixel = image.pixel(x,y);
+
+ return qGray(pixel);//((qRed(pixel) + qGreen(pixel) + qBlue(pixel)) / 3);
+}
+
+void CameraImageWrapper::setImage(QString fileName, char* format)
+{
+ image.load(fileName);
+
+ if(image.width() > QApplication::desktop()->width())
+ image = image.scaled(QApplication::desktop()->width(), image.height(), Qt::IgnoreAspectRatio);
+
+ if(image.height() > QApplication::desktop()->height())
+ image = image.scaled(image.width(), QApplication::desktop()->height(), Qt::IgnoreAspectRatio);
+}
+
+void CameraImageWrapper::setImage(QImage newImage)
+{
+ image = newImage.copy();
+
+ if(image.width() > 640)
+ image = image.scaled(640, image.height(), Qt::KeepAspectRatio);
+}
+
+QImage CameraImageWrapper::grayScaleImage(QImage::Format f)
+{
+ QImage tmp(image.width(), image.height(), f);
+ for(int i=0; i<image.width(); i++)
+ {
+ for(int j=0; j<image.height(); j++)
+ {
+ int pix = (int)getPixel(i,j);
+ tmp.setPixel(i,j, qRgb(pix ,pix,pix));
+ }
+ }
+
+ return tmp;
+
+ //return image.convertToFormat(f);
+}
+
+QImage CameraImageWrapper::getOriginalImage()
+{
+ return image;
+}
+
+
diff --git a/symbian/QQrDecoder/CameraImageWrapper.h b/symbian/QQrDecoder/CameraImageWrapper.h
new file mode 100644
index 0000000..2fa1632
--- /dev/null
+++ b/symbian/QQrDecoder/CameraImageWrapper.h
@@ -0,0 +1,31 @@
+#ifndef CAMERAIMAGE_H
+#define CAMERAIMAGE_H
+
+#include <QImage>
+#include <QString>
+#include <zxing/LuminanceSource.h>
+
+using namespace zxing;
+
+class CameraImageWrapper : public LuminanceSource
+{
+public:
+ CameraImageWrapper();
+ CameraImageWrapper(CameraImageWrapper& otherInstance);
+ ~CameraImageWrapper();
+
+ int getWidth();
+ int getHeight();
+
+ unsigned char getPixel(int x, int y);
+
+ void setImage(QString fileName, char* format);
+ void setImage(QImage newImage);
+ QImage grayScaleImage(QImage::Format f);
+ QImage getOriginalImage();
+
+private:
+ QImage image;
+};
+
+#endif //CAMERAIMAGE_H
diff --git a/symbian/ZXingBarcodeReader/Nokia_Licence.txt b/symbian/QQrDecoder/Nokia_Licence.txt
similarity index 100%
copy from symbian/ZXingBarcodeReader/Nokia_Licence.txt
copy to symbian/QQrDecoder/Nokia_Licence.txt
diff --git a/symbian/QQrDecoder/QCameraControllerWidget.cpp b/symbian/QQrDecoder/QCameraControllerWidget.cpp
new file mode 100644
index 0000000..12f22c5
--- /dev/null
+++ b/symbian/QQrDecoder/QCameraControllerWidget.cpp
@@ -0,0 +1,322 @@
+#include "QCameraControllerWidget.h"
+#include <QPainter>
+
+QCameraControllerWidget::QCameraControllerWidget(QWidget* parent) : QWidget(parent),
+iCameraWrapper(NULL), iBackBuffer(NULL), iBackBufferDevice(NULL), iBackBufferContext(NULL)
+{
+ timer = new QTimer(this);
+ connect(timer, SIGNAL(timeout()), this, SLOT(sendBackbufferToDecode()));
+ timer->start(500);
+}
+
+QCameraControllerWidget::~QCameraControllerWidget()
+{
+ if (iCameraWrapper)
+ {
+ iCameraWrapper->ReleaseAndPowerOff();
+ }
+
+ delete iCameraWrapper;
+
+ if(timer)
+ {
+ delete timer;
+ timer = NULL;
+ }
+
+ ReleaseBackBuffer();
+}
+
+void QCameraControllerWidget::CaptureImage()
+{
+ if (iCameraWrapper && iCameraWrapper->State() == CCameraEngine::EEngineViewFinding)
+ {
+ emit logMessage("Capturing picture");
+ iCameraWrapper->StopViewFinder();
+ TRAPD(err,iCameraWrapper->CaptureL());
+ if (err)
+ {
+ emit logMessage("Camera capture error");
+ }
+ }
+}
+
+void QCameraControllerWidget::paintEvent(QPaintEvent* event)
+{
+ if(iBackBuffer)
+ {
+ QPainter paint(this);
+ paint.drawPixmap(0,0,QPixmap::fromSymbianCFbsBitmap(iBackBuffer));
+ }
+}
+
+void QCameraControllerWidget::resizeEvent(QResizeEvent* event)
+{
+ static int savedWidth = 0;
+ static int savedHeight = 0;
+
+ if(!savedWidth || !savedHeight)
+ {
+ InitializeCamera();
+ savedWidth = geometry().width();
+ savedHeight = geometry().height();
+ }
+}
+
+void QCameraControllerWidget::InitializeCamera()
+{
+ // Create camera wrapper class here because
+ // whole camera wrapper and all handles have to reset
+ // while orientatio of the application changes.
+ if (iCameraWrapper)
+ {
+ // Power off camera if it is on
+ iCameraWrapper->StopViewFinder();
+ iCameraWrapper->ReleaseAndPowerOff();
+ delete iCameraWrapper; iCameraWrapper = NULL;
+ }
+ TInt camErr(KErrNotSupported);
+ if(CCameraEngine::CamerasAvailable() > 0)
+ {
+ TRAP(camErr, iCameraWrapper = CCameraEngine::NewL(0,0,this));
+ }
+
+ // iViewFinderSize is picture size for viewfinder.
+ // iCaptureSize is picture size for capturing picture.
+ // We want fill whole screen
+ if (geometry().width() > geometry().height())
+ {
+ iViewFinderSize = TSize(geometry().width(),geometry().width());
+ iCaptureSize = TSize(geometry().width(),geometry().width()); // Captured picture size
+ }
+ else
+ {
+ iViewFinderSize = TSize(geometry().height(), geometry().height());
+ iCaptureSize = TSize(geometry().height(),geometry().height()); // Captured picture size
+ }
+
+ // Create back buffer where recieved camera pictures are copied
+ ReleaseBackBuffer();
+ CreateBackBufferL();
+
+ // Power on camera, start viewfinder when MceoCameraReady() received
+ if(camErr == KErrNone)
+ {
+ iCameraWrapper->ReserveAndPowerOn();
+ emit logMessage("Camera power on");
+ }
+ else
+ {
+ emit logMessage("no camera found");
+ }
+}
+
+void QCameraControllerWidget::CreateBackBufferL()
+{
+ // create back buffer bitmap
+ iBackBuffer = q_check_ptr(new CFbsBitmap);
+
+ try{
+ TSize size;
+ size.iHeight = this->geometry().height();
+ size.iWidth = this->geometry().width();
+ QT_TRAP_THROWING( iBackBuffer->Create(size,EColor64K));
+ }
+ catch(std::exception& e)
+ {
+
+ }
+
+ // create back buffer graphics context
+ iBackBufferDevice = CFbsBitmapDevice::NewL(iBackBuffer);
+ User::LeaveIfError(iBackBufferDevice->CreateContext(iBackBufferContext));
+ iBackBufferContext->SetPenStyle(CGraphicsContext::ESolidPen);
+
+ iBackBufferContext->SetBrushColor(KRgbBlack);
+ iBackBufferContext->Clear();
+}
+
+void QCameraControllerWidget::ReleaseBackBuffer()
+{
+ if (iBackBufferContext)
+ {
+ delete iBackBufferContext;
+ iBackBufferContext = NULL;
+ }
+ if (iBackBufferDevice)
+ {
+ delete iBackBufferDevice;
+ iBackBufferDevice = NULL;
+ }
+ if (iBackBuffer)
+ {
+ delete iBackBuffer;
+ iBackBuffer = NULL;
+ }
+}
+
+void QCameraControllerWidget::MceoCameraReady()
+{
+ if (iCameraWrapper->State() == CCameraEngine::EEngineIdle)
+ {
+ // Prepare camera
+ TSize imageSize;
+ imageSize.iHeight = 480;
+ imageSize.iWidth = 640;
+
+ CCamera::TFormat format = CCamera::EFormatFbsBitmapColor64K;
+
+ TRAPD(err,iCameraWrapper->PrepareL(imageSize, format));
+ if (err)
+ {
+ emit logMessage("Camera prepare error");
+ return;
+ }
+
+ // Start viewfinder. Viewfinder pictures starts coming into MceoViewFinderFrameReady();
+
+ TSize finderSize;
+ finderSize.iHeight = this->geometry().height();
+ finderSize.iWidth = this->geometry().width();
+ TRAPD(err2,iCameraWrapper->StartViewFinderL(finderSize));
+ if (err2)
+ {
+ emit logMessage("Camera start viewfinder error");
+ return;
+ }
+
+ emit logMessage("Camera viewfinder started");
+ }
+}
+
+void QCameraControllerWidget::MceoFocusComplete()
+{
+ // CameraEngine state is EEngineIdle
+ emit logMessage("Focused");
+
+ // Capture picture after it has focused
+ iCameraWrapper->StopViewFinder();
+ TRAPD(err,iCameraWrapper->CaptureL());
+ if (err)
+ {
+ emit logMessage("Camera capture error");
+ }
+}
+
+void QCameraControllerWidget::MceoCapturedDataReady( TDesC8* aData )
+{
+
+}
+
+void QCameraControllerWidget::MceoCapturedBitmapReady( CFbsBitmap* aBitmap )
+{
+ if (iBackBufferContext)
+ {
+ emit logMessage("Succesfull capture");
+
+ QPixmap pix(QPixmap::fromSymbianCFbsBitmap(aBitmap));
+ emit imageCaptured(pix.toImage());
+
+ TSize finderSize;
+ finderSize.iHeight = this->geometry().height();
+ finderSize.iWidth = this->geometry().width();
+ TRAPD(err2,iCameraWrapper->StartViewFinderL(finderSize));
+ if (err2)
+ {
+ emit logMessage("Camera start viewfinder error");
+ return;
+ }
+ }
+ if (iCameraWrapper)
+ iCameraWrapper->ReleaseImageBuffer();
+}
+
+void QCameraControllerWidget::MceoViewFinderFrameReady( CFbsBitmap& aFrame )
+{
+ if (iBackBufferContext)
+ {
+ TSize bmpSizeInPixels = aFrame.SizeInPixels();
+ TInt xDelta = 0;
+ TInt yDelta = 0;
+ TPoint pos( xDelta, yDelta );
+
+ // Copy received viewfinder picture to back buffer
+ iBackBufferContext->BitBlt( pos, &aFrame, TRect( TPoint( 0, 0 ), bmpSizeInPixels ));
+
+ // Update backbuffer into screen
+ update();
+ }
+ if (iCameraWrapper)
+ iCameraWrapper->ReleaseViewFinderBuffer();
+}
+
+void QCameraControllerWidget::MceoHandleError( TCameraEngineError aErrorType, TInt aError )
+{
+ // NOTE: CameraEngine state seems to go into CCameraEngine::EEngineIdle state
+
+ if (aErrorType == EErrReserve)
+ {
+ return; //-18 comes on application startup, but everything works ok
+ }
+
+ switch (aErrorType)
+ {
+ case EErrReserve:
+ {
+ emit logMessage("Camera reserved error");
+ break;
+ }
+ case EErrPowerOn:
+ {
+ emit logMessage("Camera power on error");
+ break;
+ }
+ case EErrViewFinderReady:
+ {
+ emit logMessage("Camera viewfinder error");
+ break;
+ }
+ case EErrImageReady:
+ {
+ emit logMessage("Camera image ready error");
+ break;
+ }
+ case EErrAutoFocusInit:
+ case EErrAutoFocusMode:
+ case EErrAutoFocusArea:
+ case EErrAutoFocusRange:
+ case EErrAutoFocusType:
+ case EErrOptimisedFocusComplete:
+ {
+ //emit logMessage("Try focusing again");
+ break;
+ }
+ default:
+ {
+ emit logMessage("Unknown error");
+ break;
+ }
+ };
+
+ // Try handle error
+ //CancelCapturedPicture(EFalse);
+ // iAppUi->UseOptionsExitCbaL();
+}
+
+void QCameraControllerWidget::MceoHandleOtherEvent( const TECAMEvent& /*aEvent*/ )
+{
+}
+
+//Timer slot
+void QCameraControllerWidget::sendBackbufferToDecode()
+{
+ if(!iBackBuffer)
+ return;
+
+ QPixmap pix(QPixmap::fromSymbianCFbsBitmap(iBackBuffer));
+ emit imageCaptured(pix.toImage());
+
+ if(timer)
+ timer->start(500);
+}
+
diff --git a/symbian/QQrDecoder/QCameraControllerWidget.h b/symbian/QQrDecoder/QCameraControllerWidget.h
new file mode 100644
index 0000000..ae0e38d
--- /dev/null
+++ b/symbian/QQrDecoder/QCameraControllerWidget.h
@@ -0,0 +1,67 @@
+#ifndef QCAMERACONTROLLER_H
+#define QCAMERACONTROLLER_H
+
+#include <QWidget>
+#include <FBS.H>
+#include <BITDEV.H>
+#include <BITSTD.H>
+#include <e32cmn.h>
+#include <GDI.H>
+
+#include <cameraengine.h>
+#include <cameraengineobserver.h>
+
+#include <QTimer>
+
+class QCameraControllerWidget : public QWidget, public MCameraEngineObserver
+{
+ Q_OBJECT
+
+public:
+ QCameraControllerWidget(QWidget* parent);
+ ~QCameraControllerWidget();
+
+protected:
+ void paintEvent(QPaintEvent* event);
+ void resizeEvent(QResizeEvent* event);
+
+private: // From MCameraEngineObserver
+ void CreateBackBufferL();
+ void ReleaseBackBuffer();
+
+ void MceoCameraReady();
+ void MceoFocusComplete();
+ void MceoCapturedDataReady( TDesC8* aData );
+ void MceoCapturedBitmapReady( CFbsBitmap* aBitmap );
+ void MceoViewFinderFrameReady( CFbsBitmap& aFrame );
+ void MceoHandleError( TCameraEngineError aErrorType, TInt aError );
+ void MceoHandleOtherEvent( const TECAMEvent& /*aEvent*/ );
+ void InitializeCamera();
+
+////////////////////////
+public slots:
+ void CaptureImage();
+
+private slots:
+ void sendBackbufferToDecode();
+
+signals:
+ void logMessage(QString str);
+ void imageCaptured(QImage cImage);
+
+private:
+ // CameraWrapper class
+ CCameraEngine* iCameraWrapper;
+
+ CFbsBitmap* iBackBuffer;
+ CFbsBitmapDevice* iBackBufferDevice;
+ CFbsBitGc* iBackBufferContext;
+
+ TSize iViewFinderSize;
+ TSize iCaptureSize;
+
+ //Timer
+ QTimer* timer;
+};
+
+#endif //QCAMERACONTROLLER_H
diff --git a/symbian/QQrDecoder/QQrDecoder.cpp b/symbian/QQrDecoder/QQrDecoder.cpp
new file mode 100644
index 0000000..a20ad1f
--- /dev/null
+++ b/symbian/QQrDecoder/QQrDecoder.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+ **
+ ** Trolltech hereby grants a license to use the Qt/Eclipse Integration
+ ** plug-in (the software contained herein), in binary form, solely for the
+ ** purpose of creating code to be used with Trolltech's Qt software.
+ **
+ ** Qt Designer is licensed under the terms of the GNU General Public
+ ** License versions 2.0 and 3.0 ("GPL License"). Trolltech offers users the
+ ** right to use certain no GPL licensed software under the terms of its GPL
+ ** Exception version 1.2 (http://trolltech.com/products/qt/gplexception).
+ **
+ ** THIS SOFTWARE IS PROVIDED BY TROLLTECH AND ITS CONTRIBUTORS (IF ANY) "AS
+ ** IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ ** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ ** PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ ** OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ ** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ ** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ ** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ ** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ ** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+ **
+ ** Since we now have the GPL exception I think that the "special exception
+ ** is no longer needed. The license text proposed above (other than the
+ ** special exception portion of it) is the BSD license and we have added
+ ** the BSD license as a permissible license under the exception.
+ **
+ ****************************************************************************/
+
+#include "QQrDecoder.h"
+#include <zxing/qrcode/QRCodeReader.h>
+
+#include <zxing/common/GlobalHistogramBinarizer.h>
+#include <zxing/Binarizer.h>
+#include <zxing/BinaryBitmap.h>
+#include <QFileDialog>
+#include <QGraphicsView>
+#include <QPainter>
+#include <QPoint>
+#include <QPixmap>
+
+using namespace zxing;
+using namespace zxing::qrcode;
+
+QQrDecoder::QQrDecoder(QWidget *parent): QMainWindow(parent)
+{
+ ui.setupUi(this);
+ connect(ui.startDecode, SIGNAL(clicked()), this, SLOT(findAndDecode()));
+ connect(ui.cameraWidget, SIGNAL(imageCaptured(QImage)), this, SLOT(decodeImage(QImage)));
+ connect(ui.cameraWidget, SIGNAL(logMessage(QString)), ui.resultLabel, SLOT(setText(QString)));
+}
+
+QQrDecoder::~QQrDecoder()
+{
+}
+
+void QQrDecoder::InitializeSymbianCamera()
+{
+
+}
+
+void QQrDecoder::findAndDecode()
+{
+ ui.cameraWidget->CaptureImage();
+}
+
+void QQrDecoder::decodeImage(QImage originalImage)
+{
+ QRCodeReader decoder;
+
+ image.setImage(originalImage);
+
+ Ref<Result> res;
+
+ try{
+ Ref<LuminanceSource> imageRef(new CameraImageWrapper(image));
+ GlobalHistogramBinarizer* binz = new GlobalHistogramBinarizer(imageRef);
+
+ Ref<Binarizer> bz (binz);
+ BinaryBitmap* bb = new BinaryBitmap(bz);
+
+ Ref<BinaryBitmap> ref(bb);
+
+ res = decoder.decode(ref);
+
+ QString string = QString(res->getText()->getText().c_str());
+ ui.resultLabel->setText(string);
+ }
+ catch(zxing::Exception& e)
+ {
+ ui.resultLabel->setText("Error");
+ }
+}
+
+void QQrDecoder::reloadFormatedPicture(int x)
+{
+}
+
diff --git a/symbian/QQrDecoder/QQrDecoder.h b/symbian/QQrDecoder/QQrDecoder.h
new file mode 100644
index 0000000..ecdfff2
--- /dev/null
+++ b/symbian/QQrDecoder/QQrDecoder.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Trolltech hereby grants a license to use the Qt/Eclipse Integration
+** plug-in (the software contained herein), in binary form, solely for the
+** purpose of creating code to be used with Trolltech's Qt software.
+**
+** Qt Designer is licensed under the terms of the GNU General Public
+** License versions 2.0 and 3.0 ("GPL License"). Trolltech offers users the
+** right to use certain no GPL licensed software under the terms of its GPL
+** Exception version 1.2 (http://trolltech.com/products/qt/gplexception).
+**
+** THIS SOFTWARE IS PROVIDED BY TROLLTECH AND ITS CONTRIBUTORS (IF ANY) "AS
+** IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+** PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+** OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** Since we now have the GPL exception I think that the "special exception
+** is no longer needed. The license text proposed above (other than the
+** special exception portion of it) is the BSD license and we have added
+** the BSD license as a permissible license under the exception.
+**
+****************************************************************************/
+
+#ifndef QQRDECODER_H
+#define QQRDECODER_H
+
+#include <QtGui/QMainWindow>
+#include <QPixmap>
+#include "ui_QQrDecoder.h"
+
+#include "CameraImageWrapper.h"
+
+class QQrDecoder : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ QQrDecoder(QWidget *parent = 0);
+ ~QQrDecoder();
+
+private:
+ void InitializeSymbianCamera();
+
+protected slots:
+ void findAndDecode();
+ void decodeImage(QImage originalImage);
+ void reloadFormatedPicture(int x);
+
+private:
+ Ui::QQrDecoder ui;
+ CameraImageWrapper image;
+ QPixmap px;
+};
+
+#endif // QQRDECODER_H
diff --git a/symbian/QQrDecoder/QQrDecoder.pro b/symbian/QQrDecoder/QQrDecoder.pro
new file mode 100644
index 0000000..8db0373
--- /dev/null
+++ b/symbian/QQrDecoder/QQrDecoder.pro
@@ -0,0 +1,159 @@
+TEMPLATE = app
+TARGET = QQrDecoder
+QT += core \
+ gui
+HEADERS += CameraImageWrapper.h \
+ zxing/BarcodeFormat.h \
+ zxing/Binarizer.h \
+ zxing/BinaryBitmap.h \
+ zxing/Exception.h \
+ zxing/LuminanceSource.h \
+ zxing/MultiFormatReader.h \
+ zxing/Reader.h \
+ zxing/ReaderException.h \
+ zxing/Result.h \
+ zxing/ResultPoint.h \
+ zxing/common/Array.h \
+ zxing/common/BitArray.h \
+ zxing/common/BitMatrix.h \
+ zxing/common/BitSource.h \
+ zxing/common/Counted.h \
+ zxing/common/DecoderResult.h \
+ zxing/common/DetectorResult.h \
+ zxing/common/EdgeDetector.h \
+ zxing/common/GlobalHistogramBinarizer.h \
+ zxing/common/GridSampler.h \
+ zxing/common/IllegalArgumentException.h \
+ zxing/common/LocalBlockBinarizer.h \
+ zxing/common/PerspectiveTransform.h \
+ zxing/common/Point.h \
+ zxing/common/Str.h \
+ zxing/common/reedsolomon/GF256.h \
+ zxing/common/reedsolomon/GF256Poly.h \
+ zxing/common/reedsolomon/ReedSolomonDecoder.h \
+ zxing/common/reedsolomon/ReedSolomonException.h \
+ zxing/oned/Code128Reader.h \
+ zxing/oned/Code39Reader.h \
+ zxing/oned/EAN13Reader.h \
+ zxing/oned/EAN8Reader.h \
+ zxing/oned/ITFReader.h \
+ zxing/oned/MultiFormatOneDReader.h \
+ zxing/oned/MultiFormatUPCEANReader.h \
+ zxing/oned/OneDReader.h \
+ zxing/oned/OneDResultPoint.h \
+ zxing/oned/UPCAReader.h \
+ zxing/oned/UPCEANReader.h \
+ zxing/oned/UPCEReader.h \
+ zxing/qrcode/ErrorCorrectionLevel.h \
+ zxing/qrcode/FormatInformation.h \
+ zxing/qrcode/QRCodeReader.h \
+ zxing/qrcode/Version.h \
+ zxing/qrcode/decoder/BitMatrixParser.h \
+ zxing/qrcode/decoder/DataBlock.h \
+ zxing/qrcode/decoder/DataMask.h \
+ zxing/qrcode/decoder/DecodedBitStreamParser.h \
+ zxing/qrcode/decoder/Decoder.h \
+ zxing/qrcode/decoder/Mode.h \
+ zxing/qrcode/detector/AlignmentPattern.h \
+ zxing/qrcode/detector/AlignmentPatternFinder.h \
+ zxing/qrcode/detector/Detector.h \
+ zxing/qrcode/detector/FinderPattern.h \
+ zxing/qrcode/detector/FinderPatternFinder.h \
+ zxing/qrcode/detector/FinderPatternInfo.h \
+ zxing/qrcode/detector/QREdgeDetector.h \
+ QQrDecoder.loc \
+ QQrDecoder.h
+SOURCES += CameraImageWrapper.cpp \
+ zxing/BarcodeFormat.cpp \
+ zxing/Binarizer.cpp \
+ zxing/BinaryBitmap.cpp \
+ zxing/Exception.cpp \
+ zxing/LuminanceSource.cpp \
+ zxing/MultiFormatReader.cpp \
+ zxing/Reader.cpp \
+ zxing/ReaderException.cpp \
+ zxing/Result.cpp \
+ zxing/ResultPoint.cpp \
+ zxing/common/Array.cpp \
+ zxing/common/BitArray.cpp \
+ zxing/common/BitMatrix.cpp \
+ zxing/common/BitSource.cpp \
+ zxing/common/Counted.cpp \
+ zxing/common/DecoderResult.cpp \
+ zxing/common/DetectorResult.cpp \
+ zxing/common/EdgeDetector.cpp \
+ zxing/common/GlobalHistogramBinarizer.cpp \
+ zxing/common/GridSampler.cpp \
+ zxing/common/IllegalArgumentException.cpp \
+ zxing/common/LocalBlockBinarizer.cpp \
+ zxing/common/PerspectiveTransform.cpp \
+ zxing/common/Str.cpp \
+ zxing/common/reedsolomon/GF256.cpp \
+ zxing/common/reedsolomon/GF256Poly.cpp \
+ zxing/common/reedsolomon/ReedSolomonDecoder.cpp \
+ zxing/common/reedsolomon/ReedSolomonException.cpp \
+ zxing/oned/Code128Reader.cpp \
+ zxing/oned/Code39Reader.cpp \
+ zxing/oned/EAN13Reader.cpp \
+ zxing/oned/EAN8Reader.cpp \
+ zxing/oned/ITFReader.cpp \
+ zxing/oned/MultiFormatOneDReader.cpp \
+ zxing/oned/MultiFormatUPCEANReader.cpp \
+ zxing/oned/OneDReader.cpp \
+ zxing/oned/OneDResultPoint.cpp \
+ zxing/oned/UPCAReader.cpp \
+ zxing/oned/UPCEANReader.cpp \
+ zxing/oned/UPCEReader.cpp \
+ zxing/qrcode/ErrorCorrectionLevel.cpp \
+ zxing/qrcode/FormatInformation.cpp \
+ zxing/qrcode/QRCodeReader.cpp \
+ zxing/qrcode/Version.cpp \
+ zxing/qrcode/decoder/BitMatrixParser.cpp \
+ zxing/qrcode/decoder/DataBlock.cpp \
+ zxing/qrcode/decoder/DataMask.cpp \
+ zxing/qrcode/decoder/DecodedBitStreamParser.cpp \
+ zxing/qrcode/decoder/Decoder.cpp \
+ zxing/qrcode/decoder/Mode.cpp \
+ zxing/qrcode/detector/AlignmentPattern.cpp \
+ zxing/qrcode/detector/AlignmentPatternFinder.cpp \
+ zxing/qrcode/detector/Detector.cpp \
+ zxing/qrcode/detector/FinderPattern.cpp \
+ zxing/qrcode/detector/FinderPatternFinder.cpp \
+ zxing/qrcode/detector/FinderPatternInfo.cpp \
+ zxing/qrcode/detector/QREdgeDetector.cpp \
+ QQrDecoder.rss \
+ QQrDecoder_reg.rss \
+ main.cpp \
+ QQrDecoder.cpp
+FORMS += QQrDecoder.ui
+RESOURCES +=
+symbian {
+ TARGET.UID3 = 0xEF2CE79D
+ HEADERS += QCameraControllerWidget.h
+ SOURCES += QCameraControllerWidget.cpp
+ LIBS += -leuser \
+ -lapparc \
+ -lcone \
+ -leikcore \
+ -lavkon \
+ -lcommonengine \
+ -lefsrv \
+ -lestor \
+ -laknnotify \
+ -lfbscli \
+ -lbitgdi \
+ -leikcoctl \
+ -lbafl \ # BafUtils
+ -lecam \ # Camera
+ -lcamerawrapper
+ TARGET.CAPABILITY = UserEnvironment
+
+ customrules.pkg_prerules = \
+ ";CameraWrapper" \
+ "@\"$(EPOCROOT)Epoc32\InstallToDevice\CameraWrapper\sis\camerawrapper.sisx\", (0x2001ec5f)" \
+ " "
+
+ DEPLOYMENT += customrules
+}
+
+ICON = QQrDecoder.svg
diff --git a/symbian/ZXingBarcodeReader/gfx/QrDecoder.svg b/symbian/QQrDecoder/QQrDecoder.svg
similarity index 100%
copy from symbian/ZXingBarcodeReader/gfx/QrDecoder.svg
copy to symbian/QQrDecoder/QQrDecoder.svg
diff --git a/symbian/QQrDecoder/QQrDecoder.ui b/symbian/QQrDecoder/QQrDecoder.ui
new file mode 100644
index 0000000..c691a66
--- /dev/null
+++ b/symbian/QQrDecoder/QQrDecoder.ui
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>QQrDecoder</class>
+ <widget class="QMainWindow" name="QQrDecoder">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>340</width>
+ <height>640</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>QQrDecoder</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <layout class="QVBoxLayout" name="verticalLayout" stretch="1,1,8">
+ <item>
+ <widget class="QPushButton" name="startDecode">
+ <property name="text">
+ <string>Capture And Decode</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="resultLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>No result</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCameraControllerWidget" name="cameraWidget" native="true"/>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>QCameraControllerWidget</class>
+ <extends>QWidget</extends>
+ <header>qcameracontrollerwidget.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/symbian/QQrDecoder/QQrDecoder_template.sisx b/symbian/QQrDecoder/QQrDecoder_template.sisx
new file mode 100644
index 0000000..dbf497d
Binary files /dev/null and b/symbian/QQrDecoder/QQrDecoder_template.sisx differ
diff --git a/symbian/ZXingBarcodeReader/ZXing_Licence.txt b/symbian/QQrDecoder/ZXing_Licence.txt
similarity index 100%
copy from symbian/ZXingBarcodeReader/ZXing_Licence.txt
copy to symbian/QQrDecoder/ZXing_Licence.txt
diff --git a/symbian/ZXingBarcodeReader/camerawrapper/epoc32/include/cameraengine.h b/symbian/QQrDecoder/camerawrapper/epoc32/include/cameraengine.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/camerawrapper/epoc32/include/cameraengine.h
copy to symbian/QQrDecoder/camerawrapper/epoc32/include/cameraengine.h
diff --git a/symbian/ZXingBarcodeReader/camerawrapper/epoc32/include/cameraengineobserver.h b/symbian/QQrDecoder/camerawrapper/epoc32/include/cameraengineobserver.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/camerawrapper/epoc32/include/cameraengineobserver.h
copy to symbian/QQrDecoder/camerawrapper/epoc32/include/cameraengineobserver.h
diff --git a/symbian/ZXingBarcodeReader/camerawrapper/epoc32/release/armv5/urel/camerawrapper.dll.map b/symbian/QQrDecoder/camerawrapper/epoc32/release/armv5/urel/camerawrapper.dll.map
similarity index 100%
copy from symbian/ZXingBarcodeReader/camerawrapper/epoc32/release/armv5/urel/camerawrapper.dll.map
copy to symbian/QQrDecoder/camerawrapper/epoc32/release/armv5/urel/camerawrapper.dll.map
diff --git a/symbian/QQrDecoder/main.cpp b/symbian/QQrDecoder/main.cpp
new file mode 100644
index 0000000..a758912
--- /dev/null
+++ b/symbian/QQrDecoder/main.cpp
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Trolltech hereby grants a license to use the Qt/Eclipse Integration
+** plug-in (the software contained herein), in binary form, solely for the
+** purpose of creating code to be used with Trolltech's Qt software.
+**
+** Qt Designer is licensed under the terms of the GNU General Public
+** License versions 2.0 and 3.0 ("GPL License"). Trolltech offers users the
+** right to use certain no GPL licensed software under the terms of its GPL
+** Exception version 1.2 (http://trolltech.com/products/qt/gplexception).
+**
+** THIS SOFTWARE IS PROVIDED BY TROLLTECH AND ITS CONTRIBUTORS (IF ANY) "AS
+** IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+** PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+** OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** Since we now have the GPL exception I think that the "special exception
+** is no longer needed. The license text proposed above (other than the
+** special exception portion of it) is the BSD license and we have added
+** the BSD license as a permissible license under the exception.
+**
+****************************************************************************/
+
+#include "QQrDecoder.h"
+
+#include <QtGui>
+#include <QApplication>
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ QQrDecoder w;
+ w.showMaximized();
+ return a.exec();
+}
diff --git a/cpp/core/src/zxing/BarcodeFormat.cpp b/symbian/QQrDecoder/zxing/BarcodeFormat.cpp
old mode 100755
new mode 100644
similarity index 100%
copy from cpp/core/src/zxing/BarcodeFormat.cpp
copy to symbian/QQrDecoder/zxing/BarcodeFormat.cpp
diff --git a/cpp/core/src/zxing/BarcodeFormat.h b/symbian/QQrDecoder/zxing/BarcodeFormat.h
similarity index 100%
copy from cpp/core/src/zxing/BarcodeFormat.h
copy to symbian/QQrDecoder/zxing/BarcodeFormat.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/Binarizer.cpp b/symbian/QQrDecoder/zxing/Binarizer.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/Binarizer.cpp
copy to symbian/QQrDecoder/zxing/Binarizer.cpp
diff --git a/cpp/core/src/zxing/Binarizer.h b/symbian/QQrDecoder/zxing/Binarizer.h
similarity index 100%
copy from cpp/core/src/zxing/Binarizer.h
copy to symbian/QQrDecoder/zxing/Binarizer.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/BinaryBitmap.cpp b/symbian/QQrDecoder/zxing/BinaryBitmap.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/BinaryBitmap.cpp
copy to symbian/QQrDecoder/zxing/BinaryBitmap.cpp
diff --git a/cpp/core/src/zxing/BinaryBitmap.h b/symbian/QQrDecoder/zxing/BinaryBitmap.h
similarity index 100%
copy from cpp/core/src/zxing/BinaryBitmap.h
copy to symbian/QQrDecoder/zxing/BinaryBitmap.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/Exception.cpp b/symbian/QQrDecoder/zxing/Exception.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/Exception.cpp
copy to symbian/QQrDecoder/zxing/Exception.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/Exception.h b/symbian/QQrDecoder/zxing/Exception.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/Exception.h
copy to symbian/QQrDecoder/zxing/Exception.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/LuminanceSource.cpp b/symbian/QQrDecoder/zxing/LuminanceSource.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/LuminanceSource.cpp
copy to symbian/QQrDecoder/zxing/LuminanceSource.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/LuminanceSource.h b/symbian/QQrDecoder/zxing/LuminanceSource.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/LuminanceSource.h
copy to symbian/QQrDecoder/zxing/LuminanceSource.h
diff --git a/symbian/QQrDecoder/zxing/MultiFormatReader.cpp b/symbian/QQrDecoder/zxing/MultiFormatReader.cpp
new file mode 100644
index 0000000..2270ebe
--- /dev/null
+++ b/symbian/QQrDecoder/zxing/MultiFormatReader.cpp
@@ -0,0 +1,54 @@
+/*
+ * MultiFormatBarcodeReader.cpp
+ * ZXing
+ *
+ * Created by Lukasz Warchol on 10-01-26.
+ * Modified by Luiz Silva on 09/02/2010.
+ * Copyright 2010 ZXing authors All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "MultiFormatReader.h"
+#include <zxing/qrcode/QRCodeReader.h>
+//#include <zxing/datamatrix/DataMatrixReader.h>
+#include <zxing/oned/MultiFormatUPCEANReader.h>
+#include <zxing/oned/MultiFormatOneDReader.h>
+#include <zxing/ReaderException.h>
+
+namespace zxing {
+ MultiFormatReader::MultiFormatReader(){
+ readers = new std::vector<Reader*>();
+
+ readers->push_back(new zxing::qrcode::QRCodeReader());
+// readers->push_back(new zxing::datamatrix::DataMatrixReader());
+ readers->push_back(new zxing::oned::MultiFormatUPCEANReader());
+ readers->push_back(new zxing::oned::MultiFormatOneDReader());
+ }
+
+ Ref<Result> MultiFormatReader::decode(Ref<BinaryBitmap> image){
+ int size = readers->size();
+ for (int i = 0; i < size; i++) {
+ Reader* reader = (*readers)[i];
+ try {
+ return reader->decode(image);
+ } catch (ReaderException re) {
+ // continue
+ }
+ }
+ throw ReaderException("No code detected");
+ }
+ MultiFormatReader::~MultiFormatReader(){
+ delete readers;
+ }
+}
diff --git a/symbian/QQrDecoder/zxing/MultiFormatReader.h b/symbian/QQrDecoder/zxing/MultiFormatReader.h
new file mode 100644
index 0000000..ff51c01
--- /dev/null
+++ b/symbian/QQrDecoder/zxing/MultiFormatReader.h
@@ -0,0 +1,38 @@
+/*
+ * MultiFormatBarcodeReader.h
+ * ZXing
+ *
+ * Created by Lukasz Warchol on 10-01-26.
+ * Copyright 2010 ZXing authors All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <zxing/Reader.h>
+#include <zxing/common/BitArray.h>
+#include <zxing/Result.h>
+
+namespace zxing {
+ class MultiFormatReader : public Reader {
+
+ private:
+ std::vector<Reader*>* readers;
+ public:
+ MultiFormatReader();
+
+ Ref<Result> decode(Ref<BinaryBitmap> image);
+
+ ~MultiFormatReader();
+ };
+}
diff --git a/cpp/core/src/zxing/Reader.cpp b/symbian/QQrDecoder/zxing/Reader.cpp
old mode 100755
new mode 100644
similarity index 100%
copy from cpp/core/src/zxing/Reader.cpp
copy to symbian/QQrDecoder/zxing/Reader.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/Reader.h b/symbian/QQrDecoder/zxing/Reader.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/Reader.h
copy to symbian/QQrDecoder/zxing/Reader.h
diff --git a/cpp/core/src/zxing/ReaderException.cpp b/symbian/QQrDecoder/zxing/ReaderException.cpp
similarity index 100%
copy from cpp/core/src/zxing/ReaderException.cpp
copy to symbian/QQrDecoder/zxing/ReaderException.cpp
diff --git a/cpp/core/src/zxing/ReaderException.h b/symbian/QQrDecoder/zxing/ReaderException.h
similarity index 100%
copy from cpp/core/src/zxing/ReaderException.h
copy to symbian/QQrDecoder/zxing/ReaderException.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/Result.cpp b/symbian/QQrDecoder/zxing/Result.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/Result.cpp
copy to symbian/QQrDecoder/zxing/Result.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/Result.h b/symbian/QQrDecoder/zxing/Result.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/Result.h
copy to symbian/QQrDecoder/zxing/Result.h
diff --git a/cpp/core/src/zxing/ResultPoint.cpp b/symbian/QQrDecoder/zxing/ResultPoint.cpp
old mode 100755
new mode 100644
similarity index 100%
copy from cpp/core/src/zxing/ResultPoint.cpp
copy to symbian/QQrDecoder/zxing/ResultPoint.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/ResultPoint.h b/symbian/QQrDecoder/zxing/ResultPoint.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/ResultPoint.h
copy to symbian/QQrDecoder/zxing/ResultPoint.h
diff --git a/cpp/core/src/zxing/common/Array.cpp b/symbian/QQrDecoder/zxing/common/Array.cpp
old mode 100755
new mode 100644
similarity index 100%
copy from cpp/core/src/zxing/common/Array.cpp
copy to symbian/QQrDecoder/zxing/common/Array.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/common/Array.h b/symbian/QQrDecoder/zxing/common/Array.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/common/Array.h
copy to symbian/QQrDecoder/zxing/common/Array.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/common/BitArray.cpp b/symbian/QQrDecoder/zxing/common/BitArray.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/common/BitArray.cpp
copy to symbian/QQrDecoder/zxing/common/BitArray.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/common/BitArray.h b/symbian/QQrDecoder/zxing/common/BitArray.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/common/BitArray.h
copy to symbian/QQrDecoder/zxing/common/BitArray.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/common/BitMatrix.cpp b/symbian/QQrDecoder/zxing/common/BitMatrix.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/common/BitMatrix.cpp
copy to symbian/QQrDecoder/zxing/common/BitMatrix.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/common/BitMatrix.h b/symbian/QQrDecoder/zxing/common/BitMatrix.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/common/BitMatrix.h
copy to symbian/QQrDecoder/zxing/common/BitMatrix.h
diff --git a/cpp/core/src/zxing/common/BitSource.cpp b/symbian/QQrDecoder/zxing/common/BitSource.cpp
similarity index 100%
copy from cpp/core/src/zxing/common/BitSource.cpp
copy to symbian/QQrDecoder/zxing/common/BitSource.cpp
diff --git a/cpp/core/src/zxing/common/BitSource.h b/symbian/QQrDecoder/zxing/common/BitSource.h
similarity index 100%
copy from cpp/core/src/zxing/common/BitSource.h
copy to symbian/QQrDecoder/zxing/common/BitSource.h
diff --git a/cpp/core/src/zxing/common/Counted.cpp b/symbian/QQrDecoder/zxing/common/Counted.cpp
similarity index 100%
copy from cpp/core/src/zxing/common/Counted.cpp
copy to symbian/QQrDecoder/zxing/common/Counted.cpp
diff --git a/symbian/QQrDecoder/zxing/common/Counted.h b/symbian/QQrDecoder/zxing/common/Counted.h
new file mode 100644
index 0000000..c272399
--- /dev/null
+++ b/symbian/QQrDecoder/zxing/common/Counted.h
@@ -0,0 +1,204 @@
+#ifndef __COUNTED_H__
+#define __COUNTED_H__
+
+/*
+ * Counted.h
+ * zxing
+ *
+ * Created by Christian Brunschen on 07/05/2008.
+ * Copyright 2008 Google UK. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//#define DEBUG_COUNTING
+//using namespace std;
+
+#include <iostream>
+
+
+#ifdef DEBUG_COUNTING
+#include <typeinfo>
+using namespace std;
+#endif
+
+namespace zxing {
+
+/* base class for reference-counted objects */
+class Counted {
+private:
+ unsigned int count_;
+public:
+ Counted() :
+ count_(0) {
+#ifdef DEBUG_COUNTING
+ cout << "instantiating " << typeid(*this).name() << " " << this <<
+ " @ " << count_ << "\n";
+#endif
+ }
+ virtual ~Counted() {
+ }
+ virtual Counted *retain() {
+#ifdef DEBUG_COUNTING
+ cout << "retaining " << typeid(*this).name() << " " << this <<
+ " @ " << count_;
+#endif
+ count_++;
+#ifdef DEBUG_COUNTING
+ cout << "->" << count_ << "\n";
+#endif
+ return this;
+ }
+ virtual void release() {
+#ifdef DEBUG_COUNTING
+ cout << "releasing " << typeid(*this).name() << " " << this <<
+ " @ " << count_;
+#endif
+ if (count_ == 0 || count_ == 54321) {
+#ifdef DEBUG_COUNTING
+ cout << "\nOverreleasing already-deleted object " << this << "!!!\n";
+#endif
+ throw 4711;
+ }
+ count_--;
+#ifdef DEBUG_COUNTING
+ cout << "->" << count_ << "\n";
+#endif
+ if (count_ == 0) {
+#ifdef DEBUG_COUNTING
+ cout << "deleting " << typeid(*this).name() << " " << this << "\n";
+#endif
+ count_ = 0xDEADF001;
+ delete this;
+ }
+ }
+
+
+ /* return the current count for denugging purposes or similar */
+ int count() const {
+ return count_;
+ }
+};
+
+/* counting reference to reference-counted objects */
+template<typename T> class Ref {
+private:
+public:
+ T *object_;
+ explicit Ref(T *o = 0) :
+ object_(0) {
+#ifdef DEBUG_COUNTING
+ cout << "instantiating Ref " << this << " from pointer" << o << "\n";
+#endif
+ reset(o);
+ }
+
+ explicit Ref(const T &o) :
+ object_(0) {
+#ifdef DEBUG_COUNTING
+ cout << "instantiating Ref " << this << " from reference\n";
+#endif
+ reset(const_cast<T *>(&o));
+ }
+
+ Ref(const Ref &other) :
+ object_(0) {
+#ifdef DEBUG_COUNTING
+ cout << "instantiating Ref " << this << " from Ref " << &other << "\n";
+#endif
+ reset(other.object_);
+ }
+
+ template<class Y>
+ Ref(const Ref<Y> &other) :
+ object_(0) {
+#ifdef DEBUG_COUNTING
+ cout << "instantiating Ref " << this << " from reference\n";
+#endif
+ reset(other.object_);
+ }
+
+ ~Ref() {
+#ifdef DEBUG_COUNTING
+ cout << "destroying Ref " << this << " with " <<
+ (object_ ? typeid(*object_).name() : "NULL") << " " << object_ << "\n";
+#endif
+ if (object_) {
+ object_->release();
+ }
+ }
+
+ void reset(T *o) {
+#ifdef DEBUG_COUNTING
+ cout << "resetting Ref " << this << " from " <<
+ (object_ ? typeid(*object_).name() : "NULL") << " " << object_ <<
+ " to " << (o ? typeid(*o).name() : "NULL") << " " << o << "\n";
+#endif
+ if (o) {
+ o->retain();
+ }
+ if (object_ != 0) {
+ object_->release();
+ }
+ object_ = o;
+ }
+ Ref& operator=(const Ref &other) {
+ reset(other.object_);
+ return *this;
+ }
+ template<class Y>
+ Ref& operator=(const Ref<Y> &other) {
+ reset(other.object_);
+ return *this;
+ }
+ Ref& operator=(T* o) {
+ reset(o);
+ return *this;
+ }
+ template<class Y>
+ Ref& operator=(Y* o) {
+ reset(o);
+ return *this;
+ }
+
+ T& operator*() {
+ return *object_;
+ }
+ T* operator->() {
+ return object_;
+ }
+ operator T*() {
+ return object_;
+ }
+
+ bool operator==(const int x) {
+ return x == 0 ? object_ == 0 : false;
+ }
+ bool operator==(const Ref &other) const {
+ return object_ == other.object_ || *object_ == *(other.object_);
+ }
+ template<class Y>
+ bool operator==(const Ref<Y> &other) const {
+ return object_ == other.object_ || *object_ == *(other.object_);
+ }
+
+ bool operator!=(const int x) {
+ return x == 0 ? object_ != 0 : true;
+ }
+
+ template<class Y>
+ friend std::ostream& operator<<(std::ostream &out, Ref<Y>& ref);
+};
+}
+
+#endif // __COUNTED_H__
diff --git a/cpp/core/src/zxing/common/DecoderResult.cpp b/symbian/QQrDecoder/zxing/common/DecoderResult.cpp
similarity index 100%
copy from cpp/core/src/zxing/common/DecoderResult.cpp
copy to symbian/QQrDecoder/zxing/common/DecoderResult.cpp
diff --git a/cpp/core/src/zxing/common/DecoderResult.h b/symbian/QQrDecoder/zxing/common/DecoderResult.h
similarity index 100%
copy from cpp/core/src/zxing/common/DecoderResult.h
copy to symbian/QQrDecoder/zxing/common/DecoderResult.h
diff --git a/cpp/core/src/zxing/common/DetectorResult.cpp b/symbian/QQrDecoder/zxing/common/DetectorResult.cpp
similarity index 100%
copy from cpp/core/src/zxing/common/DetectorResult.cpp
copy to symbian/QQrDecoder/zxing/common/DetectorResult.cpp
diff --git a/cpp/core/src/zxing/common/DetectorResult.h b/symbian/QQrDecoder/zxing/common/DetectorResult.h
similarity index 100%
copy from cpp/core/src/zxing/common/DetectorResult.h
copy to symbian/QQrDecoder/zxing/common/DetectorResult.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/common/EdgeDetector.cpp b/symbian/QQrDecoder/zxing/common/EdgeDetector.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/common/EdgeDetector.cpp
copy to symbian/QQrDecoder/zxing/common/EdgeDetector.cpp
diff --git a/cpp/core/src/zxing/common/EdgeDetector.h b/symbian/QQrDecoder/zxing/common/EdgeDetector.h
similarity index 100%
copy from cpp/core/src/zxing/common/EdgeDetector.h
copy to symbian/QQrDecoder/zxing/common/EdgeDetector.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/common/GlobalHistogramBinarizer.cpp b/symbian/QQrDecoder/zxing/common/GlobalHistogramBinarizer.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/common/GlobalHistogramBinarizer.cpp
copy to symbian/QQrDecoder/zxing/common/GlobalHistogramBinarizer.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/common/GlobalHistogramBinarizer.h b/symbian/QQrDecoder/zxing/common/GlobalHistogramBinarizer.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/common/GlobalHistogramBinarizer.h
copy to symbian/QQrDecoder/zxing/common/GlobalHistogramBinarizer.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/common/GridSampler.cpp b/symbian/QQrDecoder/zxing/common/GridSampler.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/common/GridSampler.cpp
copy to symbian/QQrDecoder/zxing/common/GridSampler.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/common/GridSampler.h b/symbian/QQrDecoder/zxing/common/GridSampler.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/common/GridSampler.h
copy to symbian/QQrDecoder/zxing/common/GridSampler.h
diff --git a/cpp/core/src/zxing/common/IllegalArgumentException.cpp b/symbian/QQrDecoder/zxing/common/IllegalArgumentException.cpp
similarity index 100%
copy from cpp/core/src/zxing/common/IllegalArgumentException.cpp
copy to symbian/QQrDecoder/zxing/common/IllegalArgumentException.cpp
diff --git a/cpp/core/src/zxing/common/IllegalArgumentException.h b/symbian/QQrDecoder/zxing/common/IllegalArgumentException.h
similarity index 100%
copy from cpp/core/src/zxing/common/IllegalArgumentException.h
copy to symbian/QQrDecoder/zxing/common/IllegalArgumentException.h
diff --git a/cpp/core/src/zxing/common/LocalBlockBinarizer.cpp b/symbian/QQrDecoder/zxing/common/LocalBlockBinarizer.cpp
similarity index 100%
copy from cpp/core/src/zxing/common/LocalBlockBinarizer.cpp
copy to symbian/QQrDecoder/zxing/common/LocalBlockBinarizer.cpp
diff --git a/cpp/core/src/zxing/common/LocalBlockBinarizer.h b/symbian/QQrDecoder/zxing/common/LocalBlockBinarizer.h
similarity index 100%
copy from cpp/core/src/zxing/common/LocalBlockBinarizer.h
copy to symbian/QQrDecoder/zxing/common/LocalBlockBinarizer.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/common/PerspectiveTransform.cpp b/symbian/QQrDecoder/zxing/common/PerspectiveTransform.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/common/PerspectiveTransform.cpp
copy to symbian/QQrDecoder/zxing/common/PerspectiveTransform.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/common/PerspectiveTransform.h b/symbian/QQrDecoder/zxing/common/PerspectiveTransform.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/common/PerspectiveTransform.h
copy to symbian/QQrDecoder/zxing/common/PerspectiveTransform.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/common/Point.h b/symbian/QQrDecoder/zxing/common/Point.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/common/Point.h
copy to symbian/QQrDecoder/zxing/common/Point.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/common/Str.cpp b/symbian/QQrDecoder/zxing/common/Str.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/common/Str.cpp
copy to symbian/QQrDecoder/zxing/common/Str.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/common/Str.h b/symbian/QQrDecoder/zxing/common/Str.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/common/Str.h
copy to symbian/QQrDecoder/zxing/common/Str.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/common/reedsolomon/GF256.cpp b/symbian/QQrDecoder/zxing/common/reedsolomon/GF256.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/common/reedsolomon/GF256.cpp
copy to symbian/QQrDecoder/zxing/common/reedsolomon/GF256.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/common/reedsolomon/GF256.h b/symbian/QQrDecoder/zxing/common/reedsolomon/GF256.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/common/reedsolomon/GF256.h
copy to symbian/QQrDecoder/zxing/common/reedsolomon/GF256.h
diff --git a/cpp/core/src/zxing/common/reedsolomon/GF256Poly.cpp b/symbian/QQrDecoder/zxing/common/reedsolomon/GF256Poly.cpp
similarity index 100%
copy from cpp/core/src/zxing/common/reedsolomon/GF256Poly.cpp
copy to symbian/QQrDecoder/zxing/common/reedsolomon/GF256Poly.cpp
diff --git a/cpp/core/src/zxing/common/reedsolomon/GF256Poly.h b/symbian/QQrDecoder/zxing/common/reedsolomon/GF256Poly.h
similarity index 100%
copy from cpp/core/src/zxing/common/reedsolomon/GF256Poly.h
copy to symbian/QQrDecoder/zxing/common/reedsolomon/GF256Poly.h
diff --git a/cpp/core/src/zxing/common/reedsolomon/ReedSolomonDecoder.cpp b/symbian/QQrDecoder/zxing/common/reedsolomon/ReedSolomonDecoder.cpp
similarity index 100%
copy from cpp/core/src/zxing/common/reedsolomon/ReedSolomonDecoder.cpp
copy to symbian/QQrDecoder/zxing/common/reedsolomon/ReedSolomonDecoder.cpp
diff --git a/cpp/core/src/zxing/common/reedsolomon/ReedSolomonDecoder.h b/symbian/QQrDecoder/zxing/common/reedsolomon/ReedSolomonDecoder.h
similarity index 100%
copy from cpp/core/src/zxing/common/reedsolomon/ReedSolomonDecoder.h
copy to symbian/QQrDecoder/zxing/common/reedsolomon/ReedSolomonDecoder.h
diff --git a/cpp/core/src/zxing/common/reedsolomon/ReedSolomonException.cpp b/symbian/QQrDecoder/zxing/common/reedsolomon/ReedSolomonException.cpp
similarity index 100%
copy from cpp/core/src/zxing/common/reedsolomon/ReedSolomonException.cpp
copy to symbian/QQrDecoder/zxing/common/reedsolomon/ReedSolomonException.cpp
diff --git a/cpp/core/src/zxing/common/reedsolomon/ReedSolomonException.h b/symbian/QQrDecoder/zxing/common/reedsolomon/ReedSolomonException.h
similarity index 100%
copy from cpp/core/src/zxing/common/reedsolomon/ReedSolomonException.h
copy to symbian/QQrDecoder/zxing/common/reedsolomon/ReedSolomonException.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/oned/Code128Reader.cpp b/symbian/QQrDecoder/zxing/oned/Code128Reader.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/oned/Code128Reader.cpp
copy to symbian/QQrDecoder/zxing/oned/Code128Reader.cpp
diff --git a/cpp/core/src/zxing/oned/Code128Reader.h b/symbian/QQrDecoder/zxing/oned/Code128Reader.h
similarity index 100%
copy from cpp/core/src/zxing/oned/Code128Reader.h
copy to symbian/QQrDecoder/zxing/oned/Code128Reader.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/oned/Code39Reader.cpp b/symbian/QQrDecoder/zxing/oned/Code39Reader.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/oned/Code39Reader.cpp
copy to symbian/QQrDecoder/zxing/oned/Code39Reader.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/oned/Code39Reader.h b/symbian/QQrDecoder/zxing/oned/Code39Reader.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/oned/Code39Reader.h
copy to symbian/QQrDecoder/zxing/oned/Code39Reader.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/oned/EAN13Reader.cpp b/symbian/QQrDecoder/zxing/oned/EAN13Reader.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/oned/EAN13Reader.cpp
copy to symbian/QQrDecoder/zxing/oned/EAN13Reader.cpp
diff --git a/symbian/QQrDecoder/zxing/oned/EAN13Reader.h b/symbian/QQrDecoder/zxing/oned/EAN13Reader.h
new file mode 100644
index 0000000..381d6e9
--- /dev/null
+++ b/symbian/QQrDecoder/zxing/oned/EAN13Reader.h
@@ -0,0 +1,41 @@
+/*
+ * EAN13Reader.h
+ * ZXing
+ *
+ * Created by Lukasz Warchol on 10-01-22.
+ * Copyright 2010 ZXing authors All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <zxing/oned/UPCEANReader.h>
+#include <zxing/Result.h>
+
+namespace zxing {
+ namespace oned {
+ class EAN13Reader : public UPCEANReader {
+
+ private:
+ int* decodeMiddleCounters;
+ static void determineFirstDigit(std::string& resultString, int lgPatternFound); //throws ReaderException
+
+ public:
+ EAN13Reader();
+
+ int decodeMiddle(Ref<BitArray> row, int startRange[], int startRangeLen, std::string& resultString); //throws ReaderException
+
+ BarcodeFormat getBarcodeFormat();
+ ~EAN13Reader();
+ };
+ }
+}
diff --git a/symbian/QQrDecoder/zxing/oned/EAN8Reader.cpp b/symbian/QQrDecoder/zxing/oned/EAN8Reader.cpp
new file mode 100644
index 0000000..5c34c9f
--- /dev/null
+++ b/symbian/QQrDecoder/zxing/oned/EAN8Reader.cpp
@@ -0,0 +1,75 @@
+/*
+ * EAN8Reader.cpp
+ * ZXing
+ *
+ * Created by Lukasz Warchol on 10-01-25.
+ * Copyright 2010 ZXing authors All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "EAN8Reader.h"
+#include <zxing/ReaderException.h>
+
+namespace zxing {
+ namespace oned {
+
+ EAN8Reader::EAN8Reader(){
+ decodeMiddleCounters = new int[4];
+ for (int i=0; i<4; i++) {
+ decodeMiddleCounters[i] = 0;
+ }
+ }
+
+ int EAN8Reader::decodeMiddle(Ref<BitArray> row, int startRange[], int startRangeLen, std::string& resultString){
+ int countersLen = 4;
+ int* counters = decodeMiddleCounters;
+ counters[0] = 0;
+ counters[1] = 0;
+ counters[2] = 0;
+ counters[3] = 0;
+
+
+ int end = row->getSize();
+ int rowOffset = startRange[1];
+
+ for (int x = 0; x < 4 && rowOffset < end; x++) {
+ int bestMatch = decodeDigit(row, counters, countersLen, rowOffset, UPC_EAN_PATTERNS_L_PATTERNS);
+ resultString.append(1, (char) ('0' + bestMatch));
+ for (int i = 0; i < countersLen; i++) {
+ rowOffset += counters[i];
+ }
+ }
+
+ int* middleRange = findGuardPattern(row, rowOffset, true, (int*)getMIDDLE_PATTERN(), getMIDDLE_PATTERN_LEN());
+ rowOffset = middleRange[1];
+
+ for (int x = 0; x < 4 && rowOffset < end; x++) {
+ int bestMatch = decodeDigit(row, counters, countersLen, rowOffset, UPC_EAN_PATTERNS_L_PATTERNS);
+ resultString.append(1, (char) ('0' + bestMatch));
+ for (int i = 0; i < countersLen; i++) {
+ rowOffset += counters[i];
+ }
+ }
+
+ return rowOffset;
+ }
+
+ BarcodeFormat EAN8Reader::getBarcodeFormat(){
+ return BarcodeFormat_EAN_8;
+ }
+ EAN8Reader::~EAN8Reader(){
+ delete [] decodeMiddleCounters;
+ }
+ }
+}
diff --git a/symbian/QQrDecoder/zxing/oned/EAN8Reader.h b/symbian/QQrDecoder/zxing/oned/EAN8Reader.h
new file mode 100644
index 0000000..f700856
--- /dev/null
+++ b/symbian/QQrDecoder/zxing/oned/EAN8Reader.h
@@ -0,0 +1,40 @@
+/*
+ * EAN8Reader.h
+ * ZXing
+ *
+ * Created by Lukasz Warchol on 10-01-25.
+ * Copyright 2010 ZXing authors All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <zxing/oned/UPCEANReader.h>
+#include <zxing/Result.h>
+
+namespace zxing {
+ namespace oned {
+ class EAN8Reader : public UPCEANReader {
+
+ private:
+ int* decodeMiddleCounters;
+
+ public:
+ EAN8Reader();
+
+ int decodeMiddle(Ref<BitArray> row, int startRange[], int startRangeLen, std::string& resultString); //throws ReaderException
+
+ BarcodeFormat getBarcodeFormat();
+ ~EAN8Reader();
+ };
+ }
+}
diff --git a/symbian/QQrDecoder/zxing/oned/ITFReader.cpp b/symbian/QQrDecoder/zxing/oned/ITFReader.cpp
new file mode 100644
index 0000000..7febab0
--- /dev/null
+++ b/symbian/QQrDecoder/zxing/oned/ITFReader.cpp
@@ -0,0 +1,355 @@
+/*
+ * ITFReader.cpp
+ * ZXing
+ *
+ * Created by Lukasz Warchol on 10-01-26.
+ * Copyright 2010 ZXing authors All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ITFReader.h"
+#include <zxing/oned/OneDResultPoint.h>
+#include <zxing/common/Array.h>
+#include <zxing/ReaderException.h>
+#include <math.h>
+
+namespace zxing {
+ namespace oned {
+
+ static const int W = 3; // Pixel width of a wide line
+ static const int N = 1; // Pixed width of a narrow line
+
+ const int DEFAULT_ALLOWED_LENGTHS[4] = { 6, 10, 14, 44 };
+
+ /**
+ * Start/end guard pattern.
+ *
+ * Note: The end pattern is reversed because the row is reversed before
+ * searching for the END_PATTERN
+ */
+ static const int START_PATTERN_LEN = 4;
+ static const int START_PATTERN[START_PATTERN_LEN] = {N, N, N, N};
+
+ static const int END_PATTERN_REVERSED_LEN = 3;
+ static const int END_PATTERN_REVERSED[END_PATTERN_REVERSED_LEN] = {N, N, W};
+
+ /**
+ * Patterns of Wide / Narrow lines to indicate each digit
+ */
+ static const int PATTERNS_LEN = 10;
+ static const int PATTERNS[PATTERNS_LEN][5] = {
+ {N, N, W, W, N}, // 0
+ {W, N, N, N, W}, // 1
+ {N, W, N, N, W}, // 2
+ {W, W, N, N, N}, // 3
+ {N, N, W, N, W}, // 4
+ {W, N, W, N, N}, // 5
+ {N, W, W, N, N}, // 6
+ {N, N, N, W, W}, // 7
+ {W, N, N, W, N}, // 8
+ {N, W, N, W, N} // 9
+ };
+
+
+ ITFReader::ITFReader(){
+ narrowLineWidth = -1;
+ }
+
+
+ Ref<Result> ITFReader::decodeRow(int rowNumber, Ref<BitArray> row){
+ // Find out where the Middle section (payload) starts & ends
+ int* startRange = decodeStart(row);
+ int* endRange = decodeEnd(row);
+
+ std::string tmpResult;
+ decodeMiddle(row, startRange[1], endRange[0], tmpResult);
+
+ // To avoid false positives with 2D barcodes (and other patterns), make
+ // an assumption that the decoded string must be 6, 10 or 14 digits.
+ int length = tmpResult.length();
+ bool lengthOK = false;
+ if (length == 6 || length == 10 || length == 14) {
+ lengthOK = true;
+ }
+ if (!lengthOK) {
+ throw ReaderException("not enought characters count");
+ }
+
+ Ref<String> resultString(new String(tmpResult));
+
+ std::vector< Ref<ResultPoint> > resultPoints(2);
+ Ref<OneDResultPoint> resultPoint1(new OneDResultPoint(startRange[1], (float) rowNumber));
+ Ref<OneDResultPoint> resultPoint2(new OneDResultPoint(endRange[0], (float) rowNumber));
+ resultPoints[0] = resultPoint1;
+ resultPoints[1] = resultPoint2;
+
+ ArrayRef<unsigned char> resultBytes(1);
+
+ delete [] startRange;
+ delete [] endRange;
+
+ Ref<Result> res(new Result(resultString, resultBytes, resultPoints, BarcodeFormat_ITF));
+ return res;
+ }
+
+ /**
+ * @param row row of black/white values to search
+ * @param payloadStart offset of start pattern
+ * @param resultString {@link StringBuffer} to append decoded chars to
+ * @throws ReaderException if decoding could not complete successfully
+ */
+ void ITFReader::decodeMiddle(Ref<BitArray> row, int payloadStart, int payloadEnd, std::string& resultString){
+ // Digits are interleaved in pairs - 5 black lines for one digit, and the
+ // 5
+ // interleaved white lines for the second digit.
+ // Therefore, need to scan 10 lines and then
+ // split these into two arrays
+ int counterDigitPairLen = 10;
+ int* counterDigitPair = new int[counterDigitPairLen];
+ for (int i=0; i<counterDigitPairLen; i++) {
+ counterDigitPair[i] = 0;
+ }
+
+ int* counterBlack = new int[5];
+ int* counterWhite = new int[5];
+ for (int i=0; i<5; i++) {
+ counterBlack[i] = 0;
+ counterWhite[i] = 0;
+ }
+
+ while (payloadStart < payloadEnd) {
+ // Get 10 runs of black/white.
+ recordPattern(row, payloadStart, counterDigitPair, counterDigitPairLen);
+ // Split them into each array
+ for (int k = 0; k < 5; k++) {
+ int twoK = k << 1;
+ counterBlack[k] = counterDigitPair[twoK];
+ counterWhite[k] = counterDigitPair[twoK + 1];
+ }
+
+ int bestMatch = decodeDigit(counterBlack, 5);
+ resultString.append(1, (char) ('0' + bestMatch));
+ bestMatch = decodeDigit(counterWhite, 5);
+ resultString.append(1, (char) ('0' + bestMatch));
+
+ for (int i = 0; i < counterDigitPairLen; i++) {
+ payloadStart += counterDigitPair[i];
+ }
+ }
+ delete [] counterDigitPair;
+ delete [] counterBlack;
+ delete [] counterWhite;
+ }
+
+ /**
+ * Identify where the start of the middle / payload section starts.
+ *
+ * @param row row of black/white values to search
+ * @return Array, containing index of start of 'start block' and end of
+ * 'start block'
+ * @throws ReaderException
+ */
+ int* ITFReader::decodeStart(Ref<BitArray> row){
+ int endStart = skipWhiteSpace(row);
+/// static int* findGuardPattern(Ref<BitArray> row, int rowOffset, bool whiteFirst, const int pattern[], int patternLen);
+ int* startPattern = findGuardPattern(row, endStart, START_PATTERN, START_PATTERN_LEN);
+
+ // Determine the width of a narrow line in pixels. We can do this by
+ // getting the width of the start pattern and dividing by 4 because its
+ // made up of 4 narrow lines.
+ narrowLineWidth = (startPattern[1] - startPattern[0]) >> 2;
+
+ validateQuietZone(row, startPattern[0]);
+
+ return startPattern;
+ }
+
+ /**
+ * Identify where the end of the middle / payload section ends.
+ *
+ * @param row row of black/white values to search
+ * @return Array, containing index of start of 'end block' and end of 'end
+ * block'
+ * @throws ReaderException
+ */
+
+ int* ITFReader::decodeEnd(Ref<BitArray> row){
+ // For convenience, reverse the row and then
+ // search from 'the start' for the end block
+ row->reverse();
+ try {
+ int endStart = skipWhiteSpace(row);
+ int* endPattern = findGuardPattern(row, endStart, END_PATTERN_REVERSED, END_PATTERN_REVERSED_LEN);
+
+ // The start & end patterns must be pre/post fixed by a quiet zone. This
+ // zone must be at least 10 times the width of a narrow line.
+ // ref: http://www.barcode-1.net/i25code.html
+ validateQuietZone(row, endPattern[0]);
+
+ // Now recalculate the indices of where the 'endblock' starts & stops to
+ // accommodate
+ // the reversed nature of the search
+ int temp = endPattern[0];
+ endPattern[0] = row->getSize() - endPattern[1];
+ endPattern[1] = row->getSize() - temp;
+
+ return endPattern;
+ }catch (Exception e) {
+ row->reverse();
+ throw e;
+ }
+ }
+
+ /**
+ * The start & end patterns must be pre/post fixed by a quiet zone. This
+ * zone must be at least 10 times the width of a narrow line. Scan back until
+ * we either get to the start of the barcode or match the necessary number of
+ * quiet zone pixels.
+ *
+ * Note: Its assumed the row is reversed when using this method to find
+ * quiet zone after the end pattern.
+ *
+ * ref: http://www.barcode-1.net/i25code.html
+ *
+ * @param row bit array representing the scanned barcode.
+ * @param startPattern index into row of the start or end pattern.
+ * @throws ReaderException if the quiet zone cannot be found, a ReaderException is thrown.
+ */
+ void ITFReader::validateQuietZone(Ref<BitArray> row, int startPattern){
+#pragma mark needs some corrections
+// int quietCount = narrowLineWidth * 10; // expect to find this many pixels of quiet zone
+//
+// for (int i = startPattern - 1; quietCount > 0 && i >= 0; i--) {
+// if (row->get(i)) {
+// break;
+// }
+// quietCount--;
+// }
+// if (quietCount != 0) {
+// // Unable to find the necessary number of quiet zone pixels.
+// throw ReaderException("Unable to find the necessary number of quiet zone pixels");
+// }
+ }
+
+ /**
+ * Skip all whitespace until we get to the first black line.
+ *
+ * @param row row of black/white values to search
+ * @return index of the first black line.
+ * @throws ReaderException Throws exception if no black lines are found in the row
+ */
+ int ITFReader::skipWhiteSpace(Ref<BitArray> row){
+ int width = row->getSize();
+ int endStart = 0;
+ while (endStart < width) {
+ if (row->get(endStart)) {
+ break;
+ }
+ endStart++;
+ }
+ if (endStart == width) {
+ throw ReaderException("");
+ }
+ return endStart;
+ }
+
+ /**
+ * @param row row of black/white values to search
+ * @param rowOffset position to start search
+ * @param pattern pattern of counts of number of black and white pixels that are
+ * being searched for as a pattern
+ * @return start/end horizontal offset of guard pattern, as an array of two
+ * ints
+ * @throws ReaderException if pattern is not found
+ */
+
+ int* ITFReader::findGuardPattern(Ref<BitArray> row, int rowOffset, const int pattern[], int patternLen){
+ // TODO: This is very similar to implementation in UPCEANReader. Consider if they can be
+ // merged to a single method.
+ int patternLength = patternLen;
+ int* counters = new int[patternLength];
+ for (int i=0; i<patternLength; i++) {
+ counters[i] = 0;
+ }
+ int width = row->getSize();
+ bool isWhite = false;
+
+ int counterPosition = 0;
+ int patternStart = rowOffset;
+ for (int x = rowOffset; x < width; x++) {
+ bool pixel = row->get(x);
+ if (pixel ^ isWhite) {
+ counters[counterPosition]++;
+ } else {
+ if (counterPosition == patternLength - 1) {
+ if (patternMatchVariance(counters, patternLength, pattern, MAX_INDIVIDUAL_VARIANCE) < MAX_AVG_VARIANCE) {
+ int* resultValue = new int[2];
+ resultValue[0] = patternStart;
+ resultValue[1] = x;
+ return resultValue;
+ }
+ patternStart += counters[0] + counters[1];
+ for (int y = 2; y < patternLength; y++) {
+ counters[y - 2] = counters[y];
+ }
+ counters[patternLength - 2] = 0;
+ counters[patternLength - 1] = 0;
+ counterPosition--;
+ } else {
+ counterPosition++;
+ }
+ counters[counterPosition] = 1;
+ isWhite = !isWhite;
+ }
+ }
+ throw ReaderException("");
+ }
+
+ /**
+ * Attempts to decode a sequence of ITF black/white lines into single
+ * digit.
+ *
+ * @param counters the counts of runs of observed black/white/black/... values
+ * @return The decoded digit
+ * @throws ReaderException if digit cannot be decoded
+ */
+ int ITFReader::decodeDigit(int counters[], int countersLen){
+ int bestVariance = MAX_AVG_VARIANCE; // worst variance we'll accept
+ int bestMatch = -1;
+ int max = PATTERNS_LEN;
+ for (int i = 0; i < max; i++) {
+ //int pattern[countersLen];
+ int* pattern = new int(countersLen);
+ for(int ind = 0; ind<countersLen; ind++){
+ pattern[ind] = PATTERNS[i][ind];
+ }
+ int variance = patternMatchVariance(counters, countersLen, pattern, MAX_INDIVIDUAL_VARIANCE);
+ if (variance < bestVariance) {
+ bestVariance = variance;
+ bestMatch = i;
+ }
+ delete pattern;
+ }
+ if (bestMatch >= 0) {
+ return bestMatch;
+ } else {
+ throw ReaderException("digit didint found");
+ }
+ }
+
+
+ ITFReader::~ITFReader(){
+ }
+ }
+}
diff --git a/cpp/core/src/zxing/oned/ITFReader.h b/symbian/QQrDecoder/zxing/oned/ITFReader.h
similarity index 100%
copy from cpp/core/src/zxing/oned/ITFReader.h
copy to symbian/QQrDecoder/zxing/oned/ITFReader.h
diff --git a/symbian/QQrDecoder/zxing/oned/MultiFormatOneDReader.cpp b/symbian/QQrDecoder/zxing/oned/MultiFormatOneDReader.cpp
new file mode 100644
index 0000000..245003b
--- /dev/null
+++ b/symbian/QQrDecoder/zxing/oned/MultiFormatOneDReader.cpp
@@ -0,0 +1,55 @@
+/*
+ * MultiFormatOneDReader.cpp
+ * ZXing
+ *
+ * Created by Lukasz Warchol on 10-01-25.
+ * Copyright 2010 ZXing authors All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "MultiFormatOneDReader.h"
+
+#include <zxing/oned/MultiFormatUPCEANReader.h>
+#include <zxing/oned/Code39Reader.h>
+#include <zxing/oned/Code128Reader.h>
+#include <zxing/oned/ITFReader.h>
+#include <zxing/ReaderException.h>
+
+namespace zxing {
+ namespace oned {
+ MultiFormatOneDReader::MultiFormatOneDReader(){
+ readers = new std::vector<OneDReader*>();
+ readers->push_back(new MultiFormatUPCEANReader());
+ readers->push_back(new Code39Reader());
+ readers->push_back(new Code128Reader());
+ readers->push_back(new ITFReader());
+ }
+
+ Ref<Result> MultiFormatOneDReader::decodeRow(int rowNumber, Ref<BitArray> row){
+ int size = readers->size();
+ for (int i = 0; i < size; i++) {
+ OneDReader* reader = (*readers)[i];
+ try {
+ return reader->decodeRow(rowNumber, row);
+ } catch (ReaderException re) {
+ // continue
+ }
+ }
+ throw ReaderException("No code detected");
+ }
+ MultiFormatOneDReader::~MultiFormatOneDReader(){
+ delete readers;
+ }
+ }
+}
diff --git a/symbian/QQrDecoder/zxing/oned/MultiFormatOneDReader.h b/symbian/QQrDecoder/zxing/oned/MultiFormatOneDReader.h
new file mode 100644
index 0000000..5320924
--- /dev/null
+++ b/symbian/QQrDecoder/zxing/oned/MultiFormatOneDReader.h
@@ -0,0 +1,39 @@
+/*
+ * MultiFormatOneDReader.h
+ * ZXing
+ *
+ * Created by Lukasz Warchol on 10-01-25.
+ * Copyright 2010 ZXing authors All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <zxing/oned/OneDReader.h>
+#include <zxing/common/BitArray.h>
+#include <zxing/Result.h>
+
+namespace zxing {
+ namespace oned {
+ class MultiFormatOneDReader : public OneDReader {
+
+ private:
+ std::vector<OneDReader*>* readers;
+ public:
+ MultiFormatOneDReader();
+
+ Ref<Result> decodeRow(int rowNumber, Ref<BitArray> row);
+
+ ~MultiFormatOneDReader();
+ };
+ }
+}
diff --git a/symbian/QQrDecoder/zxing/oned/MultiFormatUPCEANReader.cpp b/symbian/QQrDecoder/zxing/oned/MultiFormatUPCEANReader.cpp
new file mode 100644
index 0000000..21045e3
--- /dev/null
+++ b/symbian/QQrDecoder/zxing/oned/MultiFormatUPCEANReader.cpp
@@ -0,0 +1,79 @@
+/*
+ * MultiFormatUPCEANReader.cpp
+ * ZXing
+ *
+ * Created by Lukasz Warchol on 10-01-25.
+ * Copyright 2010 ZXing authors All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "MultiFormatUPCEANReader.h"
+
+#include <zxing/oned/EAN13Reader.h>
+#include <zxing/oned/EAN8Reader.h>
+#include <zxing/oned/UPCEReader.h>
+#include <zxing/oned/OneDResultPoint.h>
+#include <zxing/common/Array.h>
+#include <zxing/ReaderException.h>
+#include <math.h>
+
+namespace zxing {
+ namespace oned {
+
+ MultiFormatUPCEANReader::MultiFormatUPCEANReader(){
+ readers = new std::vector<OneDReader*>();
+ readers->push_back(new EAN13Reader());
+ // UPC-A is covered by EAN-13
+ readers->push_back(new EAN8Reader());
+ readers->push_back(new UPCEReader());
+ }
+
+ Ref<Result> MultiFormatUPCEANReader::decodeRow(int rowNumber, Ref<BitArray> row){
+ // Compute this location once and reuse it on multiple implementations
+ int size = readers->size();
+ for (int i = 0; i < size; i++) {
+ OneDReader* reader = (*readers)[i];
+ Ref<Result> result;
+ try {
+ result = reader->decodeRow(rowNumber, row);//decodeRow(rowNumber, row, startGuardPattern);
+ } catch (ReaderException re) {
+ continue;
+ }
+ // Special case: a 12-digit code encoded in UPC-A is identical to a "0"
+ // followed by those 12 digits encoded as EAN-13. Each will recognize such a code,
+ // UPC-A as a 12-digit string and EAN-13 as a 13-digit string starting with "0".
+ // Individually these are correct and their readers will both read such a code
+ // and correctly call it EAN-13, or UPC-A, respectively.
+ //
+ // In this case, if we've been looking for both types, we'd like to call it
+ // a UPC-A code. But for efficiency we only run the EAN-13 decoder to also read
+ // UPC-A. So we special case it here, and convert an EAN-13 result to a UPC-A
+ // result if appropriate.
+ if (result->getBarcodeFormat() == BarcodeFormat_EAN_13) {
+ std::string& text = (result->getText())->getText();
+ if (text[0] == '0') {
+ Ref<String> resultString(new String(text.substr(1)));
+ Ref<Result> res(new Result(resultString, result->getRawBytes(), result->getResultPoints(), BarcodeFormat_UPC_A));
+ return res;
+ }
+ }
+ return result;
+ }
+ throw ReaderException("No EAN code detected");
+ }
+
+ MultiFormatUPCEANReader::~MultiFormatUPCEANReader(){
+ delete readers;
+ }
+ }
+}
diff --git a/symbian/QQrDecoder/zxing/oned/MultiFormatUPCEANReader.h b/symbian/QQrDecoder/zxing/oned/MultiFormatUPCEANReader.h
new file mode 100644
index 0000000..2021bb5
--- /dev/null
+++ b/symbian/QQrDecoder/zxing/oned/MultiFormatUPCEANReader.h
@@ -0,0 +1,41 @@
+/*
+ * MultiFormatUPCEANReader.h
+ * ZXing
+ *
+ * Created by Lukasz Warchol on 10-01-25.
+ * Copyright 2010 ZXing authors All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#include <zxing/oned/OneDReader.h>
+#include <zxing/common/BitArray.h>
+#include <zxing/Result.h>
+
+namespace zxing {
+ namespace oned {
+ class MultiFormatUPCEANReader : public OneDReader {
+
+ private:
+ std::vector<OneDReader*>* readers;
+ public:
+ MultiFormatUPCEANReader();
+
+ Ref<Result> decodeRow(int rowNumber, Ref<BitArray> row);
+
+ ~MultiFormatUPCEANReader();
+ };
+ }
+}
diff --git a/cpp/core/src/zxing/oned/OneDReader.cpp b/symbian/QQrDecoder/zxing/oned/OneDReader.cpp
similarity index 100%
copy from cpp/core/src/zxing/oned/OneDReader.cpp
copy to symbian/QQrDecoder/zxing/oned/OneDReader.cpp
diff --git a/cpp/core/src/zxing/oned/OneDReader.h b/symbian/QQrDecoder/zxing/oned/OneDReader.h
similarity index 100%
copy from cpp/core/src/zxing/oned/OneDReader.h
copy to symbian/QQrDecoder/zxing/oned/OneDReader.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/oned/OneDResultPoint.cpp b/symbian/QQrDecoder/zxing/oned/OneDResultPoint.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/oned/OneDResultPoint.cpp
copy to symbian/QQrDecoder/zxing/oned/OneDResultPoint.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/oned/OneDResultPoint.h b/symbian/QQrDecoder/zxing/oned/OneDResultPoint.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/oned/OneDResultPoint.h
copy to symbian/QQrDecoder/zxing/oned/OneDResultPoint.h
diff --git a/symbian/QQrDecoder/zxing/oned/UPCAReader.cpp b/symbian/QQrDecoder/zxing/oned/UPCAReader.cpp
new file mode 100644
index 0000000..8757b2a
--- /dev/null
+++ b/symbian/QQrDecoder/zxing/oned/UPCAReader.cpp
@@ -0,0 +1,64 @@
+/*
+ * UPCAReader.cpp
+ * ZXing
+ *
+ * Created by Lukasz Warchol on 10-01-25.
+ * Copyright 2010 ZXing authors All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "UPCAReader.h"
+#include <zxing/oned/EAN13Reader.h>
+#include <zxing/ReaderException.h>
+
+namespace zxing {
+ namespace oned {
+ UPCAReader::UPCAReader(){
+ ean13Reader = new EAN13Reader();
+ }
+
+ Ref<Result> UPCAReader::decodeRow(int rowNumber, Ref<BitArray> row){
+ return maybeReturnResult(ean13Reader->decodeRow(rowNumber, row));
+ }
+ Ref<Result> UPCAReader::decodeRow(int rowNumber, Ref<BitArray> row, int startGuardRange[]){
+ return maybeReturnResult(ean13Reader->decodeRow(rowNumber, row, startGuardRange));
+ }
+ Ref<Result> UPCAReader::decode(Ref<BinaryBitmap> image){
+ return maybeReturnResult(ean13Reader->decode(image));
+ }
+
+ int UPCAReader::decodeMiddle(Ref<BitArray> row, int startRange[], int startRangeLen, std::string& resultString){
+ return ean13Reader->decodeMiddle(row, startRange, startRangeLen, resultString);
+ }
+
+ Ref<Result> UPCAReader::maybeReturnResult(Ref<Result> result){
+ std::string& text = (result->getText())->getText();
+ if (text[0] == '0') {
+ Ref<String> resultString(new String(text.substr(1)));
+ Ref<Result> res(new Result(resultString, result->getRawBytes(), result->getResultPoints(), BarcodeFormat_UPC_A));
+ return res;
+ } else {
+ throw ReaderException("Not UPC-A barcode.");
+ }
+ }
+
+
+ BarcodeFormat UPCAReader::getBarcodeFormat(){
+ return BarcodeFormat_UPC_A;
+ }
+ UPCAReader::~UPCAReader(){
+ delete ean13Reader;
+ }
+ }
+}
diff --git a/symbian/QQrDecoder/zxing/oned/UPCAReader.h b/symbian/QQrDecoder/zxing/oned/UPCAReader.h
new file mode 100644
index 0000000..0562952
--- /dev/null
+++ b/symbian/QQrDecoder/zxing/oned/UPCAReader.h
@@ -0,0 +1,45 @@
+/*
+ * UPCAReader.h
+ * ZXing
+ *
+ * Created by Lukasz Warchol on 10-01-25.
+ * Copyright 2010 ZXing authors All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <zxing/oned/UPCEANReader.h>
+#include <zxing/Result.h>
+
+namespace zxing {
+ namespace oned {
+ class UPCAReader : public UPCEANReader {
+
+ private:
+ UPCEANReader* ean13Reader;
+ static Ref<Result> maybeReturnResult(Ref<Result> result); //throws ReaderException
+
+ public:
+ UPCAReader();
+
+ int decodeMiddle(Ref<BitArray> row, int startRange[], int startRangeLen, std::string& resultString); //throws ReaderException
+
+ Ref<Result> decodeRow(int rowNumber, Ref<BitArray> row); //throws ReaderException
+ Ref<Result> decodeRow(int rowNumber, Ref<BitArray> row, int startGuardRange[]); //throws ReaderException
+ Ref<Result> decode(Ref<BinaryBitmap> image);
+
+ BarcodeFormat getBarcodeFormat();
+ ~UPCAReader();
+ };
+ }
+}
diff --git a/symbian/QQrDecoder/zxing/oned/UPCEANReader.cpp b/symbian/QQrDecoder/zxing/oned/UPCEANReader.cpp
new file mode 100644
index 0000000..e9bfa17
--- /dev/null
+++ b/symbian/QQrDecoder/zxing/oned/UPCEANReader.cpp
@@ -0,0 +1,316 @@
+/*
+ * UPCEANReader.cpp
+ * ZXing
+ *
+ * Created by Lukasz Warchol on 10-01-21.
+ * Copyright 2010 ZXing authors All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "UPCEANReader.h"
+#include <zxing/oned/OneDResultPoint.h>
+#include <zxing/ReaderException.h>
+namespace zxing {
+ namespace oned {
+
+ /**
+ * Start/end guard pattern.
+ */
+ static const int START_END_PATTERN[3] = {1, 1, 1};
+
+ /**
+ * Pattern marking the middle of a UPC/EAN pattern, separating the two halves.
+ */
+ static const int MIDDLE_PATTERN_LEN = 5;
+ static const int MIDDLE_PATTERN[MIDDLE_PATTERN_LEN] = {1, 1, 1, 1, 1};
+
+ /**
+ * "Odd", or "L" patterns used to encode UPC/EAN digits.
+ */
+ const int L_PATTERNS_LEN = 10;
+ const int L_PATTERNS_SUB_LEN = 4;
+ const int L_PATTERNS[10][4] = {
+ {3, 2, 1, 1}, // 0
+ {2, 2, 2, 1}, // 1
+ {2, 1, 2, 2}, // 2
+ {1, 4, 1, 1}, // 3
+ {1, 1, 3, 2}, // 4
+ {1, 2, 3, 1}, // 5
+ {1, 1, 1, 4}, // 6
+ {1, 3, 1, 2}, // 7
+ {1, 2, 1, 3}, // 8
+ {3, 1, 1, 2} // 9
+ };
+
+ /**
+ * As above but also including the "even", or "G" patterns used to encode UPC/EAN digits.
+ */
+ const int L_AND_G_PATTERNS_LEN = 20;
+ const int L_AND_G_PATTERNS_SUB_LEN = 4;
+ const int L_AND_G_PATTERNS[L_AND_G_PATTERNS_LEN][L_AND_G_PATTERNS_SUB_LEN] = {
+ {3, 2, 1, 1}, // 0
+ {2, 2, 2, 1}, // 1
+ {2, 1, 2, 2}, // 2
+ {1, 4, 1, 1}, // 3
+ {1, 1, 3, 2}, // 4
+ {1, 2, 3, 1}, // 5
+ {1, 1, 1, 4}, // 6
+ {1, 3, 1, 2}, // 7
+ {1, 2, 1, 3}, // 8
+ {3, 1, 1, 2}, // 9
+ {1, 1, 2, 3}, // 10 reversed 0
+ {1, 2, 2, 2}, // 11 reversed 1
+ {2, 2, 1, 2}, // 12 reversed 2
+ {1, 1, 4, 1}, // 13 reversed 3
+ {2, 3, 1, 1}, // 14 reversed 4
+ {1, 3, 2, 1}, // 15 reversed 5
+ {4, 1, 1, 1}, // 16 reversed 6
+ {2, 1, 3, 1}, // 17 reversed 7
+ {3, 1, 2, 1}, // 18 reversed 8
+ {2, 1, 1, 3} // 19 reversed 9
+ };
+
+
+ const int UPCEANReader::getMIDDLE_PATTERN_LEN(){
+ return MIDDLE_PATTERN_LEN;
+ }
+ const int* UPCEANReader::getMIDDLE_PATTERN(){
+ return MIDDLE_PATTERN;
+ }
+
+ UPCEANReader::UPCEANReader(){
+ }
+
+
+ Ref<Result> UPCEANReader::decodeRow(int rowNumber, Ref<BitArray> row){
+ return decodeRow(rowNumber, row, findStartGuardPattern(row));
+ }
+ Ref<Result> UPCEANReader::decodeRow(int rowNumber, Ref<BitArray> row, int startGuardRange[]){
+
+ std::string tmpResultString;
+ std::string& tmpResultStringRef = tmpResultString;
+ int endStart = decodeMiddle(row, startGuardRange, 2 /*reference findGuardPattern*/ , tmpResultStringRef);
+
+ int* endRange = decodeEnd(row, endStart);
+
+#pragma mark QuietZone needs some change
+ // Make sure there is a quiet zone at least as big as the end pattern after the barcode. The
+ // spec might want more whitespace, but in practice this is the maximum we can count on.
+// int end = endRange[1];
+// int quietEnd = end + (end - endRange[0]);
+// if (quietEnd >= row->getSize() || !row->isRange(end, quietEnd, false)) {
+// throw ReaderException("Quiet zone asserrt fail.");
+// }
+
+ if (!checkChecksum(tmpResultString)) {
+ throw ReaderException("Checksum fail.");
+ }
+
+ Ref<String> resultString(new String(tmpResultString));
+
+ float left = (float) (startGuardRange[1] + startGuardRange[0]) / 2.0f;
+ float right = (float) (endRange[1] + endRange[0]) / 2.0f;
+
+ std::vector< Ref<ResultPoint> > resultPoints(2);
+ Ref<OneDResultPoint> resultPoint1(new OneDResultPoint(left, (float) rowNumber));
+ Ref<OneDResultPoint> resultPoint2(new OneDResultPoint(right, (float) rowNumber));
+ resultPoints[0] = resultPoint1;
+ resultPoints[1] = resultPoint2;
+
+ ArrayRef<unsigned char> resultBytes(1);
+
+ if (startGuardRange!=NULL) {
+ delete [] startGuardRange;
+ startGuardRange = NULL;
+ }
+ if (endRange!=NULL) {
+ delete [] endRange;
+ endRange = NULL;
+ }
+
+ Ref<Result> res(new Result(resultString, resultBytes, resultPoints, getBarcodeFormat()));
+ return res;
+ }
+
+ int* UPCEANReader::findStartGuardPattern(Ref<BitArray> row){
+ bool foundStart = false;
+
+ int* startRange = NULL;
+ int nextStart = 0;
+ while (!foundStart) {
+ startRange = findGuardPattern(row, nextStart, false, START_END_PATTERN, sizeof(START_END_PATTERN)/sizeof(int));
+ int start = startRange[0];
+ nextStart = startRange[1];
+ // Make sure there is a quiet zone at least as big as the start pattern before the barcode.
+ // If this check would run off the left edge of the image, do not accept this barcode,
+ // as it is very likely to be a false positive.
+ int quietStart = start - (nextStart - start);
+ if (quietStart >= 0) {
+ foundStart = row->isRange(quietStart, start, false);
+ }
+ }
+ return startRange;
+ }
+
+ int* UPCEANReader::findGuardPattern(Ref<BitArray> row, int rowOffset, bool whiteFirst, const int pattern[], int patternLen){
+ int patternLength = patternLen;
+
+ //int counters[patternLength];
+ int* counters = new int(patternLength);
+ int countersCount = sizeof(counters)/sizeof(int);
+ for (int i=0; i<countersCount ; i++) {
+ counters[i]=0;
+ }
+ int width = row->getSize();
+ bool isWhite = false;
+ while (rowOffset < width) {
+ isWhite = !row->get(rowOffset);
+ if (whiteFirst == isWhite) {
+ break;
+ }
+ rowOffset++;
+ }
+
+ int counterPosition = 0;
+ int patternStart = rowOffset;
+ for (int x = rowOffset; x < width; x++) {
+ bool pixel = row->get(x);
+ if (pixel ^ isWhite) {
+ counters[counterPosition]++;
+ } else {
+ if (counterPosition == patternLength - 1) {
+ if (patternMatchVariance(counters, countersCount, pattern, MAX_INDIVIDUAL_VARIANCE) < MAX_AVG_VARIANCE) {
+ int* resultValue = new int[2];
+ resultValue[0] = patternStart;
+ resultValue[1] = x;
+ return resultValue;
+ }
+ patternStart += counters[0] + counters[1];
+ for (int y = 2; y < patternLength; y++) {
+ counters[y - 2] = counters[y];
+ }
+ counters[patternLength - 2] = 0;
+ counters[patternLength - 1] = 0;
+ counterPosition--;
+ } else {
+ counterPosition++;
+ }
+ counters[counterPosition] = 1;
+ isWhite = !isWhite;
+ }
+ }
+ delete counters;
+ throw ReaderException("findGuardPattern");
+ }
+
+ int* UPCEANReader::decodeEnd(Ref<BitArray> row, int endStart){
+ return findGuardPattern(row, endStart, false, START_END_PATTERN, sizeof(START_END_PATTERN)/sizeof(int));
+ }
+
+// int UPCEANReader::decodeDigit(Ref<BitArray> row, int counters[], int countersLen, int rowOffset, int** patterns/*[][]*/, int paterns1Len, int paterns2Len)
+ int UPCEANReader::decodeDigit(Ref<BitArray> row, int counters[], int countersLen, int rowOffset, UPC_EAN_PATTERNS paternType){
+ recordPattern(row, rowOffset, counters, countersLen);
+ int bestVariance = MAX_AVG_VARIANCE; // worst variance we'll accept
+ int bestMatch = -1;
+
+ int max = 0;
+ switch (paternType) {
+ case UPC_EAN_PATTERNS_L_PATTERNS:
+ max = L_PATTERNS_LEN;
+ for (int i = 0; i < max; i++) {
+ //int pattern[countersLen];
+ int* pattern = new int(countersLen);
+ for(int j = 0; j< countersLen; j++){
+ pattern[j] = L_PATTERNS[i][j];
+ }
+
+ int variance = patternMatchVariance(counters, countersLen, pattern, MAX_INDIVIDUAL_VARIANCE);
+ if (variance < bestVariance) {
+ bestVariance = variance;
+ bestMatch = i;
+ }
+ delete pattern;
+ }
+ break;
+ case UPC_EAN_PATTERNS_L_AND_G_PATTERNS:
+ max = L_AND_G_PATTERNS_LEN;
+ for (int i = 0; i < max; i++) {
+ //int pattern[countersLen];
+ int* pattern = new int(countersLen);
+ for(int j = 0; j< countersLen; j++){
+ pattern[j] = L_AND_G_PATTERNS[i][j];
+ }
+
+ int variance = patternMatchVariance(counters, countersLen, pattern, MAX_INDIVIDUAL_VARIANCE);
+ if (variance < bestVariance) {
+ bestVariance = variance;
+ bestMatch = i;
+ }
+ delete pattern;
+ }
+ break;
+ default:
+ break;
+ }
+ if (bestMatch >= 0) {
+ return bestMatch;
+ } else {
+ throw ReaderException("UPCEANReader::decodeDigit: No best mach");
+ }
+ }
+
+
+ /**
+ * @return {@link #checkStandardUPCEANChecksum(String)}
+ */
+ bool UPCEANReader::checkChecksum(std::string s){
+ return checkStandardUPCEANChecksum(s);
+ }
+
+ /**
+ * Computes the UPC/EAN checksum on a string of digits, and reports
+ * whether the checksum is correct or not.
+ *
+ * @param s string of digits to check
+ * @return true iff string of digits passes the UPC/EAN checksum algorithm
+ * @throws ReaderException if the string does not contain only digits
+ */
+ bool UPCEANReader::checkStandardUPCEANChecksum(std::string s){
+ int length = s.length();
+ if (length == 0) {
+ return false;
+ }
+
+ int sum = 0;
+ for (int i = length - 2; i >= 0; i -= 2) {
+ int digit = (int) s[i] - (int) '0';
+ if (digit < 0 || digit > 9) {
+ throw ReaderException("checkStandardUPCEANChecksum");
+ }
+ sum += digit;
+ }
+ sum *= 3;
+ for (int i = length - 1; i >= 0; i -= 2) {
+ int digit = (int) s[i] - (int) '0';
+ if (digit < 0 || digit > 9) {
+ throw ReaderException("checkStandardUPCEANChecksum");
+ }
+ sum += digit;
+ }
+ return sum % 10 == 0;
+ }
+ UPCEANReader::~UPCEANReader(){
+ }
+ }
+}
diff --git a/symbian/QQrDecoder/zxing/oned/UPCEANReader.h b/symbian/QQrDecoder/zxing/oned/UPCEANReader.h
new file mode 100644
index 0000000..3a39cf9
--- /dev/null
+++ b/symbian/QQrDecoder/zxing/oned/UPCEANReader.h
@@ -0,0 +1,65 @@
+/*
+ * UPCEANReader.h
+ * ZXing
+ *
+ * Created by Lukasz Warchol on 10-01-21.
+ * Copyright 2010 ZXing authors All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <zxing/oned/OneDReader.h>
+#include <zxing/common/BitArray.h>
+#include <zxing/Result.h>
+typedef enum UPC_EAN_PATTERNS {
+ UPC_EAN_PATTERNS_L_PATTERNS = 0,
+ UPC_EAN_PATTERNS_L_AND_G_PATTERNS
+} UPC_EAN_PATTERNS;
+namespace zxing {
+ namespace oned {
+ class UPCEANReader : public OneDReader {
+
+ private:
+ static const int MAX_AVG_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.42f);
+ static const int MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.7f);
+
+ static int* findStartGuardPattern(Ref<BitArray> row); //throws ReaderException
+
+ int* decodeEnd(Ref<BitArray> row, int endStart); //throws ReaderException
+
+ static bool checkStandardUPCEANChecksum(std::string s); //throws ReaderException
+ protected:
+ static int* findGuardPattern(Ref<BitArray> row, int rowOffset, bool whiteFirst, const int pattern[], int patternLen); //throws ReaderException
+
+ virtual const int getMIDDLE_PATTERN_LEN();
+ virtual const int* getMIDDLE_PATTERN();
+
+ public:
+ UPCEANReader();
+
+ virtual int decodeMiddle(Ref<BitArray> row, int startRange[], int startRangeLen, std::string& resultString) = 0; //throws ReaderException
+
+ Ref<Result> decodeRow(int rowNumber, Ref<BitArray> row);
+ Ref<Result> decodeRow(int rowNumber, Ref<BitArray> row, int startGuardRange[]);
+
+ static int decodeDigit(Ref<BitArray> row, int counters[], int countersLen, int rowOffset, UPC_EAN_PATTERNS paternType); //throws ReaderException
+
+ bool checkChecksum(std::string s); //throws ReaderException
+
+ virtual BarcodeFormat getBarcodeFormat() = 0;
+ virtual ~UPCEANReader();
+ };
+ }
+}
diff --git a/symbian/ZXingBarcodeReader/group/zxing/oned/UPCEReader.cpp b/symbian/QQrDecoder/zxing/oned/UPCEReader.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/oned/UPCEReader.cpp
copy to symbian/QQrDecoder/zxing/oned/UPCEReader.cpp
diff --git a/symbian/QQrDecoder/zxing/oned/UPCEReader.h b/symbian/QQrDecoder/zxing/oned/UPCEReader.h
new file mode 100644
index 0000000..7daa87a
--- /dev/null
+++ b/symbian/QQrDecoder/zxing/oned/UPCEReader.h
@@ -0,0 +1,45 @@
+/*
+ * UPCEReader.h
+ * ZXing
+ *
+ * Created by Lukasz Warchol on 10-01-26.
+ * Copyright 2010 ZXing authors All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <zxing/oned/UPCEANReader.h>
+#include <zxing/Result.h>
+
+namespace zxing {
+ namespace oned {
+ class UPCEReader : public UPCEANReader {
+
+ private:
+ int* decodeMiddleCounters;
+ static void determineFirstDigit(std::string& resultString, int lgPatternFound); //throws ReaderException
+ static void determineNumSysAndCheckDigit(std::string& resultString, int lgPatternFound); //throws ReaderException
+ protected:
+ int* decodeEnd(Ref<BitArray> row, int endStart); //throws ReaderException
+ bool checkChecksum(std::string s); //throws ReaderException
+ public:
+ UPCEReader();
+
+ int decodeMiddle(Ref<BitArray> row, int startRange[], int startRangeLen, std::string& resultString); //throws ReaderException
+ static std::string& convertUPCEtoUPCA(std::string upce);
+
+ BarcodeFormat getBarcodeFormat();
+ ~UPCEReader();
+ };
+ }
+}
diff --git a/symbian/ZXingBarcodeReader/group/zxing/qrcode/ErrorCorrectionLevel.cpp b/symbian/QQrDecoder/zxing/qrcode/ErrorCorrectionLevel.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/qrcode/ErrorCorrectionLevel.cpp
copy to symbian/QQrDecoder/zxing/qrcode/ErrorCorrectionLevel.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/qrcode/ErrorCorrectionLevel.h b/symbian/QQrDecoder/zxing/qrcode/ErrorCorrectionLevel.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/qrcode/ErrorCorrectionLevel.h
copy to symbian/QQrDecoder/zxing/qrcode/ErrorCorrectionLevel.h
diff --git a/cpp/core/src/zxing/qrcode/FormatInformation.cpp b/symbian/QQrDecoder/zxing/qrcode/FormatInformation.cpp
similarity index 100%
copy from cpp/core/src/zxing/qrcode/FormatInformation.cpp
copy to symbian/QQrDecoder/zxing/qrcode/FormatInformation.cpp
diff --git a/cpp/core/src/zxing/qrcode/FormatInformation.h b/symbian/QQrDecoder/zxing/qrcode/FormatInformation.h
similarity index 100%
copy from cpp/core/src/zxing/qrcode/FormatInformation.h
copy to symbian/QQrDecoder/zxing/qrcode/FormatInformation.h
diff --git a/symbian/QQrDecoder/zxing/qrcode/QRCodeReader.cpp b/symbian/QQrDecoder/zxing/qrcode/QRCodeReader.cpp
new file mode 100644
index 0000000..f3843ec
--- /dev/null
+++ b/symbian/QQrDecoder/zxing/qrcode/QRCodeReader.cpp
@@ -0,0 +1,84 @@
+/*
+ * QRCodeReader.cpp
+ * zxing
+ *
+ * Created by Christian Brunschen on 20/05/2008.
+ * Copyright 2008 ZXing authors All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <zxing/qrcode/QRCodeReader.h>
+#include <zxing/qrcode/detector/Detector.h>
+
+#include <iostream>
+
+namespace zxing {
+ namespace qrcode {
+
+ using namespace std;
+
+ QRCodeReader::QRCodeReader() :decoder_() {
+ }
+
+ Ref<Result> QRCodeReader::decode(Ref<BinaryBitmap> image) {
+#ifdef DEBUG
+ cout << "decoding image " << image.object_ << ":\n" ;
+#endif
+
+ Detector detector(image->getBlackMatrix());
+
+
+#ifdef DEBUG
+ cout << "(1) created detector " << &detector << "\n" ;
+#endif
+
+ Ref<DetectorResult> detectorResult(detector.detect());
+#ifdef DEBUG
+ cout << "(2) detected, have detectorResult " << detectorResult.object_ << "\n" ;
+#endif
+
+ std::vector<Ref<ResultPoint> > points(detectorResult->getPoints());
+
+
+#ifdef DEBUG
+ cout << "(3) extracted points " << &points << "\n";
+ cout << "found " << points.size() << " points:\n";
+ for (size_t i = 0; i < points.size(); i++) {
+ cout << " " << points[i]->getX() << "," << points[i]->getY() << "\n";
+ }
+ cout << "bits:\n";
+ cout << *(detectorResult->getBits()) << "\n";
+#endif
+
+ Ref<DecoderResult> decoderResult(decoder_.decode(detectorResult->getBits()));
+#ifdef DEBUG
+ cout << "(4) decoded, have decoderResult " << decoderResult.object_ << "\n" ;
+#endif
+
+ Ref<Result> result(
+ new Result(decoderResult->getText(), decoderResult->getRawBytes(), points, BarcodeFormat_QR_CODE));
+#ifdef DEBUG
+ cout << "(5) created result " << result.object_ << ", returning\n" ;
+
+ cout << "(6) text: " << result->getText()->getText() << std::endl;
+#endif
+
+ return result;
+ }
+
+ QRCodeReader::~QRCodeReader() {
+ }
+
+ }
+}
diff --git a/cpp/core/src/zxing/qrcode/QRCodeReader.h b/symbian/QQrDecoder/zxing/qrcode/QRCodeReader.h
similarity index 100%
copy from cpp/core/src/zxing/qrcode/QRCodeReader.h
copy to symbian/QQrDecoder/zxing/qrcode/QRCodeReader.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/qrcode/Version.cpp b/symbian/QQrDecoder/zxing/qrcode/Version.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/qrcode/Version.cpp
copy to symbian/QQrDecoder/zxing/qrcode/Version.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/qrcode/Version.h b/symbian/QQrDecoder/zxing/qrcode/Version.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/qrcode/Version.h
copy to symbian/QQrDecoder/zxing/qrcode/Version.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/qrcode/decoder/BitMatrixParser.cpp b/symbian/QQrDecoder/zxing/qrcode/decoder/BitMatrixParser.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/qrcode/decoder/BitMatrixParser.cpp
copy to symbian/QQrDecoder/zxing/qrcode/decoder/BitMatrixParser.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/qrcode/decoder/BitMatrixParser.h b/symbian/QQrDecoder/zxing/qrcode/decoder/BitMatrixParser.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/qrcode/decoder/BitMatrixParser.h
copy to symbian/QQrDecoder/zxing/qrcode/decoder/BitMatrixParser.h
diff --git a/cpp/core/src/zxing/qrcode/decoder/DataBlock.cpp b/symbian/QQrDecoder/zxing/qrcode/decoder/DataBlock.cpp
similarity index 100%
copy from cpp/core/src/zxing/qrcode/decoder/DataBlock.cpp
copy to symbian/QQrDecoder/zxing/qrcode/decoder/DataBlock.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/qrcode/decoder/DataBlock.h b/symbian/QQrDecoder/zxing/qrcode/decoder/DataBlock.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/qrcode/decoder/DataBlock.h
copy to symbian/QQrDecoder/zxing/qrcode/decoder/DataBlock.h
diff --git a/cpp/core/src/zxing/qrcode/decoder/DataMask.cpp b/symbian/QQrDecoder/zxing/qrcode/decoder/DataMask.cpp
similarity index 100%
copy from cpp/core/src/zxing/qrcode/decoder/DataMask.cpp
copy to symbian/QQrDecoder/zxing/qrcode/decoder/DataMask.cpp
diff --git a/cpp/core/src/zxing/qrcode/decoder/DataMask.h b/symbian/QQrDecoder/zxing/qrcode/decoder/DataMask.h
similarity index 100%
copy from cpp/core/src/zxing/qrcode/decoder/DataMask.h
copy to symbian/QQrDecoder/zxing/qrcode/decoder/DataMask.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/qrcode/decoder/DecodedBitStreamParser.cpp b/symbian/QQrDecoder/zxing/qrcode/decoder/DecodedBitStreamParser.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/qrcode/decoder/DecodedBitStreamParser.cpp
copy to symbian/QQrDecoder/zxing/qrcode/decoder/DecodedBitStreamParser.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/qrcode/decoder/DecodedBitStreamParser.h b/symbian/QQrDecoder/zxing/qrcode/decoder/DecodedBitStreamParser.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/qrcode/decoder/DecodedBitStreamParser.h
copy to symbian/QQrDecoder/zxing/qrcode/decoder/DecodedBitStreamParser.h
diff --git a/cpp/core/src/zxing/qrcode/decoder/Decoder.cpp b/symbian/QQrDecoder/zxing/qrcode/decoder/Decoder.cpp
similarity index 100%
copy from cpp/core/src/zxing/qrcode/decoder/Decoder.cpp
copy to symbian/QQrDecoder/zxing/qrcode/decoder/Decoder.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/qrcode/decoder/Decoder.h b/symbian/QQrDecoder/zxing/qrcode/decoder/Decoder.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/qrcode/decoder/Decoder.h
copy to symbian/QQrDecoder/zxing/qrcode/decoder/Decoder.h
diff --git a/cpp/core/src/zxing/qrcode/decoder/Mode.cpp b/symbian/QQrDecoder/zxing/qrcode/decoder/Mode.cpp
similarity index 100%
copy from cpp/core/src/zxing/qrcode/decoder/Mode.cpp
copy to symbian/QQrDecoder/zxing/qrcode/decoder/Mode.cpp
diff --git a/cpp/core/src/zxing/qrcode/decoder/Mode.h b/symbian/QQrDecoder/zxing/qrcode/decoder/Mode.h
similarity index 100%
copy from cpp/core/src/zxing/qrcode/decoder/Mode.h
copy to symbian/QQrDecoder/zxing/qrcode/decoder/Mode.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/qrcode/detector/AlignmentPattern.cpp b/symbian/QQrDecoder/zxing/qrcode/detector/AlignmentPattern.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/qrcode/detector/AlignmentPattern.cpp
copy to symbian/QQrDecoder/zxing/qrcode/detector/AlignmentPattern.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/qrcode/detector/AlignmentPattern.h b/symbian/QQrDecoder/zxing/qrcode/detector/AlignmentPattern.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/qrcode/detector/AlignmentPattern.h
copy to symbian/QQrDecoder/zxing/qrcode/detector/AlignmentPattern.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/qrcode/detector/AlignmentPatternFinder.cpp b/symbian/QQrDecoder/zxing/qrcode/detector/AlignmentPatternFinder.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/qrcode/detector/AlignmentPatternFinder.cpp
copy to symbian/QQrDecoder/zxing/qrcode/detector/AlignmentPatternFinder.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/qrcode/detector/AlignmentPatternFinder.h b/symbian/QQrDecoder/zxing/qrcode/detector/AlignmentPatternFinder.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/qrcode/detector/AlignmentPatternFinder.h
copy to symbian/QQrDecoder/zxing/qrcode/detector/AlignmentPatternFinder.h
diff --git a/symbian/QQrDecoder/zxing/qrcode/detector/Detector.cpp b/symbian/QQrDecoder/zxing/qrcode/detector/Detector.cpp
new file mode 100644
index 0000000..dc8090b
--- /dev/null
+++ b/symbian/QQrDecoder/zxing/qrcode/detector/Detector.cpp
@@ -0,0 +1,265 @@
+/*
+ * Detector.cpp
+ * zxing
+ *
+ * Created by Christian Brunschen on 14/05/2008.
+ * Copyright 2008 ZXing authors All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <zxing/qrcode/detector/Detector.h>
+#include <zxing/qrcode/detector/FinderPatternFinder.h>
+#include <zxing/qrcode/detector/FinderPattern.h>
+#include <zxing/qrcode/detector/AlignmentPattern.h>
+#include <zxing/qrcode/detector/AlignmentPatternFinder.h>
+#include <zxing/qrcode/Version.h>
+#include <zxing/common/GridSampler.h>
+#include <cmath>
+#include <sstream>
+
+namespace zxing {
+namespace qrcode {
+
+using namespace std;
+
+Detector::Detector(Ref<BitMatrix> image) :
+ image_(image) {
+}
+
+Ref<BitMatrix> Detector::getImage() {
+ return image_;
+}
+
+Ref<DetectorResult> Detector::detect() {
+ FinderPatternFinder finder(image_);
+ Ref<FinderPatternInfo> info(finder.find());
+
+ Ref<FinderPattern> topLeft(info->getTopLeft());
+ Ref<FinderPattern> topRight(info->getTopRight());
+ Ref<FinderPattern> bottomLeft(info->getBottomLeft());
+
+ float moduleSize = calculateModuleSize(topLeft, topRight, bottomLeft);
+ int dimension = computeDimension(topLeft, topRight, bottomLeft, moduleSize);
+ Version *provisionalVersion = Version::getProvisionalVersionForDimension(dimension);
+ int modulesBetweenFPCenters = provisionalVersion->getDimensionForVersion() - 7;
+
+ Ref<AlignmentPattern> alignmentPattern;
+ // Anything above version 1 has an alignment pattern
+ if (provisionalVersion->getAlignmentPatternCenters().size() > 0) {
+
+
+ // Guess where a "bottom right" finder pattern would have been
+ float bottomRightX = topRight->getX() - topLeft->getX() + bottomLeft->getX();
+ float bottomRightY = topRight->getY() - topLeft->getY() + bottomLeft->getY();
+
+
+ // Estimate that alignment pattern is closer by 3 modules
+ // from "bottom right" to known top left location
+ float correctionToTopLeft = 1.0f - 3.0f / (float)modulesBetweenFPCenters;
+ int estAlignmentX = (int)(topLeft->getX() + correctionToTopLeft * (bottomRightX - topLeft->getX()));
+ int estAlignmentY = (int)(topLeft->getY() + correctionToTopLeft * (bottomRightY - topLeft->getY()));
+
+
+ // Kind of arbitrary -- expand search radius before giving up
+ for (int i = 4; i <= 16; i <<= 1) {
+ try {
+ alignmentPattern = findAlignmentInRegion(moduleSize, estAlignmentX, estAlignmentY, (float)i);
+ break;
+ } catch (zxing::ReaderException re) {
+ // try next round
+ }
+ }
+ if (alignmentPattern == 0) {
+ // Try anyway
+ }
+
+ }
+
+ Ref<PerspectiveTransform> transform = createTransform(topLeft, topRight, bottomLeft, alignmentPattern, dimension);
+ Ref<BitMatrix> bits(sampleGrid(image_, dimension, transform));
+ std::vector<Ref<ResultPoint> > points(alignmentPattern == 0 ? 3 : 4);
+ points[0].reset(bottomLeft);
+ points[1].reset(topLeft);
+ points[2].reset(topRight);
+ if (alignmentPattern != 0) {
+ points[3].reset(alignmentPattern);
+ }
+
+ Ref<DetectorResult> result(new DetectorResult(bits, points, transform));
+ return result;
+}
+
+Ref<PerspectiveTransform> Detector::createTransform(Ref<ResultPoint> topLeft, Ref<ResultPoint> topRight, Ref <
+ ResultPoint > bottomLeft, Ref<ResultPoint> alignmentPattern, int dimension) {
+
+ float dimMinusThree = (float)dimension - 3.5f;
+ float bottomRightX;
+ float bottomRightY;
+ float sourceBottomRightX;
+ float sourceBottomRightY;
+ if (alignmentPattern != 0) {
+ bottomRightX = alignmentPattern->getX();
+ bottomRightY = alignmentPattern->getY();
+ sourceBottomRightX = sourceBottomRightY = dimMinusThree - 3.0f;
+ } else {
+ // Don't have an alignment pattern, just make up the bottom-right point
+ bottomRightX = (topRight->getX() - topLeft->getX()) + bottomLeft->getX();
+ bottomRightY = (topRight->getY() - topLeft->getY()) + bottomLeft->getY();
+ sourceBottomRightX = sourceBottomRightY = dimMinusThree;
+ }
+
+ Ref<PerspectiveTransform> transform(PerspectiveTransform::quadrilateralToQuadrilateral(3.5f, 3.5f, dimMinusThree, 3.5f, sourceBottomRightX,
+ sourceBottomRightY, 3.5f, dimMinusThree, topLeft->getX(), topLeft->getY(), topRight->getX(),
+ topRight->getY(), bottomRightX, bottomRightY, bottomLeft->getX(), bottomLeft->getY()));
+
+ return transform;
+}
+
+Ref<BitMatrix> Detector::sampleGrid(Ref<BitMatrix> image, int dimension, Ref<PerspectiveTransform> transform) {
+ GridSampler &sampler = GridSampler::getInstance();
+ return sampler.sampleGrid(image, dimension, transform);
+}
+
+int Detector::computeDimension(Ref<ResultPoint> topLeft, Ref<ResultPoint> topRight, Ref<ResultPoint> bottomLeft,
+ float moduleSize) {
+ int tltrCentersDimension = lround(FinderPatternFinder::distance(topLeft, topRight) / moduleSize);
+ int tlblCentersDimension = lround(FinderPatternFinder::distance(topLeft, bottomLeft) / moduleSize);
+ int dimension = ((tltrCentersDimension + tlblCentersDimension) >> 1) + 7;
+ switch (dimension & 0x03) { // mod 4
+ case 0:
+ dimension++;
+ break;
+ // 1? do nothing
+ case 2:
+ dimension--;
+ break;
+ case 3:
+ ostringstream s;
+ s << "Bad dimension: " << dimension;
+ throw zxing::ReaderException(s.str().c_str());
+ }
+ return dimension;
+}
+
+float Detector::calculateModuleSize(Ref<ResultPoint> topLeft, Ref<ResultPoint> topRight, Ref<ResultPoint> bottomLeft) {
+ // Take the average
+ return (calculateModuleSizeOneWay(topLeft, topRight) + calculateModuleSizeOneWay(topLeft, bottomLeft)) / 2.0f;
+}
+
+float Detector::calculateModuleSizeOneWay(Ref<ResultPoint> pattern, Ref<ResultPoint> otherPattern) {
+ float moduleSizeEst1 = sizeOfBlackWhiteBlackRunBothWays((int)pattern->getX(), (int)pattern->getY(),
+ (int)otherPattern->getX(), (int)otherPattern->getY());
+ float moduleSizeEst2 = sizeOfBlackWhiteBlackRunBothWays((int)otherPattern->getX(), (int)otherPattern->getY(),
+ (int)pattern->getX(), (int)pattern->getY());
+ if (isnan(moduleSizeEst1)) {
+ return moduleSizeEst2;
+ }
+ if (isnan(moduleSizeEst2)) {
+ return moduleSizeEst1;
+ }
+ // Average them, and divide by 7 since we've counted the width of 3 black modules,
+ // and 1 white and 1 black module on either side. Ergo, divide sum by 14.
+ return (moduleSizeEst1 + moduleSizeEst2) / 14.0f;
+}
+
+float Detector::sizeOfBlackWhiteBlackRunBothWays(int fromX, int fromY, int toX, int toY) {
+
+ float result = sizeOfBlackWhiteBlackRun(fromX, fromY, toX, toY);
+
+
+ // Now count other way -- don't run off image though of course
+ int otherToX = fromX - (toX - fromX);
+ if (otherToX < 0) {
+ // "to" should the be the first value not included, so, the first value off
+ // the edge is -1
+ otherToX = -1;
+ } else if (otherToX >= (int)image_->getWidth()) {
+ otherToX = image_->getWidth();
+ }
+ int otherToY = fromY - (toY - fromY);
+ if (otherToY < 0) {
+ otherToY = -1;
+ } else if (otherToY >= (int)image_->getHeight()) {
+ otherToY = image_->getHeight();
+ }
+ result += sizeOfBlackWhiteBlackRun(fromX, fromY, otherToX, otherToY);
+ return result - 1.0f; // -1 because we counted the middle pixel twice
+}
+
+float Detector::sizeOfBlackWhiteBlackRun(int fromX, int fromY, int toX, int toY) {
+ // Mild variant of Bresenham's algorithm;
+ // see http://en.wikipedia.org/wiki/Bresenham's_line_algorithm
+ bool steep = abs(toY - fromY) > abs(toX - fromX);
+ if (steep) {
+ int temp = fromX;
+ fromX = fromY;
+ fromY = temp;
+ temp = toX;
+ toX = toY;
+ toY = temp;
+ }
+
+ int dx = abs(toX - fromX);
+ int dy = abs(toY - fromY);
+ int error = -dx >> 1;
+ int ystep = fromY < toY ? 1 : -1;
+ int xstep = fromX < toX ? 1 : -1;
+ int state = 0; // In black pixels, looking for white, first or second time
+ for (int x = fromX, y = fromY; x != toX; x += xstep) {
+
+ int realX = steep ? y : x;
+ int realY = steep ? x : y;
+ if (state == 1) { // In white pixels, looking for black
+ if (image_->get(realX, realY)) {
+ state++;
+ }
+ } else {
+ if (!image_->get(realX, realY)) {
+ state++;
+ }
+ }
+
+ if (state == 3) { // Found black, white, black, and stumbled back onto white; done
+ int diffX = x - fromX;
+ int diffY = y - fromY;
+ return (float)sqrt((double)(diffX * diffX + diffY * diffY));
+ }
+ error += dy;
+ if (error > 0) {
+ y += ystep;
+ error -= dx;
+ }
+ }
+ int diffX = toX - fromX;
+ int diffY = toY - fromY;
+ return (float)sqrt((double)(diffX * diffX + diffY * diffY));
+}
+
+Ref<AlignmentPattern> Detector::findAlignmentInRegion(float overallEstModuleSize, int estAlignmentX, int estAlignmentY,
+ float allowanceFactor) {
+ // Look for an alignment pattern (3 modules in size) around where it
+ // should be
+ int allowance = (int)(allowanceFactor * overallEstModuleSize);
+ int alignmentAreaLeftX = max(0, estAlignmentX - allowance);
+ int alignmentAreaRightX = min((int)(image_->getWidth() - 1), estAlignmentX + allowance);
+ int alignmentAreaTopY = max(0, estAlignmentY - allowance);
+ int alignmentAreaBottomY = min((int)(image_->getHeight() - 1), estAlignmentY + allowance);
+
+ AlignmentPatternFinder alignmentFinder(image_, alignmentAreaLeftX, alignmentAreaTopY, alignmentAreaRightX
+ - alignmentAreaLeftX, alignmentAreaBottomY - alignmentAreaTopY, overallEstModuleSize);
+ return alignmentFinder.find();
+}
+
+}
+}
diff --git a/cpp/core/src/zxing/qrcode/detector/Detector.h b/symbian/QQrDecoder/zxing/qrcode/detector/Detector.h
similarity index 100%
copy from cpp/core/src/zxing/qrcode/detector/Detector.h
copy to symbian/QQrDecoder/zxing/qrcode/detector/Detector.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/qrcode/detector/FinderPattern.cpp b/symbian/QQrDecoder/zxing/qrcode/detector/FinderPattern.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/qrcode/detector/FinderPattern.cpp
copy to symbian/QQrDecoder/zxing/qrcode/detector/FinderPattern.cpp
diff --git a/symbian/ZXingBarcodeReader/group/zxing/qrcode/detector/FinderPattern.h b/symbian/QQrDecoder/zxing/qrcode/detector/FinderPattern.h
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/qrcode/detector/FinderPattern.h
copy to symbian/QQrDecoder/zxing/qrcode/detector/FinderPattern.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/qrcode/detector/FinderPatternFinder.cpp b/symbian/QQrDecoder/zxing/qrcode/detector/FinderPatternFinder.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/qrcode/detector/FinderPatternFinder.cpp
copy to symbian/QQrDecoder/zxing/qrcode/detector/FinderPatternFinder.cpp
diff --git a/cpp/core/src/zxing/qrcode/detector/FinderPatternFinder.h b/symbian/QQrDecoder/zxing/qrcode/detector/FinderPatternFinder.h
similarity index 100%
copy from cpp/core/src/zxing/qrcode/detector/FinderPatternFinder.h
copy to symbian/QQrDecoder/zxing/qrcode/detector/FinderPatternFinder.h
diff --git a/cpp/core/src/zxing/qrcode/detector/FinderPatternInfo.cpp b/symbian/QQrDecoder/zxing/qrcode/detector/FinderPatternInfo.cpp
similarity index 100%
copy from cpp/core/src/zxing/qrcode/detector/FinderPatternInfo.cpp
copy to symbian/QQrDecoder/zxing/qrcode/detector/FinderPatternInfo.cpp
diff --git a/cpp/core/src/zxing/qrcode/detector/FinderPatternInfo.h b/symbian/QQrDecoder/zxing/qrcode/detector/FinderPatternInfo.h
similarity index 100%
copy from cpp/core/src/zxing/qrcode/detector/FinderPatternInfo.h
copy to symbian/QQrDecoder/zxing/qrcode/detector/FinderPatternInfo.h
diff --git a/symbian/ZXingBarcodeReader/group/zxing/qrcode/detector/QREdgeDetector.cpp b/symbian/QQrDecoder/zxing/qrcode/detector/QREdgeDetector.cpp
similarity index 100%
copy from symbian/ZXingBarcodeReader/group/zxing/qrcode/detector/QREdgeDetector.cpp
copy to symbian/QQrDecoder/zxing/qrcode/detector/QREdgeDetector.cpp
diff --git a/cpp/core/src/zxing/qrcode/detector/QREdgeDetector.h b/symbian/QQrDecoder/zxing/qrcode/detector/QREdgeDetector.h
similarity index 100%
copy from cpp/core/src/zxing/qrcode/detector/QREdgeDetector.h
copy to symbian/QQrDecoder/zxing/qrcode/detector/QREdgeDetector.h
diff --git a/symbian/QQrDecoder_tutorial.txt b/symbian/QQrDecoder_tutorial.txt
new file mode 100644
index 0000000..d7f6cfb
--- /dev/null
+++ b/symbian/QQrDecoder_tutorial.txt
@@ -0,0 +1,58 @@
+This project is the same as ZXingBarcodeReader. The difference is that the GUI is
+developed using Qt framework. This means that it can easily be ported to other platforms
+supported by Qt by simply changing the camera operations implemented in "QCameraControllerWidget"
+which is Symbian specific code.
+
+Also the advantage of this implementation over "ZXingBarcodeReader" is that the code written is
+more readable and familiar to users that have never used Qt framework or Symbian C++ before.
+
+== Prerequisities ==
+
+* Have at least one S60 SDK. One of the SDKs can be obtained from here:
+ http://www.forum.nokia.com/info/sw.nokia.com/id/ec866fab-4b76-49f6-b5a5-af0631419e9c/S60_All_in_One_SDKs.html
+
+* After installing S60 SDK you have to install OpenC++.
+ http://www.forum.nokia.com/info/sw.nokia.com/id/91d89929-fb8c-4d66-bea0-227e42df9053/Open_C_SDK_Plug-In.html
+
+* Next step, have "Qt for Symbian" installed. It under LGLP licence.
+ http://qt.nokia.com/downloads/symbian-cpp
+
+* (Optional) You can use Carbide C++ as IDE which makes the life a bit easier on creating applications for Symbian.
+ An alternative approach is to compile the program in command line but i am afraid i can help you here because i
+ have no idea :P
+or
+ You can use Qt Creator (see its tutorials on how to use it)
+ http://qt.nokia.com/products/developer-tools/developer-tools
+
+== Create project ==
+If you have Carbide C++ IDE then go "File->Import->Qt->Qt Project",
+click "Browse" and find and select file "QQrDecoder\QQrDecoder.pro".
+Next step you select the S60 SDK to be compiled to and you are ready.
+
+== Build project ==
+Since the project is created, we can proceed to build it.
+
+First in "QQrDecoder\camerawrapper" folder there is a folder named "epoc32".
+Copy this folder and paste it to the root folder of the S60 SDK that you are going to use
+(in my case: C:\S60\devices\S60_5th_Edition_SDK_v1.0). This step is important in order
+to use a Plug-In API for the easier manipulation of the camera.
+
+Now we are ready to compile. Since the camera is not supported in the Symbian emulator we
+will build the project directly to be installed on a devidce.
+Select "QQrDecoder" project in the "Project Explorer" view in Carbide, right click on it
+and select "Properties". Expand "Carbide.c++" field and select "Build Configurations".
+Being in the "SIS Builder" tab, select as Active Configuration the "Phone Degug (GCCE)".
+Then press "Add" button, and to select a PKG file click "Browse" button. Go to "QQrDecoder"
+folder and select "QQrDecoder_template.pkg" file. Make sure that "Self sign sis file" radio
+button is selected and press OK.
+
+Now go "Project->Build Project" and if everything goes right, you will have 2 installation files
+in "QQrDecoder" folder. Install the .sisx file to your device and you are ready.
+
+== Additional information ==
+For afew more details about the implementation you can see the following page:
+http://wiki.forum.nokia.com/index.php/Qr_Decoder_in_Qt
+
+== The same project in Symbian C++ ==
+
+In case you are interested in using this project with only Symbian C++, take a look at ZXingBarcodeReader folder.
\ No newline at end of file
diff --git a/symbian/ZXingBarcodeReader_tutorial.txt b/symbian/ZXingBarcodeReader_tutorial.txt
new file mode 100644
index 0000000..254f50d
--- /dev/null
+++ b/symbian/ZXingBarcodeReader_tutorial.txt
@@ -0,0 +1,46 @@
+The whole ZXingBarcodeReader folder is a Carbide project build and tested on both
+S60 5th Edition SDK and S60 3rd Edition FP2. (currently only Qr Codes can be detected)
+
+== Prerequisities ==
+
+* Have at least one S60 SDK. One of the SDKs can be obtained from here:
+ http://www.forum.nokia.com/info/sw.nokia.com/id/ec866fab-4b76-49f6-b5a5-af0631419e9c/S60_All_in_One_SDKs.html
+
+* After installing S60 SDK you have to install OpenC++.
+ http://www.forum.nokia.com/info/sw.nokia.com/id/91d89929-fb8c-4d66-bea0-227e42df9053/Open_C_SDK_Plug-In.html
+
+* (Optional) You can use Carbide C++ as IDE which makes the life a bit easier on creating applications for Symbian.
+ An alternative approach is to compile the program in command line but i am afraid i can help you here because i
+ have no idea :P
+
+== Create project ==
+If you have Carbide C++ IDE then go "File->Import->Symbian OS->Symbian OS Bld.inf file",
+click "Browse" and find and select file "ZXingBarcodeReader\group\bld.inf".
+Next step you select the S60 SDK to be compiled to and you are ready.
+
+== Build project ==
+Since the project is created, we can proceed to build it.
+
+First in "ZXingBarcodeReader\camerawrapper" folder there is a folder named "epoc32".
+Copy this folder and paste it to the root folder of the S60 SDK that you are going to use
+(in my case: C:\S60\devices\S60_5th_Edition_SDK_v1.0). This step is important in order
+to use a Plug-In API for the easier manipulation of the camera.
+
+Now we are ready to compile. Since the camera is not supported in the Symbian emulator we
+will build the project directly to be installed on a devidce.
+Select "ZXingBarcodeReader" project in the "Project Explorer" view in Carbide, right click on it
+and select "Properties". Expand "Carbide.c++" field and select "Build Configurations".
+Being in the "SIS Builder" tab, select as Active Configuration the "Phone Degug (GCCE)".
+Then press "Add" button, and to select a PKG file click "Browse" button. Go to "ZXingBarcodeReader\sis"
+folder and select "ZXingBarcodeReader_S60.pkg" file. Make sure that "Self sign sis file" radio
+button is selected and press OK.
+
+Now go "Project->Build Project" and if everything goes right, you will have 2 installation files
+in "ZXingBarcodeReader\sis" folder. Install the .sisx file to your device and you are ready.
+
+== The same project in Qt ==
+
+In case you are interested in using this project with Qt on Symbian, take a look at QQrDecoder folder.
+
+
+
--
Multi-format 1D/2D barcode image processing library
More information about the Pkg-google-commits
mailing list