X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=shared%2Futility.h;h=7c31dffc71813802adff9860202cfbf8d967e903;hb=708a5e016f973900a20a885914d3b70741fa80d9;hp=283ae33d1bdcb27402dbc8aa249708c03ab786de;hpb=b94540523c4e8585fa749fd8b508dccced78ea37;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/shared/utility.h b/shared/utility.h index 283ae33..7c31dff 100644 --- a/shared/utility.h +++ b/shared/utility.h @@ -2,7 +2,7 @@ #define DALI_DEMO_UTILITY_H /* - * 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. @@ -19,70 +19,35 @@ */ #include -#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::Texture LoadWindowFillingTexture( Dali::Uint16Pair size, const char* imagePath ) { - Dali::Vector2 stageSize = Dali::Stage::GetCurrent().GetSize(); - return LoadTexture( imagePath, Dali::ImageDimensions( stageSize.x, stageSize.y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); + return LoadTexture( imagePath, size, Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); } Dali::Geometry CreateTexturedQuad()