2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file GlThumbnailInfo.cpp
19 * @brief This is the implementation file for ThumbnailInfo class.
22 #include <FGraphics.h>
23 #include "GlThumbnailInfo.h"
26 using namespace Tizen::Base;
27 using namespace Tizen::Content;
28 using namespace Tizen::Graphics;
30 ThumbnailInfo::ThumbnailInfo(void)
32 , __contentType(CONTENT_TYPE_IMAGE)
37 ThumbnailInfo::~ThumbnailInfo(void)
42 ThumbnailInfo::Construct(const ContentId& contentId, const String& filePath,
43 const Bitmap& bitmap, const ContentType contentType, const long duration)
45 __contentId = contentId;
46 __filePath = filePath;
47 __pBitmap = CloneBitmapN(bitmap);
48 __contentType = contentType;
49 __duration = duration;
53 ThumbnailInfo::GetContentId(void) const
59 ThumbnailInfo::GetFilePath(void) const
65 ThumbnailInfo::SetFilePath(const String& filePath)
67 if (&filePath == null)
69 __filePath = EMPTY_SPACE;
73 __filePath = filePath;
78 ThumbnailInfo::GetBitmapN(void) const
80 return CloneBitmapN(*__pBitmap);
84 ThumbnailInfo::SetBitmap(const Bitmap& bitmap)
86 __pBitmap = CloneBitmapN(bitmap);
90 ThumbnailInfo::GetContentType(void) const
96 ThumbnailInfo::SetContentType(ContentType contentType)
98 __contentType = contentType;
102 ThumbnailInfo::GetDuration(void) const
108 ThumbnailInfo::SetDuration(long duration)
110 __duration = duration;
114 ThumbnailInfo::CloneBitmapN(const Bitmap& bitmap) const
116 Bitmap* pResultBitmap = null;
119 Rectangle mainRect(0, 0, bitmap.GetWidth(), bitmap.GetHeight());
121 mainCanvas.Construct(mainRect);
122 mainCanvas.DrawBitmap(mainRect, bitmap);
123 pResultBitmap = new (std::nothrow) Bitmap();
124 result r = pResultBitmap->Construct(mainCanvas, mainRect);
125 TryCatch(r == E_SUCCESS, , "pResultBitmap->Construct Failed:%s", GetErrorMessage(r));
127 return pResultBitmap;
130 delete pResultBitmap;
131 pResultBitmap = null;