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)
43 ThumbnailInfo::Construct(const ContentId& contentId, const String& filePath,
44 const Bitmap& bitmap, const ContentType contentType, const long duration)
46 __contentId = contentId;
47 __filePath = filePath;
48 __pBitmap = CloneBitmapN(bitmap);
49 __contentType = contentType;
50 __duration = duration;
54 ThumbnailInfo::GetContentId(void) const
60 ThumbnailInfo::GetFilePath(void) const
66 ThumbnailInfo::SetFilePath(const String& filePath)
68 if (&filePath == null)
70 __filePath = EMPTY_SPACE;
74 __filePath = filePath;
79 ThumbnailInfo::GetBitmapN(void) const
81 return CloneBitmapN(*__pBitmap);
85 ThumbnailInfo::SetBitmap(const Bitmap& bitmap)
91 __pBitmap = CloneBitmapN(bitmap);
95 ThumbnailInfo::GetContentType(void) const
101 ThumbnailInfo::SetContentType(ContentType contentType)
103 __contentType = contentType;
107 ThumbnailInfo::GetDuration(void) const
113 ThumbnailInfo::SetDuration(long duration)
115 __duration = duration;
119 ThumbnailInfo::CloneBitmapN(const Bitmap& bitmap) const
121 Bitmap* pResultBitmap = null;
124 Rectangle mainRect(0, 0, bitmap.GetWidth(), bitmap.GetHeight());
126 mainCanvas.Construct(mainRect);
127 mainCanvas.DrawBitmap(mainRect, bitmap);
128 pResultBitmap = new (std::nothrow) Bitmap();
129 result r = pResultBitmap->Construct(mainCanvas, mainRect);
130 TryCatch(r == E_SUCCESS,, "pResultBitmap->Construct Failed:%s", GetErrorMessage(r));
132 return pResultBitmap;
135 delete pResultBitmap;
136 pResultBitmap = null;