diff --git a/com.samsung.dali-demo.xml b/com.samsung.dali-demo.xml index 203ecce..238b338 100644 --- a/com.samsung.dali-demo.xml +++ b/com.samsung.dali-demo.xml @@ -109,4 +109,10 @@ + + + + + + diff --git a/demo/dali-demo.cpp b/demo/dali-demo.cpp index 91ea1b2..35eb917 100644 --- a/demo/dali-demo.cpp +++ b/demo/dali-demo.cpp @@ -65,6 +65,7 @@ int main(int argc, char **argv) demo.AddExample(Example("mesh-sorting.example", DALI_DEMO_STR_TITLE_MESH_SORTING)); demo.AddExample(Example("textured-mesh.example", DALI_DEMO_STR_TITLE_TEXTURED_MESH)); demo.AddExample(Example("line-mesh.example", DALI_DEMO_STR_TITLE_LINE_MESH)); + demo.AddExample(Example("gradients.example", DALI_DEMO_STR_TITLE_COLOR_GRADIENT)); demo.SortAlphabetically( true ); diff --git a/demo/dali-table-view.cpp b/demo/dali-table-view.cpp index 50b52a8..13c895e 100644 --- a/demo/dali-table-view.cpp +++ b/demo/dali-table-view.cpp @@ -67,7 +67,14 @@ const float EFFECT_SNAP_DURATION = 0.66f; ///< Scroll Snap const float EFFECT_FLICK_DURATION = 0.5f; ///< Scroll Flick Duration for Effects const Vector3 ANGLE_CUBE_PAGE_ROTATE(Math::PI * 0.5f, Math::PI * 0.5f, 0.0f); - +const Vector4 BUBBLE_COLOR[] = +{ + Vector4( 0.3255f, 0.3412f, 0.6353f, 0.38f ), + Vector4( 0.3647f, 0.7569f, 0.8157f, 0.38f ), + Vector4( 0.3804f, 0.7412f, 0.6510f, 0.38f ), + Vector4( 1.f, 1.f, 1.f, 0.2f ) +}; +const int NUMBER_OF_BUBBLE_COLOR( sizeof(BUBBLE_COLOR) / sizeof(BUBBLE_COLOR[0]) ); const int NUM_BACKGROUND_IMAGES = 18; const float BACKGROUND_SWIPE_SCALE = 0.025f; @@ -79,7 +86,7 @@ const float SCALE_SPEED_SIN = 0.1f; const unsigned int BACKGROUND_ANIMATION_DURATION = 15000; // 15 secs const float BACKGROUND_Z = -1.0f; -const Vector4 BACKGROUND_COLOR( 1.0f, 1.0f, 1.0f, 1.0f ); +const Vector4 BACKGROUND_COLOR( 0.3569f, 0.5451f, 0.7294f, 1.0f ); const float BUBBLE_MIN_Z = -1.0; const float BUBBLE_MAX_Z = 0.0f; @@ -755,9 +762,6 @@ void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage dis for( int i = 0; i < count; ++i ) { float randSize = Random::Range( 10.0f, 400.0f ); - float hue = Random::Range( 0.3f, 1.0f ); - Vector4 randColour( hue, hue * 0.5, 0.0f, Random::Range( 0.3f, 0.6f )); - ImageActor dfActor = ImageActor::New( distanceField ); dfActor.SetSize( Vector2( randSize, randSize ) ); dfActor.SetParentOrigin( ParentOrigin::CENTER ); @@ -767,7 +771,7 @@ void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage dis ShaderEffect effect = Toolkit::CreateDistanceFieldEffect(); dfActor.SetShaderEffect( effect ); - dfActor.SetColor( randColour ); + dfActor.SetColor( BUBBLE_COLOR[ i%NUMBER_OF_BUBBLE_COLOR ] ); effect.SetUniform("uOutlineParams", Vector2( 0.55f, 0.00f ) ); effect.SetUniform("uSmoothing", 0.5f ); layer.Add( dfActor ); diff --git a/examples/benchmark/benchmark.cpp b/examples/benchmark/benchmark.cpp new file mode 100644 index 0000000..f673c49 --- /dev/null +++ b/examples/benchmark/benchmark.cpp @@ -0,0 +1,564 @@ +/* + * Copyright (c) 2015 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; + + +namespace +{ +const char* IMAGE_PATH[] = { + DALI_IMAGE_DIR "gallery-medium-1.jpg", + DALI_IMAGE_DIR "gallery-medium-2.jpg", + DALI_IMAGE_DIR "gallery-medium-3.jpg", + DALI_IMAGE_DIR "gallery-medium-4.jpg", + DALI_IMAGE_DIR "gallery-medium-5.jpg", + DALI_IMAGE_DIR "gallery-medium-6.jpg", + DALI_IMAGE_DIR "gallery-medium-7.jpg", + DALI_IMAGE_DIR "gallery-medium-8.jpg", + DALI_IMAGE_DIR "gallery-medium-9.jpg", + DALI_IMAGE_DIR "gallery-medium-10.jpg", + DALI_IMAGE_DIR "gallery-medium-11.jpg", + DALI_IMAGE_DIR "gallery-medium-12.jpg", + DALI_IMAGE_DIR "gallery-medium-13.jpg", + DALI_IMAGE_DIR "gallery-medium-14.jpg", + DALI_IMAGE_DIR "gallery-medium-15.jpg", + DALI_IMAGE_DIR "gallery-medium-16.jpg", + DALI_IMAGE_DIR "gallery-medium-17.jpg", + DALI_IMAGE_DIR "gallery-medium-18.jpg", + DALI_IMAGE_DIR "gallery-medium-19.jpg", + DALI_IMAGE_DIR "gallery-medium-20.jpg", + DALI_IMAGE_DIR "gallery-medium-21.jpg", + DALI_IMAGE_DIR "gallery-medium-22.jpg", + DALI_IMAGE_DIR "gallery-medium-23.jpg", + DALI_IMAGE_DIR "gallery-medium-24.jpg", + DALI_IMAGE_DIR "gallery-medium-25.jpg", + DALI_IMAGE_DIR "gallery-medium-26.jpg", + DALI_IMAGE_DIR "gallery-medium-27.jpg", + DALI_IMAGE_DIR "gallery-medium-28.jpg", + DALI_IMAGE_DIR "gallery-medium-29.jpg", + DALI_IMAGE_DIR "gallery-medium-30.jpg", + DALI_IMAGE_DIR "gallery-medium-31.jpg", + DALI_IMAGE_DIR "gallery-medium-32.jpg", + DALI_IMAGE_DIR "gallery-medium-33.jpg", + DALI_IMAGE_DIR "gallery-medium-34.jpg", + DALI_IMAGE_DIR "gallery-medium-35.jpg", + DALI_IMAGE_DIR "gallery-medium-36.jpg", + DALI_IMAGE_DIR "gallery-medium-37.jpg", + DALI_IMAGE_DIR "gallery-medium-38.jpg", + DALI_IMAGE_DIR "gallery-medium-39.jpg", + DALI_IMAGE_DIR "gallery-medium-40.jpg", + DALI_IMAGE_DIR "gallery-medium-41.jpg", + DALI_IMAGE_DIR "gallery-medium-42.jpg", + DALI_IMAGE_DIR "gallery-medium-43.jpg", + DALI_IMAGE_DIR "gallery-medium-44.jpg", + DALI_IMAGE_DIR "gallery-medium-45.jpg", + DALI_IMAGE_DIR "gallery-medium-46.jpg", + DALI_IMAGE_DIR "gallery-medium-47.jpg", + DALI_IMAGE_DIR "gallery-medium-48.jpg", + DALI_IMAGE_DIR "gallery-medium-49.jpg", + DALI_IMAGE_DIR "gallery-medium-50.jpg", + DALI_IMAGE_DIR "gallery-medium-51.jpg", + DALI_IMAGE_DIR "gallery-medium-52.jpg", + DALI_IMAGE_DIR "gallery-medium-53.jpg", +}; + +const char* NINEPATCH_IMAGE_PATH[] = { + DALI_IMAGE_DIR "selection-popup-bg.1.9.png", + DALI_IMAGE_DIR "selection-popup-bg.2.9.png", + DALI_IMAGE_DIR "selection-popup-bg.3.9.png", + DALI_IMAGE_DIR "selection-popup-bg.4.9.png", + DALI_IMAGE_DIR "selection-popup-bg.5.9.png", + DALI_IMAGE_DIR "selection-popup-bg.6.9.png", + DALI_IMAGE_DIR "selection-popup-bg.7.9.png", + DALI_IMAGE_DIR "selection-popup-bg.8.9.png", + DALI_IMAGE_DIR "selection-popup-bg.9.9.png", + DALI_IMAGE_DIR "selection-popup-bg.10.9.png", + DALI_IMAGE_DIR "selection-popup-bg.11.9.png", + DALI_IMAGE_DIR "selection-popup-bg.12.9.png", + DALI_IMAGE_DIR "selection-popup-bg.13.9.png", + DALI_IMAGE_DIR "selection-popup-bg.14.9.png", + DALI_IMAGE_DIR "selection-popup-bg.15.9.png", + DALI_IMAGE_DIR "selection-popup-bg.16.9.png", + DALI_IMAGE_DIR "selection-popup-bg.17.9.png", + DALI_IMAGE_DIR "selection-popup-bg.18.9.png", + DALI_IMAGE_DIR "selection-popup-bg.19.9.png", + DALI_IMAGE_DIR "selection-popup-bg.20.9.png", + DALI_IMAGE_DIR "selection-popup-bg.21.9.png", + DALI_IMAGE_DIR "selection-popup-bg.22.9.png", + DALI_IMAGE_DIR "selection-popup-bg.23.9.png", + DALI_IMAGE_DIR "selection-popup-bg.24.9.png", + DALI_IMAGE_DIR "selection-popup-bg.25.9.png", + DALI_IMAGE_DIR "selection-popup-bg.26.9.png", + DALI_IMAGE_DIR "selection-popup-bg.27.9.png", + DALI_IMAGE_DIR "selection-popup-bg.28.9.png", + DALI_IMAGE_DIR "selection-popup-bg.29.9.png", + DALI_IMAGE_DIR "selection-popup-bg.30.9.png", + DALI_IMAGE_DIR "selection-popup-bg.31.9.png", + DALI_IMAGE_DIR "selection-popup-bg.32.9.png", + DALI_IMAGE_DIR "selection-popup-bg.33.9.png", + DALI_IMAGE_DIR "button-disabled.9.png", + DALI_IMAGE_DIR "button-down.9.png", + DALI_IMAGE_DIR "button-down-disabled.9.png", + DALI_IMAGE_DIR "button-up-1.9.png", + DALI_IMAGE_DIR "button-up-2.9.png", + DALI_IMAGE_DIR "button-up-3.9.png", + DALI_IMAGE_DIR "button-up-4.9.png", + DALI_IMAGE_DIR "button-up-5.9.png", + DALI_IMAGE_DIR "button-up-6.9.png", + DALI_IMAGE_DIR "button-up-7.9.png", + DALI_IMAGE_DIR "button-up-8.9.png", + DALI_IMAGE_DIR "button-up-9.9.png", + DALI_IMAGE_DIR "button-up-10.9.png", + DALI_IMAGE_DIR "button-up-11.9.png", + DALI_IMAGE_DIR "button-up-12.9.png", + DALI_IMAGE_DIR "button-up-13.9.png", + DALI_IMAGE_DIR "button-up-14.9.png", + DALI_IMAGE_DIR "button-up-15.9.png", + DALI_IMAGE_DIR "button-up-16.9.png", + DALI_IMAGE_DIR "button-up-17.9.png", +}; + +const unsigned int NUM_IMAGES = sizeof(IMAGE_PATH) / sizeof(char*); +const unsigned int NUM_NINEPATCH_IMAGES = sizeof(NINEPATCH_IMAGE_PATH) / sizeof(char*); + +const float ANIMATION_TIME ( 5.0f ); // animation length in seconds + +struct VertexWithTexture +{ + Vector2 position; + Vector2 texCoord; +}; + +VertexWithTexture gQuadWithTexture[] = { + { Vector2( -0.5f, -0.5f ), Vector2( 0.0f, 0.0f ) }, + { Vector2( 0.5f, -0.5f ), Vector2( 1.0f, 0.0f ) }, + { Vector2( -0.5f, 0.5f ), Vector2( 0.0f, 1.0f ) }, + { Vector2( 0.5f, 0.5f ), Vector2( 1.0f, 1.0f ) } +}; + +const char* VERTEX_SHADER_TEXTURE = DALI_COMPOSE_SHADER( + attribute mediump vec2 aPosition;\n + attribute mediump vec2 aTexCoord;\n + uniform mediump mat4 uMvpMatrix;\n + uniform mediump vec3 uSize;\n + varying mediump vec2 vTexCoord;\n + void main()\n + {\n + vec4 position = vec4(aPosition,0.0,1.0)*vec4(uSize,1.0);\n + gl_Position = uMvpMatrix * position;\n + vTexCoord = aTexCoord;\n + }\n +); + +const char* FRAGMENT_SHADER_TEXTURE = DALI_COMPOSE_SHADER( + uniform lowp vec4 uColor;\n + uniform sampler2D sTexture;\n + varying mediump vec2 vTexCoord;\n + + void main()\n + {\n + gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n + }\n +); + + +Geometry& QuadMesh() +{ + static Geometry mesh; + if( !mesh ) + { + PropertyBuffer vertexBuffer; + Property::Map vertexFormat; + vertexFormat["aPosition"] = Property::VECTOR2; + vertexFormat["aTexCoord"] = Property::VECTOR2; + + //Create a vertex buffer for vertex positions and texture coordinates + vertexBuffer = PropertyBuffer::New( vertexFormat, 4u ); + vertexBuffer.SetData( gQuadWithTexture ); + + //Create the geometry + mesh = Geometry::New(); + mesh.AddVertexBuffer( vertexBuffer ); + mesh.SetGeometryType(Geometry::TRIANGLE_STRIP ); + } + return mesh; +} + +bool gUseMesh(false); +bool gUseImageView(false); +bool gNinePatch(false); +unsigned int gRowsPerPage(25); +unsigned int gColumnsPerPage( 25 ); +unsigned int gPageCount(13); + +Renderer CreateRenderer( unsigned int index ) +{ + + int numImages = !gNinePatch ? NUM_IMAGES : NUM_NINEPATCH_IMAGES; + static Renderer* renderers = new Renderer[numImages]; + if( !renderers[index] ) + { + //Create the renderer + Shader shader = Shader::New( VERTEX_SHADER_TEXTURE, FRAGMENT_SHADER_TEXTURE ); + + const char* imagePath = !gNinePatch ? IMAGE_PATH[index] : NINEPATCH_IMAGE_PATH[index]; + Image image = ResourceImage::New(imagePath); + Sampler textureSampler = Sampler::New( image, "sTexture" ); + Material material = Material::New( shader ); + material.AddSampler(textureSampler); + material.SetBlendMode( BlendingMode::OFF ); + renderers[index] = Renderer::New( QuadMesh(), material ); + } + return renderers[index]; +} + +Actor CreateMeshActor( unsigned int index) +{ + Renderer renderer = CreateRenderer(index); + Actor meshActor = Actor::New(); + meshActor.AddRenderer( renderer ); + return meshActor; +} + +} +// Test application to compare performance between ImageActor and ImageView +// By default, the application consist of 10 pages of 25x25 ImageActors, this can be modified using the following command line arguments: +// -r NumberOfRows (Modifies the number of rows per page) +// -c NumberOfColumns (Modifies the number of columns per page) +// -p NumberOfPages (Modifies the nimber of pages ) +// --use-imageview ( Use ImageView instead of ImageActor ) +// --use-mesh ( Use new renderer API (as ImageView) but shares renderers between actors when possible ) +// --use-nine-patch ( Use nine patch images ) + +// +class Benchmark : public ConnectionTracker +{ +public: + + Benchmark( Application& application ) +: mApplication( application ), + mRowsPerPage( gRowsPerPage ), + mColumnsPerPage( gColumnsPerPage ), + mPageCount( gPageCount ) +{ + // Connect to the Application's Init signal + mApplication.InitSignal().Connect( this, &Benchmark::Create ); +} + + ~Benchmark() + { + // Nothing to do here; + } + + // The Init signal is received once (only) during the Application lifetime + void Create( Application& application ) + { + // Get a handle to the stage + Stage stage = Stage::GetCurrent(); + stage.SetBackgroundColor( Color::WHITE ); + Vector2 stageSize = stage.GetSize(); + + stage.GetRootLayer().SetDepthTestDisabled(true); + + mSize = Vector3( stageSize.x / mColumnsPerPage, stageSize.y / mRowsPerPage, 0.0f ); + + // Respond to a click anywhere on the stage + stage.GetRootLayer().TouchedSignal().Connect( this, &Benchmark::OnTouch ); + + if( gUseMesh ) + { + CreateMeshActors(); + } + else if( gUseImageView ) + { + CreateImageViews(); + } + else + { + CreateImageActors(); + } + + ShowAnimation(); + } + + bool OnTouch( Actor actor, const TouchEvent& touch ) + { + // quit the application + mApplication.Quit(); + return true; + } + + const char* ImagePath( int i ) + { + return !gNinePatch ? IMAGE_PATH[i % NUM_IMAGES] : NINEPATCH_IMAGE_PATH[i % NUM_NINEPATCH_IMAGES]; + } + + void CreateImageActors() + { + Stage stage = Stage::GetCurrent(); + unsigned int actorCount(mRowsPerPage*mColumnsPerPage * mPageCount); + mActor.resize(actorCount); + + for( size_t i(0); i mActor; + std::vector mImageView; + + Vector3 mSize; + unsigned int mRowsPerPage; + unsigned int mColumnsPerPage; + unsigned int mPageCount; + + Animation mShow; + Animation mScroll; + Animation mHide; +}; + +void RunTest( Application& application ) +{ + Benchmark test( application ); + + application.MainLoop(); +} + +// Entry point for Linux & Tizen applications +// +int main( int argc, char **argv ) +{ + Application application = Application::New( &argc, &argv ); + + for( int i(1) ; i < argc; ++i ) + { + std::string arg( argv[i] ); + if( arg.compare("--use-mesh") == 0) + { + gUseMesh = true; + } + else if( arg.compare("--use-imageview") == 0) + { + gUseImageView = true; + } + else if( arg.compare("--nine-patch" ) == 0) + { + gNinePatch = true; + } + else if( arg.compare(0, 2, "-r" ) == 0) + { + gRowsPerPage = atoi( arg.substr( 2, arg.size()).c_str()); + } + else if( arg.compare(0, 2, "-c" ) == 0) + { + gColumnsPerPage = atoi( arg.substr( 2, arg.size()).c_str()); + } + else if( arg.compare(0, 2, "-p" ) == 0) + { + gPageCount = atoi( arg.substr( 2, arg.size()).c_str()); + } + } + + RunTest( application ); + + return 0; +} diff --git a/examples/gradients/gradients-example.cpp b/examples/gradients/gradients-example.cpp new file mode 100644 index 0000000..6ea9b15 --- /dev/null +++ b/examples/gradients/gradients-example.cpp @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2015 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include "shared/view.h" + +using namespace Dali; +using namespace Dali::Toolkit; + +namespace +{ +const char * const APPLICATION_TITLE( "Color Gradients" ); + +const char * const TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" ); +const char * const CHANGE_ICON( DALI_IMAGE_DIR "icon-change.png" ); +const char * const CHANGE_ICON_SELECTED( DALI_IMAGE_DIR "icon-change-selected.png" ); +} + +// This example shows how to render color gradients +// +class GradientController : public ConnectionTracker +{ +public: + + GradientController( Application& application ) + : mApplication( application ), + mIndex( 0 ) + { + // Connect to the Application's Init signal + mApplication.InitSignal().Connect( this, &GradientController::Create ); + } + + ~GradientController() + { + // Nothing to do here; + } + + // The Init signal is received once (only) during the Application lifetime + void Create( Application& application ) + { + // Get a handle to the stage + Stage stage = Stage::GetCurrent(); + stage.KeyEventSignal().Connect(this, &GradientController::OnKeyEvent); + + // Creates a default view with a default tool bar. + // The view is added to the stage. + Toolkit::ToolBar toolBar; + Layer content = DemoHelper::CreateView( application, + mView, + toolBar, + "", + TOOLBAR_IMAGE, + APPLICATION_TITLE ); + + PushButton changeButton = Toolkit::PushButton::New(); + changeButton.SetUnselectedImage( CHANGE_ICON ); + changeButton.SetSelectedImage( CHANGE_ICON_SELECTED ); + changeButton.ClickedSignal().Connect( this, &GradientController::OnChangeIconClicked ); + toolBar.AddControl( changeButton, + DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, + Toolkit::Alignment::HorizontalRight, + DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); + +// ---- Gradient for background + + mGradientMap.Insert("renderer-type", "gradient-renderer"); + Property::Array stopOffsets; + stopOffsets.PushBack( 0.0f ); + stopOffsets.PushBack( 0.3f ); + stopOffsets.PushBack( 0.6f ); + stopOffsets.PushBack( 0.8f ); + stopOffsets.PushBack( 1.f ); + mGradientMap.Insert("gradient-stop-offset", stopOffsets); + Property::Array stopColors; + stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 255.f )/255.f ); + stopColors.PushBack( Vector4( 196.f, 198.f, 71.f, 122.f )/255.f ); + stopColors.PushBack( Vector4( 214.f, 37.f, 139.f, 191.f )/255.f ); + stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 150.f )/255.f ); + stopColors.PushBack( Color::YELLOW ); + mGradientMap.Insert("gradient-stop-color", stopColors); + + OnChangeIconClicked( changeButton ); + } + + bool OnChangeIconClicked( Toolkit::Button button ) + { + Property::Map gradientMap; + + switch( mIndex%4 ) + { + case 0: // linear gradient with units as objectBoundingBox + { + gradientMap.Insert("gradient-start-position", Vector2( 0.5f, 0.5f )); + gradientMap.Insert("gradient-end-position", Vector2( -0.5f, -0.5f )); + break; + } + case 1: // linear gradient with units as userSpaceOnUse + { + Vector2 halfStageSize = Stage::GetCurrent().GetSize()*0.5f; + gradientMap.Insert("gradient-start-position", halfStageSize); + gradientMap.Insert("gradient-end-position", -halfStageSize ); + gradientMap.Insert("gradient-units", "user-space"); + break; + } + case 2: // radial gradient with units as objectBoundingBox + { + gradientMap.Insert("gradient-center", Vector2(0.5f, 0.5f)); + gradientMap.Insert("gradient-radius", 1.414f); + break; + } + default: // radial gradient with units as userSpaceOnUse + { + Vector2 stageSize = Stage::GetCurrent().GetSize(); + gradientMap.Insert("gradient-center", stageSize*0.5f); + gradientMap.Insert("gradient-radius", stageSize.Length()); + gradientMap.Insert("gradient-units", "user-space"); + break; + } + } + + gradientMap.Merge( mGradientMap ); + mView.SetProperty( Control::Property::BACKGROUND, gradientMap ); + + mIndex++; + return true; + } + + bool OnTouch( Actor actor, const TouchEvent& touch ) + { + // quit the application + mApplication.Quit(); + return true; + } + + void OnKeyEvent(const KeyEvent& event) + { + if(event.state == KeyEvent::Down) + { + if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) ) + { + mApplication.Quit(); + } + } + } + +private: + Application& mApplication; + + Property::Map mGradientMap; + Control mView; + unsigned mIndex; +}; + +void RunTest( Application& application ) +{ + GradientController test( application ); + + application.MainLoop(); +} + +// Entry point for Linux & Tizen applications +// +int main( int argc, char **argv ) +{ + Application application = Application::New( &argc, &argv ); + + RunTest( application ); + + return 0; +} diff --git a/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp b/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp index efac586..e8642d0 100644 --- a/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp +++ b/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp @@ -538,13 +538,14 @@ public: if( gridImageView ) { // Cycle the scaling mode options: - const Vector2 imageSize = mSizes[gridImageView.GetId()]; - Dali::FittingMode::Type newMode = NextMode( mFittingModes[gridImageView.GetId()] ); - Image oldImage = gridImageView.GetImage(); - Image newImage = CreateImage(ResourceImage::DownCast(oldImage).GetUrl(), imageSize.width, imageSize.height, newMode ); + unsigned int id = gridImageView.GetId(); + + const Vector2 imageSize = mSizes[ id ]; + Dali::FittingMode::Type newMode = NextMode( mFittingModes[ id ] ); + Image newImage = CreateImage( mResourceUrls[ id ], imageSize.width, imageSize.height, newMode ); gridImageView.SetImage( newImage ); - mFittingModes[gridImageView.GetId()] = newMode; + mFittingModes[ id ] = newMode; SetTitle( std::string( newMode == FittingMode::SHRINK_TO_FIT ? "SHRINK_TO_FIT" : newMode == FittingMode::SCALE_TO_FILL ? "SCALE_TO_FILL" : newMode == FittingMode::FIT_WIDTH ? "FIT_WIDTH" : "FIT_HEIGHT" ) ); } diff --git a/packaging/com.samsung.dali-demo.spec b/packaging/com.samsung.dali-demo.spec index 870674b..d1473f6 100755 --- a/packaging/com.samsung.dali-demo.spec +++ b/packaging/com.samsung.dali-demo.spec @@ -2,7 +2,7 @@ Name: com.samsung.dali-demo Summary: The OpenGLES Canvas Core Demo -Version: 1.1.5 +Version: 1.1.6 Release: 1 Group: System/Libraries License: Apache-2.0 diff --git a/resources/images/button-disabled.9.png b/resources/images/button-disabled.9.png new file mode 100644 index 0000000..36b3908 --- /dev/null +++ b/resources/images/button-disabled.9.png diff --git a/resources/images/button-down-disabled.9.png b/resources/images/button-down-disabled.9.png new file mode 100644 index 0000000..21084b2 --- /dev/null +++ b/resources/images/button-down-disabled.9.png diff --git a/resources/images/button-down.9.png b/resources/images/button-down.9.png new file mode 100644 index 0000000..f6e25ab --- /dev/null +++ b/resources/images/button-down.9.png diff --git a/resources/images/button-up-1.9.png b/resources/images/button-up-1.9.png new file mode 100644 index 0000000..a2e2e01 --- /dev/null +++ b/resources/images/button-up-1.9.png diff --git a/resources/images/button-up-10.9.png b/resources/images/button-up-10.9.png new file mode 100644 index 0000000..3045787 --- /dev/null +++ b/resources/images/button-up-10.9.png diff --git a/resources/images/button-up-11.9.png b/resources/images/button-up-11.9.png new file mode 100644 index 0000000..0f0fd97 --- /dev/null +++ b/resources/images/button-up-11.9.png diff --git a/resources/images/button-up-12.9.png b/resources/images/button-up-12.9.png new file mode 100644 index 0000000..114673d --- /dev/null +++ b/resources/images/button-up-12.9.png diff --git a/resources/images/button-up-13.9.png b/resources/images/button-up-13.9.png new file mode 100644 index 0000000..30d9f32 --- /dev/null +++ b/resources/images/button-up-13.9.png diff --git a/resources/images/button-up-14.9.png b/resources/images/button-up-14.9.png new file mode 100644 index 0000000..18d42c4 --- /dev/null +++ b/resources/images/button-up-14.9.png diff --git a/resources/images/button-up-15.9.png b/resources/images/button-up-15.9.png new file mode 100644 index 0000000..0a99c95 --- /dev/null +++ b/resources/images/button-up-15.9.png diff --git a/resources/images/button-up-16.9.png b/resources/images/button-up-16.9.png new file mode 100644 index 0000000..4c6f60e --- /dev/null +++ b/resources/images/button-up-16.9.png diff --git a/resources/images/button-up-17.9.png b/resources/images/button-up-17.9.png new file mode 100644 index 0000000..5f3b4e6 --- /dev/null +++ b/resources/images/button-up-17.9.png diff --git a/resources/images/button-up-2.9.png b/resources/images/button-up-2.9.png new file mode 100644 index 0000000..fe5dcac --- /dev/null +++ b/resources/images/button-up-2.9.png diff --git a/resources/images/button-up-3.9.png b/resources/images/button-up-3.9.png new file mode 100644 index 0000000..ba27124 --- /dev/null +++ b/resources/images/button-up-3.9.png diff --git a/resources/images/button-up-4.9.png b/resources/images/button-up-4.9.png new file mode 100644 index 0000000..3351201 --- /dev/null +++ b/resources/images/button-up-4.9.png diff --git a/resources/images/button-up-5.9.png b/resources/images/button-up-5.9.png new file mode 100644 index 0000000..4632e0b --- /dev/null +++ b/resources/images/button-up-5.9.png diff --git a/resources/images/button-up-6.9.png b/resources/images/button-up-6.9.png new file mode 100644 index 0000000..428348d --- /dev/null +++ b/resources/images/button-up-6.9.png diff --git a/resources/images/button-up-7.9.png b/resources/images/button-up-7.9.png new file mode 100644 index 0000000..ec065d2 --- /dev/null +++ b/resources/images/button-up-7.9.png diff --git a/resources/images/button-up-8.9.png b/resources/images/button-up-8.9.png new file mode 100644 index 0000000..b84f6e4 --- /dev/null +++ b/resources/images/button-up-8.9.png diff --git a/resources/images/button-up-9.9.png b/resources/images/button-up-9.9.png new file mode 100644 index 0000000..2bfab8b --- /dev/null +++ b/resources/images/button-up-9.9.png diff --git a/resources/images/selection-popup-bg.1.9.png b/resources/images/selection-popup-bg.1.9.png new file mode 100644 index 0000000..376a3b7 --- /dev/null +++ b/resources/images/selection-popup-bg.1.9.png diff --git a/resources/images/selection-popup-bg.10.9.png b/resources/images/selection-popup-bg.10.9.png new file mode 100644 index 0000000..9a7ebf8 --- /dev/null +++ b/resources/images/selection-popup-bg.10.9.png diff --git a/resources/images/selection-popup-bg.11.9.png b/resources/images/selection-popup-bg.11.9.png new file mode 100644 index 0000000..1d2aa8f --- /dev/null +++ b/resources/images/selection-popup-bg.11.9.png diff --git a/resources/images/selection-popup-bg.12.9.png b/resources/images/selection-popup-bg.12.9.png new file mode 100644 index 0000000..5c2201b --- /dev/null +++ b/resources/images/selection-popup-bg.12.9.png diff --git a/resources/images/selection-popup-bg.13.9.png b/resources/images/selection-popup-bg.13.9.png new file mode 100644 index 0000000..0f729c8 --- /dev/null +++ b/resources/images/selection-popup-bg.13.9.png diff --git a/resources/images/selection-popup-bg.14.9.png b/resources/images/selection-popup-bg.14.9.png new file mode 100644 index 0000000..d1deedf --- /dev/null +++ b/resources/images/selection-popup-bg.14.9.png diff --git a/resources/images/selection-popup-bg.15.9.png b/resources/images/selection-popup-bg.15.9.png new file mode 100644 index 0000000..453a10f --- /dev/null +++ b/resources/images/selection-popup-bg.15.9.png diff --git a/resources/images/selection-popup-bg.16.9.png b/resources/images/selection-popup-bg.16.9.png new file mode 100644 index 0000000..e8becfb --- /dev/null +++ b/resources/images/selection-popup-bg.16.9.png diff --git a/resources/images/selection-popup-bg.17.9.png b/resources/images/selection-popup-bg.17.9.png new file mode 100644 index 0000000..2c924a6 --- /dev/null +++ b/resources/images/selection-popup-bg.17.9.png diff --git a/resources/images/selection-popup-bg.18.9.png b/resources/images/selection-popup-bg.18.9.png new file mode 100644 index 0000000..ccd92b2 --- /dev/null +++ b/resources/images/selection-popup-bg.18.9.png diff --git a/resources/images/selection-popup-bg.19.9.png b/resources/images/selection-popup-bg.19.9.png new file mode 100644 index 0000000..71258b5 --- /dev/null +++ b/resources/images/selection-popup-bg.19.9.png diff --git a/resources/images/selection-popup-bg.2.9.png b/resources/images/selection-popup-bg.2.9.png new file mode 100644 index 0000000..799326f --- /dev/null +++ b/resources/images/selection-popup-bg.2.9.png diff --git a/resources/images/selection-popup-bg.20.9.png b/resources/images/selection-popup-bg.20.9.png new file mode 100644 index 0000000..62a9b4f --- /dev/null +++ b/resources/images/selection-popup-bg.20.9.png diff --git a/resources/images/selection-popup-bg.21.9.png b/resources/images/selection-popup-bg.21.9.png new file mode 100644 index 0000000..281ddf0 --- /dev/null +++ b/resources/images/selection-popup-bg.21.9.png diff --git a/resources/images/selection-popup-bg.22.9.png b/resources/images/selection-popup-bg.22.9.png new file mode 100644 index 0000000..f87e3c5 --- /dev/null +++ b/resources/images/selection-popup-bg.22.9.png diff --git a/resources/images/selection-popup-bg.23.9.png b/resources/images/selection-popup-bg.23.9.png new file mode 100644 index 0000000..144e1b2 --- /dev/null +++ b/resources/images/selection-popup-bg.23.9.png diff --git a/resources/images/selection-popup-bg.24.9.png b/resources/images/selection-popup-bg.24.9.png new file mode 100644 index 0000000..5fa412f --- /dev/null +++ b/resources/images/selection-popup-bg.24.9.png diff --git a/resources/images/selection-popup-bg.25.9.png b/resources/images/selection-popup-bg.25.9.png new file mode 100644 index 0000000..e5d462f --- /dev/null +++ b/resources/images/selection-popup-bg.25.9.png diff --git a/resources/images/selection-popup-bg.26.9.png b/resources/images/selection-popup-bg.26.9.png new file mode 100644 index 0000000..24998f6 --- /dev/null +++ b/resources/images/selection-popup-bg.26.9.png diff --git a/resources/images/selection-popup-bg.27.9.png b/resources/images/selection-popup-bg.27.9.png new file mode 100644 index 0000000..f2becae --- /dev/null +++ b/resources/images/selection-popup-bg.27.9.png diff --git a/resources/images/selection-popup-bg.28.9.png b/resources/images/selection-popup-bg.28.9.png new file mode 100644 index 0000000..6235352 --- /dev/null +++ b/resources/images/selection-popup-bg.28.9.png diff --git a/resources/images/selection-popup-bg.29.9.png b/resources/images/selection-popup-bg.29.9.png new file mode 100644 index 0000000..75f0a29 --- /dev/null +++ b/resources/images/selection-popup-bg.29.9.png diff --git a/resources/images/selection-popup-bg.3.9.png b/resources/images/selection-popup-bg.3.9.png new file mode 100644 index 0000000..016caac --- /dev/null +++ b/resources/images/selection-popup-bg.3.9.png diff --git a/resources/images/selection-popup-bg.30.9.png b/resources/images/selection-popup-bg.30.9.png new file mode 100644 index 0000000..b00aa37 --- /dev/null +++ b/resources/images/selection-popup-bg.30.9.png diff --git a/resources/images/selection-popup-bg.31.9.png b/resources/images/selection-popup-bg.31.9.png new file mode 100644 index 0000000..291b24f --- /dev/null +++ b/resources/images/selection-popup-bg.31.9.png diff --git a/resources/images/selection-popup-bg.32.9.png b/resources/images/selection-popup-bg.32.9.png new file mode 100644 index 0000000..ae8f1a9 --- /dev/null +++ b/resources/images/selection-popup-bg.32.9.png diff --git a/resources/images/selection-popup-bg.33.9.png b/resources/images/selection-popup-bg.33.9.png new file mode 100644 index 0000000..96c1cbf --- /dev/null +++ b/resources/images/selection-popup-bg.33.9.png diff --git a/resources/images/selection-popup-bg.4.9.png b/resources/images/selection-popup-bg.4.9.png new file mode 100644 index 0000000..fe3ac7b --- /dev/null +++ b/resources/images/selection-popup-bg.4.9.png diff --git a/resources/images/selection-popup-bg.5.9.png b/resources/images/selection-popup-bg.5.9.png new file mode 100644 index 0000000..c8c82bc --- /dev/null +++ b/resources/images/selection-popup-bg.5.9.png diff --git a/resources/images/selection-popup-bg.6.9.png b/resources/images/selection-popup-bg.6.9.png new file mode 100644 index 0000000..9a8a1c3 --- /dev/null +++ b/resources/images/selection-popup-bg.6.9.png diff --git a/resources/images/selection-popup-bg.7.9.png b/resources/images/selection-popup-bg.7.9.png new file mode 100644 index 0000000..bf498cd --- /dev/null +++ b/resources/images/selection-popup-bg.7.9.png diff --git a/resources/images/selection-popup-bg.8.9.png b/resources/images/selection-popup-bg.8.9.png new file mode 100644 index 0000000..aad71bc --- /dev/null +++ b/resources/images/selection-popup-bg.8.9.png diff --git a/resources/images/selection-popup-bg.9.9.png b/resources/images/selection-popup-bg.9.9.png new file mode 100644 index 0000000..8452e2d --- /dev/null +++ b/resources/images/selection-popup-bg.9.9.png diff --git a/shared/dali-demo-strings.h b/shared/dali-demo-strings.h index d9be8c0..9c62408 100644 --- a/shared/dali-demo-strings.h +++ b/shared/dali-demo-strings.h @@ -60,6 +60,7 @@ extern "C" #define DALI_DEMO_STR_TITLE_MESH_SORTING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_MESH_SORTING") #define DALI_DEMO_STR_TITLE_TEXTURED_MESH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TEXTURED_MESH") #define DALI_DEMO_STR_TITLE_LINE_MESH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_LINE_MESH") +#define DALI_DEMO_STR_TITLE_COLOR_GRADIENT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_COLOR_GRADIENT") #else // !INTERNATIONALIZATION_ENABLED @@ -92,6 +93,7 @@ extern "C" #define DALI_DEMO_STR_TITLE_MESH_SORTING "Mesh Sorting" #define DALI_DEMO_STR_TITLE_TEXTURED_MESH "Mesh Texture" #define DALI_DEMO_STR_TITLE_LINE_MESH "Mesh Line" +#define DALI_DEMO_STR_TITLE_COLOR_GRADIENT "Color Gradient" #endif