Commit 1ae1d7c57bd014617c14c71bd3982bf0a81e328b

Authored by Nick Holland
Committed by Paul Wisbey
1 parent 2ce65796

Remove examples using Deprecated SetImage( FrameBuffer ) API

Examples removed dali-examples:

super-blur-bloom-example
new-window-example
page-turn-view-example

Example removed from dali-demo

meta-ball-explosion & refrac

The meta ball demos will be reimplemented with the new rendering API

Change-Id: Ib3026a2dce5728c4adf28951fa8cd7b9139ec28b
demo/dali-demo.cpp
... ... @@ -43,8 +43,6 @@ int DALI_EXPORT_API main(int argc, char **argv)
43 43 demo.AddExample(Example("fpp-game.example", DALI_DEMO_STR_TITLE_FPP_GAME));
44 44 demo.AddExample(Example("item-view.example", DALI_DEMO_STR_TITLE_ITEM_VIEW));
45 45 demo.AddExample(Example("mesh-visual.example", DALI_DEMO_STR_TITLE_MESH_VISUAL));
46   - demo.AddExample(Example("metaball-explosion.example", DALI_DEMO_STR_TITLE_METABALL_EXPLOSION));
47   - demo.AddExample(Example("metaball-refrac.example", DALI_DEMO_STR_TITLE_METABALL_REFRAC));
48 46 demo.AddExample(Example("motion-blur.example", DALI_DEMO_STR_TITLE_MOTION_BLUR));
49 47 demo.AddExample(Example("refraction-effect.example", DALI_DEMO_STR_TITLE_REFRACTION));
50 48 demo.AddExample(Example("renderer-stencil.example", DALI_DEMO_STR_TITLE_RENDERER_STENCIL));
... ...
examples-reel/dali-examples-reel.cpp
... ... @@ -58,14 +58,12 @@ int DALI_EXPORT_API main(int argc, char **argv)
58 58 demo.AddExample(Example("mesh-sorting.example", DALI_DEMO_STR_TITLE_MESH_SORTING));
59 59 demo.AddExample(Example("motion-stretch.example", DALI_DEMO_STR_TITLE_MOTION_STRETCH));
60 60 demo.AddExample(Example("native-image-source.example", DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE));
61   - demo.AddExample(Example("page-turn-view.example", DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW));
62 61 demo.AddExample(Example("popup.example", DALI_DEMO_STR_TITLE_POPUP));
63 62 demo.AddExample(Example("primitive-shapes.example", DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES));
64 63 demo.AddExample(Example("progress-bar.example", DALI_DEMO_STR_TITLE_PROGRESS_BAR));
65 64 demo.AddExample(Example("scroll-view.example", DALI_DEMO_STR_TITLE_SCROLL_VIEW));
66 65 demo.AddExample(Example("size-negotiation.example", DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE));
67 66 demo.AddExample(Example("styling.example", DALI_DEMO_STR_TITLE_STYLING));
68   - demo.AddExample(Example("super-blur-bloom.example", DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM));
69 67 demo.AddExample(Example("text-editor.example", DALI_DEMO_STR_TITLE_TEXT_EDITOR));
70 68 demo.AddExample(Example("text-field.example", DALI_DEMO_STR_TITLE_TEXT_FIELD));
71 69 demo.AddExample(Example("text-label.example", DALI_DEMO_STR_TITLE_TEXT_LABEL));
... ...
examples/metaball-explosion/metaball-explosion-example.cpp deleted
1   -/*
2   - * Copyright (c) 2016 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   -// EXTERNAL INCLUDES
19   -#include <cstdio>
20   -#include <string>
21   -#include <dali/dali.h>
22   -#include <dali/devel-api/images/texture-set-image.h>
23   -#include <dali/public-api/rendering/renderer.h>
24   -#include <dali-toolkit/dali-toolkit.h>
25   -#include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
26   -
27   -// INTERNAL INCLUDES
28   -#include "shared/view.h"
29   -#include "shared/utility.h"
30   -
31   -using namespace Dali;
32   -using namespace Dali::Toolkit;
33   -
34   -namespace
35   -{
36   -const char * const BACKGROUND_IMAGE( DEMO_IMAGE_DIR "background-2.jpg" );
37   -const char * const TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" );
38   -
39   -const float GRAVITY_X(0);
40   -const float GRAVITY_Y(-0.09);
41   -}
42   -
43   -#define METABALL_NUMBER 6
44   -
45   -
46   -const char*const METABALL_VERTEX_SHADER = DALI_COMPOSE_SHADER (
47   - attribute mediump vec2 aPosition;\n
48   - attribute mediump vec2 aTexture;\n
49   - uniform mediump mat4 uMvpMatrix;\n
50   - uniform mediump vec3 uSize;\n
51   - uniform lowp vec4 uColor;\n
52   - varying mediump vec2 vTexCoord;\n
53   -
54   - void main()\n
55   - {\n
56   - vTexCoord = aTexture;\n
57   - mediump vec4 vertexPosition = vec4(aPosition.x, aPosition.y, 0.0, 1.0);\n
58   - gl_Position = uMvpMatrix * vertexPosition;\n
59   - }\n
60   -);
61   -
62   -
63   -const char*const METABALL_FRAG_SHADER = DALI_COMPOSE_SHADER (
64   - precision mediump float;\n
65   - varying vec2 vTexCoord;\n
66   - uniform vec2 uPositionMetaball;\n
67   - uniform vec2 uPositionVar;\n
68   - uniform vec2 uGravityVector;\n
69   - uniform float uRadius;\n
70   - uniform float uRadiusVar;\n
71   - void main()\n
72   - {\n
73   - vec2 adjustedCoords = vTexCoord * 2.0 - 1.0;\n
74   - vec2 finalMetaballPosition = uPositionMetaball + uGravityVector + uPositionVar;\n
75   - \n
76   - float finalRadius = uRadius + uRadiusVar;\n
77   - vec2 distanceVec = adjustedCoords - finalMetaballPosition;\n
78   - float result = dot(distanceVec, distanceVec);\n
79   - float color = inversesqrt(result) * finalRadius;\n
80   - \n
81   - gl_FragColor = vec4(color,color,color,1.0);\n
82   - }\n
83   -);
84   -
85   -const char*const REFRACTION_FRAG_SHADER = DALI_COMPOSE_SHADER (
86   - precision highp float;\n
87   - varying vec2 vTexCoord;\n
88   - uniform sampler2D sTexture;\n
89   - uniform sampler2D sEffect;\n
90   - uniform vec2 uPositionMetaball;\n
91   - void main()\n
92   - {\n
93   - vec2 zoomCoords;\n
94   - vec3 normal = vec3(0.0,0.0,1.0);\n
95   - vec2 fakePos = vec2(0.0,0.0);\n
96   - vec3 color = vec3(1.0, 1.0, 1.0);
97   - float ambient = 0.2;
98   - \n
99   - vec4 metaColor = texture2D(sEffect, vTexCoord);\n
100   - \n
101   - vec2 adjustedCoords = vTexCoord.xy * vec2(2.0) - vec2(1.0);\n
102   - fakePos = adjustedCoords.xy - vec2(uPositionMetaball.x, -uPositionMetaball.y);
103   - float len = length(fakePos) + 0.01;\n
104   - vec3 colorPos = vec3(0,0,1);
105   - \n
106   - if (metaColor.r > 0.85)\n
107   - {\n
108   - zoomCoords = ((vTexCoord - 0.5) * 0.9);\n
109   - zoomCoords = zoomCoords + 0.5;\n
110   - \n
111   - float interpNormal = mix(0.7, 1.0, (metaColor.r - 0.85) * 4.);\n
112   - normal.xyz = vec3(fakePos.x * (1.0 - interpNormal) / len, fakePos.y * (1.0 - interpNormal) / len, interpNormal);\n
113   - normal.xyz = normalize(normal.xyz);\n
114   - color = vec3(0.65, 1.0, 0);\n
115   - colorPos = vec3(fakePos.x,fakePos.y,0);
116   - }\n
117   - else if (metaColor.r > 0.75)\n
118   - {\n
119   - float interpolation = mix(0.9, 1.15, (0.85 - metaColor.r) * 10.0);\n
120   - zoomCoords = ((vTexCoord - 0.5) * interpolation);\n
121   - zoomCoords = zoomCoords + 0.5;\n
122   - \n
123   - float interpNormal = mix(0.7, 0.0, (0.85 - metaColor.r) * 10.0);\n
124   - normal.xyz = vec3(fakePos.x * (1.0 - interpNormal) / len, fakePos.y * (1.0 - interpNormal) / len, interpNormal);\n
125   - normal.xyz = normalize(normal.xyz);\n
126   - color = vec3(0.65, 1.0, 0);\n
127   - colorPos = vec3(fakePos.x,fakePos.y,0);
128   - }\n
129   - else\n
130   - {\n
131   - zoomCoords = vTexCoord;\n
132   - normal = vec3(0,0,0);\n
133   - ambient = 0.5;\n
134   - }\n
135   - \n
136   - vec3 lightPosition = vec3(-750.0,-1000.0,2000.0);\n
137   - vec3 vertex = vec3(adjustedCoords.x,adjustedCoords.y,0.0);\n
138   - \n
139   - vec3 vecToLight = normalize( lightPosition - vertex );\n
140   - \n
141   - float lightDiffuse = dot( vecToLight, normal );\n
142   - lightDiffuse = max(0.0,lightDiffuse);\n
143   - lightDiffuse = lightDiffuse * 0.5 + 0.5;
144   - \n
145   - vec3 vertexToEye = vec3(0,0,1) - vertex;\n
146   - vertexToEye = normalize(vertexToEye);
147   - vec3 lightReflect = normalize(reflect(-vecToLight, normal));\n
148   - float specularFactor = max(0.0,dot(vertexToEye, lightReflect));\n
149   - specularFactor = pow(specularFactor, 32.0) * 0.7;
150   - \n
151   - vec4 texColor = texture2D(sTexture, zoomCoords);\n
152   - gl_FragColor.rgb = texColor.rgb * ambient + color.rgb * texColor.rgb * lightDiffuse + vec3(specularFactor);\n
153   - gl_FragColor.a = 1.0;
154   - }\n
155   - );
156   -
157   -const char*const FRAG_SHADER = DALI_COMPOSE_SHADER (
158   - precision mediump float;\n
159   - void main()\n
160   - {\n
161   - gl_FragColor = texture2D(sTexture, vTexCoord);\n
162   - }\n
163   -);
164   -
165   -
166   -struct MetaballInfo
167   -{
168   - Actor actor;
169   - Vector2 position;
170   - float radius;
171   - float initRadius;
172   -
173   - //new shader stuff
174   - Property::Index positionIndex;
175   - Property::Index positionVarIndex;
176   -};
177   -
178   -
179   -/**************************************************************************/
180   -/* Demo using Metaballs ***********/
181   -/* When the metaball is clicked it explodes in different balls ***********/
182   -/**************************************************************************/
183   -class MetaballExplosionController : public ConnectionTracker
184   -{
185   -public:
186   - MetaballExplosionController( Application& application );
187   - ~MetaballExplosionController();
188   -
189   - /**
190   - * Main create function, it creates the metaballs and all the related data
191   - */
192   - void Create( Application& app );
193   -
194   - /**
195   - * Touch event function
196   - */
197   - bool OnTouch( Actor actor, const TouchData& touch );
198   -
199   - /**
200   - * Key event function
201   - */
202   - void OnKeyEvent(const KeyEvent& event);
203   -
204   -
205   -private:
206   - Application& mApplication;
207   - Vector2 mScreenSize;
208   -
209   - Layer mContentLayer;
210   -
211   - Image mBackImage;
212   - FrameBufferImage mMetaballFBO;
213   -
214   - Actor mMetaballRoot;
215   - MetaballInfo mMetaballs[METABALL_NUMBER];
216   -
217   - Property::Index mPositionIndex;
218   - Actor mCompositionActor;
219   -
220   - //Motion
221   - Vector2 mCurrentTouchPosition;
222   - Vector2 mMetaballPosVariation;
223   - Vector2 mMetaballPosVariationFrom;
224   - Vector2 mMetaballPosVariationTo;
225   - Vector2 mMetaballCenter;
226   -
227   - //Animations
228   - Animation mPositionVarAnimation[METABALL_NUMBER];
229   -
230   - int mDispersion;
231   - Animation mDispersionAnimation[METABALL_NUMBER];
232   -
233   - Timer mTimerDispersion;
234   -
235   - float mTimeMult;
236   -
237   - //Private functions
238   -
239   - /**
240   - * Create a mesh data with the geometry for the metaball rendering
241   - */
242   - Geometry CreateGeometry();
243   -
244   - /**
245   - * Create a mesh data with the geometry for the final composition
246   - */
247   - Geometry CreateGeometryComposition();
248   -
249   - /**
250   - * Create a mesh actor for the metaballs
251   - */
252   - void CreateMetaballActors();
253   -
254   - /**
255   - * Create the render task and FBO to render the metaballs into a texture
256   - */
257   - void CreateMetaballImage();
258   -
259   - /**
260   - * Create a mesh image to render the final composition
261   - */
262   - void AddRefractionImage();
263   -
264   - /**
265   - * Function to create animations for the small variations of position inside the metaball
266   - */
267   - void CreateAnimations();
268   -
269   - /**
270   - * Function to reset metaball state
271   - */
272   - void ResetMetaballs(bool resetAnims);
273   -
274   - /**
275   - * Function to create disperse each of the ball that compose the metaball when exploding
276   - */
277   - void DisperseBallAnimation(int ball);
278   -
279   - /**
280   - * Function to make metaballs come back to reset position
281   - */
282   - void LaunchResetMetaballPosition(Animation &source);
283   -
284   - /**
285   - * Function to set things at the end of the animation
286   - */
287   - void EndDisperseAnimation(Animation &source);
288   -
289   - /**
290   - * Function to init dispersion of the metaballs one by one using a timer
291   - * (so not all the balls begin moving at the same time)
292   - */
293   - bool OnTimerDispersionTick();
294   -
295   - /**
296   - * Function to set the actual position of the metaballs when the user clicks the screen
297   - */
298   - void SetPositionToMetaballs(Vector2 & metaballCenter);
299   -};
300   -
301   -
302   -//-----------------------------------------------------------------------------------------------
303   -//
304   -// IMPLEMENTATION
305   -//
306   -//----------------
307   -
308   -MetaballExplosionController::MetaballExplosionController( Application& application )
309   -: mApplication( application ),
310   - mScreenSize(),
311   - mContentLayer(),
312   - mBackImage(),
313   - mMetaballFBO(),
314   - mMetaballRoot(),
315   - mMetaballs(),
316   - mPositionIndex(),
317   - mCompositionActor(),
318   - mCurrentTouchPosition(),
319   - mMetaballPosVariation(),
320   - mMetaballPosVariationFrom(),
321   - mMetaballPosVariationTo(),
322   - mMetaballCenter(),
323   - mPositionVarAnimation(),
324   - mDispersion( 0 ),
325   - mDispersionAnimation(),
326   - mTimerDispersion(),
327   - mTimeMult( 1.0f )
328   -{
329   - // Connect to the Application's Init signal
330   - mApplication.InitSignal().Connect( this, &MetaballExplosionController::Create );
331   -}
332   -
333   -MetaballExplosionController::~MetaballExplosionController()
334   -{
335   - // Nothing to do here;
336   -}
337   -
338   -void MetaballExplosionController::Create( Application& app )
339   -{
340   - Stage stage = Stage::GetCurrent();
341   -
342   - stage.KeyEventSignal().Connect(this, &MetaballExplosionController::OnKeyEvent);
343   -
344   - mScreenSize = stage.GetSize();
345   -
346   - mTimeMult = 1.0f;
347   -
348   - stage.SetBackgroundColor(Color::BLACK);
349   -
350   - //Set background image for the view
351   - mBackImage = DemoHelper::LoadImage( BACKGROUND_IMAGE );
352   -
353   - srand((unsigned)time(0));
354   -
355   - //Create internal data
356   - CreateMetaballActors();
357   - CreateMetaballImage();
358   - AddRefractionImage();
359   -
360   - CreateAnimations();
361   -
362   - mDispersion = 0;
363   - mTimerDispersion = Timer::New( 150 );
364   - mTimerDispersion.TickSignal().Connect(this, &MetaballExplosionController::OnTimerDispersionTick);
365   -
366   - // Connect the callback to the touch signal on the mesh actor
367   - stage.GetRootLayer().TouchSignal().Connect( this, &MetaballExplosionController::OnTouch );
368   -}
369   -
370   -Geometry MetaballExplosionController::CreateGeometry()
371   -{
372   - float aspect = (float)mScreenSize.y / (float)mScreenSize.x;
373   -
374   - // Create vertices and specify their color
375   - float xsize = mScreenSize.x * 0.5;
376   -
377   - //We create the meshdata for the metaballs
378   - struct VertexPosition { Vector2 position; };
379   - struct VertexTexture { Vector2 texture; };
380   - struct VertexNormal { Vector3 normal; };
381   -
382   - VertexPosition vertices[] = {
383   - { Vector2( -xsize, -xsize * aspect) },
384   - { Vector2( xsize, -xsize * aspect) },
385   - { Vector2( -xsize, xsize * aspect) },
386   - { Vector2( xsize, xsize * aspect) }
387   - };
388   -
389   - VertexTexture textures[] = {
390   - { Vector2(0.0f, 0.0f) },
391   - { Vector2(1.0f, 0.0f) },
392   - { Vector2(0.0f, 1.0f * aspect) },
393   - { Vector2(1.0f, 1.0f * aspect) }
394   - };
395   -
396   - unsigned int numberOfVertices = sizeof(vertices)/sizeof(VertexPosition);
397   -
398   - //Vertices
399   - Property::Map positionVertexFormat;
400   - positionVertexFormat["aPosition"] = Property::VECTOR2;
401   - PropertyBuffer positionVertices = PropertyBuffer::New( positionVertexFormat );
402   - positionVertices.SetData( vertices, numberOfVertices );
403   -
404   - //Textures
405   - Property::Map textureVertexFormat;
406   - textureVertexFormat["aTexture"] = Property::VECTOR2;
407   - PropertyBuffer textureVertices = PropertyBuffer::New( textureVertexFormat );
408   - textureVertices.SetData( textures, numberOfVertices );
409   -
410   - //Indices
411   - unsigned short indices[] = { 0, 3, 1, 0, 2, 3 };
412   -
413   - // Create the geometry object
414   - Geometry texturedQuadGeometry = Geometry::New();
415   - texturedQuadGeometry.AddVertexBuffer( positionVertices );
416   - texturedQuadGeometry.AddVertexBuffer( textureVertices );
417   -
418   - texturedQuadGeometry.SetIndexBuffer ( &indices[0], sizeof( indices )/ sizeof( indices[0] ) );
419   -
420   - return texturedQuadGeometry;
421   -}
422   -
423   -Geometry MetaballExplosionController::CreateGeometryComposition()
424   -{
425   - float aspect = (float)mScreenSize.y / (float)mScreenSize.x;
426   -
427   - // Create vertices and specify their color
428   - float xsize = mScreenSize.x * 0.5;
429   -
430   - //We create the meshdata for the metaballs
431   - struct VertexPosition { Vector2 position; };
432   - struct VertexTexture { Vector2 texture; };
433   - struct VertexNormal { Vector3 normal; };
434   -
435   - VertexPosition vertices[] = {
436   - { Vector2( -xsize, -xsize * aspect) },
437   - { Vector2( xsize, -xsize * aspect) },
438   - { Vector2( -xsize, xsize * aspect) },
439   - { Vector2( xsize, xsize * aspect) }
440   - };
441   -
442   - VertexTexture textures[] = {
443   - { Vector2(0.0f, 0.0f) },
444   - { Vector2(1.0f, 0.0f) },
445   - { Vector2(0.0f, 1.0f) },
446   - { Vector2(1.0f, 1.0f) }
447   - };
448   -
449   - unsigned int numberOfVertices = sizeof(vertices)/sizeof(VertexPosition);
450   -
451   - //Vertices
452   - Property::Map positionVertexFormat;
453   - positionVertexFormat["aPosition"] = Property::VECTOR2;
454   - PropertyBuffer positionVertices = PropertyBuffer::New( positionVertexFormat );
455   - positionVertices.SetData( vertices, numberOfVertices );
456   -
457   - //Textures
458   - Property::Map textureVertexFormat;
459   - textureVertexFormat["aTexture"] = Property::VECTOR2;
460   - PropertyBuffer textureVertices = PropertyBuffer::New( textureVertexFormat );
461   - textureVertices.SetData( textures, numberOfVertices );
462   -
463   - //Indices
464   - unsigned short indices[] = { 0, 3, 1, 0, 2, 3 };
465   -
466   - // Create the geometry object
467   - Geometry texturedQuadGeometry = Geometry::New();
468   - texturedQuadGeometry.AddVertexBuffer( positionVertices );
469   - texturedQuadGeometry.AddVertexBuffer( textureVertices );
470   -
471   - texturedQuadGeometry.SetIndexBuffer ( &indices[0], sizeof( indices )/ sizeof( indices[0] ) );
472   -
473   - return texturedQuadGeometry;
474   -}
475   -
476   -float randomNumber(float lowest, float highest)
477   -{
478   - float range=(highest-lowest);
479   - return lowest+range*rand()/RAND_MAX;
480   -}
481   -
482   -void MetaballExplosionController::CreateMetaballActors()
483   -{
484   - //Create the shader for the metaballs
485   - Shader shader = Shader::New( METABALL_VERTEX_SHADER, METABALL_FRAG_SHADER );
486   -
487   - Geometry metaballGeom = CreateGeometry();
488   - Renderer renderer = Renderer::New( metaballGeom, shader );
489   - renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
490   - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::ONE );
491   - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::ONE );
492   - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::ONE );
493   - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::ONE );
494   -
495   - //Initialization of each of the metaballs
496   - for( int i = 0; i < METABALL_NUMBER; i++ )
497   - {
498   - mMetaballs[i].position = Vector2(0.0f, 0.0f);
499   - mMetaballs[i].radius = mMetaballs[i].initRadius = randomNumber(0.05f,0.07f);
500   -
501   - mMetaballs[i].actor = Actor::New( );
502   - mMetaballs[i].actor.SetName("Metaball");
503   - mMetaballs[i].actor.SetScale( 1.0f );
504   - mMetaballs[i].actor.SetParentOrigin( ParentOrigin::CENTER );
505   - mMetaballs[i].actor.AddRenderer( renderer );
506   -
507   - mMetaballs[i].positionIndex = mMetaballs[i].actor.RegisterProperty( "uPositionMetaball", mMetaballs[i].position );
508   -
509   - mMetaballs[i].positionVarIndex = mMetaballs[i].actor.RegisterProperty( "uPositionVar", Vector2(0.f,0.f) );
510   -
511   - mMetaballs[i].actor.RegisterProperty( "uGravityVector", Vector2(randomNumber(-0.2,0.2),randomNumber(-0.2,0.2)) );
512   -
513   - mMetaballs[i].actor.RegisterProperty( "uRadius", mMetaballs[i].radius );
514   -
515   - mMetaballs[i].actor.RegisterProperty( "uRadiusVar", 0.f );
516   -
517   - mMetaballs[i].actor.SetSize(400, 400);
518   - }
519   -
520   - //Root creation
521   - mMetaballRoot = Actor::New();
522   - mMetaballRoot.SetParentOrigin( ParentOrigin::CENTER );
523   - for( int i = 0; i < METABALL_NUMBER; i++ )
524   - {
525   - mMetaballRoot.Add( mMetaballs[i].actor );
526   - }
527   -
528   - //Initialization of variables related to metaballs
529   - mMetaballPosVariation = Vector2(0,0);
530   - mMetaballPosVariationFrom = Vector2(0,0);
531   - mMetaballPosVariationTo = Vector2(0,0);
532   - mCurrentTouchPosition = Vector2(0,0);
533   -}
534   -
535   -void MetaballExplosionController::CreateMetaballImage()
536   -{
537   - //We create an FBO and a render task to create to render the metaballs with a fragment shader
538   - Stage stage = Stage::GetCurrent();
539   - mMetaballFBO = FrameBufferImage::New(mScreenSize.x, mScreenSize.y, Pixel::RGBA8888, RenderBuffer::COLOR_DEPTH);
540   -
541   -
542   - stage.Add(mMetaballRoot);
543   -
544   - //Creation of the render task used to render the metaballs
545   - RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
546   - RenderTask task = taskList.CreateTask();
547   - task.SetRefreshRate( RenderTask::REFRESH_ALWAYS );
548   - task.SetSourceActor( mMetaballRoot );
549   - task.SetExclusive(true);
550   - task.SetClearColor( Color::BLACK );
551   - task.SetClearEnabled( true );
552   - task.SetTargetFrameBuffer( mMetaballFBO );
553   -}
554   -
555   -void MetaballExplosionController::AddRefractionImage()
556   -{
557   - //Create Gaussian blur for the rendered image
558   - FrameBufferImage fbo;
559   - fbo = FrameBufferImage::New( mScreenSize.x, mScreenSize.y, Pixel::RGBA8888, RenderBuffer::COLOR_DEPTH);
560   -
561   - GaussianBlurView gbv = GaussianBlurView::New(5, 2.0f, Pixel::RGBA8888, 0.5f, 0.5f, true);
562   - gbv.SetBackgroundColor(Color::TRANSPARENT);
563   - gbv.SetUserImageAndOutputRenderTarget( mMetaballFBO, fbo );
564   - gbv.SetSize(mScreenSize.x, mScreenSize.y);
565   - Stage::GetCurrent().Add(gbv);
566   - gbv.Activate();
567   -
568   - //Create new shader
569   - Shader shader = Shader::New( METABALL_VERTEX_SHADER, REFRACTION_FRAG_SHADER );
570   -
571   - //Create new texture set
572   - TextureSet textureSet = TextureSet::New();
573   - TextureSetImage( textureSet, 0u, mBackImage );
574   - TextureSetImage( textureSet, 1u, fbo );
575   -
576   - //Create geometry
577   - Geometry metaballGeom = CreateGeometryComposition();
578   -
579   - Renderer mRenderer = Renderer::New( metaballGeom, shader );
580   - mRenderer.SetTextures( textureSet );
581   -
582   - mCompositionActor = Actor::New( );
583   - mCompositionActor.SetParentOrigin(ParentOrigin::CENTER);
584   - mCompositionActor.SetPosition(Vector3(0.0f, 0.0f, 0.0f));
585   - mCompositionActor.SetSize(mScreenSize.x, mScreenSize.y);
586   -
587   - mCompositionActor.AddRenderer( mRenderer );
588   -
589   - Vector2 metaballCenter(0.0,0);
590   - metaballCenter.x = metaballCenter.x * 0.5;
591   - metaballCenter.y = metaballCenter.y * 0.5;
592   -
593   - mPositionIndex = mCompositionActor.RegisterProperty( "uPositionMetaball", metaballCenter );
594   -
595   - SetPositionToMetaballs(metaballCenter);
596   -
597   - mCompositionActor.SetSize(mScreenSize.x, mScreenSize.y);
598   -
599   - Stage stage = Stage::GetCurrent();
600   - stage.Add( mCompositionActor );
601   -}
602   -
603   -void MetaballExplosionController::CreateAnimations()
604   -{
605   - Vector2 direction;
606   -
607   - for( int i = 0; i < METABALL_NUMBER; i++ )
608   - {
609   - float key;
610   - KeyFrames keySinCosVariation = KeyFrames::New();
611   - Vector2 sinCosVariation(0,0);
612   -
613   - direction.x = randomNumber(-100.f,100.f);
614   - direction.y = randomNumber(-100.f,100.f);
615   -
616   - direction.Normalize();
617   - direction *= 0.1f;
618   -
619   - for( int j = 0; j < 360; j++ )
620   - {
621   - sinCosVariation.x = sin(j * Math::PI/180.f) * direction.x;
622   - sinCosVariation.y = cos(j * Math::PI/180.f) * direction.y;
623   - key = j/360.f;
624   - keySinCosVariation.Add(key, sinCosVariation);
625   - }
626   -
627   - mPositionVarAnimation[i] = Animation::New(3.f);
628   - mPositionVarAnimation[i].AnimateBetween(Property( mMetaballs[i].actor, mMetaballs[i].positionVarIndex ), keySinCosVariation);
629   - mPositionVarAnimation[i].SetLooping( true );
630   - mPositionVarAnimation[i].Play();
631   - }
632   -}
633   -
634   -void MetaballExplosionController::ResetMetaballs(bool resetAnims)
635   -{
636   - for( int i = 0; i < METABALL_NUMBER; i++ )
637   - {
638   - if (mDispersionAnimation[i])
639   - mDispersionAnimation[i].Clear();
640   -
641   - mMetaballs[i].position = Vector2(0.0f, 0.0f);
642   - mMetaballs[i].actor.SetProperty(mMetaballs[i].positionIndex, mMetaballs[i].position);
643   - }
644   - mTimerDispersion.Stop();
645   - mDispersion = 0;
646   -
647   - mCompositionActor.SetProperty( mPositionIndex, Vector2(0,0) );
648   -}
649   -
650   -void MetaballExplosionController::DisperseBallAnimation(int ball)
651   -{
652   - Vector2 position;
653   - position.x = randomNumber(-1.5f,1.5f);
654   - position.y = randomNumber(-1.5f,1.5f);
655   -
656   - mDispersionAnimation[ball] = Animation::New(2.0f * mTimeMult);
657   - mDispersionAnimation[ball].AnimateTo( Property(mMetaballs[ball].actor, mMetaballs[ball].positionIndex), position);
658   - mDispersionAnimation[ball].Play();
659   -
660   - if( ball == METABALL_NUMBER - 1 )
661   - mDispersionAnimation[ball].FinishedSignal().Connect( this, &MetaballExplosionController::LaunchResetMetaballPosition );
662   -}
663   -
664   -void MetaballExplosionController::LaunchResetMetaballPosition(Animation &source)
665   -{
666   - for( int i = 0; i < METABALL_NUMBER; i++ )
667   - {
668   - mDispersionAnimation[i] = Animation::New(1.5f + i*0.25f*mTimeMult);
669   - mDispersionAnimation[i].AnimateTo(Property(mMetaballs[i].actor, mMetaballs[i].positionIndex), Vector2(0,0));
670   - mDispersionAnimation[i].Play();
671   -
672   - if( i == METABALL_NUMBER - 1 )
673   - mDispersionAnimation[i].FinishedSignal().Connect( this, &MetaballExplosionController::EndDisperseAnimation );
674   - }
675   -}
676   -
677   -void MetaballExplosionController::EndDisperseAnimation(Animation &source)
678   -{
679   - mCompositionActor.SetProperty( mPositionIndex, Vector2(0,0) );
680   -}
681   -
682   -bool MetaballExplosionController::OnTimerDispersionTick()
683   -{
684   - if( mDispersion < METABALL_NUMBER )
685   - {
686   - DisperseBallAnimation(mDispersion);
687   - mDispersion++;
688   - }
689   - return true;
690   -}
691   -
692   -void MetaballExplosionController::SetPositionToMetaballs(Vector2 & metaballCenter)
693   -{
694   - //We set the position for the metaballs based on click position
695   - for( int i = 0; i < METABALL_NUMBER; i++ )
696   - {
697   - mMetaballs[i].position = metaballCenter;
698   - mMetaballs[i].actor.SetProperty(mMetaballs[i].positionIndex, mMetaballs[i].position);
699   - }
700   -
701   - mCompositionActor.SetProperty( mPositionIndex, metaballCenter );
702   -}
703   -
704   -bool MetaballExplosionController::OnTouch( Actor actor, const TouchData& touch )
705   -{
706   - float aspectR = mScreenSize.y / mScreenSize.x;
707   -
708   - switch( touch.GetState( 0 ) )
709   - {
710   - case PointState::DOWN:
711   - {
712   - ResetMetaballs(true);
713   -
714   - const Vector2 screen = touch.GetScreenPosition( 0 );
715   - Vector2 metaballCenter = Vector2((screen.x / mScreenSize.x) - 0.5, (aspectR * (mScreenSize.y - screen.y) / mScreenSize.y) - 0.5) * 2.0;
716   - SetPositionToMetaballs(metaballCenter);
717   -
718   - break;
719   - }
720   - case PointState::MOTION:
721   - {
722   - const Vector2 screen = touch.GetScreenPosition( 0 );
723   - Vector2 metaballCenter = Vector2((screen.x / mScreenSize.x) - 0.5, (aspectR * (mScreenSize.y - screen.y) / mScreenSize.y) - 0.5) * 2.0;
724   - SetPositionToMetaballs(metaballCenter);
725   - break;
726   - }
727   - case PointState::UP:
728   - case PointState::LEAVE:
729   - case PointState::INTERRUPTED:
730   - {
731   - mTimerDispersion.Start();
732   - break;
733   - }
734   - default:
735   - break;
736   - }
737   - return true;
738   -}
739   -
740   -void MetaballExplosionController::OnKeyEvent(const KeyEvent& event)
741   -{
742   - if(event.state == KeyEvent::Down)
743   - {
744   - if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
745   - {
746   - mApplication.Quit();
747   - }
748   - }
749   -}
750   -
751   -
752   -//-----------------------------------------------------------------------------------------------
753   -//
754   -// Main functions
755   -//
756   -//-----------------------------------------------------------------------------------------------
757   -
758   -void RunTest( Application& application )
759   -{
760   - MetaballExplosionController test( application );
761   -
762   - application.MainLoop();
763   -}
764   -
765   -// Entry point for Linux & Tizen applications
766   -//
767   -int DALI_EXPORT_API main( int argc, char **argv )
768   -{
769   - Application application = Application::New( &argc, &argv );
770   -
771   - RunTest( application );
772   -
773   - return 0;
774   -}
examples/metaball-refrac/metaball-refrac-example.cpp deleted
1   -/*
2   - * Copyright (c) 2016 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/dali.h>
19   -#include <dali/devel-api/images/texture-set-image.h>
20   -#include <dali/public-api/rendering/renderer.h>
21   -#include <dali-toolkit/dali-toolkit.h>
22   -
23   -#include <cstdio>
24   -#include <string>
25   -#include "shared/utility.h"
26   -
27   -using namespace Dali;
28   -using namespace Dali::Toolkit;
29   -
30   -namespace
31   -{
32   -const char * const BACKGROUND_IMAGE( DEMO_IMAGE_DIR "background-2.jpg" );
33   -const char * const TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" );
34   -
35   -const float GRAVITY_X(0);
36   -const float GRAVITY_Y(-0.09);
37   -}
38   -
39   -#define METABALL_NUMBER 4
40   -
41   -const char*const METABALL_VERTEX_SHADER = DALI_COMPOSE_SHADER (
42   - attribute mediump vec2 aPosition;\n
43   - attribute mediump vec2 aTexture;\n
44   - attribute mediump vec3 aNormal;\n
45   - uniform mediump mat4 uMvpMatrix;\n
46   - uniform mediump vec3 uSize;\n
47   - uniform lowp vec4 uColor;\n
48   - varying mediump vec2 vTexCoord;\n
49   -
50   - void main()\n
51   - {\n
52   - mediump vec4 vertexPosition = vec4(aPosition.x, aPosition.y, 0.0, 1.0);\n
53   - vertexPosition = uMvpMatrix * vertexPosition;\n
54   - gl_Position = vertexPosition;\n
55   - vTexCoord = aTexture;\n
56   - }\n
57   -);
58   -
59   -
60   -const char*const METABALL_FRAG_SHADER = DALI_COMPOSE_SHADER (
61   - precision mediump float;\n
62   - varying vec2 vTexCoord;\n
63   - uniform vec2 uPositionMetaball;\n
64   - uniform vec2 uPositionVar;\n
65   - uniform vec2 uGravityVector;\n
66   - uniform float uRadius;\n
67   - uniform float uRadiusVar;\n
68   - uniform float uAspect;\n
69   - void main()\n
70   - {\n
71   - vec2 adjustedCoords = vTexCoord * 2.0 - 1.0;\n
72   - vec2 finalMetaballPosition = uPositionMetaball + uGravityVector + uPositionVar;\n
73   -
74   - float distance = (adjustedCoords.x - finalMetaballPosition.x) * (adjustedCoords.x - finalMetaballPosition.x) +
75   - (adjustedCoords.y - finalMetaballPosition.y) * (adjustedCoords.y - finalMetaballPosition.y);\n
76   - float finalRadius = uRadius + uRadiusVar;\n
77   - float color = finalRadius / sqrt( distance );\n
78   - vec2 bordercolor = vec2(0.0,0.0);\n
79   - if (vTexCoord.x < 0.1)\n
80   - {\n
81   - bordercolor.x = (0.1 - vTexCoord.x) * 0.8;\n
82   - }\n
83   - if (vTexCoord.x > 0.9)\n
84   - {\n
85   - bordercolor.x = (vTexCoord.x - 0.9) * 0.8;\n
86   - }\n
87   - if (vTexCoord.y < 0.1)\n
88   - {\n
89   - bordercolor.y = (0.1 - vTexCoord.y) * 0.8;\n
90   - }\n
91   - if (vTexCoord.y > (0.9 * uAspect))\n
92   - {\n
93   - bordercolor.y = (vTexCoord.y - (0.9 * uAspect)) * 0.8;\n
94   - }\n
95   - float border = (bordercolor.x + bordercolor.y) * 0.5;\n
96   - gl_FragColor = vec4(color + border,color + border,color + border,1.0);\n
97   - }\n
98   -);
99   -
100   -const char*const REFRACTION_FRAG_SHADER = DALI_COMPOSE_SHADER (
101   - precision mediump float;\n
102   - varying vec2 vTexCoord;\n
103   - uniform sampler2D sTexture;\n
104   - uniform sampler2D sEffect;\n
105   - void main()\n
106   - {\n
107   - vec4 metaColor = texture2D(sEffect, vTexCoord);\n
108   - vec2 zoomCoords;\n
109   - float bright = 1.0;\n
110   - if (metaColor.r > 0.85)\n
111   - {\n
112   - zoomCoords = ((vTexCoord - 0.5) * 0.95) + 0.5;\n
113   - }\n
114   - else if (metaColor.r > 0.81)\n
115   - {\n
116   - float interpolation = mix(0.95, 1.05, (0.85 - metaColor.r) * 50.0);\n
117   - zoomCoords = ((vTexCoord - 0.5) * interpolation) + 0.5;\n
118   - bright = 1.2;\n
119   - }\n
120   - else\n
121   - {\n
122   - zoomCoords = vTexCoord;\n
123   - }\n
124   -
125   - gl_FragColor = texture2D(sTexture, zoomCoords) * bright;\n
126   - }\n
127   - );
128   -
129   -const char*const FRAG_SHADER = DALI_COMPOSE_SHADER (
130   - precision mediump float;\n
131   - varying vec2 vTexCoord;\n
132   - uniform sampler2D sTexture;\n
133   - void main()\n
134   - {\n
135   - gl_FragColor = texture2D(sTexture, vTexCoord);\n
136   - }\n
137   -);
138   -
139   -
140   -struct MetaballInfo
141   -{
142   - Actor actor;
143   - Vector2 position;
144   - float radius;
145   - float initRadius;
146   -
147   - //Properties needed for animations
148   - Property::Index positionIndex;
149   - Property::Index positionVarIndex;
150   - Property::Index gravityIndex;
151   - Property::Index radiusIndex;
152   - Property::Index radiusVarIndex;
153   - Property::Index aspectIndex;
154   -};
155   -
156   -
157   -/***************************************************************************/
158   -/* Demo using Metaballs for Refraction when clicking the screen ************/
159   -/* The concept is similar to the Note 5 ScreenLock ************/
160   -/***************************************************************************/
161   -class MetaballRefracController : public ConnectionTracker
162   -{
163   -public:
164   - MetaballRefracController( Application& application );
165   - ~MetaballRefracController();
166   -
167   - void Create( Application& app );
168   - bool OnTouch( Actor actor, const TouchData& touch );
169   - void OnKeyEvent(const KeyEvent& event);
170   -
171   - void SetGravity(const Vector2 & gravity);
172   -
173   -
174   -private:
175   - Application& mApplication;
176   - Vector2 mScreenSize;
177   -
178   - Layer mContentLayer;
179   -
180   - Image mBackImage;
181   - FrameBufferImage mMetaballFBO;
182   -
183   - Actor mMetaballRoot;
184   - MetaballInfo mMetaballs[METABALL_NUMBER];
185   -
186   - Actor mCompositionActor;
187   -
188   - //Motion
189   - Vector2 mCurrentTouchPosition;
190   - Vector2 mMetaballPosVariation;
191   - Vector2 mMetaballPosVariationFrom;
192   - Vector2 mMetaballPosVariationTo;
193   - Vector2 mMetaballCenter;
194   -
195   - Vector2 mGravity;
196   - Vector2 mGravityVar;
197   -
198   - Renderer mRendererRefraction;
199   - TextureSet mTextureSetRefraction;
200   - Shader mShaderRefraction;
201   - TextureSet mTextureSetNormal;
202   - Shader mShaderNormal;
203   -
204   - //Animations
205   - Animation mGravityAnimation[METABALL_NUMBER];
206   - Animation mRadiusDecAnimation[METABALL_NUMBER];
207   - Animation mRadiusIncFastAnimation[METABALL_NUMBER];
208   - Animation mRadiusIncSlowAnimation[METABALL_NUMBER];
209   - Animation mRadiusVarAnimation[METABALL_NUMBER];
210   - Animation mPositionVarAnimation[METABALL_NUMBER];
211   -
212   - //Private functions
213   - Geometry CreateGeometry();
214   - Geometry CreateGeometryComposition();
215   -
216   - void CreateMetaballActors();
217   - void CreateMetaballImage();
218   - void AddRefractionImage();
219   - void CreateAnimations();
220   -
221   - void LaunchRadiusIncSlowAnimations(Animation &source);
222   - void LaunchGetBackToPositionAnimation(Animation &source);
223   -
224   - void StopClickAnimations();
225   - void StopAfterClickAnimations();
226   -
227   - void ResetMetaballsState();
228   -
229   - void SetPositionToMetaballs(Vector2 & metaballCenter);
230   -};
231   -
232   -
233   -//-----------------------------------------------------------------------------------------------
234   -//
235   -// IMPLEMENTATION
236   -//
237   -//----------------
238   -
239   -MetaballRefracController::MetaballRefracController( Application& application )
240   - : mApplication( application )
241   -{
242   - // Connect to the Application's Init signal
243   - mApplication.InitSignal().Connect( this, &MetaballRefracController::Create );
244   -}
245   -
246   -MetaballRefracController::~MetaballRefracController()
247   -{
248   - // Nothing to do here;
249   -}
250   -
251   -/*
252   - * Setter function for gravity
253   - */
254   -void MetaballRefracController::SetGravity(const Vector2 & gravity)
255   -{
256   - mGravity = gravity;
257   -}
258   -
259   -/**
260   - * Main create function, it creates the metaballs and all the
261   - */
262   -void MetaballRefracController::Create( Application& app )
263   -{
264   - Stage stage = Stage::GetCurrent();
265   -
266   - stage.KeyEventSignal().Connect(this, &MetaballRefracController::OnKeyEvent);
267   -
268   - mScreenSize = stage.GetSize();
269   -
270   - stage.SetBackgroundColor(Color::BLACK);
271   -
272   - //Set background image for the view
273   - mBackImage = DemoHelper::LoadImage( BACKGROUND_IMAGE );
274   -
275   - mGravity = Vector2(GRAVITY_X,GRAVITY_Y);
276   - mGravityVar = Vector2(0,0);
277   -
278   - //Create internal data
279   - CreateMetaballActors();
280   - CreateMetaballImage();
281   - AddRefractionImage();
282   -
283   - CreateAnimations();
284   -
285   - // Connect the callback to the touch signal on the mesh actor
286   - stage.GetRootLayer().TouchSignal().Connect( this, &MetaballRefracController::OnTouch );
287   -}
288   -
289   -/**
290   - * Create a mesh data with the geometry for the metaball rendering
291   - */
292   -Geometry MetaballRefracController::CreateGeometry()
293   -{
294   - float aspect = (float)mScreenSize.y / (float)mScreenSize.x;
295   -
296   - // Create vertices and specify their color
297   - float xsize = mScreenSize.x * 0.5;
298   -
299   - //We create the meshdata for the metaballs
300   - struct VertexPosition { Vector2 position; };
301   - struct VertexTexture { Vector2 texture; };
302   - struct VertexNormal { Vector3 normal; };
303   -
304   - VertexPosition vertices[] = {
305   - { Vector2( -xsize, -xsize * aspect) },
306   - { Vector2( xsize, -xsize * aspect) },
307   - { Vector2( -xsize, xsize * aspect) },
308   - { Vector2( xsize, xsize * aspect) }
309   - };
310   -
311   - VertexTexture textures[] = {
312   - { Vector2(0.0f, 0.0f) },
313   - { Vector2(1.0f, 0.0f) },
314   - { Vector2(0.0f, 1.0f * aspect) },
315   - { Vector2(1.0f, 1.0f * aspect) }
316   - };
317   -
318   - VertexNormal normals [] = {
319   - { Vector3(0.0f, 0.0f, 1.0f) },
320   - { Vector3(0.0f, 0.0f, 1.0f) },
321   - { Vector3(0.0f, 0.0f, 1.0f) },
322   - { Vector3(0.0f, 0.0f, 1.0f) }
323   - };
324   -
325   - unsigned int numberOfVertices = sizeof(vertices)/sizeof(VertexPosition);
326   -
327   - //Vertices
328   - Property::Map positionVertexFormat;
329   - positionVertexFormat["aPosition"] = Property::VECTOR2;
330   - PropertyBuffer positionVertices = PropertyBuffer::New( positionVertexFormat );
331   - positionVertices.SetData( vertices, numberOfVertices );
332   -
333   - //Textures
334   - Property::Map textureVertexFormat;
335   - textureVertexFormat["aTexture"] = Property::VECTOR2;
336   - PropertyBuffer textureVertices = PropertyBuffer::New( textureVertexFormat );
337   - textureVertices.SetData( textures, numberOfVertices );
338   -
339   - //Normals
340   - Property::Map normalVertexFormat;
341   - normalVertexFormat["aNormal"] = Property::VECTOR3;
342   - PropertyBuffer normalVertices = PropertyBuffer::New( normalVertexFormat );
343   - normalVertices.SetData( normals, numberOfVertices );
344   -
345   - //Indices
346   - unsigned short indices[] = { 0, 3, 1, 0, 2, 3 };
347   -
348   - // Create the geometry object
349   - Geometry texturedQuadGeometry = Geometry::New();
350   - texturedQuadGeometry.AddVertexBuffer( positionVertices );
351   - texturedQuadGeometry.AddVertexBuffer( textureVertices );
352   - texturedQuadGeometry.AddVertexBuffer( normalVertices );
353   -
354   - texturedQuadGeometry.SetIndexBuffer ( &indices[0], 6 );
355   -
356   - return texturedQuadGeometry;
357   -}
358   -
359   -/**
360   - * Create a mesh data with the geometry for the metaball rendering
361   - */
362   -Geometry MetaballRefracController::CreateGeometryComposition()
363   -{
364   - float aspect = (float)mScreenSize.y / (float)mScreenSize.x;
365   -
366   - // Create vertices and specify their color
367   - float xsize = mScreenSize.x * 0.5;
368   -
369   - //We create the meshdata for the metaballs
370   - struct VertexPosition { Vector2 position; };
371   - struct VertexTexture { Vector2 texture; };
372   - struct VertexNormal { Vector3 normal; };
373   -
374   - VertexPosition vertices[] = {
375   - { Vector2( -xsize, -xsize * aspect) },
376   - { Vector2( xsize, -xsize * aspect) },
377   - { Vector2( -xsize, xsize * aspect) },
378   - { Vector2( xsize, xsize * aspect) }
379   - };
380   -
381   - VertexTexture textures[] = {
382   - { Vector2(0.0f, 0.0f) },
383   - { Vector2(1.0f, 0.0f) },
384   - { Vector2(0.0f, 1.0f) },
385   - { Vector2(1.0f, 1.0f) }
386   - };
387   -
388   - VertexNormal normals [] = {
389   - { Vector3(0.0f, 0.0f, 1.0f) },
390   - { Vector3(0.0f, 0.0f, 1.0f) },
391   - { Vector3(0.0f, 0.0f, 1.0f) },
392   - { Vector3(0.0f, 0.0f, 1.0f) }
393   - };
394   -
395   - unsigned int numberOfVertices = sizeof(vertices)/sizeof(VertexPosition);
396   -
397   - //Vertices
398   - Property::Map positionVertexFormat;
399   - positionVertexFormat["aPosition"] = Property::VECTOR2;
400   - PropertyBuffer positionVertices = PropertyBuffer::New( positionVertexFormat );
401   - positionVertices.SetData( vertices, numberOfVertices );
402   -
403   - //Textures
404   - Property::Map textureVertexFormat;
405   - textureVertexFormat["aTexture"] = Property::VECTOR2;
406   - PropertyBuffer textureVertices = PropertyBuffer::New( textureVertexFormat );
407   - textureVertices.SetData( textures, numberOfVertices );
408   -
409   - //Normals
410   - Property::Map normalVertexFormat;
411   - normalVertexFormat["aNormal"] = Property::VECTOR3;
412   - PropertyBuffer normalVertices = PropertyBuffer::New( normalVertexFormat );
413   - normalVertices.SetData( normals, numberOfVertices );
414   -
415   - //Indices
416   - unsigned short indices[] = { 0, 3, 1, 0, 2, 3 };
417   -
418   - // Create the geometry object
419   - Geometry texturedQuadGeometry = Geometry::New();
420   - texturedQuadGeometry.AddVertexBuffer( positionVertices );
421   - texturedQuadGeometry.AddVertexBuffer( textureVertices );
422   - texturedQuadGeometry.AddVertexBuffer( normalVertices );
423   -
424   - texturedQuadGeometry.SetIndexBuffer ( &indices[0], sizeof( indices )/ sizeof( indices[0] ) );
425   -
426   - return texturedQuadGeometry;
427   -}
428   -
429   -/**
430   - * Create a mesh actor for the metaballs
431   - */
432   -void MetaballRefracController::CreateMetaballActors()
433   -{
434   - //We create metaball structures
435   - //With MeshData Textured
436   - float aspect = (float)mScreenSize.y / (float)mScreenSize.x;
437   -
438   - //Create the renderer for the metaballs
439   - Shader shader = Shader::New( METABALL_VERTEX_SHADER, METABALL_FRAG_SHADER );
440   - Geometry metaballGeom = CreateGeometry();
441   - Renderer renderer = Renderer::New( metaballGeom, shader );
442   - renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
443   - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::ONE );
444   - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::ONE );
445   - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::ONE );
446   - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::ONE );
447   -
448   - //Each metaball has a different radius
449   - mMetaballs[0].radius = mMetaballs[0].initRadius = 0.0145f;
450   - mMetaballs[1].radius = mMetaballs[1].initRadius = 0.012f;
451   - mMetaballs[2].radius = mMetaballs[2].initRadius = 0.0135f;
452   - mMetaballs[3].radius = mMetaballs[3].initRadius = 0.0135f;
453   -
454   - //Initialization of each of the metaballs
455   - for (int i = 0 ; i < METABALL_NUMBER ; i++)
456   - {
457   - mMetaballs[i].position = Vector2(0.0f, 0.0f);
458   -
459   - mMetaballs[i].actor = Actor::New( );
460   - mMetaballs[i].actor.SetName("Metaball");
461   - mMetaballs[i].actor.SetScale( 1.0f );
462   - mMetaballs[i].actor.SetParentOrigin( ParentOrigin::CENTER );
463   -
464   -
465   - mMetaballs[i].actor.AddRenderer( renderer );
466   -
467   - mMetaballs[i].positionIndex = mMetaballs[i].actor.RegisterProperty( "uPositionMetaball", mMetaballs[i].position );
468   -
469   - mMetaballs[i].positionVarIndex = mMetaballs[i].actor.RegisterProperty( "uPositionVar", Vector2(0.f,0.f) );
470   -
471   - mMetaballs[i].gravityIndex = mMetaballs[i].actor.RegisterProperty( "uGravityVector", Vector2(0.f,0.f) );
472   -
473   - mMetaballs[i].radiusIndex = mMetaballs[i].actor.RegisterProperty( "uRadius", mMetaballs[i].radius );
474   -
475   - mMetaballs[i].radiusVarIndex = mMetaballs[i].actor.RegisterProperty( "uRadiusVar", 0.f );
476   -
477   - mMetaballs[i].aspectIndex = mMetaballs[i].actor.RegisterProperty( "uAspect", aspect );
478   -
479   - mMetaballs[i].actor.SetSize(400, 400);
480   - }
481   -
482   - //Root creation
483   - mMetaballRoot = Actor::New();
484   - mMetaballRoot.SetParentOrigin( ParentOrigin::CENTER );
485   - for (int i = 0 ; i < METABALL_NUMBER ; i++)
486   - {
487   - mMetaballRoot.Add( mMetaballs[i].actor );
488   - }
489   -
490   - //Initialization of variables related to metaballs
491   - mMetaballPosVariation = Vector2(0,0);
492   - mMetaballPosVariationFrom = Vector2(0,0);
493   - mMetaballPosVariationTo = Vector2(0,0);
494   - mCurrentTouchPosition = Vector2(0,0);
495   -}
496   -
497   -/**
498   - * Create the render task and FBO to render the metaballs into a texture
499   - */
500   -void MetaballRefracController::CreateMetaballImage()
501   -{
502   - //We create an FBO and a render task to create to render the metaballs with a fragment shader
503   - Stage stage = Stage::GetCurrent();
504   - mMetaballFBO = FrameBufferImage::New(mScreenSize.x, mScreenSize.y );
505   -
506   - stage.Add(mMetaballRoot);
507   -
508   - //Creation of the render task used to render the metaballs
509   - RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
510   - RenderTask task = taskList.CreateTask();
511   - task.SetRefreshRate( RenderTask::REFRESH_ALWAYS );
512   - task.SetSourceActor( mMetaballRoot );
513   - task.SetExclusive(true);
514   - task.SetClearColor( Color::BLACK );
515   - task.SetClearEnabled( true );
516   - task.SetTargetFrameBuffer( mMetaballFBO );
517   -}
518   -
519   -/**
520   - * Create a mesh image to render the final composition
521   - */
522   -void MetaballRefracController::AddRefractionImage()
523   -{
524   - //Creation of the composition image
525   -
526   - //Create geometry
527   - Geometry metaballGeom = CreateGeometryComposition();
528   -
529   - //Create Refraction shader and renderer
530   - mShaderRefraction = Shader::New( METABALL_VERTEX_SHADER, REFRACTION_FRAG_SHADER );
531   -
532   - //Create new texture set
533   - mTextureSetRefraction = TextureSet::New();
534   - TextureSetImage( mTextureSetRefraction, 0u, mBackImage );
535   - TextureSetImage( mTextureSetRefraction, 1u, mMetaballFBO );
536   -
537   - //Create normal shader
538   - mShaderNormal = Shader::New( METABALL_VERTEX_SHADER, FRAG_SHADER );
539   -
540   - //Create new texture set
541   - mTextureSetNormal = TextureSet::New();
542   - TextureSetImage( mTextureSetNormal, 0u, mBackImage );
543   -
544   - //Create actor
545   - mCompositionActor = Actor::New( );
546   - mCompositionActor.SetParentOrigin(ParentOrigin::CENTER);
547   - mCompositionActor.SetPosition(Vector3(0.0f, 0.0f, 0.0f));
548   - mCompositionActor.SetSize(mScreenSize.x, mScreenSize.y);
549   -
550   - mRendererRefraction = Renderer::New( metaballGeom, mShaderNormal );
551   - mRendererRefraction.SetTextures( mTextureSetNormal );
552   - mCompositionActor.AddRenderer( mRendererRefraction );
553   -
554   - Stage stage = Stage::GetCurrent();
555   - stage.Add( mCompositionActor );
556   -}
557   -
558   -/**
559   - * Creation of all the metaballs animations (gravity, movement, size, etc.)
560   - */
561   -void MetaballRefracController::CreateAnimations()
562   -{
563   - int i = 0;
564   - float key;
565   -
566   - mPositionVarAnimation[1] = Animation::New(2.f);
567   - mPositionVarAnimation[1].SetLooping( false );
568   - mPositionVarAnimation[1].Pause();
569   - mPositionVarAnimation[1].FinishedSignal().Connect( this, &MetaballRefracController::LaunchGetBackToPositionAnimation );
570   -
571   - KeyFrames keySinCosVariation = KeyFrames::New();
572   - Vector2 sinCosVariation(0,0);
573   - for ( i = 0 ; i < 360 ; i++)
574   - {
575   - sinCosVariation.x = 0.05f * (-sin(i * Math::PI/180.f) + cos(i * Math::PI/180.f));
576   - sinCosVariation.y = 0.05f * (sin(i * Math::PI/180.f) - cos(i * Math::PI/180.f));
577   - key = i/360.f;
578   - keySinCosVariation.Add(key, sinCosVariation);
579   - }
580   -
581   - mPositionVarAnimation[2] = Animation::New(6.f);
582   - mPositionVarAnimation[2].AnimateBetween(Property( mMetaballs[2].actor, mMetaballs[2].positionVarIndex ), keySinCosVariation);
583   - mPositionVarAnimation[2].SetLooping( true );
584   - mPositionVarAnimation[2].Pause();
585   -
586   - KeyFrames keyCosSinVariation = KeyFrames::New();
587   - Vector2 cosSinVariation(0,0);
588   - for ( i = 0 ; i < 360 ; i++)
589   - {
590   - cosSinVariation.x = 0.05f * (-sin(i * Math::PI/180.f) - cos(i * Math::PI/180.f));
591   - cosSinVariation.y = 0.05f * (sin(i * Math::PI/180.f) + cos(i * Math::PI/180.f));
592   - key = i/360.f;
593   - keyCosSinVariation.Add(key, cosSinVariation);
594   - }
595   -
596   - mPositionVarAnimation[3] = Animation::New(6.f);
597   - mPositionVarAnimation[3].AnimateBetween(Property( mMetaballs[3].actor, mMetaballs[3].positionVarIndex ), keyCosSinVariation);
598   - mPositionVarAnimation[3].SetLooping( true );
599   - mPositionVarAnimation[3].Pause();
600   -
601   - //Animations for gravity
602   - for ( i = 0 ; i < METABALL_NUMBER ; i++)
603   - {
604   - mGravityAnimation[i] = Animation::New(25.f);
605   - mGravityAnimation[i].AnimateBy( Property( mMetaballs[i].actor, mMetaballs[i].gravityIndex ), mGravity * 25.f * 3.f);
606   - mGravityAnimation[i].SetLooping( false );
607   - mGravityAnimation[i].Pause();
608   - }
609   -
610   - //Animation to decrease size of metaballs when there is no click
611   - for ( i = 0 ; i < METABALL_NUMBER ; i++)
612   - {
613   - mRadiusDecAnimation[i] = Animation::New(25.f);
614   - mRadiusDecAnimation[i].AnimateBy( Property( mMetaballs[i].actor, mMetaballs[i].radiusIndex ), -0.004f * 25.f * 3.f);
615   - mRadiusDecAnimation[i].SetLooping( false );
616   - mRadiusDecAnimation[i].Pause();
617   - }
618   -
619   - //Animation to grow the size of the metaballs the first second of the click
620   - for ( i = 0 ; i < METABALL_NUMBER ; i++)
621   - {
622   - mRadiusIncFastAnimation[i] = Animation::New(0.3f);
623   - mRadiusIncFastAnimation[i].AnimateBy( Property( mMetaballs[i].actor, mMetaballs[i].radiusIndex ), 0.06f);
624   - mRadiusIncFastAnimation[i].SetLooping( false );
625   - mRadiusIncFastAnimation[i].Pause();
626   - }
627   - mRadiusIncFastAnimation[0].FinishedSignal().Connect( this, &MetaballRefracController::LaunchRadiusIncSlowAnimations );
628   -
629   - //Animation to grow the size of the metaballs afterwards
630   - for ( i = 0 ; i < METABALL_NUMBER ; i++)
631   - {
632   - mRadiusIncSlowAnimation[i] = Animation::New(20.f);
633   - mRadiusIncSlowAnimation[i].AnimateBy( Property( mMetaballs[i].actor, mMetaballs[i].radiusIndex ), 0.04f);
634   - mRadiusIncSlowAnimation[i].SetLooping( false );
635   - mRadiusIncSlowAnimation[i].Pause();
636   - }
637   -
638   - //keyframes of a sin function
639   - KeyFrames keySin = KeyFrames::New();
640   - float val;
641   - for ( i = 0 ; i < 360 ; i++)
642   - {
643   - val = 0.01f * sin(i * Math::PI/180.f);
644   - key = i/360.f;
645   - keySin.Add(key, val);
646   - }
647   -
648   - //Animation to change the size of the metaball
649   - mRadiusVarAnimation[2] = Animation::New(8.f);
650   - mRadiusVarAnimation[2].AnimateBetween(Property( mMetaballs[2].actor, mMetaballs[2].radiusVarIndex ), keySin);
651   - mRadiusVarAnimation[2].SetLooping( true );
652   -
653   - //keyframes of a cos function
654   - KeyFrames keyCos = KeyFrames::New();
655   - for ( i = 0 ; i < 360 ; i++)
656   - {
657   - val = 0.01f * cos(i * Math::PI/180.f);
658   - key = i/360.f;
659   - keyCos.Add(key, val);
660   - }
661   -
662   - //Animation to change the size of the metaball
663   - mRadiusVarAnimation[3] = Animation::New(8.f);
664   - mRadiusVarAnimation[3].AnimateBetween(Property( mMetaballs[3].actor, mMetaballs[3].radiusVarIndex ), keyCos);
665   - mRadiusVarAnimation[3].SetLooping( true );
666   -}
667   -
668   -/**
669   - * Function to launch the animation to get the metaball[1] back to the center
670   - */
671   -void MetaballRefracController::LaunchGetBackToPositionAnimation(Animation &source)
672   -{
673   - mMetaballPosVariationTo = Vector2(0,0);
674   -
675   - mPositionVarAnimation[1] = Animation::New(1.f);
676   - mPositionVarAnimation[1].SetLooping( false );
677   - mPositionVarAnimation[1].AnimateTo(Property( mMetaballs[1].actor, mMetaballs[1].positionVarIndex ), Vector2(0,0));
678   - mPositionVarAnimation[1].Play();
679   -}
680   -
681   -/**
682   - * Function to launch the gro slow radius for the metaballs, and also the small variations for metaball[2] and [3]
683   - */
684   -void MetaballRefracController::LaunchRadiusIncSlowAnimations(Animation &source)
685   -{
686   - for (int i = 0 ; i < METABALL_NUMBER ; i++)
687   - {
688   - mRadiusIncSlowAnimation[i].Play();
689   - }
690   - mPositionVarAnimation[2].Play();
691   - mPositionVarAnimation[3].Play();
692   -}
693   -
694   -/**
695   - * Function to stop all animations related to the click of the user in the screen
696   - */
697   -void MetaballRefracController::StopClickAnimations()
698   -{
699   - for (int i = 0 ; i < METABALL_NUMBER ; i++)
700   - {
701   - mRadiusIncSlowAnimation[i].Stop();
702   - mRadiusIncFastAnimation[i].Stop();
703   - }
704   - mPositionVarAnimation[1].Stop();
705   - mPositionVarAnimation[2].Stop();
706   - mPositionVarAnimation[3].Stop();
707   -}
708   -
709   -/**
710   - * Function to stop all animations related to the after click of the user in the screen
711   - */
712   -void MetaballRefracController::StopAfterClickAnimations()
713   -{
714   - for (int i = 0 ; i < METABALL_NUMBER ; i++)
715   - {
716   - mGravityAnimation[i].Stop();
717   - mRadiusDecAnimation[i].Stop();
718   -
719   - mMetaballs[i].radius = mMetaballs[i].initRadius;
720   -
721   - mMetaballs[i].actor.SetProperty(mMetaballs[i].gravityIndex, Vector2(0,0));
722   - mMetaballs[i].actor.SetProperty(mMetaballs[i].radiusIndex, mMetaballs[i].radius);
723   - mMetaballs[i].actor.SetProperty(mMetaballs[i].radiusVarIndex, 0.f);
724   - }
725   - mRadiusVarAnimation[2].Stop();
726   - mRadiusVarAnimation[3].Stop();
727   -}
728   -
729   -/*
730   - * Function that resets the sate of the different Metaballs
731   - */
732   -void MetaballRefracController::ResetMetaballsState()
733   -{
734   - mRendererRefraction.SetTextures(mTextureSetNormal);
735   - mRendererRefraction.SetShader( mShaderNormal );
736   -
737   - for (int i = 0 ; i < METABALL_NUMBER ; i++)
738   - {
739   - mMetaballs[i].radius = mMetaballs[i].initRadius;
740   - }
741   -
742   - mMetaballPosVariationTo = Vector2(0,0);
743   - mMetaballPosVariationFrom = Vector2(0,0);
744   - mMetaballPosVariation = Vector2(0,0);
745   -
746   - mGravityVar = Vector2(0,0);
747   -}
748   -
749   -/**
750   - * Function to set the actual position of the metaballs when the user clicks the screen
751   - */
752   -void MetaballRefracController::SetPositionToMetaballs(Vector2 & metaballCenter)
753   -{
754   - //We set the position for the metaballs based on click position
755   - for (int i = 0 ; i < METABALL_NUMBER ; i++)
756   - {
757   - mMetaballs[i].position = metaballCenter;
758   - mMetaballs[i].actor.SetProperty(mMetaballs[i].positionIndex, mMetaballs[0].position); // 0 y no i ?!?!?!
759   - }
760   -}
761   -
762   -bool MetaballRefracController::OnTouch( Actor actor, const TouchData& touch )
763   -{
764   - float aspectR = mScreenSize.y / mScreenSize.x;
765   - switch( touch.GetState( 0 ) )
766   - {
767   - case PointState::DOWN:
768   - {
769   - StopAfterClickAnimations();
770   - for (int i = 0 ; i < METABALL_NUMBER ; i++)
771   - mRadiusIncFastAnimation[i].Play();
772   - mRadiusVarAnimation[2].Play();
773   - mRadiusVarAnimation[3].Play();
774   -
775   - //We draw with the refraction-composition shader
776   - mRendererRefraction.SetTextures(mTextureSetRefraction);
777   - mRendererRefraction.SetShader( mShaderRefraction );
778   - mCurrentTouchPosition = touch.GetScreenPosition( 0 );
779   -
780   - //we use the click position for the metaballs
781   - Vector2 metaballCenter = Vector2((mCurrentTouchPosition.x / mScreenSize.x) - 0.5, (aspectR * (mScreenSize.y - mCurrentTouchPosition.y) / mScreenSize.y) - 0.5) * 2.0;
782   - SetPositionToMetaballs(metaballCenter);
783   - break;
784   - }
785   - case PointState::MOTION:
786   - {
787   - Vector2 screen = touch.GetScreenPosition( 0 );
788   - Vector2 displacement = screen - mCurrentTouchPosition;
789   - mCurrentTouchPosition = screen;
790   -
791   - mMetaballPosVariationTo.x += (displacement.x / mScreenSize.x) * 2.2;
792   - mMetaballPosVariationTo.y += (- displacement.y / mScreenSize.y) * 2.2;
793   -
794   - if (mPositionVarAnimation[1])
795   - {
796   - mPositionVarAnimation[1].FinishedSignal().Disconnect( this, &MetaballRefracController::LaunchGetBackToPositionAnimation );
797   - mPositionVarAnimation[1].Stop();
798   - }
799   - mPositionVarAnimation[1] = Animation::New(1.f);
800   - mPositionVarAnimation[1].SetLooping( false );
801   - mPositionVarAnimation[1].AnimateTo(Property( mMetaballs[1].actor, mMetaballs[1].positionVarIndex ), mMetaballPosVariationTo);
802   - mPositionVarAnimation[1].FinishedSignal().Connect( this, &MetaballRefracController::LaunchGetBackToPositionAnimation );
803   - mPositionVarAnimation[1].Play();
804   -
805   - //we use the click position for the metaballs
806   - Vector2 metaballCenter = Vector2((screen.x / mScreenSize.x) - 0.5, (aspectR * (mScreenSize.y - screen.y) / mScreenSize.y) - 0.5) * 2.0;
807   - SetPositionToMetaballs(metaballCenter);
808   - break;
809   - }
810   - case PointState::UP:
811   - case PointState::LEAVE:
812   - case PointState::INTERRUPTED:
813   - {
814   - //Stop click animations
815   - StopClickAnimations();
816   -
817   - //Launch out of screen animations
818   - for (int i = 0 ; i < METABALL_NUMBER ; i++)
819   - mGravityAnimation[i].Play();
820   -
821   - for (int i = 0 ; i < METABALL_NUMBER ; i++)
822   - mRadiusDecAnimation[i].Play();
823   -
824   - break;
825   - }
826   - default:
827   - break;
828   - }
829   - return true;
830   -}
831   -
832   -
833   -void MetaballRefracController::OnKeyEvent(const KeyEvent& event)
834   -{
835   - if(event.state == KeyEvent::Down)
836   - {
837   - if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
838   - {
839   - mApplication.Quit();
840   - }
841   - }
842   -}
843   -
844   -
845   -//
846   -//
847   -//-----------------------------------------------------------------------------------------------
848   -
849   -void RunTest( Application& application )
850   -{
851   - MetaballRefracController test( application );
852   -
853   - application.MainLoop();
854   -}
855   -
856   -// Entry point for Linux & Tizen applications
857   -//
858   -int DALI_EXPORT_API main( int argc, char **argv )
859   -{
860   - Application application = Application::New( &argc, &argv );
861   -
862   - RunTest( application );
863   -
864   - return 0;
865   -}
examples/new-window/new-window-example.cpp deleted
1   -/*
2   - * Copyright (c) 2017 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   -// EXTERNAL INCLUDES
18   -#include <dali/devel-api/images/texture-set-image.h>
19   -#include <dali/public-api/rendering/renderer.h>
20   -#include <dali-toolkit/dali-toolkit.h>
21   -#include <dali-toolkit/devel-api/controls/bubble-effect/bubble-emitter.h>
22   -#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
23   -#include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
24   -
25   -#include <cstdio>
26   -#include <iostream>
27   -
28   -// INTERNAL INCLUDES
29   -#include "shared/view.h"
30   -#include "shared/utility.h"
31   -
32   -using namespace Dali;
33   -using namespace Dali::Toolkit;
34   -
35   -class NewWindowController;
36   -
37   -namespace
38   -{
39   -const char * const BACKGROUND_IMAGE( DEMO_IMAGE_DIR "background-2.jpg" );
40   -const char * const TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" );
41   -const char * const LOSE_CONTEXT_IMAGE( DEMO_IMAGE_DIR "icon-cluster-wobble.png" );
42   -const char * const LOSE_CONTEXT_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-cluster-wobble-selected.png" );
43   -const char * const BASE_IMAGE( DEMO_IMAGE_DIR "gallery-large-14.jpg" );
44   -const char * const EFFECT_IMAGE( DEMO_IMAGE_DIR "gallery-large-18.jpg" );
45   -const char * const LOGO_IMAGE(DEMO_IMAGE_DIR "dali-logo.png");
46   -
47   -const float EXPLOSION_DURATION(1.2f);
48   -const unsigned int EMIT_INTERVAL_IN_MS(40);
49   -const float TRACK_DURATION_IN_MS(970);
50   -
51   -Application gApplication;
52   -NewWindowController* gNewWindowController(NULL);
53   -
54   -#define MAKE_SHADER(A)#A
55   -
56   -const char* VERTEX_COLOR_MESH = MAKE_SHADER(
57   -attribute mediump vec3 aPosition;\n
58   -attribute lowp vec3 aColor;\n
59   -uniform mediump mat4 uMvpMatrix;\n
60   -uniform mediump vec3 uSize;\n
61   -varying lowp vec3 vColor;\n
62   -\n
63   -void main()\n
64   -{\n
65   - gl_Position = uMvpMatrix * vec4( aPosition*uSize, 1.0 );\n
66   - vColor = aColor;\n
67   -}\n
68   -);
69   -
70   -const char* FRAGMENT_COLOR_MESH = MAKE_SHADER(
71   -uniform lowp vec4 uColor;\n
72   -varying lowp vec3 vColor;\n
73   -\n
74   -void main()\n
75   -{\n
76   - gl_FragColor = vec4(vColor,1.0)*uColor;
77   -}\n
78   -);
79   -
80   -const char* VERTEX_TEXTURE_MESH = MAKE_SHADER(
81   -attribute mediump vec3 aPosition;\n
82   -attribute highp vec2 aTexCoord;\n
83   -uniform mediump mat4 uMvpMatrix;\n
84   -uniform mediump vec3 uSize;\n
85   -varying mediump vec2 vTexCoord;\n
86   -\n
87   -void main()\n
88   -{\n
89   - gl_Position = uMvpMatrix * vec4( aPosition*uSize, 1.0 );\n
90   - vTexCoord = aTexCoord;\n
91   -}\n
92   -);
93   -
94   -const char* FRAGMENT_TEXTURE_MESH = MAKE_SHADER(
95   -varying mediump vec2 vTexCoord;\n
96   -uniform lowp vec4 uColor;\n
97   -uniform sampler2D sTexture;\n
98   -\n
99   -void main()\n
100   -{\n
101   - gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;
102   -}\n
103   -);
104   -
105   -const char* FRAGMENT_BLEND_SHADER = MAKE_SHADER(
106   -varying mediump vec2 vTexCoord;\n
107   -uniform sampler2D sTexture;\n
108   -uniform sampler2D sEffect;\n
109   -uniform mediump float alpha;\n
110   -\n
111   -void main()\n
112   -{\n
113   - mediump vec4 fragColor = texture2D(sTexture, vTexCoord);\n
114   - mediump vec4 fxColor = texture2D(sEffect, vTexCoord);\n
115   - gl_FragColor = mix(fragColor,fxColor, alpha);\n
116   -}\n
117   -);
118   -
119   -}; // anonymous namespace
120   -
121   -
122   -class NewWindowController : public ConnectionTracker
123   -{
124   -public:
125   - NewWindowController( Application& app );
126   - void Create( Application& app );
127   - void Destroy( Application& app );
128   -
129   - void AddBubbles( Actor& parentActor, const Vector2& stageSize);
130   - void AddMeshActor( Actor& parentActor );
131   - void AddBlendingImageActor( Actor& parentActor );
132   - void AddTextLabel( Actor& parentActor );
133   -
134   - ImageView CreateBlurredMirrorImage(const char* imageName);
135   - FrameBufferImage CreateFrameBufferForImage( const char* imageName, Property::Map& shaderEffect, const Vector3& rgbDelta );
136   - void SetUpBubbleEmission( const Vector2& emitPosition, const Vector2& direction );
137   - Geometry CreateMeshGeometry();
138   - Dali::Property::Map CreateColorModifierer();
139   -
140   - static void NewWindow(void);
141   -
142   - bool OnTrackTimerTick();
143   - void OnKeyEvent(const KeyEvent& event);
144   - bool OnLoseContextButtonClicked( Toolkit::Button button );
145   - void OnContextLost();
146   - void OnContextRegained();
147   -
148   -private:
149   - Application mApplication;
150   - TextLabel mTextActor;
151   -
152   - Toolkit::Control mView; ///< The View instance.
153   - Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
154   - TextLabel mTitleActor; ///< The Toolbar's Title.
155   - Layer mContentLayer; ///< Content layer (scrolling cluster content)
156   - Toolkit::PushButton mLoseContextButton;
157   -
158   - Toolkit::BubbleEmitter mEmitter;
159   - Timer mEmitTrackTimer;
160   - bool mNeedNewAnimation;
161   - unsigned int mAnimateComponentCount;
162   - Animation mEmitAnimation;
163   -};
164   -
165   -
166   -NewWindowController::NewWindowController( Application& application )
167   -: mApplication(application),
168   - mNeedNewAnimation(true),
169   - mAnimateComponentCount( 0 )
170   -{
171   - mApplication.InitSignal().Connect(this, &NewWindowController::Create);
172   - mApplication.TerminateSignal().Connect(this, &NewWindowController::Destroy);
173   -}
174   -
175   -void NewWindowController::Create( Application& app )
176   -{
177   - Stage stage = Stage::GetCurrent();
178   - stage.SetBackgroundColor(Color::YELLOW);
179   -
180   - stage.KeyEventSignal().Connect(this, &NewWindowController::OnKeyEvent);
181   -
182   - // The Init signal is received once (only) during the Application lifetime
183   -
184   - // Hide the indicator bar
185   - mApplication.GetWindow().ShowIndicator( Dali::Window::INVISIBLE );
186   -
187   - mContentLayer = DemoHelper::CreateView( app,
188   - mView,
189   - mToolBar,
190   - "",
191   - TOOLBAR_IMAGE,
192   - "Context recovery" );
193   -
194   - Size stageSize = stage.GetSize();
195   - ImageView backgroundActor = ImageView::New( BACKGROUND_IMAGE, Dali::ImageDimensions( stageSize.x, stageSize.y ) );
196   - backgroundActor.SetParentOrigin( ParentOrigin::CENTER );
197   - mContentLayer.Add(backgroundActor);
198   -
199   - // Point the default render task at the view
200   - RenderTaskList taskList = stage.GetRenderTaskList();
201   - RenderTask defaultTask = taskList.GetTask( 0u );
202   - if ( defaultTask )
203   - {
204   - defaultTask.SetSourceActor( mView );
205   - }
206   -
207   - mLoseContextButton = Toolkit::PushButton::New();
208   - mLoseContextButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, LOSE_CONTEXT_IMAGE );
209   - mLoseContextButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, LOSE_CONTEXT_IMAGE_SELECTED );
210   - mLoseContextButton.ClickedSignal().Connect( this, &NewWindowController::OnLoseContextButtonClicked );
211   - mToolBar.AddControl( mLoseContextButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
212   -
213   - Actor logoLayoutActor = Actor::New();
214   - logoLayoutActor.SetParentOrigin(ParentOrigin::CENTER);
215   - logoLayoutActor.SetPosition(0.0f, -200.0f, 0.0f);
216   - logoLayoutActor.SetScale(0.5f);
217   - backgroundActor.Add(logoLayoutActor);
218   -
219   - ImageView imageView = ImageView::New( LOGO_IMAGE );
220   - imageView.SetName("daliLogo");
221   - imageView.SetParentOrigin(ParentOrigin::CENTER);
222   - imageView.SetAnchorPoint(AnchorPoint::BOTTOM_CENTER);
223   - logoLayoutActor.Add(imageView);
224   -
225   - ImageView mirrorImageView = CreateBlurredMirrorImage(LOGO_IMAGE);
226   - mirrorImageView.SetParentOrigin(ParentOrigin::TOP_CENTER);
227   - mirrorImageView.SetAnchorPoint(AnchorPoint::BOTTOM_CENTER);
228   - logoLayoutActor.Add(mirrorImageView);
229   -
230   - AddBubbles( backgroundActor, stage.GetSize());
231   - AddMeshActor( backgroundActor );
232   - AddBlendingImageActor( backgroundActor );
233   - AddTextLabel( backgroundActor );
234   -
235   - stage.ContextLostSignal().Connect(this, &NewWindowController::OnContextLost);
236   - stage.ContextRegainedSignal().Connect(this, &NewWindowController::OnContextRegained);
237   -}
238   -
239   -void NewWindowController::Destroy( Application& app )
240   -{
241   - UnparentAndReset(mTextActor);
242   -}
243   -
244   -void NewWindowController::AddBubbles( Actor& parentActor, const Vector2& stageSize)
245   -{
246   - mEmitter = Toolkit::BubbleEmitter::New( stageSize,
247   - DemoHelper::LoadTexture( DEMO_IMAGE_DIR "bubble-ball.png" ),
248   - 200, Vector2( 5.0f, 5.0f ) );
249   -
250   - Texture background = DemoHelper::LoadTexture(BACKGROUND_IMAGE);
251   - mEmitter.SetBackground( background, Vector3(0.5f, 0.f,0.5f) );
252   - mEmitter.SetBubbleDensity( 9.f );
253   - Actor bubbleRoot = mEmitter.GetRootActor();
254   - parentActor.Add( bubbleRoot );
255   - bubbleRoot.SetParentOrigin(ParentOrigin::CENTER);
256   - bubbleRoot.SetZ(0.1f);
257   -
258   - mEmitTrackTimer = Timer::New( EMIT_INTERVAL_IN_MS );
259   - mEmitTrackTimer.TickSignal().Connect(this, &NewWindowController::OnTrackTimerTick);
260   - mEmitTrackTimer.Start();
261   -}
262   -
263   -void NewWindowController::AddMeshActor( Actor& parentActor )
264   -{
265   - Geometry meshGeometry = CreateMeshGeometry();
266   -
267   - // Create a coloured mesh
268   - Shader shaderColorMesh = Shader::New( VERTEX_COLOR_MESH, FRAGMENT_COLOR_MESH );
269   - Renderer colorMeshRenderer = Renderer::New( meshGeometry, shaderColorMesh );
270   -
271   - Actor colorMeshActor = Actor::New();
272   - colorMeshActor.AddRenderer( colorMeshRenderer );
273   - colorMeshActor.SetSize( 175.f,175.f, 175.f );
274   - colorMeshActor.SetParentOrigin( ParentOrigin::CENTER );
275   - colorMeshActor.SetAnchorPoint(AnchorPoint::TOP_CENTER);
276   - colorMeshActor.SetPosition(Vector3(0.0f, 50.0f, 0.0f));
277   - colorMeshActor.SetOrientation( Degree(75.f), Vector3::XAXIS );
278   - colorMeshActor.SetName("ColorMeshActor");
279   -
280   - // Create a textured mesh
281   - Texture effectTexture = DemoHelper::LoadTexture(EFFECT_IMAGE);
282   - Shader shaderTextureMesh = Shader::New( VERTEX_TEXTURE_MESH, FRAGMENT_TEXTURE_MESH );
283   - TextureSet textureSet = TextureSet::New();
284   - textureSet.SetTexture( 0u, effectTexture );
285   - Renderer textureMeshRenderer = Renderer::New( meshGeometry, shaderTextureMesh );
286   - textureMeshRenderer.SetTextures( textureSet );
287   -
288   - Actor textureMeshActor = Actor::New();
289   - textureMeshActor.AddRenderer( textureMeshRenderer );
290   - textureMeshActor.SetSize( 175.f,175.f, 175.f );
291   - textureMeshActor.SetParentOrigin( ParentOrigin::CENTER );
292   - textureMeshActor.SetAnchorPoint(AnchorPoint::TOP_CENTER);
293   - textureMeshActor.SetPosition(Vector3(0.0f, 200.0f, 0.0f));
294   - textureMeshActor.SetOrientation( Degree(75.f), Vector3::XAXIS );
295   - textureMeshActor.SetName("TextureMeshActor");
296   -
297   - Layer layer3d = Layer::New();
298   - layer3d.SetParentOrigin( ParentOrigin::CENTER );
299   - layer3d.SetAnchorPoint( AnchorPoint::CENTER );
300   - layer3d.SetBehavior(Layer::LAYER_3D);
301   -
302   - layer3d.Add( colorMeshActor );
303   - layer3d.Add( textureMeshActor );
304   - parentActor.Add(layer3d);
305   -}
306   -
307   -void NewWindowController::AddBlendingImageActor( Actor& parentActor )
308   -{
309   - Property::Map colorModifier = CreateColorModifierer();
310   -
311   - FrameBufferImage fb2 = CreateFrameBufferForImage( EFFECT_IMAGE, colorModifier, Vector3( 0.5f, 0.5f, 0.5f ) );
312   -
313   - ImageView tmpActor = ImageView::New(fb2);
314   - parentActor.Add(tmpActor);
315   - tmpActor.SetParentOrigin(ParentOrigin::CENTER_RIGHT);
316   - tmpActor.SetAnchorPoint(AnchorPoint::TOP_RIGHT);
317   - tmpActor.SetPosition(Vector3(0.0f, 150.0f, 0.0f));
318   - tmpActor.SetScale(0.25f);
319   -
320   - // create blending shader effect
321   - Property::Map customShader;
322   - customShader[ "fragmentShader" ] = FRAGMENT_BLEND_SHADER;
323   - Property::Map map;
324   - map[ "shader" ] = customShader;
325   -
326   - ImageView blendActor = ImageView::New( BASE_IMAGE );
327   - blendActor.SetProperty( ImageView::Property::IMAGE, map );
328   - blendActor.RegisterProperty( "alpha", 0.5f );
329   -
330   - blendActor.SetParentOrigin(ParentOrigin::CENTER_RIGHT);
331   - blendActor.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT);
332   - blendActor.SetPosition(Vector3(0.0f, 100.0f, 0.0f));
333   - blendActor.SetSize(140, 140);
334   - parentActor.Add(blendActor);
335   -
336   - TextureSet textureSet = blendActor.GetRendererAt(0u).GetTextures();
337   - TextureSetImage( textureSet, 1u, fb2 );
338   -}
339   -
340   -void NewWindowController::AddTextLabel( Actor& parentActor )
341   -{
342   - mTextActor = TextLabel::New("Some text");
343   - mTextActor.SetParentOrigin(ParentOrigin::CENTER);
344   - mTextActor.SetColor(Color::RED);
345   - mTextActor.SetName("PushMe text");
346   - parentActor.Add( mTextActor );
347   -}
348   -
349   -ImageView NewWindowController::CreateBlurredMirrorImage(const char* imageName)
350   -{
351   - Image image = DemoHelper::LoadImage(imageName);
352   -
353   - Vector2 FBOSize = Vector2( image.GetWidth(), image.GetHeight() );
354   - FrameBufferImage fbo = FrameBufferImage::New( FBOSize.width, FBOSize.height, Pixel::RGBA8888);
355   -
356   - GaussianBlurView gbv = GaussianBlurView::New(5, 2.0f, Pixel::RGBA8888, 0.5f, 0.5f, true);
357   - gbv.SetBackgroundColor(Color::TRANSPARENT);
358   - gbv.SetUserImageAndOutputRenderTarget( image, fbo );
359   - gbv.SetSize(FBOSize);
360   - Stage::GetCurrent().Add(gbv);
361   - gbv.ActivateOnce();
362   -
363   - ImageView blurredActor = ImageView::New(fbo);
364   - blurredActor.SetSize(FBOSize);
365   - blurredActor.SetScale(1.0f, -1.0f, 1.0f);
366   - return blurredActor;
367   -}
368   -
369   -FrameBufferImage NewWindowController::CreateFrameBufferForImage(const char* imageName, Property::Map& shaderEffect, const Vector3& rgbDelta )
370   -{
371   - Stage stage = Stage::GetCurrent();
372   - Uint16Pair intFboSize = ResourceImage::GetImageSize( imageName );
373   - Vector2 FBOSize = Vector2(intFboSize.GetWidth(), intFboSize.GetHeight());
374   -
375   - FrameBufferImage framebuffer = FrameBufferImage::New(FBOSize.x, FBOSize.y );
376   -
377   - RenderTask renderTask = stage.GetRenderTaskList().CreateTask();
378   -
379   - ImageView imageView = ImageView::New( imageName );
380   - imageView.SetName("Source image actor");
381   - imageView.SetProperty( ImageView::Property::IMAGE, shaderEffect );
382   - imageView.RegisterProperty( "uRGBDelta", rgbDelta );
383   -
384   - imageView.SetParentOrigin(ParentOrigin::CENTER);
385   - imageView.SetAnchorPoint(AnchorPoint::CENTER);
386   - imageView.SetScale(1.0f, -1.0f, 1.0f);
387   - stage.Add(imageView); // Not in default image view
388   -
389   - CameraActor cameraActor = CameraActor::New(FBOSize);
390   - cameraActor.SetParentOrigin(ParentOrigin::CENTER);
391   - cameraActor.SetFieldOfView(Math::PI*0.25f);
392   - cameraActor.SetNearClippingPlane(1.0f);
393   - cameraActor.SetAspectRatio(FBOSize.width / FBOSize.height);
394   - cameraActor.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor
395   - cameraActor.SetPosition(0.0f, 0.0f, ((FBOSize.height * 0.5f) / tanf(Math::PI * 0.125f)));
396   - stage.Add(cameraActor);
397   -
398   - renderTask.SetSourceActor(imageView);
399   - renderTask.SetInputEnabled(false);
400   - renderTask.SetTargetFrameBuffer(framebuffer);
401   - renderTask.SetCameraActor( cameraActor );
402   - renderTask.SetClearColor( Color::TRANSPARENT );
403   - renderTask.SetClearEnabled( true );
404   - renderTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
405   -
406   - return framebuffer;
407   -}
408   -
409   -void NewWindowController::SetUpBubbleEmission( const Vector2& emitPosition, const Vector2& direction)
410   -{
411   - if( mNeedNewAnimation )
412   - {
413   - float duration = Random::Range(1.f, 1.5f);
414   - mEmitAnimation = Animation::New( duration );
415   - mNeedNewAnimation = false;
416   - mAnimateComponentCount = 0;
417   - }
418   -
419   - mEmitter.EmitBubble( mEmitAnimation, emitPosition, direction, Vector2(10,10) );
420   -
421   - mAnimateComponentCount++;
422   -
423   - if( mAnimateComponentCount % 6 ==0 )
424   - {
425   - mEmitAnimation.Play();
426   - mNeedNewAnimation = true;
427   - }
428   -}
429   -
430   -Geometry NewWindowController::CreateMeshGeometry()
431   -{
432   - // Create vertices and specify their color
433   - struct Vertex
434   - {
435   - Vector3 position;
436   - Vector2 textureCoordinates;
437   - Vector3 color;
438   - };
439   -
440   - Vertex vertexData[5] = {
441   - { Vector3( 0.0f, 0.0f, 0.5f ), Vector2(0.5f, 0.5f), Vector3(1.0f, 1.0f, 1.0f) },
442   - { Vector3( -0.5f, -0.5f, 0.0f ), Vector2(0.0f, 0.0f), Vector3(1.0f, 0.0f, 0.0f) },
443   - { Vector3( 0.5f, -0.5f, 0.0f ), Vector2(1.0f, 0.0f), Vector3(1.0f, 1.0f, 0.0f) },
444   - { Vector3( -0.5f, 0.5f, 0.0f ), Vector2(0.0f, 1.0f), Vector3(0.0f, 1.0f, 0.0f) },
445   - { Vector3( 0.5f, 0.5f, 0.0f ), Vector2(1.0f, 1.0f), Vector3(0.0f, 0.0f, 1.0f) } };
446   -
447   - Property::Map vertexFormat;
448   - vertexFormat["aPosition"] = Property::VECTOR3;
449   - vertexFormat["aTexCoord"] = Property::VECTOR2;
450   - vertexFormat["aColor"] = Property::VECTOR3;
451   - PropertyBuffer vertices = PropertyBuffer::New( vertexFormat );
452   - vertices.SetData( vertexData, 5 );
453   -
454   - // Specify all the faces
455   - unsigned short indexData[12] = { 0,1,3,0,2,4,0,3,4,0,2,1 };
456   -
457   - // Create the geometry object
458   - Geometry geometry = Geometry::New();
459   - geometry.AddVertexBuffer( vertices );
460   - geometry.SetIndexBuffer( &indexData[0], 12 );
461   -
462   - return geometry;
463   -}
464   -
465   -Dali::Property::Map NewWindowController::CreateColorModifierer()
466   -{
467   - const char* fragmentShader ( DALI_COMPOSE_SHADER (
468   - precision highp float;\n
469   - uniform vec3 uRGBDelta;\n
470   - uniform float uIgnoreAlpha;\n
471   - \n
472   - varying mediump vec2 vTexCoord;\n
473   - uniform sampler2D sTexture;\n
474   - \n
475   - float rand(vec2 co) \n
476   - {\n
477   - return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); \n}
478   - \n
479   - void main() {\n
480   - vec4 color = texture2D(sTexture, vTexCoord); \n
481   - // modify the hsv Value
482   - color.rgb += uRGBDelta * rand(vTexCoord); \n
483   - // if the new vale exceeds one, then decrease it
484   - color.rgb -= max(color.rgb*2.0 - vec3(2.0), 0.0);\n
485   - // if the new vale drops below zero, then increase it
486   - color.rgb -= min(color.rgb*2.0, 0.0);\n
487   - gl_FragColor = color; \n
488   - }\n
489   - ) );
490   -
491   - Property::Map map;
492   - Property::Map customShader;
493   - customShader[ "fragmentShader" ] = fragmentShader;
494   - map[ "shader" ] = customShader;
495   -
496   - return map;
497   -}
498   -
499   -void NewWindowController::NewWindow(void)
500   -{
501   - PositionSize posSize(0, 0, 720, 1280);
502   - gApplication.ReplaceWindow(posSize, "NewWindow"); // Generates a new window
503   -}
504   -
505   -bool NewWindowController::OnLoseContextButtonClicked( Toolkit::Button button )
506   -{
507   - // Add as an idle callback to avoid ProcessEvents being recursively called.
508   - mApplication.AddIdle( MakeCallback( NewWindowController::NewWindow ) );
509   - return true;
510   -}
511   -
512   -bool NewWindowController::OnTrackTimerTick()
513   -{
514   - static int time=0;
515   - const float radius(250.0f);
516   -
517   - time += EMIT_INTERVAL_IN_MS;
518   - float modTime = time / TRACK_DURATION_IN_MS;
519   - float angle = 2.0f*Math::PI*modTime;
520   -
521   - Vector2 position(radius*cosf(angle), radius*-sinf(angle));
522   - Vector2 aimPos(radius*2*sinf(angle), radius*2*-cosf(angle));
523   - Vector2 direction = aimPos-position;
524   - Vector2 stageSize = Stage::GetCurrent().GetSize();
525   -
526   - SetUpBubbleEmission( stageSize*0.5f+position, direction );
527   - SetUpBubbleEmission( stageSize*0.5f+position*0.75f, direction );
528   - SetUpBubbleEmission( stageSize*0.5f+position*0.7f, direction );
529   -
530   - return true;
531   -}
532   -
533   -void NewWindowController::OnKeyEvent(const KeyEvent& event)
534   -{
535   - if(event.state == KeyEvent::Down)
536   - {
537   - if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
538   - {
539   - mApplication.Quit();
540   - }
541   - }
542   -}
543   -
544   -void NewWindowController::OnContextLost()
545   -{
546   - printf("Stage reporting context loss\n");
547   -}
548   -
549   -void NewWindowController::OnContextRegained()
550   -{
551   - printf("Stage reporting context regain\n");
552   -}
553   -
554   -void RunTest(Application& app)
555   -{
556   - gNewWindowController = new NewWindowController(app);
557   - app.MainLoop(Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS);
558   -}
559   -
560   -// Entry point for Linux & Tizen applications
561   -//
562   -int DALI_EXPORT_API main(int argc, char **argv)
563   -{
564   - gApplication = Application::New(&argc, &argv, DEMO_THEME_PATH);
565   - RunTest(gApplication);
566   -
567   - return 0;
568   -}
examples/page-turn-view/page-turn-view-example.cpp deleted
1   -/*
2   - * Copyright (c) 2017 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/dali.h>
19   -#include <dali-toolkit/dali-toolkit.h>
20   -#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
21   -#include <dali-toolkit/devel-api/controls/page-turn-view/page-factory.h>
22   -#include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-landscape-view.h>
23   -#include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-portrait-view.h>
24   -#include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-view.h>
25   -
26   -#include <assert.h>
27   -#include <cstdlib>
28   -#include <string.h>
29   -#include <iostream>
30   -
31   -#include "shared/view.h"
32   -#include "shared/utility.h"
33   -
34   -using namespace Dali;
35   -using namespace Dali::Toolkit;
36   -
37   -// LOCAL STUFF
38   -namespace
39   -{
40   -const char* const CHANGE_IMAGE_ICON(DEMO_IMAGE_DIR "icon-change.png");
41   -const char* const CHANGE_IMAGE_ICON_SELECTED( DEMO_IMAGE_DIR "icon-change-selected.png" );
42   -
43   -// The content amount of one page between portrait and landscape view are different
44   -// set a ratio to modify the current page number when the rotation is changed
45   -const float PAGE_NUMBER_CORRESPONDING_RATIO(1.25f);
46   -
47   -const char* BOOK_COVER_PORTRAIT( DEMO_IMAGE_DIR "book-portrait-cover.jpg" );
48   -const char* BOOK_COVER_LANDSCAPE( DEMO_IMAGE_DIR "book-landscape-cover.jpg" );
49   -const char* BOOK_COVER_BACK_LANDSCAPE( DEMO_IMAGE_DIR "book-landscape-cover-back.jpg" );
50   -
51   -const char* PAGE_IMAGES_PORTRAIT[] =
52   -{
53   - DEMO_IMAGE_DIR "book-portrait-p1.jpg",
54   - DEMO_IMAGE_DIR "book-portrait-p2.jpg",
55   - DEMO_IMAGE_DIR "book-portrait-p3.jpg",
56   - DEMO_IMAGE_DIR "book-portrait-p4.jpg",
57   - DEMO_IMAGE_DIR "book-portrait-p5.jpg"
58   -};
59   -const unsigned int NUMBER_OF_PORTRAIT_IMAGE( sizeof(PAGE_IMAGES_PORTRAIT) / sizeof(PAGE_IMAGES_PORTRAIT[0]) );
60   -
61   -const char* PAGE_IMAGES_LANDSCAPE[] =
62   -{
63   - DEMO_IMAGE_DIR "book-landscape-p1.jpg",
64   - DEMO_IMAGE_DIR "book-landscape-p2.jpg",
65   - DEMO_IMAGE_DIR "book-landscape-p3.jpg",
66   - DEMO_IMAGE_DIR "book-landscape-p4.jpg",
67   - DEMO_IMAGE_DIR "book-landscape-p5.jpg",
68   - DEMO_IMAGE_DIR "book-landscape-p6.jpg",
69   - DEMO_IMAGE_DIR "book-landscape-p7.jpg",
70   - DEMO_IMAGE_DIR "book-landscape-p8.jpg"
71   -};
72   -const unsigned int NUMBER_OF_LANDSCAPE_IMAGE( sizeof(PAGE_IMAGES_LANDSCAPE) / sizeof(PAGE_IMAGES_LANDSCAPE[0]) );
73   -
74   -Texture LoadTextures( const char* imagePath1, const char* imagePath2 )
75   -{
76   - PixelData pixelData1 = DemoHelper::LoadPixelData( imagePath1, ImageDimensions(), FittingMode::DEFAULT, SamplingMode::DEFAULT );
77   - PixelData pixelData2 = DemoHelper::LoadPixelData( imagePath2, ImageDimensions(), FittingMode::DEFAULT, SamplingMode::DEFAULT );
78   -
79   - unsigned int width = pixelData1.GetWidth() + pixelData2.GetWidth();
80   - unsigned int height = pixelData1.GetHeight() > pixelData2.GetHeight() ? pixelData1.GetHeight() : pixelData2.GetHeight();
81   -
82   - Texture texture = Texture::New( Dali::TextureType::TEXTURE_2D, Pixel::RGB888, width, height );
83   - texture.Upload( pixelData1 );
84   - texture.Upload( pixelData2, 0u, 0u, pixelData1.GetWidth(), 0u, pixelData2.GetWidth(), pixelData2.GetHeight() );
85   -
86   - return texture;
87   -}
88   -
89   -}// end LOCAL STUFF
90   -
91   -class PortraitPageFactory : public PageFactory
92   -{
93   - /**
94   - * Query the number of pages available from the factory.
95   - * The maximum available page has an ID of GetNumberOfPages()-1.
96   - */
97   - virtual unsigned int GetNumberOfPages()
98   - {
99   - return 10*NUMBER_OF_PORTRAIT_IMAGE + 1;
100   - }
101   - /**
102   - * Create an texture to represent a page.
103   - * @param[in] pageId The ID of the page to create.
104   - * @return A texture, or an uninitialized handle if the ID is out of range.
105   - */
106   - virtual Texture NewPage( unsigned int pageId )
107   - {
108   - Texture page;
109   -
110   - if( pageId == 0 )
111   - {
112   - page = DemoHelper::LoadTexture( BOOK_COVER_PORTRAIT );
113   - }
114   - else
115   - {
116   - page = DemoHelper::LoadTexture( PAGE_IMAGES_PORTRAIT[ (pageId-1) % NUMBER_OF_PORTRAIT_IMAGE ] );
117   - }
118   -
119   - return page;
120   - }
121   -};
122   -
123   -class LandscapePageFactory : public PageFactory
124   -{
125   -
126   - /**
127   - * Query the number of pages available from the factory.
128   - * The maximum available page has an ID of GetNumberOfPages()-1.
129   - */
130   - virtual unsigned int GetNumberOfPages()
131   - {
132   - return 10*NUMBER_OF_LANDSCAPE_IMAGE / 2 + 1;
133   - }
134   - /**
135   - * Create an texture to represent a page.
136   - * @param[in] pageId The ID of the page to create.
137   - * @return A texture, or an uninitialized handle if the ID is out of range.
138   - */
139   - virtual Texture NewPage( unsigned int pageId )
140   - {
141   - Texture page;
142   - if( pageId == 0 )
143   - {
144   - page = LoadTextures( BOOK_COVER_LANDSCAPE, BOOK_COVER_BACK_LANDSCAPE );
145   - }
146   - else
147   - {
148   - unsigned int imageId = (pageId-1)*2;
149   - page = LoadTextures( PAGE_IMAGES_LANDSCAPE[ imageId % NUMBER_OF_LANDSCAPE_IMAGE ], PAGE_IMAGES_LANDSCAPE[ (imageId+1) % NUMBER_OF_LANDSCAPE_IMAGE ] );
150   - }
151   -
152   - return page;
153   - }
154   -};
155   -
156   -/**
157   - * This example shows how to use the page turn UI control to implement the page-turn demo
158   - * The effect follows the pan gesture to animate the page
159   - * Pan the page inwards, the page will bent,
160   - * Depends on the distance of the panning, the page might turn over or slide back
161   - * Also, in portrait view, the pan gesture outwards from position near the spine could turn the previous page back
162   - * Allows to turn multiple pages one by one quickly towards the same direction, multiple animations are launched in this case
163   -*/
164   -class PageTurnController : public ConnectionTracker
165   -{
166   -public:
167   - PageTurnController( Application &app );
168   - ~PageTurnController();
169   -
170   - //This method gets called once the main loop of application is up and running
171   - void OnInit( Application& app );
172   -
173   -private:
174   -
175   - /**
176   - * This method gets called when the button is clicked, switch between portrait and landscape views
177   - */
178   - bool OnButtonClicked(Toolkit::Button button);
179   -
180   - /**
181   - * Main key event handler
182   - */
183   - void OnKeyEvent(const KeyEvent& event);
184   -
185   - /**
186   - * Callback function of page turned signal
187   - * @param[in] pageTurnView The handle of the PageTurnPortraitView or PageTurnLandscapeView
188   - * @param[in] pageIndex The index of the page turned over
189   - * @param[in] isTurningForward The turning direction, forwards or backwards
190   - */
191   - void OnPageStartedTurn( PageTurnView pageTurnView, unsigned int pageIndex, bool isTurningForward );
192   -
193   - /**
194   - * Callback function of page turned signal
195   - * @param[in] pageTurnView The handle of the PageTurnPortraitView or PageTurnLandscapeView
196   - * @param[in] pageIndex The index of the page turned over
197   - * @param[in] isTurningForward The turning direction, forwards or backwards
198   - */
199   - void OnPageFinishedTurn( PageTurnView pageTurnView, unsigned int pageIndex, bool isTurningForward );
200   -
201   - /**
202   - * Callback function of page started pan signal
203   - *
204   - * @param[in] pageTurnView The calling page turn view
205   - */
206   - void OnPageStartedPan( PageTurnView pageTurnView );
207   -
208   - /**
209   - * Callback function of page finished pan signal
210   - *
211   - * @param[in] pageTurnView The calling page turn view
212   - */
213   - void OnPageFinishedPan( PageTurnView pageTurnView );
214   -
215   -private:
216   -
217   - Application& mApplication;
218   - Layer mButtonLayer;
219   -
220   - PageTurnView mPageTurnPortraitView;
221   - PageTurnView mPageTurnLandscapeView;
222   - PortraitPageFactory mPortraitPageFactory;
223   - LandscapePageFactory mLandscapePageFactory;
224   -
225   - bool mIsPortrait;
226   -};
227   -
228   -PageTurnController::PageTurnController( Application &app )
229   -:mApplication( app ),
230   - mIsPortrait( true )
231   -{
232   - // Connect to the Application's Init signal
233   - app.InitSignal().Connect( this, &PageTurnController::OnInit );
234   -}
235   -
236   -PageTurnController::~PageTurnController()
237   -{
238   -}
239   -
240   -
241   -void PageTurnController::OnInit( Application& app )
242   -{
243   - // The Init signal is received once ( only ) during the Application lifetime
244   -
245   - Stage::GetCurrent().KeyEventSignal().Connect(this, &PageTurnController::OnKeyEvent);
246   -
247   - // Hide the indicator bar
248   - app.GetWindow().ShowIndicator( Dali::Window::INVISIBLE );
249   -
250   - Stage stage = Stage::GetCurrent();
251   - Vector2 stageSize = stage.GetSize();
252   -
253   - mButtonLayer = Layer::New();
254   - mButtonLayer.SetAnchorPoint( Dali::AnchorPoint::CENTER );
255   - mButtonLayer.SetParentOrigin( Dali::ParentOrigin::CENTER );
256   - mButtonLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
257   - Toolkit::PushButton button = Toolkit::PushButton::New();
258   - button.SetAnchorPoint( AnchorPoint::TOP_RIGHT );
259   - button.SetParentOrigin( ParentOrigin::TOP_RIGHT );
260   - button.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_IMAGE_ICON );
261   - button.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_IMAGE_ICON_SELECTED );
262   - button.SetLeaveRequired( true );
263   - button.SetScale(1.5f);
264   - button.PressedSignal().Connect( this, &PageTurnController::OnButtonClicked );
265   - stage.Add( mButtonLayer );
266   - mButtonLayer.Add(button);
267   -
268   - Vector2 bookSize( stageSize.x > stageSize.y ? stageSize.y : stageSize.x,
269   - stageSize.x > stageSize.y ? stageSize.x : stageSize.y );
270   -
271   - mPageTurnPortraitView = PageTurnPortraitView::New( mPortraitPageFactory, bookSize );
272   - mPageTurnPortraitView.SetParentOrigin( ParentOrigin::CENTER );
273   - mPageTurnPortraitView.SetAnchorPoint( AnchorPoint::CENTER );
274   - mPageTurnPortraitView.SetProperty( PageTurnView::Property::SPINE_SHADOW, Vector2(70.f, 30.f) );
275   - mPageTurnPortraitView.PageTurnStartedSignal().Connect( this, &PageTurnController::OnPageStartedTurn );
276   - mPageTurnPortraitView.PageTurnFinishedSignal().Connect( this, &PageTurnController::OnPageFinishedTurn );
277   - mPageTurnPortraitView.PagePanStartedSignal().Connect( this, &PageTurnController::OnPageStartedPan );
278   - mPageTurnPortraitView.PagePanFinishedSignal().Connect( this, &PageTurnController::OnPageFinishedPan );
279   -
280   - mPageTurnLandscapeView = PageTurnLandscapeView::New( mLandscapePageFactory, Vector2(bookSize.y*0.5f, bookSize.x) );
281   - mPageTurnLandscapeView.SetParentOrigin( ParentOrigin::CENTER );
282   - mPageTurnLandscapeView.SetAnchorPoint( AnchorPoint::CENTER );
283   - mPageTurnLandscapeView.PageTurnStartedSignal().Connect( this, &PageTurnController::OnPageStartedTurn );
284   - mPageTurnLandscapeView.PageTurnFinishedSignal().Connect( this, &PageTurnController::OnPageFinishedTurn );
285   - mPageTurnLandscapeView.PagePanStartedSignal().Connect( this, &PageTurnController::OnPageStartedPan );
286   - mPageTurnLandscapeView.PagePanFinishedSignal().Connect( this, &PageTurnController::OnPageFinishedPan );
287   -
288   - if( stageSize.x > stageSize.y )
289   - {
290   - stage.Add(mPageTurnLandscapeView);
291   - mPageTurnPortraitView.SetOrientation(Degree(90.f), Vector3::ZAXIS);
292   - mIsPortrait = false;
293   - }
294   - else
295   - {
296   - stage.Add(mPageTurnPortraitView);
297   - mPageTurnLandscapeView.SetOrientation(Degree(90.f), Vector3::ZAXIS);
298   - mIsPortrait = true;
299   - }
300   -
301   - mButtonLayer.RaiseToTop();
302   -}
303   -
304   -bool PageTurnController::OnButtonClicked(Toolkit::Button button)
305   -{
306   - if( mIsPortrait )
307   - {
308   - mPageTurnPortraitView.Unparent();
309   - Stage::GetCurrent().Add( mPageTurnLandscapeView );
310   - int pageId = mPageTurnPortraitView.GetProperty( PageTurnView::Property::CURRENT_PAGE_ID ).Get<int>();
311   - int currentPage = ceil( static_cast<float>(pageId) / PAGE_NUMBER_CORRESPONDING_RATIO );
312   - mPageTurnLandscapeView.SetProperty(PageTurnView::Property::CURRENT_PAGE_ID, currentPage );
313   - }
314   - else
315   - {
316   - mPageTurnLandscapeView.Unparent();
317   - Stage::GetCurrent().Add( mPageTurnPortraitView );
318   - int pageId = mPageTurnLandscapeView.GetProperty( PageTurnView::Property::CURRENT_PAGE_ID ).Get<int>();
319   - int currentPage = floor(pageId * PAGE_NUMBER_CORRESPONDING_RATIO );
320   - mPageTurnPortraitView.SetProperty(PageTurnView::Property::CURRENT_PAGE_ID, currentPage );
321   - }
322   -
323   - mIsPortrait = !mIsPortrait;
324   - mButtonLayer.RaiseToTop();
325   - return true;
326   -}
327   -
328   -/**
329   - * Main key event handler
330   - */
331   -void PageTurnController::OnKeyEvent(const KeyEvent& event)
332   -{
333   - if(event.state == KeyEvent::Down)
334   - {
335   - if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
336   - {
337   - mApplication.Quit();
338   - }
339   - }
340   -}
341   -
342   -void PageTurnController::OnPageStartedTurn( PageTurnView pageTurnView, unsigned int pageIndex, bool isTurningForward )
343   -{
344   - std::cout<< ( ( pageTurnView == mPageTurnPortraitView ) ? " portrait: " : " Landscape: " )
345   - << " page " << pageIndex
346   - << ( isTurningForward ? " is starting to turn forward" : " is starting to turn backward" )
347   - << std::endl;
348   -}
349   -
350   -void PageTurnController::OnPageFinishedTurn( PageTurnView pageTurnView, unsigned int pageIndex, bool isTurningForward )
351   -{
352   - std::cout<< ( ( pageTurnView == mPageTurnPortraitView ) ? " portrait: " : " Landscape: " )
353   - << " page " << pageIndex
354   - << ( isTurningForward ? " has finished turning forward" : " has finished turning backward" )
355   - << std::endl;
356   -}
357   -
358   -void PageTurnController::OnPageStartedPan( PageTurnView pageTurnView )
359   -{
360   - std::cout<< "Starting to pan" << std::endl;
361   -}
362   -
363   -void PageTurnController::OnPageFinishedPan( PageTurnView pageTurnView )
364   -{
365   - std::cout<< "Finished panning" << std::endl;
366   -}
367   -
368   -// Entry point for applications
369   -int DALI_EXPORT_API main( int argc, char **argv )
370   -{
371   - Application app = Application::New(&argc, &argv, DEMO_THEME_PATH);
372   - PageTurnController test ( app );
373   -
374   - app.MainLoop();
375   -
376   - return 0;
377   -}
examples/super-blur-bloom/super-blur-bloom-example.cpp deleted
1   -/*
2   - * Copyright (c) 2017 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   -#include <dali/dali.h>
18   -#include <dali-toolkit/dali-toolkit.h>
19   -#include <dali-toolkit/devel-api/controls/bloom-view/bloom-view.h>
20   -#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
21   -#include <dali-toolkit/devel-api/controls/super-blur-view/super-blur-view.h>
22   -#include "shared/view.h"
23   -#include "shared/utility.h"
24   -
25   -using namespace Dali;
26   -
27   -namespace
28   -{
29   -const char * const TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" );
30   -const char * const TITLE_SUPER_BLUR( "Super Blur" );
31   -const char * const TITLE_BLOOM( "Bloom" );
32   -const char * const CHANGE_BACKGROUND_ICON( DEMO_IMAGE_DIR "icon-change.png" );
33   -const char * const CHANGE_BACKGROUND_ICON_SELECTED( DEMO_IMAGE_DIR "icon-change-selected.png" );
34   -const char * const CHANGE_BLUR_ICON( DEMO_IMAGE_DIR "icon-replace.png" );
35   -const char * const CHANGE_BLUR_ICON_SELECTED( DEMO_IMAGE_DIR "icon-replace-selected.png" );
36   -
37   -const char* BACKGROUND_IMAGES[]=
38   -{
39   - DEMO_IMAGE_DIR "background-1.jpg",
40   - DEMO_IMAGE_DIR "background-2.jpg",
41   - DEMO_IMAGE_DIR "background-3.jpg",
42   - DEMO_IMAGE_DIR "background-4.jpg",
43   - DEMO_IMAGE_DIR "background-5.jpg",
44   - DEMO_IMAGE_DIR "background-magnifier.jpg",
45   -};
46   -const unsigned int NUM_BACKGROUND_IMAGES( sizeof( BACKGROUND_IMAGES ) / sizeof( BACKGROUND_IMAGES[0] ) );
47   -
48   -}
49   -
50   -class BlurExample : public ConnectionTracker
51   -{
52   -public:
53   - BlurExample(Application &app)
54   - : mApp(app),
55   - mImageIndex( 0 ),
56   - mIsBlurring( false )
57   - {
58   - // Connect to the Application's Init signal
59   - app.InitSignal().Connect(this, &BlurExample::Create);
60   - }
61   -
62   - ~BlurExample()
63   - {
64   - }
65   -private:
66   - // The Init signal is received once (only) during the Application lifetime
67   - void Create(Application& app)
68   - {
69   - Stage stage = Stage::GetCurrent();
70   - Vector2 stageSize = stage.GetSize();
71   -
72   - stage.KeyEventSignal().Connect(this, &BlurExample::OnKeyEvent);
73   -
74   - // Creates a default view with a default tool bar.
75   - // The view is added to the stage.
76   - Layer content = DemoHelper::CreateView( app,
77   - mBackground,
78   - mToolBar,
79   - "",
80   - TOOLBAR_IMAGE,
81   - "" );
82   -
83   - // Add a button to change background. (right of toolbar)
84   - Toolkit::PushButton changeBackgroundButton = Toolkit::PushButton::New();
85   - changeBackgroundButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_BACKGROUND_ICON );
86   - changeBackgroundButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_BACKGROUND_ICON_SELECTED );
87   -
88   - changeBackgroundButton.ClickedSignal().Connect( this, &BlurExample::OnChangeBackgroundIconClicked );
89   - mToolBar.AddControl( changeBackgroundButton,
90   - DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage,
91   - Toolkit::Alignment::HorizontalRight,
92   - DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
93   -
94   - // Add a button to change the blur view. (left of toolbar)
95   - Toolkit::PushButton changeBlurButton = Toolkit::PushButton::New();
96   - changeBlurButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_BLUR_ICON );
97   - changeBlurButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_BLUR_ICON_SELECTED );
98   -
99   - changeBlurButton.ClickedSignal().Connect( this, &BlurExample::OnChangeBlurIconClicked );
100   - mToolBar.AddControl( changeBlurButton,
101   - DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage,
102   - Toolkit::Alignment::HorizontalLeft,
103   - DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
104   -
105   - mSuperBlurView = Toolkit::SuperBlurView::New( 5 );
106   - mSuperBlurView.SetSize( stageSize );
107   - mSuperBlurView.SetParentOrigin( ParentOrigin::CENTER );
108   - mSuperBlurView.SetAnchorPoint( AnchorPoint::CENTER );
109   - mSuperBlurView.BlurFinishedSignal().Connect(this, &BlurExample::OnBlurFinished);
110   - mCurrentImage = DemoHelper::LoadStageFillingImage( BACKGROUND_IMAGES[mImageIndex] );
111   - mSuperBlurView.SetImage( mCurrentImage );
112   - mBackground.Add( mSuperBlurView );
113   - mIsBlurring = true;
114   - SetTitle( TITLE_SUPER_BLUR );
115   -
116   - mBloomView = Toolkit::BloomView::New();
117   - mBloomView.SetParentOrigin(ParentOrigin::CENTER);
118   - mBloomView.SetSize(stageSize);
119   - mBloomActor = Toolkit::ImageView::New(mCurrentImage);
120   - mBloomActor.SetParentOrigin( ParentOrigin::CENTER );
121   - mBloomView.Add( mBloomActor );
122   -
123   - // Connect the callback to the touch signal on the background
124   - mSuperBlurView.TouchSignal().Connect( this, &BlurExample::OnTouch );
125   - mBloomView.TouchSignal().Connect( this, &BlurExample::OnTouch );
126   - }
127   -
128   - // Callback function of the touch signal on the background
129   - bool OnTouch(Dali::Actor actor, const Dali::TouchData& event)
130   - {
131   - switch( event.GetState( 0 ) )
132   - {
133   - case PointState::DOWN:
134   - {
135   - if( mAnimation )
136   - {
137   - mAnimation.Clear();
138   - }
139   -
140   - mAnimation = Animation::New( 2.f );
141   - if( mSuperBlurView.OnStage() )
142   - {
143   - mAnimation.AnimateTo( Property( mSuperBlurView, mSuperBlurView.GetBlurStrengthPropertyIndex() ), 1.f );
144   - }
145   - else
146   - {
147   - mAnimation.AnimateTo( Property( mBloomView, mBloomView.GetBloomIntensityPropertyIndex() ), 3.f );
148   - }
149   - mAnimation.Play();
150   - break;
151   - }
152   - case PointState::UP:
153   - case PointState::LEAVE:
154   - case PointState::INTERRUPTED:
155   - {
156   - if( mAnimation )
157   - {
158   - mAnimation.Clear();
159   - }
160   -
161   - mAnimation = Animation::New( 2.f );
162   - if( mSuperBlurView.OnStage() )
163   - {
164   - mAnimation.AnimateTo( Property( mSuperBlurView, mSuperBlurView.GetBlurStrengthPropertyIndex() ), 0.f );
165   - }
166   - else
167   - {
168   - mAnimation.AnimateTo( Property( mBloomView, mBloomView.GetBloomIntensityPropertyIndex() ), 0.f );
169   - }
170   - mAnimation.Play();
171   - break;
172   - }
173   - case PointState::MOTION:
174   - case PointState::STATIONARY:
175   - {
176   - break;
177   - }
178   - }
179   - return true;
180   - }
181   -
182   - /**
183   - * Main key event handler
184   - */
185   - void OnKeyEvent(const KeyEvent& event)
186   - {
187   - if(event.state == KeyEvent::Down)
188   - {
189   - if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
190   - {
191   - mApp.Quit();
192   - }
193   - }
194   - }
195   -
196   - bool OnChangeBackgroundIconClicked( Toolkit::Button button )
197   - {
198   - if( mIsBlurring )
199   - {
200   - return true;
201   - }
202   -
203   - if( mAnimation )
204   - {
205   - mAnimation.Clear();
206   - }
207   -
208   - mImageIndex = (mImageIndex+1u)%NUM_BACKGROUND_IMAGES;
209   - mCurrentImage = DemoHelper::LoadStageFillingImage( BACKGROUND_IMAGES[mImageIndex] );
210   -
211   - if( mSuperBlurView.OnStage() )
212   - {
213   - mIsBlurring = true;
214   -
215   - mSuperBlurView.SetBlurStrength( 0.f );
216   - mSuperBlurView.SetImage( mCurrentImage );
217   - }
218   - else
219   - {
220   - mBloomView.SetProperty( mBloomView.GetBloomIntensityPropertyIndex(), 0.f );
221   - mBloomActor.SetImage( mCurrentImage );
222   - }
223   -
224   - return true;
225   - }
226   -
227   - bool OnChangeBlurIconClicked( Toolkit::Button button )
228   - {
229   - if( mSuperBlurView.OnStage() )
230   - {
231   - SetTitle( TITLE_BLOOM );
232   - mBackground.Remove( mSuperBlurView );
233   -
234   - mBloomActor.SetImage( mCurrentImage );
235   - mBloomView.SetProperty( mBloomView.GetBloomIntensityPropertyIndex(), 0.f );
236   - mBackground.Add( mBloomView );
237   - mBloomView.Activate();
238   -
239   - }
240   - else
241   - {
242   - SetTitle( TITLE_SUPER_BLUR );
243   - mBackground.Remove( mBloomView );
244   - mBloomView.Deactivate();
245   -
246   - mBackground.Add( mSuperBlurView );
247   - mSuperBlurView.SetBlurStrength( 0.f );
248   - mSuperBlurView.SetImage( mCurrentImage );
249   - mIsBlurring = true;
250   - }
251   -
252   - return true;
253   - }
254   -
255   - void OnBlurFinished( Toolkit::SuperBlurView blurView )
256   - {
257   - mIsBlurring = false;
258   - }
259   -
260   - /**
261   - * Sets/Updates the title of the View
262   - * @param[in] title The new title for the view.
263   - */
264   - void SetTitle(const std::string& title)
265   - {
266   - if(!mTitleActor)
267   - {
268   - mTitleActor = DemoHelper::CreateToolBarLabel( title );
269   - // Add title to the tool bar.
270   - mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter );
271   - }
272   -
273   - mTitleActor.SetProperty( Toolkit::TextLabel::Property::TEXT, title );
274   - }
275   -
276   -private:
277   -
278   - Application& mApp;
279   - Toolkit::ToolBar mToolBar;
280   - Toolkit::TextLabel mTitleActor; ///< The Toolbar's Title.
281   - Toolkit::Control mBackground;
282   - Toolkit::SuperBlurView mSuperBlurView;
283   - Toolkit::BloomView mBloomView;
284   - Animation mAnimation;
285   - Toolkit::ImageView mBloomActor;
286   - Image mCurrentImage;
287   - unsigned int mImageIndex;
288   - bool mIsBlurring;
289   -};
290   -
291   -/*****************************************************************************/
292   -
293   -static void
294   -RunTest(Application& app)
295   -{
296   - BlurExample theApp(app);
297   - app.MainLoop();
298   -}
299   -
300   -/*****************************************************************************/
301   -
302   -int DALI_EXPORT_API main(int argc, char **argv)
303   -{
304   - Application app = Application::New(&argc, &argv, DEMO_THEME_PATH);
305   -
306   - RunTest(app);
307   -
308   - return 0;
309   -}
resources/po/as.po
... ... @@ -79,12 +79,6 @@ msgstr &quot;মেশ অসংযোগ&quot;
79 79 msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL"
80 80 msgstr "3D অনুগামী"
81 81  
82   -msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION"
83   -msgstr "মেটাবল মহা-বিস্ফোৰণবাদ"
84   -
85   -msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC"
86   -msgstr "মেটাবল প্ৰতিসৰিত"
87   -
88 82 msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR"
89 83 msgstr "অস্পষ্ট"
90 84  
... ... @@ -97,9 +91,6 @@ msgstr &quot;অইন অনুবিম্ব&quot;
97 91 msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE"
98 92 msgstr "অকণমান আপোচ কৰ্"
99 93  
100   -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW"
101   -msgstr "পৃষ্ঠা লেআউট"
102   -
103 94 msgid "DALI_DEMO_STR_TITLE_POPUP"
104 95 msgstr "পোপা মেনু"
105 96  
... ... @@ -130,9 +121,6 @@ msgstr &quot;তাৰকা&quot;
130 121 msgid "DALI_DEMO_STR_TITLE_STYLING"
131 122 msgstr "শৈলী"
132 123  
133   -msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM"
134   -msgstr "অস্পষ্টকৈ অপুষ্পক"
135   -
136 124 msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH"
137 125 msgstr "টেক্সটারেদ মেশ"
138 126  
... ...
resources/po/de.po
... ... @@ -79,12 +79,6 @@ msgstr &quot;Mesh Sortierung&quot;
79 79 msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL"
80 80 msgstr "3D-Modelle"
81 81  
82   -msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION"
83   -msgstr "Metaball Explosion"
84   -
85   -msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC"
86   -msgstr "Metaball Brechung"
87   -
88 82 msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR"
89 83 msgstr "Bewegungsunschärfe"
90 84  
... ... @@ -97,9 +91,6 @@ msgstr &quot;Nativen Bild&quot;
97 91 msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE"
98 92 msgstr "Größe Verhandlung"
99 93  
100   -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW"
101   -msgstr "Seite wechseln"
102   -
103 94 msgid "DALI_DEMO_STR_TITLE_POPUP"
104 95 msgstr "Popup-Menü"
105 96  
... ... @@ -130,9 +121,6 @@ msgstr &quot;Funkeln&quot;
130 121 msgid "DALI_DEMO_STR_TITLE_STYLING"
131 122 msgstr "Styling"
132 123  
133   -msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM"
134   -msgstr "Unschärfe und blühen"
135   -
136 124 msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH"
137 125 msgstr "Strukturiertem Mesh"
138 126  
... ...
resources/po/en_GB.po
... ... @@ -79,12 +79,6 @@ msgstr &quot;Mesh Sorting&quot;
79 79 msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL"
80 80 msgstr "Mesh Visual"
81 81  
82   -msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION"
83   -msgstr "Metaball Explosion"
84   -
85   -msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC"
86   -msgstr "Metaball Refraction"
87   -
88 82 msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR"
89 83 msgstr "Motion Blur"
90 84  
... ... @@ -97,9 +91,6 @@ msgstr &quot;Native Image Source&quot;
97 91 msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE"
98 92 msgstr "Negotiate Size"
99 93  
100   -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW"
101   -msgstr "Page Turn View"
102   -
103 94 msgid "DALI_DEMO_STR_TITLE_POPUP"
104 95 msgstr "Popup"
105 96  
... ... @@ -130,9 +121,6 @@ msgstr &quot;Sparkle&quot;
130 121 msgid "DALI_DEMO_STR_TITLE_STYLING"
131 122 msgstr "Styling"
132 123  
133   -msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM"
134   -msgstr "Super Blur and Bloom"
135   -
136 124 msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH"
137 125 msgstr "Mesh Texture"
138 126  
... ...
resources/po/en_US.po
... ... @@ -79,12 +79,6 @@ msgstr &quot;Mesh Sorting&quot;
79 79 msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL"
80 80 msgstr "Mesh Visual"
81 81  
82   -msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION"
83   -msgstr "Metaball Explosion"
84   -
85   -msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC"
86   -msgstr "Metaball Refraction"
87   -
88 82 msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR"
89 83 msgstr "Motion Blur"
90 84  
... ... @@ -97,9 +91,6 @@ msgstr &quot;Native Image Source&quot;
97 91 msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE"
98 92 msgstr "Negotiate Size"
99 93  
100   -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW"
101   -msgstr "Page Turn View"
102   -
103 94 msgid "DALI_DEMO_STR_TITLE_POPUP"
104 95 msgstr "Popup"
105 96  
... ... @@ -130,9 +121,6 @@ msgstr &quot;Sparkle&quot;
130 121 msgid "DALI_DEMO_STR_TITLE_STYLING"
131 122 msgstr "Styling"
132 123  
133   -msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM"
134   -msgstr "Super Blur and Bloom"
135   -
136 124 msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH"
137 125 msgstr "Mesh Texture"
138 126  
... ...
resources/po/es.po
... ... @@ -79,12 +79,6 @@ msgstr &quot;Ordenacion de geometrias&quot;
79 79 msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL"
80 80 msgstr "Gemeotria 3D"
81 81  
82   -msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION"
83   -msgstr "Explosion de metabolas"
84   -
85   -msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC"
86   -msgstr "Refraccion de metabolas"
87   -
88 82 msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR"
89 83 msgstr "Desenfoque de movimiento"
90 84  
... ... @@ -97,9 +91,6 @@ msgstr &quot;Fuente de imagenes nativas&quot;
97 91 msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE"
98 92 msgstr "Negociacion de tamaño"
99 93  
100   -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW"
101   -msgstr "Vista de páginas"
102   -
103 94 msgid "DALI_DEMO_STR_TITLE_POPUP"
104 95 msgstr "Popup"
105 96  
... ... @@ -130,9 +121,6 @@ msgstr &quot;Brillar&quot;
130 121 msgid "DALI_DEMO_STR_TITLE_STYLING"
131 122 msgstr "Estilo"
132 123  
133   -msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM"
134   -msgstr "Efecto blur y bloom"
135   -
136 124 msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH"
137 125 msgstr "Geometria con texturas"
138 126  
... ...
resources/po/fi.po
... ... @@ -79,12 +79,6 @@ msgstr &quot;Polygoniverkon Lajittelu&quot;
79 79 msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL"
80 80 msgstr "Polygoniverkkovisuaali"
81 81  
82   -msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION"
83   -msgstr "Metaball Räjähdys"
84   -
85   -msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC"
86   -msgstr "Metaball Valon Taittumisella"
87   -
88 82 msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR"
89 83 msgstr "Liikesumennus"
90 84  
... ... @@ -97,9 +91,6 @@ msgstr &quot;Natiivi Kuvalähde&quot;
97 91 msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE"
98 92 msgstr "Kokoneuvottelu"
99 93  
100   -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW"
101   -msgstr "Sivunkääntönäkymä"
102   -
103 94 msgid "DALI_DEMO_STR_TITLE_POPUP"
104 95 msgstr "Ponnahdusikkuna"
105 96  
... ... @@ -130,9 +121,6 @@ msgstr &quot;Kimalteluefekti&quot;
130 121 msgid "DALI_DEMO_STR_TITLE_STYLING"
131 122 msgstr "UI Tyyli"
132 123  
133   -msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM"
134   -msgstr "Erikoissumennus ja Hehku efekti"
135   -
136 124 msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH"
137 125 msgstr "Teksturoitu Polygoniverkko"
138 126  
... ...
resources/po/ko.po
... ... @@ -79,12 +79,6 @@ msgstr &quot;메쉬 분류&quot;
79 79 msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL"
80 80 msgstr "메쉬 비주얼"
81 81  
82   -msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION"
83   -msgstr "메타볼 폭발"
84   -
85   -msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC"
86   -msgstr "메타볼 굴절"
87   -
88 82 msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR"
89 83 msgstr "모션 블러"
90 84  
... ... @@ -97,9 +91,6 @@ msgstr &quot;네이티브 이미지 소스&quot;
97 91 msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE"
98 92 msgstr "사이즈 조절"
99 93  
100   -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW"
101   -msgstr "책장 넘기기"
102   -
103 94 msgid "DALI_DEMO_STR_TITLE_POPUP"
104 95 msgstr "팝업"
105 96  
... ... @@ -130,9 +121,6 @@ msgstr &quot;불꽃&quot;
130 121 msgid "DALI_DEMO_STR_TITLE_STYLING"
131 122 msgstr "스타일링"
132 123  
133   -msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM"
134   -msgstr "블러링 이펙트"
135   -
136 124 msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH"
137 125 msgstr "텍스쳐 메쉬"
138 126  
... ...
resources/po/ml.po
... ... @@ -79,12 +79,6 @@ msgstr &quot;തരംതിരിക്കലിനായി mesh&quot;
79 79 msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL"
80 80 msgstr "3D മോഡലിങ്"
81 81  
82   -msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION"
83   -msgstr "മെറ്റാ പന്ത് സ്ഫോടനം"
84   -
85   -msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC"
86   -msgstr "മെറ്റാ പന്ത് അപവർത്തനം"
87   -
88 82 msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR"
89 83 msgstr "അവ്യക്തമാക്കല്"
90 84  
... ... @@ -97,9 +91,6 @@ msgstr &quot;നേറ്റീവ് ചിത്രം&quot;
97 91 msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE"
98 92 msgstr "വലുപ്പം കൂടിയാലോചന"
99 93  
100   -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW"
101   -msgstr "പേജ് ലേഔട്ട്"
102   -
103 94 msgid "DALI_DEMO_STR_TITLE_POPUP"
104 95 msgstr "പോപപ്പ് മെനുവിൽ"
105 96  
... ... @@ -130,9 +121,6 @@ msgstr &quot;നക്ഷത്ര&quot;
130 121 msgid "DALI_DEMO_STR_TITLE_STYLING"
131 122 msgstr "ശൈലി"
132 123  
133   -msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM"
134   -msgstr "മങ്ങൽ പൂക്കൽ"
135   -
136 124 msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH"
137 125 msgstr "ടെക്സ്ചർ mesh"
138 126  
... ...
resources/po/ur.po
... ... @@ -79,12 +79,6 @@ msgstr &quot;میش کی چھنٹائی&quot;
79 79 msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL"
80 80 msgstr "3D میش"
81 81  
82   -msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION"
83   -msgstr "میٹابال دھماکہ"
84   -
85   -msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC"
86   -msgstr "میٹابال اپورتن"
87   -
88 82 msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR"
89 83 msgstr "دھندلانے کی حرکت"
90 84  
... ... @@ -97,9 +91,6 @@ msgstr &quot;نیٹو تصویر&quot;
97 91 msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE"
98 92 msgstr "سائز مذاکرات"
99 93  
100   -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW"
101   -msgstr "کتاب"
102   -
103 94 msgid "DALI_DEMO_STR_TITLE_POPUP"
104 95 msgstr "پاپ اپ"
105 96  
... ... @@ -130,9 +121,6 @@ msgstr &quot;سٹار&quot;
130 121 msgid "DALI_DEMO_STR_TITLE_STYLING"
131 122 msgstr "سٹائل"
132 123  
133   -msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM"
134   -msgstr "دھندلاپن اور بلوم"
135   -
136 124 msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH"
137 125 msgstr "ٹیکسچرد میش"
138 126  
... ...
resources/po/zn_CH.po
... ... @@ -79,12 +79,6 @@ msgstr &quot;网格排序&quot;
79 79 msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL"
80 80 msgstr "3D模型"
81 81  
82   -msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION"
83   -msgstr "元球爆炸"
84   -
85   -msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC"
86   -msgstr "元球折射"
87   -
88 82 msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR"
89 83 msgstr "动作模糊"
90 84  
... ... @@ -97,9 +91,6 @@ msgstr &quot;本地图像&quot;
97 91 msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE"
98 92 msgstr "尺寸协商"
99 93  
100   -msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW"
101   -msgstr "翻页"
102   -
103 94 msgid "DALI_DEMO_STR_TITLE_POPUP"
104 95 msgstr "弹窗"
105 96  
... ... @@ -130,9 +121,6 @@ msgstr &quot;火花&quot;
130 121 msgid "DALI_DEMO_STR_TITLE_STYLING"
131 122 msgstr "样式"
132 123  
133   -msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM"
134   -msgstr "模糊及泛光"
135   -
136 124 msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH"
137 125 msgstr "纹理网格"
138 126  
... ...
shared/dali-demo-strings.h
... ... @@ -60,13 +60,10 @@ extern &quot;C&quot;
60 60 #define DALI_DEMO_STR_TITLE_MESH_MORPH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MESH_MORPH")
61 61 #define DALI_DEMO_STR_TITLE_MESH_SORTING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MESH_SORTING")
62 62 #define DALI_DEMO_STR_TITLE_MESH_VISUAL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MESH_VISUAL")
63   -#define DALI_DEMO_STR_TITLE_METABALL_EXPLOSION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION")
64   -#define DALI_DEMO_STR_TITLE_METABALL_REFRAC dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_METABALL_REFRAC")
65 63 #define DALI_DEMO_STR_TITLE_MOTION_BLUR dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MOTION_BLUR")
66 64 #define DALI_DEMO_STR_TITLE_MOTION_STRETCH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MOTION_STRETCH")
67 65 #define DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE")
68 66 #define DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE")
69   -#define DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW")
70 67 #define DALI_DEMO_STR_TITLE_POPUP dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_POPUP")
71 68 #define DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES")
72 69 #define DALI_DEMO_STR_TITLE_PROGRESS_BAR dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_PROGRESS_BAR")
... ... @@ -76,7 +73,6 @@ extern &quot;C&quot;
76 73 #define DALI_DEMO_STR_TITLE_SCROLL_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SCROLL_VIEW")
77 74 #define DALI_DEMO_STR_TITLE_SPARKLE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SPARKLE")
78 75 #define DALI_DEMO_STR_TITLE_STYLING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_STYLING")
79   -#define DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM")
80 76 #define DALI_DEMO_STR_TITLE_TEXTURED_MESH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXTURED_MESH")
81 77 #define DALI_DEMO_STR_TITLE_TEXT_EDITOR dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_EDITOR")
82 78 #define DALI_DEMO_STR_TITLE_TEXT_FIELD dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_FIELD")
... ... @@ -117,13 +113,10 @@ extern &quot;C&quot;
117 113 #define DALI_DEMO_STR_TITLE_MESH_MORPH "Mesh Morph"
118 114 #define DALI_DEMO_STR_TITLE_MESH_SORTING "Mesh Sorting"
119 115 #define DALI_DEMO_STR_TITLE_MESH_VISUAL "Mesh Visual"
120   -#define DALI_DEMO_STR_TITLE_METABALL_EXPLOSION "Metaball Explosion"
121   -#define DALI_DEMO_STR_TITLE_METABALL_REFRAC "Metaball Refractions"
122 116 #define DALI_DEMO_STR_TITLE_MOTION_BLUR "Motion Blur"
123 117 #define DALI_DEMO_STR_TITLE_MOTION_STRETCH "Motion Stretch"
124 118 #define DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE "Native Image Source"
125 119 #define DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE "Negotiate Size"
126   -#define DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW "Page Turn View"
127 120 #define DALI_DEMO_STR_TITLE_POPUP "Popup"
128 121 #define DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES "Primitive Shapes"
129 122 #define DALI_DEMO_STR_TITLE_PROGRESS_BAR "Progress Bar"
... ... @@ -133,7 +126,6 @@ extern &quot;C&quot;
133 126 #define DALI_DEMO_STR_TITLE_SCROLL_VIEW "Scroll View"
134 127 #define DALI_DEMO_STR_TITLE_SPARKLE "Sparkle"
135 128 #define DALI_DEMO_STR_TITLE_STYLING "Styling"
136   -#define DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM "Super Blur and Bloom"
137 129 #define DALI_DEMO_STR_TITLE_TEXTURED_MESH "Mesh Texture"
138 130 #define DALI_DEMO_STR_TITLE_TEXT_EDITOR "Text Editor"
139 131 #define DALI_DEMO_STR_TITLE_TEXT_FIELD "Text Field"
... ...