2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (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://www.apache.org/licenses/LICENSE-2.0
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.
17 #include "bitmap-loader-impl.h"
18 #include <dali/integration-api/resource-types.h>
19 #include <dali/integration-api/resource-cache.h>
20 #include "image-loaders/image-loader.h"
29 IntrusivePtr<BitmapLoader> BitmapLoader::New(const std::string& filename)
31 IntrusivePtr<BitmapLoader> internal = new BitmapLoader();
32 internal->Initialize(filename);
36 BitmapLoader::BitmapLoader()
41 BitmapLoader::~BitmapLoader()
45 void BitmapLoader::Initialize(const std::string& filename)
47 ImageAttributes attributes;
48 Integration::BitmapResourceType bitmapResourceType( attributes );
49 Integration::ResourcePointer resource = SlpPlatform::ImageLoader::LoadResourceSynchronously( bitmapResourceType, filename );
51 mBitmap = static_cast<Integration::Bitmap*>(resource.Get());
54 unsigned char* BitmapLoader::GetPixelData() const
56 return mBitmap->GetBuffer();
59 unsigned int BitmapLoader::GetImageHeight() const
61 return mBitmap->GetImageHeight();
64 unsigned int BitmapLoader::GetImageWidth() const
66 return mBitmap->GetImageWidth();
69 unsigned int BitmapLoader::GetBufferStride() const
71 return mBitmap->GetPackedPixelsProfile()->GetBufferStride();
74 Pixel::Format BitmapLoader::GetPixelFormat() const
76 return mBitmap->GetPixelFormat();
79 } // namespace Internal