Commit 6081c160daa8cac70730dfe0e927cc7de8c38207
[dali_1.1.30] Merge branch 'devel/master'
Change-Id: I90a5e9780680aa986f92bd6de28343f25f8bae5a
Showing
10 changed files
with
573 additions
and
114 deletions
com.samsung.dali-demo.xml
| @@ -133,7 +133,7 @@ | @@ -133,7 +133,7 @@ | ||
| 133 | <ui-application appid="image-view-alpha-blending.example" exec="/usr/apps/com.samsung.dali-demo/bin/image-view-alpha-blending.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 133 | <ui-application appid="image-view-alpha-blending.example" exec="/usr/apps/com.samsung.dali-demo/bin/image-view-alpha-blending.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 134 | <label>ImageView Alpha Blending</label> | 134 | <label>ImageView Alpha Blending</label> |
| 135 | </ui-application> | 135 | </ui-application> |
| 136 | - <ui-application appid="image-view-svg.example" exec="/usr/apps/com.samsung.dali-demo/bin/image-view-svg.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 136 | + <ui-application appid="image-view-svg.example" exec="/usr/apps/com.samsung.dali-demo/bin/image-view-svg.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 137 | <label>ImageView SVG</label> | 137 | <label>ImageView SVG</label> |
| 138 | </ui-application> | 138 | </ui-application> |
| 139 | <ui-application appid="homescreen-benchmark.example" exec="/usr/apps/com.samsung.dali-demo/bin/homescreen-benchmark.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 139 | <ui-application appid="homescreen-benchmark.example" exec="/usr/apps/com.samsung.dali-demo/bin/homescreen-benchmark.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| @@ -142,4 +142,10 @@ | @@ -142,4 +142,10 @@ | ||
| 142 | <ui-application appid="tilt.example" exec="/usr/apps/com.samsung.dali-demo/bin/tilt.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 142 | <ui-application appid="tilt.example" exec="/usr/apps/com.samsung.dali-demo/bin/tilt.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 143 | <label>Tilt sensor</label> | 143 | <label>Tilt sensor</label> |
| 144 | </ui-application> | 144 | </ui-application> |
| 145 | + <ui-application appid="effectse-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/effects-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | ||
| 146 | + <label>Effects View</label> | ||
| 147 | + </ui-application> | ||
| 148 | + <ui-application appid="native-image-source.example" exec="/usr/apps/com.samsung.dali-demo/bin/native-image-source.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | ||
| 149 | + <label>Native Image Source</label> | ||
| 150 | + </ui-application> | ||
| 145 | </manifest> | 151 | </manifest> |
demo/dali-demo.cpp
| @@ -74,6 +74,8 @@ int main(int argc, char **argv) | @@ -74,6 +74,8 @@ int main(int argc, char **argv) | ||
| 74 | demo.AddExample(Example("image-view-svg.example", DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG)); | 74 | demo.AddExample(Example("image-view-svg.example", DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG)); |
| 75 | demo.AddExample(Example("super-blur-bloom.example", DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM)); | 75 | demo.AddExample(Example("super-blur-bloom.example", DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM)); |
| 76 | demo.AddExample(Example("tilt.example", DALI_DEMO_STR_TITLE_TILT_SENSOR)); | 76 | demo.AddExample(Example("tilt.example", DALI_DEMO_STR_TITLE_TILT_SENSOR)); |
| 77 | + demo.AddExample(Example("effects-view.example", DALI_DEMO_STR_TITLE_EFFECTS_VIEW)); | ||
| 78 | + demo.AddExample(Example("native-image-source.example", DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE)); | ||
| 77 | 79 | ||
| 78 | demo.SortAlphabetically( true ); | 80 | demo.SortAlphabetically( true ); |
| 79 | 81 |
examples/effects-view/effects-view-example.cpp
0 → 100644
| 1 | +// | ||
| 2 | +// Copyright (c) 2016 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 | +// | ||
| 16 | + | ||
| 17 | +// EXTERNAL INCLUDES | ||
| 18 | + | ||
| 19 | +// INTERNAL INCLUDES | ||
| 20 | +#include "shared/view.h" | ||
| 21 | + | ||
| 22 | +#include <dali/dali.h> | ||
| 23 | +#include <dali-toolkit/dali-toolkit.h> | ||
| 24 | +#include <dali-toolkit/devel-api/controls/effects-view/effects-view.h> | ||
| 25 | +#include <sstream> | ||
| 26 | + | ||
| 27 | +using namespace Dali; | ||
| 28 | +using namespace Dali::Toolkit; | ||
| 29 | + | ||
| 30 | +namespace | ||
| 31 | +{ | ||
| 32 | +const char* const TITLE( "EffectsView: effect size = " ); | ||
| 33 | +const char* TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" ); | ||
| 34 | +const char* VIEW_SWAP_IMAGE( DEMO_IMAGE_DIR "icon-change.png" ); | ||
| 35 | +const char* VIEW_SWAP_SELECTED_IMAGE( DEMO_IMAGE_DIR "icon-change-selected.png" ); | ||
| 36 | +const char* TEST_IMAGE( DEMO_IMAGE_DIR "Kid1.svg" ); | ||
| 37 | +} // namespace | ||
| 38 | + | ||
| 39 | +// This example illustrates the capabilities of the EffectsView container | ||
| 40 | +// | ||
| 41 | +class EffectsViewApp : public ConnectionTracker | ||
| 42 | +{ | ||
| 43 | +public: | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * Constructor | ||
| 47 | + */ | ||
| 48 | + EffectsViewApp( Application& application ); | ||
| 49 | + /** | ||
| 50 | + * Destructor | ||
| 51 | + */ | ||
| 52 | + ~EffectsViewApp(); | ||
| 53 | + | ||
| 54 | +private: | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * Initialisation. This method gets called once the main loop of application is up and running | ||
| 58 | + */ | ||
| 59 | + void OnAppInitialize( Application& application ); | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * Create a effect view of drop shadow | ||
| 63 | + * | ||
| 64 | + * @param[in] type The type of effect to be performed by the EffectView. | ||
| 65 | + * @param[in] viewSize Size of the effect view | ||
| 66 | + * @param[in] effectSize The effect size used in image filters. | ||
| 67 | + */ | ||
| 68 | + EffectsView CreateEffectsView( EffectsView::EffectType type, const Vector2& viewSize, int effectSize ); | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * Animate the effect offset and color properties. | ||
| 72 | + * @param[in] effectsView The view whose properties to be animated. | ||
| 73 | + */ | ||
| 74 | + void AnimateEffectProperties( EffectsView& effectsView ); | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * Set title onto the toolbar | ||
| 78 | + * @param[in] effectSize The effect size value to be indicated on the title | ||
| 79 | + */ | ||
| 80 | + void SetTitle(int effectSize); | ||
| 81 | + | ||
| 82 | + /** | ||
| 83 | + * Callback function to change the effect size. | ||
| 84 | + * @param[in] button The button which triggered the callback. | ||
| 85 | + */ | ||
| 86 | + bool ChangeEffectSize( Button button ); | ||
| 87 | + | ||
| 88 | + /** | ||
| 89 | + * Main key event handler | ||
| 90 | + */ | ||
| 91 | + void OnKeyEvent(const KeyEvent& event); | ||
| 92 | + | ||
| 93 | +private: | ||
| 94 | + Application& mApplication; | ||
| 95 | + Layer mContents; | ||
| 96 | + Toolkit::Control mView; | ||
| 97 | + Toolkit::ToolBar mToolBar; | ||
| 98 | + EffectsView mDropShadowView; | ||
| 99 | + EffectsView mEmbossView; | ||
| 100 | + Toolkit::TextLabel mTitleActor; ///< The title on the toolbar | ||
| 101 | + Vector2 mStageSize; | ||
| 102 | + int mEffectSize; | ||
| 103 | +}; | ||
| 104 | + | ||
| 105 | +EffectsViewApp::EffectsViewApp( Application& application ) | ||
| 106 | +: mApplication( application ), | ||
| 107 | + mEffectSize( 2 ) | ||
| 108 | +{ | ||
| 109 | + // Connect to the Application's Init signal | ||
| 110 | + mApplication.InitSignal().Connect( this, &EffectsViewApp::OnAppInitialize ); | ||
| 111 | +} | ||
| 112 | + | ||
| 113 | +EffectsViewApp::~EffectsViewApp() | ||
| 114 | +{ | ||
| 115 | + // Nothing to do here; | ||
| 116 | +} | ||
| 117 | + | ||
| 118 | +void EffectsViewApp::OnAppInitialize( Application& application ) | ||
| 119 | +{ | ||
| 120 | + // The Init signal is received once (only) during the Application lifetime | ||
| 121 | + | ||
| 122 | + Stage stage = Stage::GetCurrent(); | ||
| 123 | + stage.KeyEventSignal().Connect(this, &EffectsViewApp::OnKeyEvent); | ||
| 124 | + stage.SetBackgroundColor( Color::WHITE ); | ||
| 125 | + | ||
| 126 | + mStageSize = stage.GetSize(); | ||
| 127 | + | ||
| 128 | + // Creates a default view with a default tool bar. | ||
| 129 | + // The view is added to the stage. | ||
| 130 | + mContents = DemoHelper::CreateView( application, mView, mToolBar, "", TOOLBAR_IMAGE, "" ); | ||
| 131 | + | ||
| 132 | + // Creates view change button. | ||
| 133 | + Toolkit::PushButton viewButton = Toolkit::PushButton::New(); | ||
| 134 | + viewButton.SetUnselectedImage( VIEW_SWAP_IMAGE ); | ||
| 135 | + viewButton.SetSelectedImage( VIEW_SWAP_SELECTED_IMAGE ); | ||
| 136 | + // Connects the view change button clicked signal to the OnView method. | ||
| 137 | + viewButton.ClickedSignal().Connect( this, &EffectsViewApp::ChangeEffectSize ); | ||
| 138 | + mToolBar.AddControl( viewButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); | ||
| 139 | + | ||
| 140 | + Vector2 effectsViewSize( mStageSize.width, mStageSize.height * 0.25f ); | ||
| 141 | + mDropShadowView = CreateEffectsView( EffectsView::DROP_SHADOW, effectsViewSize, mEffectSize ); | ||
| 142 | + mDropShadowView.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 143 | + mDropShadowView.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | ||
| 144 | + mDropShadowView.SetZ( -mStageSize.height * 0.1f ); | ||
| 145 | + mContents.Add( mDropShadowView ); | ||
| 146 | + | ||
| 147 | + mEmbossView = CreateEffectsView( EffectsView::EMBOSS, effectsViewSize, mEffectSize ); | ||
| 148 | + mEmbossView.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 149 | + mEmbossView.SetAnchorPoint( AnchorPoint::TOP_CENTER ); | ||
| 150 | + mEmbossView.SetZ( mStageSize.height * 0.1f ); | ||
| 151 | + mContents.Add( mEmbossView ); | ||
| 152 | + | ||
| 153 | + SetTitle( mEffectSize ); | ||
| 154 | +} | ||
| 155 | + | ||
| 156 | + | ||
| 157 | +EffectsView EffectsViewApp::CreateEffectsView( EffectsView::EffectType type, const Vector2& viewSize, int effectSize ) | ||
| 158 | +{ | ||
| 159 | + Toolkit::EffectsView effectsView = Toolkit::EffectsView::New(type); | ||
| 160 | + // set control size | ||
| 161 | + effectsView.SetSize( viewSize.width, viewSize.height ); | ||
| 162 | + // set effect size property | ||
| 163 | + effectsView.SetProperty( EffectsView::Property::EFFECT_SIZE, effectSize ); | ||
| 164 | + | ||
| 165 | + // Create some content | ||
| 166 | + // text | ||
| 167 | + std::string text = ( type == EffectsView::DROP_SHADOW) ? "Drop Shadow" : "Emboss"; | ||
| 168 | + TextLabel textActor( TextLabel::New( text ) ); | ||
| 169 | + textActor.SetParentOrigin( ParentOrigin::CENTER_LEFT ); | ||
| 170 | + textActor.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); | ||
| 171 | + textActor.SetSize( viewSize ); | ||
| 172 | + textActor.SetPosition( viewSize.width*0.4f, viewSize.height*0.3f ); | ||
| 173 | + textActor.SetProperty( TextLabel::Property::POINT_SIZE, DemoHelper::ScalePointSize(14.f) ); | ||
| 174 | + effectsView.Add( textActor ); | ||
| 175 | + | ||
| 176 | + // image | ||
| 177 | + ImageView icon = ImageView::New( TEST_IMAGE ); | ||
| 178 | + icon.SetParentOrigin( ParentOrigin::CENTER_LEFT ); | ||
| 179 | + icon.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); | ||
| 180 | + icon.SetX( viewSize.width*0.1f ); | ||
| 181 | + icon.SetSize( viewSize.height*0.8f, viewSize.height*0.8f ); | ||
| 182 | + effectsView.Add( icon ); | ||
| 183 | + | ||
| 184 | + AnimateEffectProperties( effectsView ); | ||
| 185 | + | ||
| 186 | + return effectsView; | ||
| 187 | +} | ||
| 188 | + | ||
| 189 | +void EffectsViewApp::AnimateEffectProperties( EffectsView& effectsView ) | ||
| 190 | +{ | ||
| 191 | + const float animationTime( 5.0f ); | ||
| 192 | + Animation animation( Animation::New(animationTime) ); | ||
| 193 | + | ||
| 194 | + animation.AnimateTo( Property( effectsView, EffectsView::Property::EFFECT_OFFSET ), Vector3( 2.f,-2.f, 0.0f), TimePeriod(animationTime * 0.0f, animationTime * 0.2f) ); | ||
| 195 | + animation.AnimateTo( Property( effectsView, EffectsView::Property::EFFECT_OFFSET ), Vector3(-2.f,-2.f, 0.0f), TimePeriod(animationTime * 0.2f, animationTime * 0.2f) ); | ||
| 196 | + animation.AnimateTo( Property( effectsView, EffectsView::Property::EFFECT_OFFSET ), Vector3(-2.f, 2.f, 0.0f), TimePeriod(animationTime * 0.4f, animationTime * 0.2f) ); | ||
| 197 | + animation.AnimateTo( Property( effectsView, EffectsView::Property::EFFECT_OFFSET ), Vector3( 4.f, 4.f, 0.0f), TimePeriod(animationTime * 0.6f, animationTime * 0.2f) ); | ||
| 198 | + animation.AnimateTo( Property( effectsView, EffectsView::Property::EFFECT_OFFSET ), Vector3::ZERO, TimePeriod(animationTime * 0.8f, animationTime * 0.2f) ); | ||
| 199 | + | ||
| 200 | + effectsView.SetProperty( EffectsView::Property::EFFECT_COLOR, Color::BLACK ); | ||
| 201 | + animation.AnimateTo( Property( effectsView, EffectsView::Property::EFFECT_COLOR ), Color::BLUE, TimePeriod(animationTime * 0.0f, animationTime * 0.33f) ); | ||
| 202 | + animation.AnimateTo( Property( effectsView, EffectsView::Property::EFFECT_COLOR ), Color::RED, TimePeriod(animationTime * 0.33f, animationTime * 0.33f) ); | ||
| 203 | + animation.AnimateTo( Property( effectsView, EffectsView::Property::EFFECT_COLOR ), Color::BLACK, TimePeriod(animationTime * 0.66f, animationTime * 0.34f)); | ||
| 204 | + | ||
| 205 | + animation.SetLooping( true ); | ||
| 206 | + animation.Play(); | ||
| 207 | +} | ||
| 208 | + | ||
| 209 | +void EffectsViewApp::SetTitle(int effectSize) | ||
| 210 | +{ | ||
| 211 | + std::ostringstream title; | ||
| 212 | + title<<TITLE<< effectSize; | ||
| 213 | + | ||
| 214 | + if(!mTitleActor) | ||
| 215 | + { | ||
| 216 | + mTitleActor = DemoHelper::CreateToolBarLabel( title.str() ); | ||
| 217 | + // Add title to the tool bar. | ||
| 218 | + mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter ); | ||
| 219 | + } | ||
| 220 | + mTitleActor.SetProperty( Toolkit::TextLabel::Property::TEXT, title.str() ); | ||
| 221 | +} | ||
| 222 | + | ||
| 223 | +bool EffectsViewApp::ChangeEffectSize( Button button ) | ||
| 224 | +{ | ||
| 225 | + mEffectSize = ( mEffectSize+1 )%5; | ||
| 226 | + mDropShadowView.SetProperty( EffectsView::Property::EFFECT_SIZE, mEffectSize ); | ||
| 227 | + mEmbossView.SetProperty( EffectsView::Property::EFFECT_SIZE, mEffectSize ); | ||
| 228 | + SetTitle( mEffectSize ); | ||
| 229 | + | ||
| 230 | + return true; | ||
| 231 | +} | ||
| 232 | + | ||
| 233 | + | ||
| 234 | +void EffectsViewApp::OnKeyEvent(const KeyEvent& event) | ||
| 235 | +{ | ||
| 236 | + if(event.state == KeyEvent::Down) | ||
| 237 | + { | ||
| 238 | + if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) ) | ||
| 239 | + { | ||
| 240 | + mApplication.Quit(); | ||
| 241 | + } | ||
| 242 | + } | ||
| 243 | +} | ||
| 244 | + | ||
| 245 | +/*****************************************************************************/ | ||
| 246 | + | ||
| 247 | +static void RunTest( Application& application ) | ||
| 248 | +{ | ||
| 249 | + EffectsViewApp test( application ); | ||
| 250 | + | ||
| 251 | + application.MainLoop(); | ||
| 252 | +} | ||
| 253 | + | ||
| 254 | +/*****************************************************************************/ | ||
| 255 | + | ||
| 256 | +int main(int argc, char **argv) | ||
| 257 | +{ | ||
| 258 | + Application application = Application::New(&argc, &argv, DEMO_THEME_PATH); | ||
| 259 | + | ||
| 260 | + RunTest(application); | ||
| 261 | + | ||
| 262 | + return 0; | ||
| 263 | +} |
examples/line-mesh/line-mesh-example.cpp
| @@ -26,8 +26,6 @@ using namespace Dali; | @@ -26,8 +26,6 @@ using namespace Dali; | ||
| 26 | 26 | ||
| 27 | namespace | 27 | namespace |
| 28 | { | 28 | { |
| 29 | -const char* MATERIAL_SAMPLE( DEMO_IMAGE_DIR "gallery-small-48.jpg" ); | ||
| 30 | -const char* MATERIAL_SAMPLE2( DEMO_IMAGE_DIR "gallery-medium-19.jpg" ); | ||
| 31 | 29 | ||
| 32 | #define MAKE_SHADER(A)#A | 30 | #define MAKE_SHADER(A)#A |
| 33 | 31 | ||
| @@ -154,8 +152,6 @@ public: | @@ -154,8 +152,6 @@ public: | ||
| 154 | mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); | 152 | mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); |
| 155 | 153 | ||
| 156 | mMaterial = Material::New( mShader ); | 154 | mMaterial = Material::New( mShader ); |
| 157 | - mImage = ResourceImage::New( MATERIAL_SAMPLE ); | ||
| 158 | - mMaterial.AddTexture(mImage, "sTexture"); | ||
| 159 | 155 | ||
| 160 | mGeometry = CreateGeometry(); | 156 | mGeometry = CreateGeometry(); |
| 161 | 157 | ||
| @@ -173,10 +169,6 @@ public: | @@ -173,10 +169,6 @@ public: | ||
| 173 | mMeshActor.SetAnchorPoint( AnchorPoint::CENTER ); | 169 | mMeshActor.SetAnchorPoint( AnchorPoint::CENTER ); |
| 174 | stage.Add( mMeshActor ); | 170 | stage.Add( mMeshActor ); |
| 175 | 171 | ||
| 176 | - mChangeImageTimer = Timer::New( 5000 ); | ||
| 177 | - mChangeImageTimer.TickSignal().Connect( this, &ExampleController::OnTimer ); | ||
| 178 | - mChangeImageTimer.Start(); | ||
| 179 | - | ||
| 180 | Animation animation = Animation::New(5); | 172 | Animation animation = Animation::New(5); |
| 181 | KeyFrames keyFrames = KeyFrames::New(); | 173 | KeyFrames keyFrames = KeyFrames::New(); |
| 182 | keyFrames.Add(0.0f, 0.0f); | 174 | keyFrames.Add(0.0f, 0.0f); |
| @@ -200,14 +192,6 @@ public: | @@ -200,14 +192,6 @@ public: | ||
| 200 | return true; | 192 | return true; |
| 201 | } | 193 | } |
| 202 | 194 | ||
| 203 | - bool OnTimer() | ||
| 204 | - { | ||
| 205 | - Image image = ResourceImage::New( MATERIAL_SAMPLE2 ); | ||
| 206 | - | ||
| 207 | - mMaterial.SetTextureImage(0,image); | ||
| 208 | - return false; | ||
| 209 | - } | ||
| 210 | - | ||
| 211 | void OnKeyEvent(const KeyEvent& event) | 195 | void OnKeyEvent(const KeyEvent& event) |
| 212 | { | 196 | { |
| 213 | if(event.state == KeyEvent::Down) | 197 | if(event.state == KeyEvent::Down) |
| @@ -224,15 +208,11 @@ private: | @@ -224,15 +208,11 @@ private: | ||
| 224 | Application& mApplication; ///< Application instance | 208 | Application& mApplication; ///< Application instance |
| 225 | Vector3 mStageSize; ///< The size of the stage | 209 | Vector3 mStageSize; ///< The size of the stage |
| 226 | 210 | ||
| 227 | - Image mImage; | ||
| 228 | Shader mShader; | 211 | Shader mShader; |
| 229 | Material mMaterial; | 212 | Material mMaterial; |
| 230 | Geometry mGeometry; | 213 | Geometry mGeometry; |
| 231 | Renderer mRenderer; | 214 | Renderer mRenderer; |
| 232 | Actor mMeshActor; | 215 | Actor mMeshActor; |
| 233 | - Renderer mRenderer2; | ||
| 234 | - Actor mMeshActor2; | ||
| 235 | - Timer mChangeImageTimer; | ||
| 236 | }; | 216 | }; |
| 237 | 217 | ||
| 238 | void RunTest( Application& application ) | 218 | void RunTest( Application& application ) |
examples/native-image-source/native-image-source-example.cpp
0 → 100644
| 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-toolkit/dali-toolkit.h> | ||
| 20 | + | ||
| 21 | +using namespace Dali; | ||
| 22 | +using namespace Toolkit; | ||
| 23 | + | ||
| 24 | +namespace | ||
| 25 | +{ | ||
| 26 | + const std::string JPG_FILENAME = DEMO_IMAGE_DIR "gallery-medium-4.jpg"; | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +// This example shows how to create and use a NativeImageSource as the target of the render task. | ||
| 30 | +// | ||
| 31 | +class NativeImageSourceController : public ConnectionTracker | ||
| 32 | +{ | ||
| 33 | +public: | ||
| 34 | + | ||
| 35 | + NativeImageSourceController( Application& application ) | ||
| 36 | + : mApplication( application ) | ||
| 37 | + { | ||
| 38 | + // Connect to the Application's Init signal | ||
| 39 | + mApplication.InitSignal().Connect( this, &NativeImageSourceController::Create ); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + ~NativeImageSourceController() | ||
| 43 | + { | ||
| 44 | + // Nothing to do here; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + // The Init signal is received once (only) during the Application lifetime | ||
| 48 | + void Create( Application& application ) | ||
| 49 | + { | ||
| 50 | + // Get a handle to the stage | ||
| 51 | + Stage stage = Stage::GetCurrent(); | ||
| 52 | + stage.SetBackgroundColor( Color::WHITE ); | ||
| 53 | + stage.KeyEventSignal().Connect(this, &NativeImageSourceController::OnKeyEvent); | ||
| 54 | + | ||
| 55 | + mButtonRefreshAlways = PushButton::New(); | ||
| 56 | + mButtonRefreshAlways.SetTogglableButton( true ); | ||
| 57 | + mButtonRefreshAlways.SetSelected( true ); | ||
| 58 | + mButtonRefreshAlways.SetLabelText( "Refresh ALWAYS" ); | ||
| 59 | + mButtonRefreshAlways.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 60 | + mButtonRefreshAlways.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 61 | + mButtonRefreshAlways.StateChangedSignal().Connect( this, &NativeImageSourceController::OnButtonSelected ); | ||
| 62 | + stage.Add( mButtonRefreshAlways ); | ||
| 63 | + | ||
| 64 | + mButtonRefreshOnce = PushButton::New(); | ||
| 65 | + mButtonRefreshOnce.SetLabelText( "Refresh ONCE" ); | ||
| 66 | + mButtonRefreshOnce.SetParentOrigin( ParentOrigin::TOP_RIGHT ); | ||
| 67 | + mButtonRefreshOnce.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); | ||
| 68 | + mButtonRefreshOnce.ClickedSignal().Connect( this, &NativeImageSourceController::OnButtonSelected ); | ||
| 69 | + stage.Add( mButtonRefreshOnce); | ||
| 70 | + | ||
| 71 | + CreateScene(); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + bool CreateScene() | ||
| 75 | + { | ||
| 76 | + Stage stage = Stage::GetCurrent(); | ||
| 77 | + Vector2 stageSize = stage.GetSize(); | ||
| 78 | + | ||
| 79 | + float buttonHeight = 100.f; | ||
| 80 | + mButtonRefreshAlways.SetSize( stageSize.x / 2.f, buttonHeight ); | ||
| 81 | + mButtonRefreshOnce.SetSize( stageSize.x / 2.f, buttonHeight ); | ||
| 82 | + | ||
| 83 | + Vector2 imageSize( stageSize.x, (stageSize.y-buttonHeight)/2.f ); | ||
| 84 | + | ||
| 85 | + // Create the native image source | ||
| 86 | + NativeImageSourcePtr nativeImageSourcePtr = NativeImageSource::New( imageSize.width, imageSize.height, NativeImageSource::COLOR_DEPTH_DEFAULT ); | ||
| 87 | + | ||
| 88 | + // Create a image view as source actor to be renderer to the native image source | ||
| 89 | + Actor sourceActor = ImageView::New(JPG_FILENAME); | ||
| 90 | + sourceActor.SetParentOrigin( ParentOrigin::CENTER); | ||
| 91 | + sourceActor.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 92 | + sourceActor.SetY( - (imageSize.height-buttonHeight)/2.f ); | ||
| 93 | + stage.Add( sourceActor ); | ||
| 94 | + | ||
| 95 | + Animation animation = Animation::New(2.f); | ||
| 96 | + Degree relativeRotationDegrees(90.0f); | ||
| 97 | + Radian relativeRotationRadians(relativeRotationDegrees); | ||
| 98 | + animation.AnimateTo( Property( sourceActor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ), AlphaFunction::LINEAR, TimePeriod(0.f, 0.5f)); | ||
| 99 | + animation.AnimateBy( Property( sourceActor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ), AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f)); | ||
| 100 | + animation.AnimateBy( Property( sourceActor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ), AlphaFunction::LINEAR, TimePeriod(1.f, 0.5f)); | ||
| 101 | + animation.AnimateBy( Property( sourceActor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ), AlphaFunction::LINEAR, TimePeriod(1.5f, 0.5f)); | ||
| 102 | + animation.SetLooping(true); | ||
| 103 | + animation.Play(); | ||
| 104 | + | ||
| 105 | + // create a offscreen renderer task to render content into the native image source | ||
| 106 | + FrameBufferImage targetBuffer = FrameBufferImage::New( *nativeImageSourcePtr ); | ||
| 107 | + | ||
| 108 | + CameraActor cameraActor = CameraActor::New(imageSize); | ||
| 109 | + cameraActor.SetParentOrigin(ParentOrigin::TOP_CENTER); | ||
| 110 | + cameraActor.SetParentOrigin( AnchorPoint::TOP_CENTER ); | ||
| 111 | + cameraActor.SetY( buttonHeight + imageSize.height/2.f ); | ||
| 112 | + stage.Add(cameraActor); | ||
| 113 | + | ||
| 114 | + RenderTaskList taskList = stage.GetRenderTaskList(); | ||
| 115 | + mOffscreenRenderTask = taskList.CreateTask(); | ||
| 116 | + mOffscreenRenderTask.SetSourceActor( sourceActor ); | ||
| 117 | + mOffscreenRenderTask.SetClearColor( Color::WHITE ); | ||
| 118 | + mOffscreenRenderTask.SetClearEnabled(true); | ||
| 119 | + mOffscreenRenderTask.SetCameraActor(cameraActor); | ||
| 120 | + mOffscreenRenderTask.GetCameraActor().SetInvertYAxis(true); | ||
| 121 | + mOffscreenRenderTask.SetTargetFrameBuffer( targetBuffer ); | ||
| 122 | + mOffscreenRenderTask.SetRefreshRate( RenderTask::REFRESH_ALWAYS ); | ||
| 123 | + | ||
| 124 | + // Display the native image on the screen | ||
| 125 | + NativeImage nativeImage = NativeImage::New( *nativeImageSourcePtr ); | ||
| 126 | + ImageView nativeImageView = ImageView::New( nativeImage ); | ||
| 127 | + nativeImageView.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); | ||
| 128 | + nativeImageView.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | ||
| 129 | + stage.Add( nativeImageView ); | ||
| 130 | + | ||
| 131 | + TextLabel textLabel1 = TextLabel::New( "Resource Image" ); | ||
| 132 | + textLabel1.SetParentOrigin( ParentOrigin::TOP_CENTER ); | ||
| 133 | + textLabel1.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | ||
| 134 | + nativeImageView.Add( textLabel1 ); | ||
| 135 | + | ||
| 136 | + TextLabel textLabel2 = TextLabel::New( "Native Image" ); | ||
| 137 | + textLabel2.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); | ||
| 138 | + textLabel2.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | ||
| 139 | + nativeImageView.Add( textLabel2 ); | ||
| 140 | + | ||
| 141 | + return false; | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + bool OnButtonSelected( Toolkit::Button button ) | ||
| 145 | + { | ||
| 146 | + Toolkit::PushButton pushButton = Toolkit::PushButton::DownCast( button ); | ||
| 147 | + if( pushButton == mButtonRefreshAlways ) | ||
| 148 | + { | ||
| 149 | + if( mButtonRefreshAlways.IsSelected() ) | ||
| 150 | + { | ||
| 151 | + mOffscreenRenderTask.SetRefreshRate( RenderTask::REFRESH_ALWAYS ); | ||
| 152 | + } | ||
| 153 | + else | ||
| 154 | + { | ||
| 155 | + mOffscreenRenderTask.SetRefreshRate( RenderTask::REFRESH_ONCE ); | ||
| 156 | + } | ||
| 157 | + } | ||
| 158 | + else if( pushButton == mButtonRefreshOnce ) | ||
| 159 | + { | ||
| 160 | + if( mButtonRefreshAlways.IsSelected() ) | ||
| 161 | + { | ||
| 162 | + mButtonRefreshAlways.SetSelected( false ); | ||
| 163 | + } | ||
| 164 | + mOffscreenRenderTask.SetRefreshRate( RenderTask::REFRESH_ONCE ); | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + return true; | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + void OnKeyEvent(const KeyEvent& event) | ||
| 171 | + { | ||
| 172 | + if(event.state == KeyEvent::Down) | ||
| 173 | + { | ||
| 174 | + if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) ) | ||
| 175 | + { | ||
| 176 | + mApplication.Quit(); | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | + } | ||
| 180 | + | ||
| 181 | +private: | ||
| 182 | + Application& mApplication; | ||
| 183 | + RenderTask mOffscreenRenderTask; | ||
| 184 | + PushButton mButtonRefreshAlways; | ||
| 185 | + PushButton mButtonRefreshOnce; | ||
| 186 | + | ||
| 187 | +}; | ||
| 188 | + | ||
| 189 | +void RunTest( Application& application ) | ||
| 190 | +{ | ||
| 191 | + NativeImageSourceController test( application ); | ||
| 192 | + | ||
| 193 | + application.MainLoop(); | ||
| 194 | +} | ||
| 195 | + | ||
| 196 | +// Entry point for Linux & Tizen applications | ||
| 197 | +// | ||
| 198 | +int main( int argc, char **argv ) | ||
| 199 | +{ | ||
| 200 | + Application application = Application::New( &argc, &argv ); | ||
| 201 | + | ||
| 202 | + RunTest( application ); | ||
| 203 | + | ||
| 204 | + return 0; | ||
| 205 | +} |
examples/page-turn-view/page-turn-view-example.cpp
| @@ -17,6 +17,7 @@ | @@ -17,6 +17,7 @@ | ||
| 17 | 17 | ||
| 18 | #include <dali/dali.h> | 18 | #include <dali/dali.h> |
| 19 | #include <dali-toolkit/dali-toolkit.h> | 19 | #include <dali-toolkit/dali-toolkit.h> |
| 20 | +#include <dali-toolkit/devel-api/image-atlas/image-atlas.h> | ||
| 20 | 21 | ||
| 21 | #include <assert.h> | 22 | #include <assert.h> |
| 22 | #include <cstdlib> | 23 | #include <cstdlib> |
| @@ -78,21 +79,21 @@ class PortraitPageFactory : public PageFactory | @@ -78,21 +79,21 @@ class PortraitPageFactory : public PageFactory | ||
| 78 | return 10*NUMBER_OF_PORTRAIT_IMAGE + 1; | 79 | return 10*NUMBER_OF_PORTRAIT_IMAGE + 1; |
| 79 | } | 80 | } |
| 80 | /** | 81 | /** |
| 81 | - * Create an image actor to represent a page. | 82 | + * Create an image to represent a page. |
| 82 | * @param[in] pageId The ID of the page to create. | 83 | * @param[in] pageId The ID of the page to create. |
| 83 | - * @return An image actor, or an uninitialized pointer if the ID is out of range. | 84 | + * @return An image, or an uninitialized pointer if the ID is out of range. |
| 84 | */ | 85 | */ |
| 85 | - virtual Actor NewPage( unsigned int pageId ) | 86 | + virtual Image NewPage( unsigned int pageId ) |
| 86 | { | 87 | { |
| 87 | - ImageActor page; | 88 | + Image page; |
| 88 | 89 | ||
| 89 | if( pageId == 0 ) | 90 | if( pageId == 0 ) |
| 90 | { | 91 | { |
| 91 | - page = ImageActor::New( ResourceImage::New( BOOK_COVER_PORTRAIT ) ); | 92 | + page = ResourceImage::New( BOOK_COVER_PORTRAIT ); |
| 92 | } | 93 | } |
| 93 | else | 94 | else |
| 94 | { | 95 | { |
| 95 | - page = ImageActor::New( ResourceImage::New( PAGE_IMAGES_PORTRAIT[ (pageId-1) % NUMBER_OF_PORTRAIT_IMAGE ] ) ); | 96 | + page = ResourceImage::New( PAGE_IMAGES_PORTRAIT[ (pageId-1) % NUMBER_OF_PORTRAIT_IMAGE ] ); |
| 96 | } | 97 | } |
| 97 | 98 | ||
| 98 | return page; | 99 | return page; |
| @@ -101,6 +102,7 @@ class PortraitPageFactory : public PageFactory | @@ -101,6 +102,7 @@ class PortraitPageFactory : public PageFactory | ||
| 101 | 102 | ||
| 102 | class LandscapePageFactory : public PageFactory | 103 | class LandscapePageFactory : public PageFactory |
| 103 | { | 104 | { |
| 105 | + | ||
| 104 | /** | 106 | /** |
| 105 | * Query the number of pages available from the factory. | 107 | * Query the number of pages available from the factory. |
| 106 | * The maximum available page has an ID of GetNumberOfPages()-1. | 108 | * The maximum available page has an ID of GetNumberOfPages()-1. |
| @@ -110,29 +112,35 @@ class LandscapePageFactory : public PageFactory | @@ -110,29 +112,35 @@ class LandscapePageFactory : public PageFactory | ||
| 110 | return 10*NUMBER_OF_LANDSCAPE_IMAGE / 2 + 1; | 112 | return 10*NUMBER_OF_LANDSCAPE_IMAGE / 2 + 1; |
| 111 | } | 113 | } |
| 112 | /** | 114 | /** |
| 113 | - * Create an image actor to represent a page. | 115 | + * Create an image to represent a page. |
| 114 | * @param[in] pageId The ID of the page to create. | 116 | * @param[in] pageId The ID of the page to create. |
| 115 | - * @return An image actor, or an uninitialized pointer if the ID is out of range. | 117 | + * @return An image, or an uninitialized pointer if the ID is out of range. |
| 116 | */ | 118 | */ |
| 117 | - virtual Actor NewPage( unsigned int pageId ) | 119 | + virtual Image NewPage( unsigned int pageId ) |
| 118 | { | 120 | { |
| 119 | - ImageActor pageFront; | ||
| 120 | - ImageActor pageBack; | 121 | + if( mImageSize.GetWidth() == 0u || mImageSize.GetHeight() == 0u ) |
| 122 | + { | ||
| 123 | + mImageSize = ResourceImage::GetImageSize(BOOK_COVER_LANDSCAPE); | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + ImageAtlas atlas = ImageAtlas::New( mImageSize.GetWidth()*2u, mImageSize.GetHeight(), Pixel::RGB888 ); | ||
| 127 | + Vector4 textureRect; | ||
| 121 | if( pageId == 0 ) | 128 | if( pageId == 0 ) |
| 122 | { | 129 | { |
| 123 | - pageFront = ImageActor::New( ResourceImage::New( BOOK_COVER_LANDSCAPE ) ); | ||
| 124 | - pageBack = ImageActor::New( ResourceImage::New( BOOK_COVER_BACK_LANDSCAPE ) ); | 130 | + atlas.Upload( textureRect, BOOK_COVER_LANDSCAPE, mImageSize ); |
| 131 | + atlas.Upload( textureRect, BOOK_COVER_BACK_LANDSCAPE, mImageSize ); | ||
| 125 | } | 132 | } |
| 126 | else | 133 | else |
| 127 | { | 134 | { |
| 128 | unsigned int imageId = (pageId-1)*2; | 135 | unsigned int imageId = (pageId-1)*2; |
| 129 | - pageFront = ImageActor::New( ResourceImage::New( PAGE_IMAGES_LANDSCAPE[ imageId % NUMBER_OF_LANDSCAPE_IMAGE ] ) ); | ||
| 130 | - pageBack = ImageActor::New( ResourceImage::New( PAGE_IMAGES_LANDSCAPE[ (imageId+1) % NUMBER_OF_LANDSCAPE_IMAGE ] ) ); | 136 | + atlas.Upload( textureRect, PAGE_IMAGES_LANDSCAPE[ imageId % NUMBER_OF_LANDSCAPE_IMAGE ], mImageSize ); |
| 137 | + atlas.Upload( textureRect, PAGE_IMAGES_LANDSCAPE[ (imageId+1) % NUMBER_OF_LANDSCAPE_IMAGE ], mImageSize ); | ||
| 131 | } | 138 | } |
| 132 | - pageFront.Add(pageBack); | ||
| 133 | 139 | ||
| 134 | - return pageFront; | 140 | + return atlas.GetAtlas(); |
| 135 | } | 141 | } |
| 142 | + | ||
| 143 | + ImageDimensions mImageSize; | ||
| 136 | }; | 144 | }; |
| 137 | 145 | ||
| 138 | /** | 146 | /** |
packaging/com.samsung.dali-demo.spec
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | 2 | ||
| 3 | Name: com.samsung.dali-demo | 3 | Name: com.samsung.dali-demo |
| 4 | Summary: The OpenGLES Canvas Core Demo | 4 | Summary: The OpenGLES Canvas Core Demo |
| 5 | -Version: 1.1.29 | 5 | +Version: 1.1.30 |
| 6 | Release: 1 | 6 | Release: 1 |
| 7 | Group: System/Libraries | 7 | Group: System/Libraries |
| 8 | License: Apache-2.0 | 8 | License: Apache-2.0 |
resources/scripts/background.json
| @@ -16,52 +16,83 @@ | @@ -16,52 +16,83 @@ | ||
| 16 | */ | 16 | */ |
| 17 | { | 17 | { |
| 18 | "stage": [ | 18 | "stage": [ |
| 19 | - // A TextLabel with a red background | 19 | + // A TextLabel with a color background |
| 20 | { | 20 | { |
| 21 | "type": "TextLabel", | 21 | "type": "TextLabel", |
| 22 | "drawMode": "OVERLAY_2D", | 22 | "drawMode": "OVERLAY_2D", |
| 23 | "text": "Hello World", | 23 | "text": "Hello World", |
| 24 | - "parentOrigin": "TOP_CENTER", | ||
| 25 | - "anchorPoint": "TOP_CENTER", | 24 | + "parentOrigin": "TOP_LEFT", |
| 25 | + "anchorPoint": "TOP_LEFT", | ||
| 26 | "pointSize": 20, | 26 | "pointSize": 20, |
| 27 | "horizontalAlignment": "CENTER", | 27 | "horizontalAlignment": "CENTER", |
| 28 | "verticalAlignment": "CENTER", | 28 | "verticalAlignment": "CENTER", |
| 29 | - "widthResizePolicy":"FILL_TO_PARENT", | 29 | + "widthResizePolicy":"SIZE_RELATIVE_TO_PARENT", |
| 30 | "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", | 30 | "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", |
| 31 | - "sizeModeFactor": [1,0.25,1], | 31 | + "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], |
| 32 | "background":{ | 32 | "background":{ |
| 33 | "rendererType": "color", | 33 | "rendererType": "color", |
| 34 | - "blendColor": [1, 0, 0, 1] | 34 | + "blendColor": [ 0.8, 0, 0.2, 1 ] |
| 35 | } | 35 | } |
| 36 | }, | 36 | }, |
| 37 | 37 | ||
| 38 | - // A control with a yellow background | 38 | + // A control with an SVG image |
| 39 | { | 39 | { |
| 40 | "type": "Control", | 40 | "type": "Control", |
| 41 | "relayoutEnabled": false, | 41 | "relayoutEnabled": false, |
| 42 | - "parentOrigin": "CENTER", | ||
| 43 | - "anchorPoint": "BOTTOM_CENTER", | ||
| 44 | - "widthResizePolicy":"FILL_TO_PARENT", | 42 | + "parentOrigin": "TOP_RIGHT", |
| 43 | + "anchorPoint": "TOP_RIGHT", | ||
| 44 | + "widthResizePolicy":"SIZE_RELATIVE_TO_PARENT", | ||
| 45 | "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", | 45 | "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", |
| 46 | - "sizeModeFactor": [1,0.25,1], | ||
| 47 | - "background":{ | ||
| 48 | - "rendererType": "color", | ||
| 49 | - "blendColor": [1, 1, 0, 1] | 46 | + "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], |
| 47 | + "background": { | ||
| 48 | + "rendererType": "svg", | ||
| 49 | + "imageUrl": "{DEMO_IMAGE_DIR}Kid1.svg" | ||
| 50 | + } | ||
| 51 | + }, | ||
| 52 | + | ||
| 53 | + // A control with a border | ||
| 54 | + { | ||
| 55 | + "type": "Control", | ||
| 56 | + "relayoutEnabled": false, | ||
| 57 | + "parentOrigin": "CENTER_LEFT", | ||
| 58 | + "anchorPoint": "CENTER_LEFT", | ||
| 59 | + "widthResizePolicy":"SIZE_RELATIVE_TO_PARENT", | ||
| 60 | + "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", | ||
| 61 | + "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], | ||
| 62 | + "background": { | ||
| 63 | + "rendererType" : "border", | ||
| 64 | + "borderColor" : [ 0.5, 0.5, 0.5, 1 ], | ||
| 65 | + "borderSize" : 15.0 | ||
| 50 | } | 66 | } |
| 51 | }, | 67 | }, |
| 52 | 68 | ||
| 53 | - // A control with an image | 69 | + // A control with a JPG image |
| 54 | { | 70 | { |
| 55 | "type": "Control", | 71 | "type": "Control", |
| 56 | "relayoutEnabled": false, | 72 | "relayoutEnabled": false, |
| 57 | - "parentOrigin": "CENTER", | ||
| 58 | - "anchorPoint": "TOP_CENTER", | ||
| 59 | - "widthResizePolicy":"FILL_TO_PARENT", | 73 | + "parentOrigin": "CENTER_RIGHT", |
| 74 | + "anchorPoint": "CENTER_RIGHT", | ||
| 75 | + "widthResizePolicy":"SIZE_RELATIVE_TO_PARENT", | ||
| 60 | "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", | 76 | "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", |
| 61 | - "sizeModeFactor": [1,0.25,1], | 77 | + "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], |
| 62 | "background": { | 78 | "background": { |
| 63 | "rendererType": "image", | 79 | "rendererType": "image", |
| 64 | - "imageUrl": "{DEMO_IMAGE_DIR}button-background.png" | 80 | + "imageUrl": "{DEMO_IMAGE_DIR}gallery-large-9.jpg" |
| 81 | + } | ||
| 82 | + }, | ||
| 83 | + | ||
| 84 | + // A control with a yellow background | ||
| 85 | + { | ||
| 86 | + "type": "Control", | ||
| 87 | + "relayoutEnabled": false, | ||
| 88 | + "parentOrigin": "BOTTOM_LEFT", | ||
| 89 | + "anchorPoint": "BOTTOM_LEFT", | ||
| 90 | + "widthResizePolicy":"SIZE_RELATIVE_TO_PARENT", | ||
| 91 | + "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", | ||
| 92 | + "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], | ||
| 93 | + "background":{ | ||
| 94 | + "rendererType": "color", | ||
| 95 | + "blendColor": [ 1, 1, 0, 1 ] | ||
| 65 | } | 96 | } |
| 66 | }, | 97 | }, |
| 67 | 98 | ||
| @@ -69,24 +100,24 @@ | @@ -69,24 +100,24 @@ | ||
| 69 | { | 100 | { |
| 70 | "type": "Control", | 101 | "type": "Control", |
| 71 | "relayoutEnabled": false, | 102 | "relayoutEnabled": false, |
| 72 | - "parentOrigin": "BOTTOM_CENTER", | ||
| 73 | - "anchorPoint": "BOTTOM_CENTER", | ||
| 74 | - "widthResizePolicy":"FILL_TO_PARENT", | 103 | + "parentOrigin": "BOTTOM_RIGHT", |
| 104 | + "anchorPoint": "BOTTOM_RIGHT", | ||
| 105 | + "widthResizePolicy":"SIZE_RELATIVE_TO_PARENT", | ||
| 75 | "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", | 106 | "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", |
| 76 | - "sizeModeFactor": [1,0.25,1], | 107 | + "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], |
| 77 | "background": { | 108 | "background": { |
| 78 | - "rendererType": "gradient", | ||
| 79 | - "center": [ 0.5, 0.5 ], | ||
| 80 | - "radius": 1.414, | ||
| 81 | - "stopOffset": [ 0.0, 0.3, 0.6, 0.8, 1.0 ], | ||
| 82 | - "stopColor": [ | ||
| 83 | - [ 0.5, 0.78, 0.76, 1.0 ], | ||
| 84 | - [ 0.77, 0.78, 0.28, 0.48 ], | ||
| 85 | - [ 0.84, 0.15, 0.55, 0.75 ], | ||
| 86 | - [ 0.5, 0.78, 0.76, 0.59 ], | ||
| 87 | - [ 1.0, 1.0, 0.0, 1.0 ] | ||
| 88 | - ] | ||
| 89 | - } | 109 | + "rendererType" : "gradient", |
| 110 | + "startPosition" : [ -0.5, -0.5 ], | ||
| 111 | + "endPosition": [ 0.5, 0.5 ], | ||
| 112 | + "stopColor" : [ | ||
| 113 | + [ 1.0, 0.0, 0.0, 1.0 ], | ||
| 114 | + [ 1.0, 0.25, 0.0, 1.0 ], | ||
| 115 | + [ 1.0, 0.5, 0.0, 1.0 ], | ||
| 116 | + [ 1.0, 0.75, 0.0, 1.0 ], | ||
| 117 | + [ 1.0, 1.0, 0.0, 1.0 ] | ||
| 118 | + ], | ||
| 119 | + "stopOffset" : [ 0, 0.25, 0.5, 0.75, 1.0 ] | ||
| 120 | + } | ||
| 90 | } | 121 | } |
| 91 | ] | 122 | ] |
| 92 | } | 123 | } |
resources/scripts/gradient.json 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 | - // a tree of actors | ||
| 19 | - "stage": [{ | ||
| 20 | - "type": "Control", | ||
| 21 | - "widthResizePolicy":"FILL_TO_PARENT", | ||
| 22 | - "heightResizePolicy":"FILL_TO_PARENT", | ||
| 23 | - "parentOrigin": "CENTER", | ||
| 24 | - "anchorPoint": "CENTER", | ||
| 25 | - "background": { | ||
| 26 | - "rendererType" : "gradient", | ||
| 27 | - "startPosition" : [-0.5, -0.5], | ||
| 28 | - "endPosition": [0.5,0.5], | ||
| 29 | - "stopColor" : [ | ||
| 30 | - [1,0,0,1], | ||
| 31 | - [1,0.25,0,1], | ||
| 32 | - [1,0.5,0,1], | ||
| 33 | - [1,0.75,0,1], | ||
| 34 | - [1,1,0,1] | ||
| 35 | - ], | ||
| 36 | - "stopOffset" : [ 0, 0.25, 0.5, 0.75, 1.0 ] | ||
| 37 | - } | ||
| 38 | - }] | ||
| 39 | -} |
shared/dali-demo-strings.h
| @@ -62,6 +62,7 @@ extern "C" | @@ -62,6 +62,7 @@ extern "C" | ||
| 62 | #define DALI_DEMO_STR_TITLE_LINE_MESH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_LINE_MESH") | 62 | #define DALI_DEMO_STR_TITLE_LINE_MESH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_LINE_MESH") |
| 63 | #define DALI_DEMO_STR_TITLE_COLOR_GRADIENT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_COLOR_GRADIENT") | 63 | #define DALI_DEMO_STR_TITLE_COLOR_GRADIENT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_COLOR_GRADIENT") |
| 64 | #define DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_SUPER_BLUR_BLOOM") | 64 | #define DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_SUPER_BLUR_BLOOM") |
| 65 | +#define DALI_DEMO_STR_TITLE_EFFECTS_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_EFFECTS_VIEW") | ||
| 65 | 66 | ||
| 66 | #else // !INTERNATIONALIZATION_ENABLED | 67 | #else // !INTERNATIONALIZATION_ENABLED |
| 67 | 68 | ||
| @@ -102,6 +103,8 @@ extern "C" | @@ -102,6 +103,8 @@ extern "C" | ||
| 102 | #define DALI_DEMO_STR_TITLE_IMAGE_VIEW_ALPHA_BLENDING "Image View Alpha Blending" | 103 | #define DALI_DEMO_STR_TITLE_IMAGE_VIEW_ALPHA_BLENDING "Image View Alpha Blending" |
| 103 | #define DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG "Image View SVG" | 104 | #define DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG "Image View SVG" |
| 104 | #define DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM "Super Blur and Bloom" | 105 | #define DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM "Super Blur and Bloom" |
| 106 | +#define DALI_DEMO_STR_TITLE_EFFECTS_VIEW "Effects View" | ||
| 107 | +#define DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE "Native Image Source" | ||
| 105 | 108 | ||
| 106 | #endif | 109 | #endif |
| 107 | 110 |