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.
20 #include <dali/integration-api/resource-types.h>
21 #include <dali/integration-api/resource-cache.h>
24 #include "bitmap-loader-impl.h"
25 #include "image-loaders/image-loader.h"
32 IntrusivePtr<BitmapLoader> BitmapLoader::New(const std::string& filename)
34 IntrusivePtr<BitmapLoader> internal = new BitmapLoader();
35 internal->Initialize(filename);
39 BitmapLoader::BitmapLoader()
44 BitmapLoader::~BitmapLoader()
48 void BitmapLoader::Initialize(const std::string& filename)
50 ImageAttributes attributes;
51 Integration::BitmapResourceType bitmapResourceType( attributes );
52 Integration::ResourcePointer resource = TizenPlatform::ImageLoader::LoadResourceSynchronously( bitmapResourceType, filename );
54 mBitmap = static_cast<Integration::Bitmap*>(resource.Get());
57 unsigned char* BitmapLoader::GetPixelData() const
59 return mBitmap->GetBuffer();
62 unsigned int BitmapLoader::GetImageHeight() const
64 return mBitmap->GetImageHeight();
67 unsigned int BitmapLoader::GetImageWidth() const
69 return mBitmap->GetImageWidth();
72 unsigned int BitmapLoader::GetBufferStride() const
74 return mBitmap->GetPackedPixelsProfile()->GetBufferStride();
77 Pixel::Format BitmapLoader::GetPixelFormat() const
79 return mBitmap->GetPixelFormat();
82 } // namespace Internal