Commit 4445466b0571bc7f5751d8ad9baa1a833ae9ecb6
1 parent
53995151
Resurrected Bloom View example
Change-Id: I2dc368a20e0845c0ecd32d047566d37f9f47d69f
Showing
9 changed files
with
249 additions
and
15 deletions
com.samsung.dali-demo.xml
| ... | ... | @@ -305,6 +305,9 @@ |
| 305 | 305 | <ui-application appid="super-blur-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/super-blur-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 306 | 306 | <label>Super Blur</label> |
| 307 | 307 | </ui-application> |
| 308 | + <ui-application appid="bloom-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/bloom-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | |
| 309 | + <label>Bloom</label> | |
| 310 | + </ui-application> | |
| 308 | 311 | |
| 309 | 312 | <privileges> |
| 310 | 313 | <privilege>http://tizen.org/privilege/mediastorage</privilege> | ... | ... |
examples-reel/dali-examples-reel.cpp
| ... | ... | @@ -40,6 +40,7 @@ int DALI_EXPORT_API main(int argc, char **argv) |
| 40 | 40 | demo.AddExample(Example("animated-shapes.example", DALI_DEMO_STR_TITLE_ANIMATED_SHAPES)); |
| 41 | 41 | demo.AddExample(Example("animated-vector-images.example", DALI_DEMO_STR_TITLE_ANIMATED_VECTOR_IMAGES)); |
| 42 | 42 | demo.AddExample(Example("alpha-blending-cpu.example", DALI_DEMO_STR_TITLE_ALPHA_BLENDING_CPU)); |
| 43 | + demo.AddExample(Example("bloom-view.example", DALI_DEMO_STR_TITLE_BLOOM_VIEW)); | |
| 43 | 44 | demo.AddExample(Example("builder.example", DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI)); |
| 44 | 45 | demo.AddExample(Example("buttons.example", DALI_DEMO_STR_TITLE_BUTTONS)); |
| 45 | 46 | demo.AddExample(Example("clipping.example", DALI_DEMO_STR_TITLE_CLIPPING)); | ... | ... |
examples/bloom-view/bloom-view-example.cpp
0 → 100644
| 1 | +/* | |
| 2 | + * Copyright (c) 2019 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/bloom-view/bloom-view.h> | |
| 21 | + | |
| 22 | +using namespace Dali; | |
| 23 | +using namespace Dali::Toolkit; | |
| 24 | + | |
| 25 | +namespace | |
| 26 | +{ | |
| 27 | + | |
| 28 | +const char* BACKGROUND_IMAGE_PATH( DEMO_IMAGE_DIR "desktop_background_1440x2560.png" ); | |
| 29 | +const char* UI_DIFFUSE_IMAGE( DEMO_IMAGE_DIR "UI-Leather-DIFF.png" ); | |
| 30 | + | |
| 31 | +const Rect<int> UI_PIXEL_AREA( 0, 0, 720, 1280 ); | |
| 32 | + | |
| 33 | +const Rect<int> PANEL1_PIXEL_AREA( 0, 0, 720, 39 ); | |
| 34 | +const Rect<int> PANEL2_PIXEL_AREA( 0, 39, 720, 100 ); | |
| 35 | + | |
| 36 | +const unsigned int NUM_MOVEMENT_ANIMATIONS = 2; | |
| 37 | + | |
| 38 | +// for animating bloom intensity on tap gesture | |
| 39 | +const float PULSE_BLOOM_INCREASE_ANIM_TIME = 1.175; | |
| 40 | +const float PULSE_BLOOM_DECREASE_ANIM_TIME = 2.4; | |
| 41 | +const float PULSE_BLOOM_TOTAL_ANIM_TIME = PULSE_BLOOM_INCREASE_ANIM_TIME + PULSE_BLOOM_DECREASE_ANIM_TIME; | |
| 42 | +const float PULSE_BLOOM_INTENSITY_DEFAULT = 1.0f; | |
| 43 | +const float PULSE_BLOOM_INTENSITY_INCREASE = 3.0f; | |
| 44 | + | |
| 45 | +// These values depend on the button background image | |
| 46 | +const Vector4 BUTTON_IMAGE_BORDER(16.0f, 16.0f, 16.0f, 20.0f); | |
| 47 | + | |
| 48 | +const float UI_MARGIN = 4.0f; ///< Screen Margin for placement of UI buttons | |
| 49 | +const Vector3 BUTTON_SIZE_CONSTRAINT( 0.24f, 0.09f, 1.0f ); | |
| 50 | + | |
| 51 | +} // namespace | |
| 52 | + | |
| 53 | +/** | |
| 54 | + * This example demonstrates a bloom effect. | |
| 55 | + */ | |
| 56 | +class BloomExample : public ConnectionTracker | |
| 57 | +{ | |
| 58 | +public: | |
| 59 | + | |
| 60 | + BloomExample( Application &application ) | |
| 61 | + : mApplication(application), | |
| 62 | + mCurrentAnimation(0) | |
| 63 | + { | |
| 64 | + application.InitSignal().Connect( this, &BloomExample::Create ); | |
| 65 | + } | |
| 66 | + | |
| 67 | + ~BloomExample() | |
| 68 | + { | |
| 69 | + } | |
| 70 | + | |
| 71 | +public: | |
| 72 | + | |
| 73 | + void Create( Application& application ) | |
| 74 | + { | |
| 75 | + Stage stage = Stage::GetCurrent(); | |
| 76 | + Vector2 stageSize = stage.GetSize(); | |
| 77 | + Vector2 viewSize( stageSize ); | |
| 78 | + | |
| 79 | + mRootActor = Actor::New(); | |
| 80 | + mRootActor.SetParentOrigin( ParentOrigin::CENTER ); | |
| 81 | + mRootActor.SetSize( stageSize ); | |
| 82 | + stage.Add( mRootActor ); | |
| 83 | + | |
| 84 | + // Create the object that will perform the blooming work | |
| 85 | + mBloomView = Dali::Toolkit::BloomView::New(); | |
| 86 | + mBloomView.SetParentOrigin( ParentOrigin::CENTER ); | |
| 87 | + mBloomView.SetSize( viewSize ); | |
| 88 | + mRootActor.Add( mBloomView ); | |
| 89 | + mBloomView.Activate(); | |
| 90 | + | |
| 91 | + Layer backgroundLayer = Layer::New(); | |
| 92 | + backgroundLayer.SetSize( viewSize ); | |
| 93 | + backgroundLayer.SetParentOrigin( ParentOrigin::CENTER ); | |
| 94 | + mBloomView.Add( backgroundLayer ); | |
| 95 | + | |
| 96 | + // Create the background image | |
| 97 | + ImageView backgroundImage = ImageView::New( BACKGROUND_IMAGE_PATH ); | |
| 98 | + backgroundImage.SetParentOrigin( ParentOrigin::CENTER ); | |
| 99 | + backgroundImage.SetSize( viewSize ); | |
| 100 | + backgroundLayer.Add( backgroundImage ); | |
| 101 | + | |
| 102 | + Layer foregroundLayer = Layer::New(); | |
| 103 | + foregroundLayer.SetSize( viewSize ); | |
| 104 | + foregroundLayer.SetParentOrigin( ParentOrigin::CENTER ); | |
| 105 | + mBloomView.Add( foregroundLayer ); | |
| 106 | + | |
| 107 | + // Create visible actors | |
| 108 | + mObjectRootActor = Actor::New(); | |
| 109 | + mObjectRootActor.SetParentOrigin( ParentOrigin::CENTER ); | |
| 110 | + mObjectRootActor.SetSize( viewSize ); | |
| 111 | + foregroundLayer.Add( mObjectRootActor ); | |
| 112 | + | |
| 113 | + ImageView imageView = ImageView::New( UI_DIFFUSE_IMAGE ); | |
| 114 | + imageView.SetParentOrigin( ParentOrigin::CENTER ); | |
| 115 | + imageView.SetSize( viewSize ); | |
| 116 | + mObjectRootActor.Add( imageView ); | |
| 117 | + | |
| 118 | + imageView = ImageView::New( UI_DIFFUSE_IMAGE ); | |
| 119 | + imageView.SetParentOrigin( ParentOrigin::CENTER ); | |
| 120 | + imageView.SetSize( stageSize * 0.5f ); | |
| 121 | + imageView.SetPosition( 0.0f, 0.0f, 100.0f ); | |
| 122 | + mObjectRootActor.Add( imageView ); | |
| 123 | + | |
| 124 | + AnimateBloomView(); | |
| 125 | + PulseBloomIntensity(); | |
| 126 | + | |
| 127 | + // Respond to key events | |
| 128 | + stage.KeyEventSignal().Connect( this, &BloomExample::OnKeyEvent ); | |
| 129 | + } | |
| 130 | + | |
| 131 | + void OnKeyEvent( const KeyEvent& event ) | |
| 132 | + { | |
| 133 | + if( event.state == KeyEvent::Down ) | |
| 134 | + { | |
| 135 | + if ( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) ) | |
| 136 | + { | |
| 137 | + mApplication.Quit(); | |
| 138 | + } | |
| 139 | + } | |
| 140 | + } | |
| 141 | + | |
| 142 | + void AnimateBloomView() | |
| 143 | + { | |
| 144 | + if(mRotationAnimation) | |
| 145 | + { | |
| 146 | + mRotationAnimation.Stop(); | |
| 147 | + } | |
| 148 | + if(mResizeAnimation) | |
| 149 | + { | |
| 150 | + mResizeAnimation.Stop(); | |
| 151 | + } | |
| 152 | + if(mTranslationAnimation) | |
| 153 | + { | |
| 154 | + mTranslationAnimation.Stop(); | |
| 155 | + } | |
| 156 | + if(mBlurAnimation) | |
| 157 | + { | |
| 158 | + mBlurAnimation.Stop(); | |
| 159 | + } | |
| 160 | + | |
| 161 | + // ROTATE | |
| 162 | + mRotationAnimation = Animation::New( 5.0f ); | |
| 163 | + mRotationAnimation.AnimateBy( Property( mObjectRootActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( 360 )), Vector3::YAXIS ), AlphaFunction::EASE_IN_OUT ); | |
| 164 | + mRotationAnimation.SetEndAction( Animation::Discard ); | |
| 165 | + mRotationAnimation.SetLooping( true ); | |
| 166 | + mRotationAnimation.Play(); | |
| 167 | + | |
| 168 | + // TRANSLATE | |
| 169 | + mTranslationAnimation = Animation::New( 7.5f ); | |
| 170 | + mTranslationAnimation.AnimateBy( Property(mObjectRootActor, Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), AlphaFunction::BOUNCE, TimePeriod(2.5f) ); | |
| 171 | + mTranslationAnimation.AnimateBy( Property(mObjectRootActor, Actor::Property::POSITION), Vector3(300.0f, 0.0f, 0.0f), AlphaFunction::BOUNCE, TimePeriod(2.5f, 2.5f) ); | |
| 172 | + mTranslationAnimation.AnimateBy( Property(mObjectRootActor, Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), AlphaFunction::BOUNCE, TimePeriod(5.0f, 2.5f) ); | |
| 173 | + mTranslationAnimation.SetEndAction( Animation::Discard ); | |
| 174 | + mTranslationAnimation.SetLooping( true ); | |
| 175 | + //mTranslationAnimation.Play(); | |
| 176 | + | |
| 177 | + // BLUR | |
| 178 | + mBlurAnimation = Animation::New( 4.0f ); | |
| 179 | + mBlurAnimation.AnimateTo( Property( mBloomView, mBloomView.GetBlurStrengthPropertyIndex() ), 0.0f, AlphaFunction::LINEAR, TimePeriod(0.0f, 0.5f) ); | |
| 180 | + mBlurAnimation.AnimateTo( Property( mBloomView, mBloomView.GetBlurStrengthPropertyIndex() ), 1.0f, AlphaFunction::LINEAR, TimePeriod(2.0f, 0.5f) ); | |
| 181 | + mBlurAnimation.SetEndAction( Animation::Discard ); | |
| 182 | + mBlurAnimation.SetLooping( true ); | |
| 183 | + mBlurAnimation.Play(); | |
| 184 | + } | |
| 185 | + | |
| 186 | + void PulseBloomIntensity() | |
| 187 | + { | |
| 188 | + mPulseBloomIntensityAnim = Animation::New( 2.5f ); | |
| 189 | + mPulseBloomIntensityAnim.AnimateTo( Property(mBloomView, mBloomView.GetBloomIntensityPropertyIndex()), 3.0f, AlphaFunction::BOUNCE, TimePeriod(2.5f) ); | |
| 190 | + mPulseBloomIntensityAnim.SetEndAction( Animation::Discard ); | |
| 191 | + mPulseBloomIntensityAnim.SetLooping( true ); | |
| 192 | + mPulseBloomIntensityAnim.Play(); | |
| 193 | + } | |
| 194 | + | |
| 195 | +private: | |
| 196 | + | |
| 197 | + Application& mApplication; | |
| 198 | + | |
| 199 | + Actor mRootActor; | |
| 200 | + | |
| 201 | + Actor mObjectRootActor; | |
| 202 | + | |
| 203 | + unsigned int mCurrentAnimation; | |
| 204 | + Animation mRotationAnimation; | |
| 205 | + Animation mResizeAnimation; | |
| 206 | + Animation mTranslationAnimation; | |
| 207 | + Animation mBlurAnimation; | |
| 208 | + Animation mPulseBloomIntensityAnim; | |
| 209 | + | |
| 210 | + BloomView mBloomView; | |
| 211 | +}; | |
| 212 | + | |
| 213 | +int main(int argc, char **argv) | |
| 214 | +{ | |
| 215 | + Application application = Application::New( &argc, &argv ); | |
| 216 | + | |
| 217 | + BloomExample theApp( application ); | |
| 218 | + application.MainLoop(); | |
| 219 | + | |
| 220 | + return 0; | |
| 221 | +} | ... | ... |
examples/effects-view/effects-view-example.cpp
| 1 | -// | |
| 2 | -// Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | -// | |
| 4 | -// Licensed under the Flora License, Version 1.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://floralicense.org/license/ | |
| 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 | -// | |
| 1 | +/* | |
| 2 | + * Copyright (c) 2019 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 | + */ | |
| 16 | 17 | |
| 17 | 18 | // EXTERNAL INCLUDES |
| 18 | 19 | ... | ... |
resources/images/UI-Leather-DIFF.png
0 → 100644
418 KB
resources/images/desktop_background_1440x2560.png
0 → 100644
1.83 MB
resources/po/en_GB.po
resources/po/en_US.po
shared/dali-demo-strings.h
| ... | ... | @@ -40,6 +40,7 @@ extern "C" |
| 40 | 40 | #define DALI_DEMO_STR_TITLE_BENCHMARK dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BENCHMARK") |
| 41 | 41 | #define DALI_DEMO_STR_TITLE_BEZIER_CURVE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BEZIER_CURVE") |
| 42 | 42 | #define DALI_DEMO_STR_TITLE_BLOCKS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BLOCKS") |
| 43 | +#define DALI_DEMO_STR_TITLE_BLOOM_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BLOOM_VIEW") | |
| 43 | 44 | #define DALI_DEMO_STR_TITLE_BUBBLES dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BUBBLES") |
| 44 | 45 | #define DALI_DEMO_STR_TITLE_BUTTONS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BUTTONS") |
| 45 | 46 | #define DALI_DEMO_STR_TITLE_CALL_ACTIVE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CALL_ACTIVE") |
| ... | ... | @@ -135,6 +136,7 @@ extern "C" |
| 135 | 136 | #define DALI_DEMO_STR_TITLE_BENCHMARK "ImageView Benchmark" |
| 136 | 137 | #define DALI_DEMO_STR_TITLE_BEZIER_CURVE "Alpha Function Bezier Curve" |
| 137 | 138 | #define DALI_DEMO_STR_TITLE_BLOCKS "Blocks" |
| 139 | +#define DALI_DEMO_STR_TITLE_BLOOM_VIEW "Bloom" | |
| 138 | 140 | #define DALI_DEMO_STR_TITLE_BUBBLES "Bubbles" |
| 139 | 141 | #define DALI_DEMO_STR_TITLE_BUTTONS "Buttons" |
| 140 | 142 | #define DALI_DEMO_STR_TITLE_CALL_ACTIVE "Call Active" | ... | ... |