X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=shared%2Futility.h;h=f3ba3e77362efef33de2da353a9caeb2f67256b0;hb=37259c312ac648e3835a9e1acf60b4518cab38a8;hp=71a2150fd3fcde4ba192833682caa3a51bf900e3;hpb=de02cf1d81d8a6fc40b2d7b55174a1651c658759;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/shared/utility.h b/shared/utility.h index 71a2150..f3ba3e7 100644 --- a/shared/utility.h +++ b/shared/utility.h @@ -19,68 +19,31 @@ */ #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(); -} - - -Dali::Atlas LoadImage( const char* imagePath, - Dali::ImageDimensions size = Dali::ImageDimensions(), - Dali::FittingMode::Type fittingMode = Dali::FittingMode::DEFAULT, - Dali::SamplingMode::Type samplingMode = Dali::SamplingMode::DEFAULT ) -{ - Dali::PixelData pixelData = LoadPixelData(imagePath, size, fittingMode, samplingMode); - Dali::Atlas image =Dali:: Atlas::New( pixelData.GetWidth(), pixelData.GetHeight(), pixelData.GetPixelFormat() ); - image.Upload( pixelData, 0u, 0u ); - - return image; -} - 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. - * - * 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::Atlas 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(); @@ -112,7 +75,7 @@ Dali::Geometry CreateTexturedQuad() //Create the geometry Dali::Geometry geometry = Dali::Geometry::New(); geometry.AddVertexBuffer( vertexBuffer ); - geometry.SetGeometryType(Dali::Geometry::TRIANGLE_STRIP ); + geometry.SetType(Dali::Geometry::TRIANGLE_STRIP ); return geometry; }