/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// CLASS HEADER
#include "sync-image-loader.h"
-#include <dali/devel-api/adaptor-framework/bitmap-loader.h>
-
+#include <dali/devel-api/adaptor-framework/image-loading.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace SyncImageLoader
{
-
-
-PixelData Load( const std::string& url )
+PixelData Load(const std::string& url)
{
- return Load( url, ImageDimensions(), FittingMode::DEFAULT, SamplingMode::BOX_THEN_LINEAR, true );
+ return Load(url, ImageDimensions(), FittingMode::DEFAULT, SamplingMode::BOX_THEN_LINEAR, true);
}
-PixelData Load( const std::string& url, ImageDimensions dimensions )
+PixelData Load(const std::string& url, ImageDimensions dimensions)
{
- return Load( url, dimensions, FittingMode::DEFAULT, SamplingMode::BOX_THEN_LINEAR, true );
+ return Load(url, dimensions, FittingMode::DEFAULT, SamplingMode::BOX_THEN_LINEAR, true);
}
-PixelData Load( const std::string& url,
- ImageDimensions dimensions,
- FittingMode::Type fittingMode,
- SamplingMode::Type samplingMode,
- bool orientationCorrection )
+PixelData Load(const std::string& url,
+ ImageDimensions dimensions,
+ FittingMode::Type fittingMode,
+ SamplingMode::Type samplingMode,
+ bool orientationCorrection)
{
- BitmapLoader loader = BitmapLoader::New( url, dimensions, fittingMode, samplingMode, orientationCorrection );
-
// Load the image synchronously (block the thread here).
- loader.Load();
-
- return loader.GetPixelData();
+ Devel::PixelBuffer pixelBuffer = Dali::LoadImageFromFile(url, dimensions, fittingMode, samplingMode, orientationCorrection);
+ if(pixelBuffer)
+ {
+ return Devel::PixelBuffer::Convert(pixelBuffer);
+ }
+ return Dali::PixelData(); // return empty handle
}
-
} // namespace SyncImageLoader
} // namespace Toolkit