Commit eaa55256641593c18c3480c843a11ae74effd0d5
[dali_1.1.6] Merge branch 'devel/master'
Change-Id: Idd8bc6beeb4fd5e1253ae19e6227abebd4883c18
Showing
61 changed files
with
776 additions
and
12 deletions
com.samsung.dali-demo.xml
| ... | ... | @@ -109,4 +109,10 @@ |
| 109 | 109 | <ui-application appid="size-negotiation.example" exec="/usr/apps/com.samsung.dali-demo/bin/size-negotiation.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 110 | 110 | <label>Size Negotiation</label> |
| 111 | 111 | </ui-application> |
| 112 | + <ui-application appid="benchmark.example" exec="/usr/apps/com.samsung.dali-demo/bin/benchmark.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | |
| 113 | + <label>Benchmark</label> | |
| 114 | + </ui-application> | |
| 115 | + <ui-application appid="gradients.example" exec="/usr/apps/com.samsung.dali-demo/bin/gradients.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | |
| 116 | + <label>Color Gradient</label> | |
| 117 | + </ui-application> | |
| 112 | 118 | </manifest> | ... | ... |
demo/dali-demo.cpp
| ... | ... | @@ -65,6 +65,7 @@ int main(int argc, char **argv) |
| 65 | 65 | demo.AddExample(Example("mesh-sorting.example", DALI_DEMO_STR_TITLE_MESH_SORTING)); |
| 66 | 66 | demo.AddExample(Example("textured-mesh.example", DALI_DEMO_STR_TITLE_TEXTURED_MESH)); |
| 67 | 67 | demo.AddExample(Example("line-mesh.example", DALI_DEMO_STR_TITLE_LINE_MESH)); |
| 68 | + demo.AddExample(Example("gradients.example", DALI_DEMO_STR_TITLE_COLOR_GRADIENT)); | |
| 68 | 69 | |
| 69 | 70 | demo.SortAlphabetically( true ); |
| 70 | 71 | ... | ... |
demo/dali-table-view.cpp
| ... | ... | @@ -67,7 +67,14 @@ const float EFFECT_SNAP_DURATION = 0.66f; ///< Scroll Snap |
| 67 | 67 | const float EFFECT_FLICK_DURATION = 0.5f; ///< Scroll Flick Duration for Effects |
| 68 | 68 | const Vector3 ANGLE_CUBE_PAGE_ROTATE(Math::PI * 0.5f, Math::PI * 0.5f, 0.0f); |
| 69 | 69 | |
| 70 | - | |
| 70 | +const Vector4 BUBBLE_COLOR[] = | |
| 71 | +{ | |
| 72 | + Vector4( 0.3255f, 0.3412f, 0.6353f, 0.38f ), | |
| 73 | + Vector4( 0.3647f, 0.7569f, 0.8157f, 0.38f ), | |
| 74 | + Vector4( 0.3804f, 0.7412f, 0.6510f, 0.38f ), | |
| 75 | + Vector4( 1.f, 1.f, 1.f, 0.2f ) | |
| 76 | +}; | |
| 77 | +const int NUMBER_OF_BUBBLE_COLOR( sizeof(BUBBLE_COLOR) / sizeof(BUBBLE_COLOR[0]) ); | |
| 71 | 78 | |
| 72 | 79 | const int NUM_BACKGROUND_IMAGES = 18; |
| 73 | 80 | const float BACKGROUND_SWIPE_SCALE = 0.025f; |
| ... | ... | @@ -79,7 +86,7 @@ const float SCALE_SPEED_SIN = 0.1f; |
| 79 | 86 | const unsigned int BACKGROUND_ANIMATION_DURATION = 15000; // 15 secs |
| 80 | 87 | |
| 81 | 88 | const float BACKGROUND_Z = -1.0f; |
| 82 | -const Vector4 BACKGROUND_COLOR( 1.0f, 1.0f, 1.0f, 1.0f ); | |
| 89 | +const Vector4 BACKGROUND_COLOR( 0.3569f, 0.5451f, 0.7294f, 1.0f ); | |
| 83 | 90 | |
| 84 | 91 | const float BUBBLE_MIN_Z = -1.0; |
| 85 | 92 | const float BUBBLE_MAX_Z = 0.0f; |
| ... | ... | @@ -755,9 +762,6 @@ void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage dis |
| 755 | 762 | for( int i = 0; i < count; ++i ) |
| 756 | 763 | { |
| 757 | 764 | float randSize = Random::Range( 10.0f, 400.0f ); |
| 758 | - float hue = Random::Range( 0.3f, 1.0f ); | |
| 759 | - Vector4 randColour( hue, hue * 0.5, 0.0f, Random::Range( 0.3f, 0.6f )); | |
| 760 | - | |
| 761 | 765 | ImageActor dfActor = ImageActor::New( distanceField ); |
| 762 | 766 | dfActor.SetSize( Vector2( randSize, randSize ) ); |
| 763 | 767 | dfActor.SetParentOrigin( ParentOrigin::CENTER ); |
| ... | ... | @@ -767,7 +771,7 @@ void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage dis |
| 767 | 771 | |
| 768 | 772 | ShaderEffect effect = Toolkit::CreateDistanceFieldEffect(); |
| 769 | 773 | dfActor.SetShaderEffect( effect ); |
| 770 | - dfActor.SetColor( randColour ); | |
| 774 | + dfActor.SetColor( BUBBLE_COLOR[ i%NUMBER_OF_BUBBLE_COLOR ] ); | |
| 771 | 775 | effect.SetUniform("uOutlineParams", Vector2( 0.55f, 0.00f ) ); |
| 772 | 776 | effect.SetUniform("uSmoothing", 0.5f ); |
| 773 | 777 | layer.Add( dfActor ); | ... | ... |
examples/benchmark/benchmark.cpp
0 → 100644
| 1 | +/* | |
| 2 | + * Copyright (c) 2015 Samsung Electronics Co., Ltd. | |
| 3 | + * | |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | + * you may not use this file except in compliance with the License. | |
| 6 | + * You may obtain a copy of the License at | |
| 7 | + * | |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | + * | |
| 10 | + * Unless required by applicable law or agreed to in writing, software | |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | + * See the License for the specific language governing permissions and | |
| 14 | + * limitations under the License. | |
| 15 | + * | |
| 16 | + */ | |
| 17 | + | |
| 18 | +#include <dali-toolkit/dali-toolkit.h> | |
| 19 | +#include <dali/devel-api/rendering/renderer.h> | |
| 20 | +#include <dali/public-api/common/dali-common.h> | |
| 21 | +#include <dali/integration-api/resource-policies.h> | |
| 22 | +#include <dali/integration-api/debug.h> | |
| 23 | +#include <iostream> | |
| 24 | + | |
| 25 | +using namespace Dali; | |
| 26 | +using namespace Dali::Toolkit; | |
| 27 | + | |
| 28 | + | |
| 29 | +namespace | |
| 30 | +{ | |
| 31 | +const char* IMAGE_PATH[] = { | |
| 32 | + DALI_IMAGE_DIR "gallery-medium-1.jpg", | |
| 33 | + DALI_IMAGE_DIR "gallery-medium-2.jpg", | |
| 34 | + DALI_IMAGE_DIR "gallery-medium-3.jpg", | |
| 35 | + DALI_IMAGE_DIR "gallery-medium-4.jpg", | |
| 36 | + DALI_IMAGE_DIR "gallery-medium-5.jpg", | |
| 37 | + DALI_IMAGE_DIR "gallery-medium-6.jpg", | |
| 38 | + DALI_IMAGE_DIR "gallery-medium-7.jpg", | |
| 39 | + DALI_IMAGE_DIR "gallery-medium-8.jpg", | |
| 40 | + DALI_IMAGE_DIR "gallery-medium-9.jpg", | |
| 41 | + DALI_IMAGE_DIR "gallery-medium-10.jpg", | |
| 42 | + DALI_IMAGE_DIR "gallery-medium-11.jpg", | |
| 43 | + DALI_IMAGE_DIR "gallery-medium-12.jpg", | |
| 44 | + DALI_IMAGE_DIR "gallery-medium-13.jpg", | |
| 45 | + DALI_IMAGE_DIR "gallery-medium-14.jpg", | |
| 46 | + DALI_IMAGE_DIR "gallery-medium-15.jpg", | |
| 47 | + DALI_IMAGE_DIR "gallery-medium-16.jpg", | |
| 48 | + DALI_IMAGE_DIR "gallery-medium-17.jpg", | |
| 49 | + DALI_IMAGE_DIR "gallery-medium-18.jpg", | |
| 50 | + DALI_IMAGE_DIR "gallery-medium-19.jpg", | |
| 51 | + DALI_IMAGE_DIR "gallery-medium-20.jpg", | |
| 52 | + DALI_IMAGE_DIR "gallery-medium-21.jpg", | |
| 53 | + DALI_IMAGE_DIR "gallery-medium-22.jpg", | |
| 54 | + DALI_IMAGE_DIR "gallery-medium-23.jpg", | |
| 55 | + DALI_IMAGE_DIR "gallery-medium-24.jpg", | |
| 56 | + DALI_IMAGE_DIR "gallery-medium-25.jpg", | |
| 57 | + DALI_IMAGE_DIR "gallery-medium-26.jpg", | |
| 58 | + DALI_IMAGE_DIR "gallery-medium-27.jpg", | |
| 59 | + DALI_IMAGE_DIR "gallery-medium-28.jpg", | |
| 60 | + DALI_IMAGE_DIR "gallery-medium-29.jpg", | |
| 61 | + DALI_IMAGE_DIR "gallery-medium-30.jpg", | |
| 62 | + DALI_IMAGE_DIR "gallery-medium-31.jpg", | |
| 63 | + DALI_IMAGE_DIR "gallery-medium-32.jpg", | |
| 64 | + DALI_IMAGE_DIR "gallery-medium-33.jpg", | |
| 65 | + DALI_IMAGE_DIR "gallery-medium-34.jpg", | |
| 66 | + DALI_IMAGE_DIR "gallery-medium-35.jpg", | |
| 67 | + DALI_IMAGE_DIR "gallery-medium-36.jpg", | |
| 68 | + DALI_IMAGE_DIR "gallery-medium-37.jpg", | |
| 69 | + DALI_IMAGE_DIR "gallery-medium-38.jpg", | |
| 70 | + DALI_IMAGE_DIR "gallery-medium-39.jpg", | |
| 71 | + DALI_IMAGE_DIR "gallery-medium-40.jpg", | |
| 72 | + DALI_IMAGE_DIR "gallery-medium-41.jpg", | |
| 73 | + DALI_IMAGE_DIR "gallery-medium-42.jpg", | |
| 74 | + DALI_IMAGE_DIR "gallery-medium-43.jpg", | |
| 75 | + DALI_IMAGE_DIR "gallery-medium-44.jpg", | |
| 76 | + DALI_IMAGE_DIR "gallery-medium-45.jpg", | |
| 77 | + DALI_IMAGE_DIR "gallery-medium-46.jpg", | |
| 78 | + DALI_IMAGE_DIR "gallery-medium-47.jpg", | |
| 79 | + DALI_IMAGE_DIR "gallery-medium-48.jpg", | |
| 80 | + DALI_IMAGE_DIR "gallery-medium-49.jpg", | |
| 81 | + DALI_IMAGE_DIR "gallery-medium-50.jpg", | |
| 82 | + DALI_IMAGE_DIR "gallery-medium-51.jpg", | |
| 83 | + DALI_IMAGE_DIR "gallery-medium-52.jpg", | |
| 84 | + DALI_IMAGE_DIR "gallery-medium-53.jpg", | |
| 85 | +}; | |
| 86 | + | |
| 87 | +const char* NINEPATCH_IMAGE_PATH[] = { | |
| 88 | + DALI_IMAGE_DIR "selection-popup-bg.1.9.png", | |
| 89 | + DALI_IMAGE_DIR "selection-popup-bg.2.9.png", | |
| 90 | + DALI_IMAGE_DIR "selection-popup-bg.3.9.png", | |
| 91 | + DALI_IMAGE_DIR "selection-popup-bg.4.9.png", | |
| 92 | + DALI_IMAGE_DIR "selection-popup-bg.5.9.png", | |
| 93 | + DALI_IMAGE_DIR "selection-popup-bg.6.9.png", | |
| 94 | + DALI_IMAGE_DIR "selection-popup-bg.7.9.png", | |
| 95 | + DALI_IMAGE_DIR "selection-popup-bg.8.9.png", | |
| 96 | + DALI_IMAGE_DIR "selection-popup-bg.9.9.png", | |
| 97 | + DALI_IMAGE_DIR "selection-popup-bg.10.9.png", | |
| 98 | + DALI_IMAGE_DIR "selection-popup-bg.11.9.png", | |
| 99 | + DALI_IMAGE_DIR "selection-popup-bg.12.9.png", | |
| 100 | + DALI_IMAGE_DIR "selection-popup-bg.13.9.png", | |
| 101 | + DALI_IMAGE_DIR "selection-popup-bg.14.9.png", | |
| 102 | + DALI_IMAGE_DIR "selection-popup-bg.15.9.png", | |
| 103 | + DALI_IMAGE_DIR "selection-popup-bg.16.9.png", | |
| 104 | + DALI_IMAGE_DIR "selection-popup-bg.17.9.png", | |
| 105 | + DALI_IMAGE_DIR "selection-popup-bg.18.9.png", | |
| 106 | + DALI_IMAGE_DIR "selection-popup-bg.19.9.png", | |
| 107 | + DALI_IMAGE_DIR "selection-popup-bg.20.9.png", | |
| 108 | + DALI_IMAGE_DIR "selection-popup-bg.21.9.png", | |
| 109 | + DALI_IMAGE_DIR "selection-popup-bg.22.9.png", | |
| 110 | + DALI_IMAGE_DIR "selection-popup-bg.23.9.png", | |
| 111 | + DALI_IMAGE_DIR "selection-popup-bg.24.9.png", | |
| 112 | + DALI_IMAGE_DIR "selection-popup-bg.25.9.png", | |
| 113 | + DALI_IMAGE_DIR "selection-popup-bg.26.9.png", | |
| 114 | + DALI_IMAGE_DIR "selection-popup-bg.27.9.png", | |
| 115 | + DALI_IMAGE_DIR "selection-popup-bg.28.9.png", | |
| 116 | + DALI_IMAGE_DIR "selection-popup-bg.29.9.png", | |
| 117 | + DALI_IMAGE_DIR "selection-popup-bg.30.9.png", | |
| 118 | + DALI_IMAGE_DIR "selection-popup-bg.31.9.png", | |
| 119 | + DALI_IMAGE_DIR "selection-popup-bg.32.9.png", | |
| 120 | + DALI_IMAGE_DIR "selection-popup-bg.33.9.png", | |
| 121 | + DALI_IMAGE_DIR "button-disabled.9.png", | |
| 122 | + DALI_IMAGE_DIR "button-down.9.png", | |
| 123 | + DALI_IMAGE_DIR "button-down-disabled.9.png", | |
| 124 | + DALI_IMAGE_DIR "button-up-1.9.png", | |
| 125 | + DALI_IMAGE_DIR "button-up-2.9.png", | |
| 126 | + DALI_IMAGE_DIR "button-up-3.9.png", | |
| 127 | + DALI_IMAGE_DIR "button-up-4.9.png", | |
| 128 | + DALI_IMAGE_DIR "button-up-5.9.png", | |
| 129 | + DALI_IMAGE_DIR "button-up-6.9.png", | |
| 130 | + DALI_IMAGE_DIR "button-up-7.9.png", | |
| 131 | + DALI_IMAGE_DIR "button-up-8.9.png", | |
| 132 | + DALI_IMAGE_DIR "button-up-9.9.png", | |
| 133 | + DALI_IMAGE_DIR "button-up-10.9.png", | |
| 134 | + DALI_IMAGE_DIR "button-up-11.9.png", | |
| 135 | + DALI_IMAGE_DIR "button-up-12.9.png", | |
| 136 | + DALI_IMAGE_DIR "button-up-13.9.png", | |
| 137 | + DALI_IMAGE_DIR "button-up-14.9.png", | |
| 138 | + DALI_IMAGE_DIR "button-up-15.9.png", | |
| 139 | + DALI_IMAGE_DIR "button-up-16.9.png", | |
| 140 | + DALI_IMAGE_DIR "button-up-17.9.png", | |
| 141 | +}; | |
| 142 | + | |
| 143 | +const unsigned int NUM_IMAGES = sizeof(IMAGE_PATH) / sizeof(char*); | |
| 144 | +const unsigned int NUM_NINEPATCH_IMAGES = sizeof(NINEPATCH_IMAGE_PATH) / sizeof(char*); | |
| 145 | + | |
| 146 | +const float ANIMATION_TIME ( 5.0f ); // animation length in seconds | |
| 147 | + | |
| 148 | +struct VertexWithTexture | |
| 149 | +{ | |
| 150 | + Vector2 position; | |
| 151 | + Vector2 texCoord; | |
| 152 | +}; | |
| 153 | + | |
| 154 | +VertexWithTexture gQuadWithTexture[] = { | |
| 155 | + { Vector2( -0.5f, -0.5f ), Vector2( 0.0f, 0.0f ) }, | |
| 156 | + { Vector2( 0.5f, -0.5f ), Vector2( 1.0f, 0.0f ) }, | |
| 157 | + { Vector2( -0.5f, 0.5f ), Vector2( 0.0f, 1.0f ) }, | |
| 158 | + { Vector2( 0.5f, 0.5f ), Vector2( 1.0f, 1.0f ) } | |
| 159 | +}; | |
| 160 | + | |
| 161 | +const char* VERTEX_SHADER_TEXTURE = DALI_COMPOSE_SHADER( | |
| 162 | + attribute mediump vec2 aPosition;\n | |
| 163 | + attribute mediump vec2 aTexCoord;\n | |
| 164 | + uniform mediump mat4 uMvpMatrix;\n | |
| 165 | + uniform mediump vec3 uSize;\n | |
| 166 | + varying mediump vec2 vTexCoord;\n | |
| 167 | + void main()\n | |
| 168 | + {\n | |
| 169 | + vec4 position = vec4(aPosition,0.0,1.0)*vec4(uSize,1.0);\n | |
| 170 | + gl_Position = uMvpMatrix * position;\n | |
| 171 | + vTexCoord = aTexCoord;\n | |
| 172 | + }\n | |
| 173 | +); | |
| 174 | + | |
| 175 | +const char* FRAGMENT_SHADER_TEXTURE = DALI_COMPOSE_SHADER( | |
| 176 | + uniform lowp vec4 uColor;\n | |
| 177 | + uniform sampler2D sTexture;\n | |
| 178 | + varying mediump vec2 vTexCoord;\n | |
| 179 | + | |
| 180 | + void main()\n | |
| 181 | + {\n | |
| 182 | + gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n | |
| 183 | + }\n | |
| 184 | +); | |
| 185 | + | |
| 186 | + | |
| 187 | +Geometry& QuadMesh() | |
| 188 | +{ | |
| 189 | + static Geometry mesh; | |
| 190 | + if( !mesh ) | |
| 191 | + { | |
| 192 | + PropertyBuffer vertexBuffer; | |
| 193 | + Property::Map vertexFormat; | |
| 194 | + vertexFormat["aPosition"] = Property::VECTOR2; | |
| 195 | + vertexFormat["aTexCoord"] = Property::VECTOR2; | |
| 196 | + | |
| 197 | + //Create a vertex buffer for vertex positions and texture coordinates | |
| 198 | + vertexBuffer = PropertyBuffer::New( vertexFormat, 4u ); | |
| 199 | + vertexBuffer.SetData( gQuadWithTexture ); | |
| 200 | + | |
| 201 | + //Create the geometry | |
| 202 | + mesh = Geometry::New(); | |
| 203 | + mesh.AddVertexBuffer( vertexBuffer ); | |
| 204 | + mesh.SetGeometryType(Geometry::TRIANGLE_STRIP ); | |
| 205 | + } | |
| 206 | + return mesh; | |
| 207 | +} | |
| 208 | + | |
| 209 | +bool gUseMesh(false); | |
| 210 | +bool gUseImageView(false); | |
| 211 | +bool gNinePatch(false); | |
| 212 | +unsigned int gRowsPerPage(25); | |
| 213 | +unsigned int gColumnsPerPage( 25 ); | |
| 214 | +unsigned int gPageCount(13); | |
| 215 | + | |
| 216 | +Renderer CreateRenderer( unsigned int index ) | |
| 217 | +{ | |
| 218 | + | |
| 219 | + int numImages = !gNinePatch ? NUM_IMAGES : NUM_NINEPATCH_IMAGES; | |
| 220 | + static Renderer* renderers = new Renderer[numImages]; | |
| 221 | + if( !renderers[index] ) | |
| 222 | + { | |
| 223 | + //Create the renderer | |
| 224 | + Shader shader = Shader::New( VERTEX_SHADER_TEXTURE, FRAGMENT_SHADER_TEXTURE ); | |
| 225 | + | |
| 226 | + const char* imagePath = !gNinePatch ? IMAGE_PATH[index] : NINEPATCH_IMAGE_PATH[index]; | |
| 227 | + Image image = ResourceImage::New(imagePath); | |
| 228 | + Sampler textureSampler = Sampler::New( image, "sTexture" ); | |
| 229 | + Material material = Material::New( shader ); | |
| 230 | + material.AddSampler(textureSampler); | |
| 231 | + material.SetBlendMode( BlendingMode::OFF ); | |
| 232 | + renderers[index] = Renderer::New( QuadMesh(), material ); | |
| 233 | + } | |
| 234 | + return renderers[index]; | |
| 235 | +} | |
| 236 | + | |
| 237 | +Actor CreateMeshActor( unsigned int index) | |
| 238 | +{ | |
| 239 | + Renderer renderer = CreateRenderer(index); | |
| 240 | + Actor meshActor = Actor::New(); | |
| 241 | + meshActor.AddRenderer( renderer ); | |
| 242 | + return meshActor; | |
| 243 | +} | |
| 244 | + | |
| 245 | +} | |
| 246 | +// Test application to compare performance between ImageActor and ImageView | |
| 247 | +// By default, the application consist of 10 pages of 25x25 ImageActors, this can be modified using the following command line arguments: | |
| 248 | +// -r NumberOfRows (Modifies the number of rows per page) | |
| 249 | +// -c NumberOfColumns (Modifies the number of columns per page) | |
| 250 | +// -p NumberOfPages (Modifies the nimber of pages ) | |
| 251 | +// --use-imageview ( Use ImageView instead of ImageActor ) | |
| 252 | +// --use-mesh ( Use new renderer API (as ImageView) but shares renderers between actors when possible ) | |
| 253 | +// --use-nine-patch ( Use nine patch images ) | |
| 254 | + | |
| 255 | +// | |
| 256 | +class Benchmark : public ConnectionTracker | |
| 257 | +{ | |
| 258 | +public: | |
| 259 | + | |
| 260 | + Benchmark( Application& application ) | |
| 261 | +: mApplication( application ), | |
| 262 | + mRowsPerPage( gRowsPerPage ), | |
| 263 | + mColumnsPerPage( gColumnsPerPage ), | |
| 264 | + mPageCount( gPageCount ) | |
| 265 | +{ | |
| 266 | + // Connect to the Application's Init signal | |
| 267 | + mApplication.InitSignal().Connect( this, &Benchmark::Create ); | |
| 268 | +} | |
| 269 | + | |
| 270 | + ~Benchmark() | |
| 271 | + { | |
| 272 | + // Nothing to do here; | |
| 273 | + } | |
| 274 | + | |
| 275 | + // The Init signal is received once (only) during the Application lifetime | |
| 276 | + void Create( Application& application ) | |
| 277 | + { | |
| 278 | + // Get a handle to the stage | |
| 279 | + Stage stage = Stage::GetCurrent(); | |
| 280 | + stage.SetBackgroundColor( Color::WHITE ); | |
| 281 | + Vector2 stageSize = stage.GetSize(); | |
| 282 | + | |
| 283 | + stage.GetRootLayer().SetDepthTestDisabled(true); | |
| 284 | + | |
| 285 | + mSize = Vector3( stageSize.x / mColumnsPerPage, stageSize.y / mRowsPerPage, 0.0f ); | |
| 286 | + | |
| 287 | + // Respond to a click anywhere on the stage | |
| 288 | + stage.GetRootLayer().TouchedSignal().Connect( this, &Benchmark::OnTouch ); | |
| 289 | + | |
| 290 | + if( gUseMesh ) | |
| 291 | + { | |
| 292 | + CreateMeshActors(); | |
| 293 | + } | |
| 294 | + else if( gUseImageView ) | |
| 295 | + { | |
| 296 | + CreateImageViews(); | |
| 297 | + } | |
| 298 | + else | |
| 299 | + { | |
| 300 | + CreateImageActors(); | |
| 301 | + } | |
| 302 | + | |
| 303 | + ShowAnimation(); | |
| 304 | + } | |
| 305 | + | |
| 306 | + bool OnTouch( Actor actor, const TouchEvent& touch ) | |
| 307 | + { | |
| 308 | + // quit the application | |
| 309 | + mApplication.Quit(); | |
| 310 | + return true; | |
| 311 | + } | |
| 312 | + | |
| 313 | + const char* ImagePath( int i ) | |
| 314 | + { | |
| 315 | + return !gNinePatch ? IMAGE_PATH[i % NUM_IMAGES] : NINEPATCH_IMAGE_PATH[i % NUM_NINEPATCH_IMAGES]; | |
| 316 | + } | |
| 317 | + | |
| 318 | + void CreateImageActors() | |
| 319 | + { | |
| 320 | + Stage stage = Stage::GetCurrent(); | |
| 321 | + unsigned int actorCount(mRowsPerPage*mColumnsPerPage * mPageCount); | |
| 322 | + mActor.resize(actorCount); | |
| 323 | + | |
| 324 | + for( size_t i(0); i<actorCount; ++i ) | |
| 325 | + { | |
| 326 | + Image image = ResourceImage::New(ImagePath(i)); | |
| 327 | + mActor[i] = ImageActor::New(image); | |
| 328 | + mActor[i].SetSize(Vector3(0.0f,0.0f,0.0f)); | |
| 329 | + mActor[i].SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | |
| 330 | + stage.Add(mActor[i]); | |
| 331 | + } | |
| 332 | + } | |
| 333 | + | |
| 334 | + void CreateImageViews() | |
| 335 | + { | |
| 336 | + Stage stage = Stage::GetCurrent(); | |
| 337 | + unsigned int actorCount(mRowsPerPage*mColumnsPerPage * mPageCount); | |
| 338 | + mImageView.resize(actorCount); | |
| 339 | + | |
| 340 | + for( size_t i(0); i<actorCount; ++i ) | |
| 341 | + { | |
| 342 | + Image image = ResourceImage::New(ImagePath(i)); | |
| 343 | + mImageView[i] = ImageView::New(image); | |
| 344 | + mImageView[i].SetSize(Vector3(0.0f,0.0f,0.0f)); | |
| 345 | + mImageView[i].SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | |
| 346 | + stage.Add(mImageView[i]); | |
| 347 | + } | |
| 348 | + } | |
| 349 | + | |
| 350 | + void CreateMeshActors() | |
| 351 | + { | |
| 352 | + Stage stage = Stage::GetCurrent(); | |
| 353 | + unsigned int actorCount(mRowsPerPage*mColumnsPerPage * mPageCount); | |
| 354 | + mActor.resize(actorCount); | |
| 355 | + for( size_t i(0); i<actorCount; ++i ) | |
| 356 | + { | |
| 357 | + size_t numImages = !gNinePatch ? NUM_IMAGES : NUM_NINEPATCH_IMAGES; | |
| 358 | + mActor[i] = CreateMeshActor(i % numImages); | |
| 359 | + mActor[i].SetSize(0.0f,0.0f,0.0f); | |
| 360 | + | |
| 361 | + stage.Add(mActor[i]); | |
| 362 | + } | |
| 363 | + } | |
| 364 | + | |
| 365 | + void OnAnimationEnd( Animation& source ) | |
| 366 | + { | |
| 367 | + if( source == mShow ) | |
| 368 | + { | |
| 369 | + ScrollAnimation(); | |
| 370 | + } | |
| 371 | + else if( source == mScroll ) | |
| 372 | + { | |
| 373 | + HideAnimation(); | |
| 374 | + } | |
| 375 | + else | |
| 376 | + { | |
| 377 | + mApplication.Quit(); | |
| 378 | + } | |
| 379 | + } | |
| 380 | + | |
| 381 | + void ShowAnimation() | |
| 382 | + { | |
| 383 | + Stage stage = Stage::GetCurrent(); | |
| 384 | + Vector3 initialPosition( stage.GetSize().x * 0.5f, stage.GetSize().y*0.5f, 1000.0f ); | |
| 385 | + | |
| 386 | + unsigned int totalColumns = mColumnsPerPage * mPageCount; | |
| 387 | + | |
| 388 | + size_t count(0); | |
| 389 | + float xpos, ypos; | |
| 390 | + mShow = Animation::New(0.0f); | |
| 391 | + | |
| 392 | + float totalDuration( 10.0f ); | |
| 393 | + float durationPerActor( 0.5f ); | |
| 394 | + float delayBetweenActors = ( totalDuration - durationPerActor) / (mRowsPerPage*mColumnsPerPage); | |
| 395 | + for( size_t i(0); i<totalColumns; ++i ) | |
| 396 | + { | |
| 397 | + xpos = mSize.x * i; | |
| 398 | + | |
| 399 | + for( size_t j(0);j<mRowsPerPage;++j) | |
| 400 | + { | |
| 401 | + | |
| 402 | + ypos = mSize.y * j; | |
| 403 | + | |
| 404 | + float delay = 0.0f; | |
| 405 | + float duration = 0.0f; | |
| 406 | + if( count < mRowsPerPage*mColumnsPerPage ) | |
| 407 | + { | |
| 408 | + duration = durationPerActor; | |
| 409 | + delay = delayBetweenActors * count; | |
| 410 | + } | |
| 411 | + if( gUseImageView ) | |
| 412 | + { | |
| 413 | + mImageView[count].SetPosition( initialPosition ); | |
| 414 | + mImageView[count].SetSize( Vector3(0.0f,0.0f,0.0f) ); | |
| 415 | + mImageView[count].SetOrientation( Quaternion( Radian(0.0f),Vector3::XAXIS)); | |
| 416 | + mShow.AnimateTo( Property( mImageView[count], Actor::Property::POSITION), Vector3(xpos+mSize.x*0.5f, ypos+mSize.y*0.5f, 0.0f), AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration )); | |
| 417 | + mShow.AnimateTo( Property( mImageView[count], Actor::Property::SIZE), mSize, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration )); | |
| 418 | + } | |
| 419 | + else | |
| 420 | + { | |
| 421 | + mActor[count].SetPosition( initialPosition ); | |
| 422 | + mActor[count].SetSize( Vector3(0.0f,0.0f,0.0f) ); | |
| 423 | + mActor[count].SetOrientation( Quaternion( Radian(0.0f),Vector3::XAXIS)); | |
| 424 | + mShow.AnimateTo( Property( mActor[count], Actor::Property::POSITION), Vector3(xpos+mSize.x*0.5f, ypos+mSize.y*0.5f, 0.0f), AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration )); | |
| 425 | + mShow.AnimateTo( Property( mActor[count], Actor::Property::SIZE), mSize, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration )); | |
| 426 | + } | |
| 427 | + ++count; | |
| 428 | + } | |
| 429 | + } | |
| 430 | + mShow.Play(); | |
| 431 | + mShow.FinishedSignal().Connect( this, &Benchmark::OnAnimationEnd ); | |
| 432 | + } | |
| 433 | + | |
| 434 | + void ScrollAnimation() | |
| 435 | + { | |
| 436 | + Stage stage = Stage::GetCurrent(); | |
| 437 | + Vector3 stageSize( stage.GetSize() ); | |
| 438 | + | |
| 439 | + mScroll = Animation::New(10.0f); | |
| 440 | + size_t actorCount( mRowsPerPage*mColumnsPerPage*mPageCount); | |
| 441 | + for( size_t i(0); i<actorCount; ++i ) | |
| 442 | + { | |
| 443 | + if( gUseImageView ) | |
| 444 | + { | |
| 445 | + mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(0.0f,3.0f)); | |
| 446 | + mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(3.0f,3.0f)); | |
| 447 | + mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(6.0f,2.0f)); | |
| 448 | + mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3( 12.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(8.0f,2.0f)); | |
| 449 | + } | |
| 450 | + else | |
| 451 | + { | |
| 452 | + mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(0.0f,3.0f)); | |
| 453 | + mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(3.0f,3.0f)); | |
| 454 | + mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(6.0f,2.0f)); | |
| 455 | + mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3( 12.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(8.0f,2.0f)); | |
| 456 | + } | |
| 457 | + } | |
| 458 | + mScroll.Play(); | |
| 459 | + mScroll.FinishedSignal().Connect( this, &Benchmark::OnAnimationEnd ); | |
| 460 | + } | |
| 461 | + | |
| 462 | + void HideAnimation() | |
| 463 | + { | |
| 464 | + size_t count(0); | |
| 465 | + unsigned int actorsPerPage( mRowsPerPage*mColumnsPerPage ); | |
| 466 | + mHide = Animation::New(0.0f); | |
| 467 | + | |
| 468 | + unsigned int totalColumns = mColumnsPerPage * mPageCount; | |
| 469 | + | |
| 470 | + float totalDuration( 5.0f); | |
| 471 | + float durationPerActor( 0.5f ); | |
| 472 | + float delayBetweenActors = ( totalDuration - durationPerActor) / (mRowsPerPage*mColumnsPerPage); | |
| 473 | + for( size_t i(0); i<mRowsPerPage; ++i ) | |
| 474 | + { | |
| 475 | + for( size_t j(0);j<totalColumns;++j) | |
| 476 | + { | |
| 477 | + float delay = 0.0f; | |
| 478 | + float duration = 0.0f; | |
| 479 | + if( count < actorsPerPage ) | |
| 480 | + { | |
| 481 | + duration = durationPerActor; | |
| 482 | + delay = delayBetweenActors * count; | |
| 483 | + } | |
| 484 | + | |
| 485 | + if( gUseImageView ) | |
| 486 | + { | |
| 487 | + mHide.AnimateTo( Property( mImageView[count], Actor::Property::ORIENTATION), Quaternion( Radian( Degree( 70.0f ) ), Vector3::XAXIS ), AlphaFunction::EASE_OUT, TimePeriod( delay, duration )); | |
| 488 | + mHide.AnimateBy( Property( mImageView[count], Actor::Property::POSITION_Z), 1000.0f, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay +delayBetweenActors*actorsPerPage + duration, duration )); | |
| 489 | + } | |
| 490 | + else | |
| 491 | + { | |
| 492 | + mHide.AnimateTo( Property( mActor[count], Actor::Property::ORIENTATION), Quaternion( Radian( Degree( 70.0f ) ), Vector3::XAXIS ), AlphaFunction::EASE_OUT, TimePeriod( delay, duration )); | |
| 493 | + mHide.AnimateBy( Property( mActor[count], Actor::Property::POSITION_Z), 1000.0f, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay +delayBetweenActors*actorsPerPage + duration, duration )); | |
| 494 | + } | |
| 495 | + ++count; | |
| 496 | + } | |
| 497 | + } | |
| 498 | + | |
| 499 | + mHide.Play(); | |
| 500 | + mHide.FinishedSignal().Connect( this, &Benchmark::OnAnimationEnd ); | |
| 501 | + } | |
| 502 | + | |
| 503 | +private: | |
| 504 | + Application& mApplication; | |
| 505 | + | |
| 506 | + std::vector<Actor> mActor; | |
| 507 | + std::vector<ImageView> mImageView; | |
| 508 | + | |
| 509 | + Vector3 mSize; | |
| 510 | + unsigned int mRowsPerPage; | |
| 511 | + unsigned int mColumnsPerPage; | |
| 512 | + unsigned int mPageCount; | |
| 513 | + | |
| 514 | + Animation mShow; | |
| 515 | + Animation mScroll; | |
| 516 | + Animation mHide; | |
| 517 | +}; | |
| 518 | + | |
| 519 | +void RunTest( Application& application ) | |
| 520 | +{ | |
| 521 | + Benchmark test( application ); | |
| 522 | + | |
| 523 | + application.MainLoop(); | |
| 524 | +} | |
| 525 | + | |
| 526 | +// Entry point for Linux & Tizen applications | |
| 527 | +// | |
| 528 | +int main( int argc, char **argv ) | |
| 529 | +{ | |
| 530 | + Application application = Application::New( &argc, &argv ); | |
| 531 | + | |
| 532 | + for( int i(1) ; i < argc; ++i ) | |
| 533 | + { | |
| 534 | + std::string arg( argv[i] ); | |
| 535 | + if( arg.compare("--use-mesh") == 0) | |
| 536 | + { | |
| 537 | + gUseMesh = true; | |
| 538 | + } | |
| 539 | + else if( arg.compare("--use-imageview") == 0) | |
| 540 | + { | |
| 541 | + gUseImageView = true; | |
| 542 | + } | |
| 543 | + else if( arg.compare("--nine-patch" ) == 0) | |
| 544 | + { | |
| 545 | + gNinePatch = true; | |
| 546 | + } | |
| 547 | + else if( arg.compare(0, 2, "-r" ) == 0) | |
| 548 | + { | |
| 549 | + gRowsPerPage = atoi( arg.substr( 2, arg.size()).c_str()); | |
| 550 | + } | |
| 551 | + else if( arg.compare(0, 2, "-c" ) == 0) | |
| 552 | + { | |
| 553 | + gColumnsPerPage = atoi( arg.substr( 2, arg.size()).c_str()); | |
| 554 | + } | |
| 555 | + else if( arg.compare(0, 2, "-p" ) == 0) | |
| 556 | + { | |
| 557 | + gPageCount = atoi( arg.substr( 2, arg.size()).c_str()); | |
| 558 | + } | |
| 559 | + } | |
| 560 | + | |
| 561 | + RunTest( application ); | |
| 562 | + | |
| 563 | + return 0; | |
| 564 | +} | ... | ... |
examples/gradients/gradients-example.cpp
0 → 100644
| 1 | +/* | |
| 2 | + * Copyright (c) 2015 Samsung Electronics Co., Ltd. | |
| 3 | + * | |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | + * you may not use this file except in compliance with the License. | |
| 6 | + * You may obtain a copy of the License at | |
| 7 | + * | |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | + * | |
| 10 | + * Unless required by applicable law or agreed to in writing, software | |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | + * See the License for the specific language governing permissions and | |
| 14 | + * limitations under the License. | |
| 15 | + * | |
| 16 | + */ | |
| 17 | + | |
| 18 | +#include <dali-toolkit/dali-toolkit.h> | |
| 19 | +#include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h> | |
| 20 | +#include <dali-toolkit/devel-api/controls/renderer-factory/control-renderer.h> | |
| 21 | +#include "shared/view.h" | |
| 22 | + | |
| 23 | +using namespace Dali; | |
| 24 | +using namespace Dali::Toolkit; | |
| 25 | + | |
| 26 | +namespace | |
| 27 | +{ | |
| 28 | +const char * const APPLICATION_TITLE( "Color Gradients" ); | |
| 29 | + | |
| 30 | +const char * const TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" ); | |
| 31 | +const char * const CHANGE_ICON( DALI_IMAGE_DIR "icon-change.png" ); | |
| 32 | +const char * const CHANGE_ICON_SELECTED( DALI_IMAGE_DIR "icon-change-selected.png" ); | |
| 33 | +} | |
| 34 | + | |
| 35 | +// This example shows how to render color gradients | |
| 36 | +// | |
| 37 | +class GradientController : public ConnectionTracker | |
| 38 | +{ | |
| 39 | +public: | |
| 40 | + | |
| 41 | + GradientController( Application& application ) | |
| 42 | + : mApplication( application ), | |
| 43 | + mIndex( 0 ) | |
| 44 | + { | |
| 45 | + // Connect to the Application's Init signal | |
| 46 | + mApplication.InitSignal().Connect( this, &GradientController::Create ); | |
| 47 | + } | |
| 48 | + | |
| 49 | + ~GradientController() | |
| 50 | + { | |
| 51 | + // Nothing to do here; | |
| 52 | + } | |
| 53 | + | |
| 54 | + // The Init signal is received once (only) during the Application lifetime | |
| 55 | + void Create( Application& application ) | |
| 56 | + { | |
| 57 | + // Get a handle to the stage | |
| 58 | + Stage stage = Stage::GetCurrent(); | |
| 59 | + stage.KeyEventSignal().Connect(this, &GradientController::OnKeyEvent); | |
| 60 | + | |
| 61 | + // Creates a default view with a default tool bar. | |
| 62 | + // The view is added to the stage. | |
| 63 | + Toolkit::ToolBar toolBar; | |
| 64 | + Layer content = DemoHelper::CreateView( application, | |
| 65 | + mView, | |
| 66 | + toolBar, | |
| 67 | + "", | |
| 68 | + TOOLBAR_IMAGE, | |
| 69 | + APPLICATION_TITLE ); | |
| 70 | + | |
| 71 | + PushButton changeButton = Toolkit::PushButton::New(); | |
| 72 | + changeButton.SetUnselectedImage( CHANGE_ICON ); | |
| 73 | + changeButton.SetSelectedImage( CHANGE_ICON_SELECTED ); | |
| 74 | + changeButton.ClickedSignal().Connect( this, &GradientController::OnChangeIconClicked ); | |
| 75 | + toolBar.AddControl( changeButton, | |
| 76 | + DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, | |
| 77 | + Toolkit::Alignment::HorizontalRight, | |
| 78 | + DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); | |
| 79 | + | |
| 80 | +// ---- Gradient for background | |
| 81 | + | |
| 82 | + mGradientMap.Insert("renderer-type", "gradient-renderer"); | |
| 83 | + Property::Array stopOffsets; | |
| 84 | + stopOffsets.PushBack( 0.0f ); | |
| 85 | + stopOffsets.PushBack( 0.3f ); | |
| 86 | + stopOffsets.PushBack( 0.6f ); | |
| 87 | + stopOffsets.PushBack( 0.8f ); | |
| 88 | + stopOffsets.PushBack( 1.f ); | |
| 89 | + mGradientMap.Insert("gradient-stop-offset", stopOffsets); | |
| 90 | + Property::Array stopColors; | |
| 91 | + stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 255.f )/255.f ); | |
| 92 | + stopColors.PushBack( Vector4( 196.f, 198.f, 71.f, 122.f )/255.f ); | |
| 93 | + stopColors.PushBack( Vector4( 214.f, 37.f, 139.f, 191.f )/255.f ); | |
| 94 | + stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 150.f )/255.f ); | |
| 95 | + stopColors.PushBack( Color::YELLOW ); | |
| 96 | + mGradientMap.Insert("gradient-stop-color", stopColors); | |
| 97 | + | |
| 98 | + OnChangeIconClicked( changeButton ); | |
| 99 | + } | |
| 100 | + | |
| 101 | + bool OnChangeIconClicked( Toolkit::Button button ) | |
| 102 | + { | |
| 103 | + Property::Map gradientMap; | |
| 104 | + | |
| 105 | + switch( mIndex%4 ) | |
| 106 | + { | |
| 107 | + case 0: // linear gradient with units as objectBoundingBox | |
| 108 | + { | |
| 109 | + gradientMap.Insert("gradient-start-position", Vector2( 0.5f, 0.5f )); | |
| 110 | + gradientMap.Insert("gradient-end-position", Vector2( -0.5f, -0.5f )); | |
| 111 | + break; | |
| 112 | + } | |
| 113 | + case 1: // linear gradient with units as userSpaceOnUse | |
| 114 | + { | |
| 115 | + Vector2 halfStageSize = Stage::GetCurrent().GetSize()*0.5f; | |
| 116 | + gradientMap.Insert("gradient-start-position", halfStageSize); | |
| 117 | + gradientMap.Insert("gradient-end-position", -halfStageSize ); | |
| 118 | + gradientMap.Insert("gradient-units", "user-space"); | |
| 119 | + break; | |
| 120 | + } | |
| 121 | + case 2: // radial gradient with units as objectBoundingBox | |
| 122 | + { | |
| 123 | + gradientMap.Insert("gradient-center", Vector2(0.5f, 0.5f)); | |
| 124 | + gradientMap.Insert("gradient-radius", 1.414f); | |
| 125 | + break; | |
| 126 | + } | |
| 127 | + default: // radial gradient with units as userSpaceOnUse | |
| 128 | + { | |
| 129 | + Vector2 stageSize = Stage::GetCurrent().GetSize(); | |
| 130 | + gradientMap.Insert("gradient-center", stageSize*0.5f); | |
| 131 | + gradientMap.Insert("gradient-radius", stageSize.Length()); | |
| 132 | + gradientMap.Insert("gradient-units", "user-space"); | |
| 133 | + break; | |
| 134 | + } | |
| 135 | + } | |
| 136 | + | |
| 137 | + gradientMap.Merge( mGradientMap ); | |
| 138 | + mView.SetProperty( Control::Property::BACKGROUND, gradientMap ); | |
| 139 | + | |
| 140 | + mIndex++; | |
| 141 | + return true; | |
| 142 | + } | |
| 143 | + | |
| 144 | + bool OnTouch( Actor actor, const TouchEvent& touch ) | |
| 145 | + { | |
| 146 | + // quit the application | |
| 147 | + mApplication.Quit(); | |
| 148 | + return true; | |
| 149 | + } | |
| 150 | + | |
| 151 | + void OnKeyEvent(const KeyEvent& event) | |
| 152 | + { | |
| 153 | + if(event.state == KeyEvent::Down) | |
| 154 | + { | |
| 155 | + if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) ) | |
| 156 | + { | |
| 157 | + mApplication.Quit(); | |
| 158 | + } | |
| 159 | + } | |
| 160 | + } | |
| 161 | + | |
| 162 | +private: | |
| 163 | + Application& mApplication; | |
| 164 | + | |
| 165 | + Property::Map mGradientMap; | |
| 166 | + Control mView; | |
| 167 | + unsigned mIndex; | |
| 168 | +}; | |
| 169 | + | |
| 170 | +void RunTest( Application& application ) | |
| 171 | +{ | |
| 172 | + GradientController test( application ); | |
| 173 | + | |
| 174 | + application.MainLoop(); | |
| 175 | +} | |
| 176 | + | |
| 177 | +// Entry point for Linux & Tizen applications | |
| 178 | +// | |
| 179 | +int main( int argc, char **argv ) | |
| 180 | +{ | |
| 181 | + Application application = Application::New( &argc, &argv ); | |
| 182 | + | |
| 183 | + RunTest( application ); | |
| 184 | + | |
| 185 | + return 0; | |
| 186 | +} | ... | ... |
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
| ... | ... | @@ -538,13 +538,14 @@ public: |
| 538 | 538 | if( gridImageView ) |
| 539 | 539 | { |
| 540 | 540 | // Cycle the scaling mode options: |
| 541 | - const Vector2 imageSize = mSizes[gridImageView.GetId()]; | |
| 542 | - Dali::FittingMode::Type newMode = NextMode( mFittingModes[gridImageView.GetId()] ); | |
| 543 | - Image oldImage = gridImageView.GetImage(); | |
| 544 | - Image newImage = CreateImage(ResourceImage::DownCast(oldImage).GetUrl(), imageSize.width, imageSize.height, newMode ); | |
| 541 | + unsigned int id = gridImageView.GetId(); | |
| 542 | + | |
| 543 | + const Vector2 imageSize = mSizes[ id ]; | |
| 544 | + Dali::FittingMode::Type newMode = NextMode( mFittingModes[ id ] ); | |
| 545 | + Image newImage = CreateImage( mResourceUrls[ id ], imageSize.width, imageSize.height, newMode ); | |
| 545 | 546 | gridImageView.SetImage( newImage ); |
| 546 | 547 | |
| 547 | - mFittingModes[gridImageView.GetId()] = newMode; | |
| 548 | + mFittingModes[ id ] = newMode; | |
| 548 | 549 | |
| 549 | 550 | 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" ) ); |
| 550 | 551 | } | ... | ... |
packaging/com.samsung.dali-demo.spec
resources/images/button-disabled.9.png
0 → 100644
783 Bytes
resources/images/button-down-disabled.9.png
0 → 100644
720 Bytes
resources/images/button-down.9.png
0 → 100644
844 Bytes
resources/images/button-up-1.9.png
0 → 100644
897 Bytes
resources/images/button-up-10.9.png
0 → 100644
943 Bytes
resources/images/button-up-11.9.png
0 → 100644
942 Bytes
resources/images/button-up-12.9.png
0 → 100644
939 Bytes
resources/images/button-up-13.9.png
0 → 100644
948 Bytes
resources/images/button-up-14.9.png
0 → 100644
934 Bytes
resources/images/button-up-15.9.png
0 → 100644
939 Bytes
resources/images/button-up-16.9.png
0 → 100644
953 Bytes
resources/images/button-up-17.9.png
0 → 100644
941 Bytes
resources/images/button-up-2.9.png
0 → 100644
997 Bytes
resources/images/button-up-3.9.png
0 → 100644
982 Bytes
resources/images/button-up-4.9.png
0 → 100644
982 Bytes
resources/images/button-up-5.9.png
0 → 100644
996 Bytes
resources/images/button-up-6.9.png
0 → 100644
989 Bytes
resources/images/button-up-7.9.png
0 → 100644
985 Bytes
resources/images/button-up-8.9.png
0 → 100644
983 Bytes
resources/images/button-up-9.9.png
0 → 100644
942 Bytes
resources/images/selection-popup-bg.1.9.png
0 → 100644
748 Bytes
resources/images/selection-popup-bg.10.9.png
0 → 100644
537 Bytes
resources/images/selection-popup-bg.11.9.png
0 → 100644
541 Bytes
resources/images/selection-popup-bg.12.9.png
0 → 100644
624 Bytes
resources/images/selection-popup-bg.13.9.png
0 → 100644
514 Bytes
resources/images/selection-popup-bg.14.9.png
0 → 100644
535 Bytes
resources/images/selection-popup-bg.15.9.png
0 → 100644
591 Bytes
resources/images/selection-popup-bg.16.9.png
0 → 100644
622 Bytes
resources/images/selection-popup-bg.17.9.png
0 → 100644
602 Bytes
resources/images/selection-popup-bg.18.9.png
0 → 100644
490 Bytes
resources/images/selection-popup-bg.19.9.png
0 → 100644
574 Bytes
resources/images/selection-popup-bg.2.9.png
0 → 100644
755 Bytes
resources/images/selection-popup-bg.20.9.png
0 → 100644
634 Bytes
resources/images/selection-popup-bg.21.9.png
0 → 100644
632 Bytes
resources/images/selection-popup-bg.22.9.png
0 → 100644
622 Bytes
resources/images/selection-popup-bg.23.9.png
0 → 100644
610 Bytes
resources/images/selection-popup-bg.24.9.png
0 → 100644
593 Bytes
resources/images/selection-popup-bg.25.9.png
0 → 100644
562 Bytes
resources/images/selection-popup-bg.26.9.png
0 → 100644
614 Bytes
resources/images/selection-popup-bg.27.9.png
0 → 100644
615 Bytes
resources/images/selection-popup-bg.28.9.png
0 → 100644
537 Bytes
resources/images/selection-popup-bg.29.9.png
0 → 100644
625 Bytes
resources/images/selection-popup-bg.3.9.png
0 → 100644
708 Bytes
resources/images/selection-popup-bg.30.9.png
0 → 100644
500 Bytes
resources/images/selection-popup-bg.31.9.png
0 → 100644
535 Bytes
resources/images/selection-popup-bg.32.9.png
0 → 100644
619 Bytes
resources/images/selection-popup-bg.33.9.png
0 → 100644
628 Bytes
resources/images/selection-popup-bg.4.9.png
0 → 100644
672 Bytes
resources/images/selection-popup-bg.5.9.png
0 → 100644
657 Bytes
resources/images/selection-popup-bg.6.9.png
0 → 100644
538 Bytes
resources/images/selection-popup-bg.7.9.png
0 → 100644
487 Bytes
resources/images/selection-popup-bg.8.9.png
0 → 100644
497 Bytes
resources/images/selection-popup-bg.9.9.png
0 → 100644
511 Bytes
shared/dali-demo-strings.h
| ... | ... | @@ -60,6 +60,7 @@ extern "C" |
| 60 | 60 | #define DALI_DEMO_STR_TITLE_MESH_SORTING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_MESH_SORTING") |
| 61 | 61 | #define DALI_DEMO_STR_TITLE_TEXTURED_MESH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TEXTURED_MESH") |
| 62 | 62 | #define DALI_DEMO_STR_TITLE_LINE_MESH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_LINE_MESH") |
| 63 | +#define DALI_DEMO_STR_TITLE_COLOR_GRADIENT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_COLOR_GRADIENT") | |
| 63 | 64 | |
| 64 | 65 | #else // !INTERNATIONALIZATION_ENABLED |
| 65 | 66 | |
| ... | ... | @@ -92,6 +93,7 @@ extern "C" |
| 92 | 93 | #define DALI_DEMO_STR_TITLE_MESH_SORTING "Mesh Sorting" |
| 93 | 94 | #define DALI_DEMO_STR_TITLE_TEXTURED_MESH "Mesh Texture" |
| 94 | 95 | #define DALI_DEMO_STR_TITLE_LINE_MESH "Mesh Line" |
| 96 | +#define DALI_DEMO_STR_TITLE_COLOR_GRADIENT "Color Gradient" | |
| 95 | 97 | |
| 96 | 98 | #endif |
| 97 | 99 | ... | ... |