2 // Open Service Platform
3 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 #include "FUixVision_QrCodeObjectImpl.h"
20 namespace Tizen { namespace Uix { namespace Vision
23 _QrCodeObjectImpl::_QrCodeObjectImpl(void)
25 , __pRectangleList(null)
28 __pRectangleList = new Tizen::Base::Collection::ArrayListT<Tizen::Graphics::FloatPoint>();
29 __Matrix = new Tizen::Graphics::FloatMatrix4();
33 _QrCodeObjectImpl::~_QrCodeObjectImpl(void)
35 delete __pRectangleList;
40 _QrCodeObjectImpl::GetId(void) const
42 return __qrCodeObject.id();
46 _QrCodeObjectImpl::GetVersion(void) const
48 return __qrCodeObject.version();
51 Tizen::Uix::Vision::QrCodeErrorCorrectionLevel
52 _QrCodeObjectImpl::GetErrorCorrectionLevel(void)
54 switch(__qrCodeObject.errorCorrectionLevel())
57 __qrCodeErrorCorrectionLevel = Tizen::Uix::Vision::QR_CODE_ERROR_CORRECTION_LEVEL_L;
60 __qrCodeErrorCorrectionLevel = Tizen::Uix::Vision::QR_CODE_ERROR_CORRECTION_LEVEL_M;
63 __qrCodeErrorCorrectionLevel = Tizen::Uix::Vision::QR_CODE_ERROR_CORRECTION_LEVEL_Q;
66 __qrCodeErrorCorrectionLevel = Tizen::Uix::Vision::QR_CODE_ERROR_CORRECTION_LEVEL_H;
70 return __qrCodeErrorCorrectionLevel;
74 _QrCodeObjectImpl::GetText(void) const
76 return Tizen::Base::String(__qrCodeObject.text());
79 const Tizen::Graphics::FloatMatrix4*
80 _QrCodeObjectImpl::GetTransformMatrix(void) const
82 float* dst = (float*)__Matrix->matrix;
83 const float* src = __qrCodeObject.transform();
84 memcpy(dst, src, 16*sizeof(float));
88 const Tizen::Base::Collection::ArrayListT<Tizen::Graphics::FloatPoint>*
89 _QrCodeObjectImpl::GetRectangle(void) const
91 __pRectangleList->RemoveAll();
92 static float coordinates[8] = {0.f};
93 __qrCodeObject.rectangle(coordinates);
95 for (int i = 0; i < 4; ++i)
97 __pRectangleList->Add(Tizen::Graphics::FloatPoint(coordinates[2 * i], coordinates[(2 * i) + 1]));
100 return __pRectangleList;
105 _QrCodeObjectImpl::SetSariPointer(const sari2::QRCodeRecognitionInfo& sari)
107 __qrCodeObject = sari;
111 _QrCodeObjectImpl::GetInstance(QrCodeObject* pQrObject)
113 return pQrObject->__pQrCodeObjectImpl;
116 const _QrCodeObjectImpl*
117 _QrCodeObjectImpl::GetInstance(const QrCodeObject* pQrObject)
119 return pQrObject->__pQrCodeObjectImpl;
123 _QrCodeObjectImpl::ReleaseQrCodeObject(QrCodeObject* pQrCodeObject)
125 delete pQrCodeObject;
129 _QrCodeObjectImpl::ReleaseQrCodeObjectArray(QrCodeObject* pQrCodeObject)
131 delete[] pQrCodeObject;
134 Tizen::Uix::Vision::QrCodeObject*
135 _QrCodeObjectImpl::CreateQRCodeObjectStorageN(const unsigned int size)
137 Tizen::Uix::Vision::QrCodeObject* objectStorage = new Tizen::Uix::Vision::QrCodeObject[size];
138 return objectStorage;
141 Tizen::Uix::Vision::QrCodeObject*
142 _QrCodeObjectImpl::CreateQRCodeObjectN()
144 Tizen::Uix::Vision::QrCodeObject* object = new Tizen::Uix::Vision::QrCodeObject;
148 } } } //Tizen::Uix::Vision