X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=shared%2Futility.h;h=f3ba3e77362efef33de2da353a9caeb2f67256b0;hb=fdd44e7412775e47763057e9c025f298826a9181;hp=283ae33d1bdcb27402dbc8aa249708c03ab786de;hpb=2174695856f00d6705e2c95c81e4d3a4b911eb91;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/shared/utility.h b/shared/utility.h index 283ae33..f3ba3e7 100644 --- a/shared/utility.h +++ b/shared/utility.h @@ -19,66 +19,31 @@ */ #include -#include #include #include +#include namespace DemoHelper { -Dali::PixelData LoadPixelData( const char* imagePath, - Dali::ImageDimensions size, - Dali::FittingMode::Type fittingMode, - Dali::SamplingMode::Type samplingMode ) -{ - Dali::BitmapLoader loader = Dali::BitmapLoader::New( imagePath, size, fittingMode, samplingMode ); - loader.Load(); - return loader.GetPixelData(); -} - -/** - * @deprecated, dont use this anymore - */ -Dali::Image LoadImage( const char* imagePath, - Dali::ImageDimensions size = Dali::ImageDimensions(), - Dali::FittingMode::Type fittingMode = Dali::FittingMode::DEFAULT, - Dali::SamplingMode::Type samplingMode = Dali::SamplingMode::DEFAULT ) -{ - return Dali::ResourceImage::New( imagePath, size, fittingMode, samplingMode ); -} - Dali::Texture LoadTexture( const char* imagePath, Dali::ImageDimensions size = Dali::ImageDimensions(), Dali::FittingMode::Type fittingMode = Dali::FittingMode::DEFAULT, - Dali::SamplingMode::Type samplingMode = Dali::SamplingMode::DEFAULT ) + Dali::SamplingMode::Type samplingMode = Dali::SamplingMode::DEFAULT, + bool orientationCorrection = true ) { - Dali::PixelData pixelData = LoadPixelData(imagePath, size, fittingMode, samplingMode); + Dali::Devel::PixelBuffer pixelBuffer = LoadImageFromFile(imagePath, size, fittingMode, samplingMode, orientationCorrection ); Dali::Texture texture = Dali::Texture::New( Dali::TextureType::TEXTURE_2D, - pixelData.GetPixelFormat(), - pixelData.GetWidth(), - pixelData.GetHeight() ); + pixelBuffer.GetPixelFormat(), + pixelBuffer.GetWidth(), + pixelBuffer.GetHeight() ); + + Dali::PixelData pixelData = Dali::Devel::PixelBuffer::Convert(pixelBuffer); texture.Upload( pixelData ); return texture; } -/** - * @brief Load an bitmap resource. - * @deprecated, dont use this anymore - * - * If it is required to scaled-down to no more than the stage dimensions, - * uses image scaling mode FittingMode::SCALE_TO_FILL to resize the image at - * load time to cover the entire stage with pixels with no borders, - * and filter mode BOX_THEN_LINEAR to sample the image with - * maximum quality. - */ - -Dali::Image LoadStageFillingImage( const char* imagePath ) -{ - Dali::Vector2 stageSize = Dali::Stage::GetCurrent().GetSize(); - return LoadImage( imagePath, Dali::ImageDimensions( stageSize.x, stageSize.y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); -} - Dali::Texture LoadStageFillingTexture( const char* imagePath ) { Dali::Vector2 stageSize = Dali::Stage::GetCurrent().GetSize();