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 languae governing permissions and
15 // limitations under the License.
18 #include <FUixVisionImageFeatureInfo.h>
19 #include "FUixVision_ImageFeatureInfoImpl.h"
21 #include <FBaseSysLog.h>
23 namespace Tizen { namespace Uix { namespace Vision
26 ImageFeatureInfo::ImageFeatureInfo()
27 : __pImageFeatureInfoImpl(0)
29 std::unique_ptr<_ImageFeatureInfoImpl> pImageFeatureInfoImpl (new (std::nothrow) _ImageFeatureInfoImpl());
30 __pImageFeatureInfoImpl = pImageFeatureInfoImpl.release();
33 ImageFeatureInfo::~ImageFeatureInfo()
38 ImageFeatureInfo::GetDescription() const
43 //get true length of path to allocate memory
44 length = __pImageFeatureInfoImpl->GetDescription(&ch, 1);
47 return Tizen::Base::String("");
50 char* pName = new char[length + 1];
52 //set data to char pointer, with allocated memory
53 __pImageFeatureInfoImpl->GetDescription(pName, length + 1);
55 Tizen::Base::String description(pName);
61 ImageFeatureInfo::GetThumbnailWidth(void) const
63 return __pImageFeatureInfoImpl->GetThumbnailWidth();
67 ImageFeatureInfo::GetThumbnailHeight(void) const
69 return __pImageFeatureInfoImpl->GetThumbnailHeight();
72 Tizen::Base::ByteBuffer*
73 ImageFeatureInfo::GetThumbnailN(void) const
75 int bufWidth = __pImageFeatureInfoImpl->GetThumbnailWidth();
76 int bufHeight = __pImageFeatureInfoImpl->GetThumbnailHeight();
78 while ((bufWidth > 0) && (bufHeight > 0))
80 result res = E_FAILURE;
81 Tizen::Base::ByteBuffer* outBuffer = new Tizen::Base::ByteBuffer();
82 if (outBuffer == null)
86 res = outBuffer->Construct(bufWidth * bufHeight);
91 if (__pImageFeatureInfoImpl->GetThumbnail((char*)outBuffer->GetPointer(), bufWidth, bufHeight, false))
101 ImageFeatureInfo::Equals(const Object& obj) const
103 return (static_cast<const Object*>(this) == &obj);
107 ImageFeatureInfo::GetHashCode(void) const
109 return (int)__pImageFeatureInfoImpl;
112 } } } //Tizen::Uix::Vision