Commit 1abe9ed8c6629f34dee99ce6e4923a000851d334

Authored by Chu Hoang
2 parents 2cae846d e90e76dc

[dali_1.1.5] Merge branch 'devel/master'

Change-Id: I8b97ae3e3b353a8aa123a4499baffbf6f83d41c9
com.samsung.dali-demo.xml
... ... @@ -88,6 +88,9 @@
88 88 <ui-application appid="text-field.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-field.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
89 89 <label>Text Field</label>
90 90 </ui-application>
  91 + <ui-application appid="text-fonts.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-fonts.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
  92 + <label>Text Fonts</label>
  93 + </ui-application>
91 94 <ui-application appid="text-message-field.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-message-field.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
92 95 <label>Text Label</label>
93 96 </ui-application>
... ...
demo/dali-table-view.cpp
... ... @@ -43,8 +43,7 @@ const std::string BUTTON_QUIT( &quot;Quit&quot; );
43 43 const std::string BUTTON_OK( "Ok" );
44 44 const std::string BUTTON_CANCEL( "Cancel" );
45 45  
46   -const std::string DEFAULT_BACKGROUND_IMAGE_PATH( DALI_IMAGE_DIR "background-gradient.jpg" );
47   -const std::string LOGO_PATH( DALI_IMAGE_DIR "dali-logo.png" );
  46 +const std::string LOGO_PATH( DALI_IMAGE_DIR "Logo-for-demo.png" );
48 47 const std::string DEFAULT_TOOLBAR_IMAGE_PATH( DALI_IMAGE_DIR "top-bar.png" );
49 48 const std::string BUTTON_BACKGROUND(DALI_IMAGE_DIR "button-background.png");
50 49 const std::string TILE_BACKGROUND(DALI_IMAGE_DIR "item-background.png");
... ... @@ -88,14 +87,14 @@ const float BUBBLE_MAX_Z = 0.0f;
88 87 /**
89 88 * Creates the background image
90 89 */
91   -ImageView CreateBackground( std::string imagePath )
  90 +Control CreateBackground( std::string stylename )
92 91 {
93   - Image image = ResourceImage::New( imagePath );
94   - ImageView background = ImageView::New( image );
  92 + Control background = Control::New();
  93 + Stage::GetCurrent().Add( background );
  94 + background.SetProperty( Control::Property::STYLE_NAME,stylename);
95 95 background.SetName( "BACKGROUND" );
96 96 background.SetAnchorPoint( AnchorPoint::CENTER );
97 97 background.SetParentOrigin( ParentOrigin::CENTER );
98   - background.SetZ( -1.0f );
99 98 background.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
100 99  
101 100 return background;
... ... @@ -171,7 +170,6 @@ DaliTableView::DaliTableView( Application&amp; application )
171 170 mBackgroundAnimations(),
172 171 mExampleList(),
173 172 mExampleMap(),
174   - mBackgroundImagePath( DEFAULT_BACKGROUND_IMAGE_PATH ),
175 173 mTotalPages(),
176 174 mScrolling( false ),
177 175 mSortAlphabetically( false ),
... ... @@ -190,11 +188,6 @@ void DaliTableView::AddExample( Example example )
190 188 mExampleMap[ example.name ] = example;
191 189 }
192 190  
193   -void DaliTableView::SetBackgroundPath( std::string imagePath )
194   -{
195   - mBackgroundImagePath = imagePath;
196   -}
197   -
198 191 void DaliTableView::SortAlphabetically( bool sortAlphabetically )
199 192 {
200 193 mSortAlphabetically = sortAlphabetically;
... ... @@ -207,10 +200,10 @@ void DaliTableView::Initialize( Application&amp; application )
207 200 const Vector2 stageSize = Stage::GetCurrent().GetSize();
208 201  
209 202 // Background
210   - ImageView background = CreateBackground( mBackgroundImagePath );
  203 + Control background = CreateBackground( "launcherbackground" );
211 204 Stage::GetCurrent().Add( background );
212 205  
213   - // Render entire content as overlays, as is all on same 2D plane.
  206 + // Add root actor
214 207 mRootActor = TableView::New( 4, 1 );
215 208 mRootActor.SetAnchorPoint( AnchorPoint::CENTER );
216 209 mRootActor.SetParentOrigin( ParentOrigin::CENTER );
... ...
demo/dali-table-view.h
... ... @@ -99,15 +99,6 @@ public:
99 99 void AddExample(Example example);
100 100  
101 101 /**
102   - * Sets the background image PATH.
103   - *
104   - * @param[in] imagePath The file path to the image to use as the background.
105   - *
106   - * @note Should be called before the Application MainLoop is started.
107   - */
108   - void SetBackgroundPath( std::string imagePath );
109   -
110   - /**
111 102 * Sorts the example list alphabetically by Title if parameter is true.
112 103 *
113 104 * @param[in] sortAlphabetically If true, example list is sorted alphabetically.
... ... @@ -407,7 +398,6 @@ private:
407 398 ExampleList mExampleList; ///< List of examples.
408 399 ExampleMap mExampleMap; ///< Map LUT for examples.
409 400  
410   - std::string mBackgroundImagePath; ///< The path to the background image.
411 401 int mTotalPages; ///< Total pages within scrollview.
412 402  
413 403 bool mScrolling:1; ///< Flag indicating whether view is currently being scrolled
... ...
examples/dissolve-effect/dissolve-effect-example.cpp
... ... @@ -77,7 +77,7 @@ const int VIEWINGTIME = 2000; // 2 seconds
77 77  
78 78 const float TRANSITION_DURATION = 2.5f; //2.5 second
79 79  
80   -const float INITIAL_DEPTH = -10.0f;
  80 +const float INITIAL_DEPTH = 10.0f;
81 81  
82 82 /**
83 83 * @brief Load an image, scaled-down to no more than the stage dimensions.
... ... @@ -163,12 +163,13 @@ private:
163 163 Toolkit::TextLabel mTitleActor;
164 164 Actor mParent;
165 165  
166   - ImageActor mCurrentImage;
167   - ImageActor mNextImage;
  166 + Toolkit::ImageView mCurrentImage;
  167 + Toolkit::ImageView mNextImage;
168 168 unsigned int mIndex;
169 169  
170   - ShaderEffect mCurrentImageEffect;
171   - ShaderEffect mNextImageEffect;
  170 + Property::Map mDissolveEffect;
  171 + Property::Map mEmptyEffect;
  172 +
172 173 bool mUseHighPrecision;
173 174 Animation mAnimation;
174 175  
... ... @@ -180,8 +181,16 @@ private:
180 181 bool mTimerReady;
181 182 unsigned int mCentralLineIndex;
182 183  
  184 + Image mIconPlay;
  185 + Image mIconPlaySelected;
  186 + Image mIconStop;
  187 + Image mIconStopSelected;
183 188 Toolkit::PushButton mPlayStopButton;
184 189  
  190 + Image mIconHighP;
  191 + Image mIconHighPSelected;
  192 + Image mIconMediumP;
  193 + Image mIconMediumPSelected;
185 194 Toolkit::PushButton mEffectChangeButton;
186 195 };
187 196  
... ... @@ -210,9 +219,13 @@ void DissolveEffectApp::OnInit( Application&amp; application )
210 219 mContent = DemoHelper::CreateView( application, mView,mToolBar, "", TOOLBAR_IMAGE, "" );
211 220  
212 221 // Add an effect-changing button on the right of the tool bar.
  222 + mIconHighP = ResourceImage::New( EFFECT_HIGHP_IMAGE );
  223 + mIconHighPSelected = ResourceImage::New( EFFECT_HIGHP_IMAGE_SELECTED );
  224 + mIconMediumP = ResourceImage::New( EFFECT_MEDIUMP_IMAGE );
  225 + mIconMediumPSelected = ResourceImage::New( EFFECT_MEDIUMP_IMAGE_SELECTED );
213 226 mEffectChangeButton = Toolkit::PushButton::New();
214   - mEffectChangeButton.SetUnselectedImage( EFFECT_HIGHP_IMAGE );
215   - mEffectChangeButton.SetSelectedImage( EFFECT_HIGHP_IMAGE_SELECTED );
  227 + mEffectChangeButton.SetButtonImage( mIconHighP );
  228 + mEffectChangeButton.SetSelectedImage( mIconHighPSelected );
216 229 mEffectChangeButton.ClickedSignal().Connect( this, &DissolveEffectApp::OnEffectButtonClicked );
217 230 mToolBar.AddControl( mEffectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
218 231  
... ... @@ -221,9 +234,13 @@ void DissolveEffectApp::OnInit( Application&amp; application )
221 234 mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter );
222 235  
223 236 // Add an slide-show button on the right of the title
  237 + mIconPlay = ResourceImage::New( PLAY_ICON );
  238 + mIconPlaySelected = ResourceImage::New( PLAY_ICON_SELECTED );
  239 + mIconStop = ResourceImage::New( STOP_ICON );
  240 + mIconStopSelected = ResourceImage::New( STOP_ICON_SELECTED );
224 241 mPlayStopButton = Toolkit::PushButton::New();
225   - mPlayStopButton.SetUnselectedImage( PLAY_ICON );
226   - mPlayStopButton.SetSelectedImage( PLAY_ICON_SELECTED );
  242 + mPlayStopButton.SetButtonImage( mIconPlay );
  243 + mPlayStopButton.SetSelectedImage( mIconPlaySelected );
227 244 mPlayStopButton.ClickedSignal().Connect( this, &DissolveEffectApp::OnSildeshowButtonClicked );
228 245 mToolBar.AddControl( mPlayStopButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING );
229 246  
... ... @@ -231,10 +248,6 @@ void DissolveEffectApp::OnInit( Application&amp; application )
231 248 mPanGestureDetector = PanGestureDetector::New();
232 249 mPanGestureDetector.DetectedSignal().Connect( this, &DissolveEffectApp::OnPanGesture );
233 250  
234   - // create the dissolve effect object
235   - mCurrentImageEffect = Toolkit::CreateDissolveEffect(mUseHighPrecision);
236   - mNextImageEffect = Toolkit::CreateDissolveEffect(mUseHighPrecision);
237   -
238 251 mViewTimer = Timer::New( VIEWINGTIME );
239 252 mViewTimer.TickSignal().Connect( this, &DissolveEffectApp::OnTimerTick );
240 253 mTimerReady = true;
... ... @@ -246,13 +259,16 @@ void DissolveEffectApp::OnInit( Application&amp; application )
246 259 mContent.Add( mParent );
247 260  
248 261 // show the first image
249   - mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) );
  262 + mCurrentImage = Toolkit::ImageView::New( LoadStageFillingImage( IMAGES[mIndex] ) );
250 263 mCurrentImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION);
251 264 mCurrentImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
252 265 mCurrentImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO );
253 266 mParent.Add( mCurrentImage );
254 267  
255 268 mPanGestureDetector.Attach( mCurrentImage );
  269 +
  270 + mDissolveEffect = Dali::Toolkit::CreateDissolveEffect( mUseHighPrecision );
  271 + mEmptyEffect.Insert( "shader", Property::Value() );
256 272 }
257 273  
258 274 // signal handler, called when the pan gesture is detected
... ... @@ -276,7 +292,7 @@ void DissolveEffectApp::OnPanGesture( Actor actor, const PanGesture&amp; gesture )
276 292 }
277 293  
278 294 Image image = LoadStageFillingImage( IMAGES[ mIndex ] );
279   - mNextImage = ImageActor::New( image );
  295 + mNextImage = Toolkit::ImageView::New( image );
280 296 mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION);
281 297 mNextImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
282 298 mNextImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO );
... ... @@ -291,20 +307,18 @@ void DissolveEffectApp::StartTransition(Vector2 position, Vector2 displacement)
291 307 {
292 308 mAnimation = Animation::New(TRANSITION_DURATION);
293 309  
294   - Dali::Toolkit::DissolveEffectSetCentralLine( mCurrentImageEffect, position, displacement );
295   - mCurrentImageEffect.SetUniform("uPercentage", 0.0f);
296   - mCurrentImage.SetShaderEffect(mCurrentImageEffect);
297   - mAnimation.AnimateTo( Property(mCurrentImageEffect, "uPercentage"), 1.0f, AlphaFunction::LINEAR );
  310 + Dali::Toolkit::DissolveEffectSetCentralLine( mCurrentImage, position, displacement, 0.0f );
  311 + mCurrentImage.SetProperty( Toolkit::ImageView::Property::IMAGE, mDissolveEffect );
  312 + mAnimation.AnimateTo( Property( mCurrentImage, "uPercentage" ), 1.0f, AlphaFunction::LINEAR );
298 313  
299 314 mNextImage.SetOpacity(0.0f);
300 315 mAnimation.AnimateTo( Property( mNextImage, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunction::LINEAR );
301 316  
302 317 if(mUseHighPrecision)
303 318 {
304   - Dali::Toolkit::DissolveEffectSetCentralLine( mNextImageEffect, position, displacement );
305   - mNextImageEffect.SetUniform("uPercentage", 1.0f);
306   - mNextImage.SetShaderEffect(mNextImageEffect);
307   - mAnimation.AnimateTo( Property(mNextImageEffect, "uPercentage"), 0.0f, AlphaFunction::LINEAR );
  319 + Dali::Toolkit::DissolveEffectSetCentralLine( mNextImage, position, displacement, 1.0f );
  320 + mNextImage.SetProperty( Toolkit::ImageView::Property::IMAGE, mDissolveEffect );
  321 + mAnimation.AnimateTo( Property( mNextImage, "uPercentage" ), 0.0f, AlphaFunction::LINEAR );
308 322 }
309 323 else
310 324 {
... ... @@ -330,18 +344,18 @@ void DissolveEffectApp::OnKeyEvent(const KeyEvent&amp; event)
330 344 bool DissolveEffectApp::OnEffectButtonClicked( Toolkit::Button button )
331 345 {
332 346 mUseHighPrecision = !mUseHighPrecision;
333   - mCurrentImageEffect = Dali::Toolkit::CreateDissolveEffect(mUseHighPrecision);
  347 + mDissolveEffect = Dali::Toolkit::CreateDissolveEffect(mUseHighPrecision);
334 348 if(mUseHighPrecision)
335 349 {
336 350 mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_HIGHP) );
337   - mEffectChangeButton.SetUnselectedImage( EFFECT_HIGHP_IMAGE );
338   - mEffectChangeButton.SetSelectedImage( EFFECT_HIGHP_IMAGE_SELECTED );
  351 + mEffectChangeButton.SetButtonImage( mIconHighP );
  352 + mEffectChangeButton.SetSelectedImage( mIconHighPSelected );
339 353 }
340 354 else
341 355 {
342 356 mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_MEDIUMP) );
343   - mEffectChangeButton.SetUnselectedImage( EFFECT_MEDIUMP_IMAGE );
344   - mEffectChangeButton.SetSelectedImage( EFFECT_MEDIUMP_IMAGE_SELECTED );
  357 + mEffectChangeButton.SetButtonImage( mIconMediumP );
  358 + mEffectChangeButton.SetSelectedImage( mIconMediumPSelected );
345 359 }
346 360  
347 361 return true;
... ... @@ -352,16 +366,16 @@ bool DissolveEffectApp::OnSildeshowButtonClicked( Toolkit::Button button )
352 366 mSlideshow = !mSlideshow;
353 367 if( mSlideshow )
354 368 {
355   - mPlayStopButton.SetUnselectedImage( STOP_ICON );
356   - mPlayStopButton.SetSelectedImage( STOP_ICON_SELECTED );
  369 + mPlayStopButton.SetButtonImage( mIconStop );
  370 + mPlayStopButton.SetSelectedImage( mIconStopSelected );
357 371 mPanGestureDetector.Detach( mParent );
358 372 mViewTimer.Start();
359 373 mTimerReady = false;
360 374 }
361 375 else
362 376 {
363   - mPlayStopButton.SetUnselectedImage( PLAY_ICON );
364   - mPlayStopButton.SetSelectedImage( PLAY_ICON_SELECTED );
  377 + mPlayStopButton.SetButtonImage( mIconPlay );
  378 + mPlayStopButton.SetSelectedImage( mIconPlaySelected );
365 379 mTimerReady = true;
366 380 mPanGestureDetector.Attach( mParent );
367 381 }
... ... @@ -370,8 +384,7 @@ bool DissolveEffectApp::OnSildeshowButtonClicked( Toolkit::Button button )
370 384  
371 385 void DissolveEffectApp::OnTransitionCompleted( Animation& source )
372 386 {
373   - mCurrentImage.RemoveShaderEffect();
374   - mNextImage.RemoveShaderEffect();
  387 + mNextImage.SetProperty( Toolkit::ImageView::Property::IMAGE, mEmptyEffect );
375 388 mParent.Remove( mCurrentImage );
376 389 mPanGestureDetector.Detach( mCurrentImage );
377 390 mCurrentImage = mNextImage;
... ... @@ -392,7 +405,7 @@ bool DissolveEffectApp::OnTimerTick()
392 405 {
393 406 mIndex = (mIndex + 1)%NUM_IMAGES;
394 407 Image image = LoadStageFillingImage( IMAGES[ mIndex ] );
395   - mNextImage = ImageActor::New( image );
  408 + mNextImage = Toolkit::ImageView::New( image );
396 409 mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION);
397 410 mNextImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
398 411 mNextImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO );
... ...
examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp
... ... @@ -194,14 +194,14 @@ public:
194 194  
195 195 mHeightBox = Toolkit::ImageView::New( heightBackground );
196 196 mHeightBox.SetOpacity( 0.2f );
197   - stage.Add( mHeightBox );
  197 + background.Add( mHeightBox );
198 198  
199 199 mWidthBox = Toolkit::ImageView::New( widthBackground );
200 200 mWidthBox.SetOpacity( 0.2f );
201   - stage.Add( mWidthBox );
  201 + background.Add( mWidthBox );
202 202  
203 203 mDesiredBox = Toolkit::ImageView::New( desiredBackground );
204   - stage.Add( mDesiredBox );
  204 + background.Add( mDesiredBox );
205 205  
206 206 mDesiredBox.SetSize( stage.GetSize() * mImageStageScale );
207 207 mDesiredBox.SetParentOrigin( ParentOrigin::CENTER );
... ... @@ -247,7 +247,7 @@ public:
247 247 mImageActor.SetSortModifier(5.f);
248 248  
249 249 // Display the actor on the stage
250   - stage.Add( mImageActor );
  250 + background.Add( mImageActor );
251 251  
252 252 mImageActor.SetSize( stage.GetSize() * mImageStageScale );
253 253  
... ...
examples/item-view/item-view-example.cpp
... ... @@ -26,6 +26,7 @@
26 26 #include <dali/dali.h>
27 27 #include <dali-toolkit/dali-toolkit.h>
28 28 #include <dali/devel-api/images/atlas.h>
  29 +#include <dali/devel-api/rendering/cull-face.h>
29 30  
30 31 using namespace Dali;
31 32 using namespace Dali::Toolkit;
... ... @@ -291,6 +292,9 @@ public:
291 292 mReplaceButton.SetVisible( false );
292 293 stage.Add( mReplaceButton );
293 294  
  295 + // Store one 1x1 white image for multiple items to share for backgrounds:
  296 + mWhiteImage = BufferImage::WHITE();
  297 +
294 298 // Create the item view actor
295 299 mImageAtlas = CreateImageAtlas();
296 300 mItemView = ItemView::New(*this);
... ... @@ -322,9 +326,6 @@ public:
322 326 // Set the title and icon to the current layout
323 327 SetLayoutTitle();
324 328 SetLayoutImage();
325   -
326   - // Store one 1x1 white image for multiple items to share for backgrounds:
327   - mWhiteImage = BufferImage::WHITE();
328 329 }
329 330  
330 331 Actor OnKeyboardPreFocusChange( Actor current, Actor proposed, Control::KeyboardFocus::Direction direction )
... ... @@ -891,7 +892,8 @@ public: // From ItemFactory
891 892 checkbox.SetSize( spiralItemSize.width * 0.2f, spiralItemSize.width * 0.2f );
892 893 checkbox.SetPosition( -SELECTION_BORDER_WIDTH, SELECTION_BORDER_WIDTH );
893 894 checkbox.SetZ( 1.0f );
894   - checkbox.SetSortModifier( -50.0f );
  895 + SetCullFace(checkbox, Dali::CullBack);
  896 + checkbox.SetSortModifier( 150.0f );
895 897 if( MODE_REMOVE_MANY != mMode &&
896 898 MODE_INSERT_MANY != mMode &&
897 899 MODE_REPLACE_MANY != mMode )
... ... @@ -907,8 +909,9 @@ public: // From ItemFactory
907 909 tick.SetAnchorPoint( AnchorPoint::TOP_RIGHT );
908 910 tick.SetSize( spiralItemSize.width * 0.2f, spiralItemSize.width * 0.2f );
909 911 tick.SetZ( 1.0f );
910   - tick.SetSortModifier( -50.0f );
  912 + tick.SetSortModifier( 150.0f );
911 913 tick.SetVisible( false );
  914 + SetCullFace(tick, Dali::CullBack);
912 915 checkbox.Add( tick );
913 916  
914 917 // Connect new items for various editing modes
... ...
examples/magnifier/magnifier-example.cpp
... ... @@ -223,7 +223,7 @@ public:
223 223 Stage::GetCurrent().Add(overlay);
224 224  
225 225 mMagnifier = Toolkit::Magnifier::New();
226   - mMagnifier.SetSourceActor( mView.GetChildAt( 0 ) );
  226 + mMagnifier.SetSourceActor( mView );
227 227 mMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width
228 228 mMagnifier.SetProperty( Toolkit::Magnifier::Property::MAGNIFICATION_FACTOR, MAGNIFICATION_FACTOR );
229 229 mMagnifier.SetScale(Vector3::ZERO);
... ... @@ -240,7 +240,7 @@ public:
240 240  
241 241 // Create bouncing magnifier automatically bounces around screen.
242 242 mBouncingMagnifier = Toolkit::Magnifier::New();
243   - mBouncingMagnifier.SetSourceActor( mView.GetChildAt( 0 ) );
  243 + mBouncingMagnifier.SetSourceActor( mView );
244 244 mBouncingMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width
245 245 mBouncingMagnifier.SetProperty( Toolkit::Magnifier::Property::MAGNIFICATION_FACTOR, MAGNIFICATION_FACTOR );
246 246 overlay.Add( mBouncingMagnifier );
... ...
examples/text-fonts/text-fonts-example.cpp 0 โ†’ 100644
  1 +/*
  2 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + *
  16 + */
  17 +
  18 +/**
  19 + * @file text-fonts-example.cpp
  20 + * @brief Example of various TextLabel each with different font set ups,
  21 + * enables Testing of Font when the system font changes.
  22 + The first label is free, with no font family set, it could use the default system font and change as it changes.
  23 + The second label has it's font family set via the demo json file. It should not change when the system font changes.
  24 + The third label has it's font family set in code via SetProperty. It also should not change when the system font changes.
  25 + The forth label is not shown until the button along the bottom is pressed, it has no font set so the newly created label should use the system font,
  26 + Pressing the button again resets and unparents that button and then re-adds it.
  27 + */
  28 +
  29 +// EXTERNAL INCLUDES
  30 +#include <dali-toolkit/dali-toolkit.h>
  31 +#include <iostream>
  32 +
  33 +// INTERNAL INCLUDES
  34 +#include "shared/multi-language-strings.h"
  35 +#include "shared/view.h"
  36 +
  37 +using namespace Dali;
  38 +using namespace Dali::Toolkit;
  39 +using namespace MultiLanguageStrings;
  40 +
  41 +namespace
  42 +{
  43 + const char* const LABEL_TEXT = "A Quick Fox";
  44 + const char* const LABEL_TEXT_MIXED = "Fox ๊ตฌ๋ฏธํ˜ธ";
  45 + const char* const LABEL_TEXT_KOREAN = "๊ตฌ๋ฏธํ˜ธ";
  46 +}
  47 +
  48 +/**
  49 + * @brief The main class of the demo.
  50 + */
  51 +class TextFontsExample : public ConnectionTracker
  52 +{
  53 +public:
  54 +
  55 + TextFontsExample( Application& application )
  56 + : mApplication( application ),
  57 + mToggle(true)
  58 + {
  59 + // Connect to the Application's Init signal
  60 + mApplication.InitSignal().Connect( this, &TextFontsExample::Create );
  61 + }
  62 +
  63 + ~TextFontsExample()
  64 + {
  65 + // Nothing to do here.
  66 + }
  67 +
  68 + void CreateTextLabel( TextLabel& textLabel, std::string textString, const Vector4& color, bool infoLabel=false )
  69 + {
  70 + textLabel = TextLabel::New( textString );
  71 + textLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  72 + textLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  73 + textLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT );
  74 + textLabel.SetProperty( TextLabel::Property::MULTI_LINE, true );
  75 + if ( infoLabel )
  76 + {
  77 + textLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::WHITE );
  78 + textLabel.SetProperty( TextLabel::Property::POINT_SIZE, 12.0f );
  79 + textLabel.SetProperty( TextLabel::Property::FONT_FAMILY, "SamsungOneUI" );
  80 + }
  81 + else
  82 + {
  83 + textLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 0.3f, 0.3f ) );
  84 + textLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK );
  85 + textLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
  86 + }
  87 + textLabel.SetBackgroundColor( color );
  88 + }
  89 +
  90 + void CreateContainer( Control& container, const Vector2 size )
  91 + {
  92 + container = Control::New();
  93 + container.SetSize( size );
  94 + container.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  95 + container.SetDrawMode( DrawMode::OVERLAY_2D );
  96 + }
  97 +
  98 + void CreateFolderButton( PushButton& button )
  99 + {
  100 + button = PushButton::New();
  101 + button.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
  102 + button.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
  103 + button.SetSize( 50.0f, 50.0f );
  104 + }
  105 +
  106 + bool OnButtonClicked( Toolkit::Button button )
  107 + {
  108 + if ( mLabel4 )
  109 + {
  110 + UnparentAndReset( mLabel4 );
  111 + }
  112 +
  113 + if ( !mContainer4 )
  114 + {
  115 + CreateContainer ( mContainer4 , mLayoutSize);
  116 + Stage stage = Stage::GetCurrent();
  117 + Vector2 stageSize = stage.GetSize();
  118 + mContainer4.SetPosition( 0, stageSize.height*0.25f*3 );
  119 + stage.Add( mContainer4 );
  120 + // Info
  121 + CreateContainer ( mContainer4Info , mLayoutSize );
  122 + mContainer4Info.SetParentOrigin( ParentOrigin::TOP_RIGHT );
  123 + mContainer4.Add( mContainer4Info );
  124 + CreateTextLabel ( mLabel4Info, "system free", Color::BLACK, true );
  125 + mContainer4Info.Add ( mLabel4Info );
  126 + }
  127 +
  128 + if ( mToggle )
  129 + {
  130 + CreateTextLabel ( mLabel4, LABEL_TEXT_KOREAN, Color::WHITE );
  131 + mToggle = false;
  132 + }
  133 + else
  134 + {
  135 + CreateTextLabel ( mLabel4, LABEL_TEXT_MIXED, Color::WHITE );
  136 + mToggle = true;
  137 + }
  138 +
  139 + mContainer4.Add( mLabel4 );
  140 +
  141 + return true;
  142 + }
  143 +
  144 + /**
  145 + * One-time setup in response to Application InitSignal.
  146 + */
  147 + void Create( Application& application )
  148 + {
  149 + Stage stage = Stage::GetCurrent();
  150 + Vector2 stageSize = stage.GetSize();
  151 +
  152 + stage.KeyEventSignal().Connect(this, &TextFontsExample::OnKeyEvent);
  153 +
  154 + CreateFolderButton ( mButton );
  155 + mButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
  156 + mButton.ClickedSignal().Connect( this, &TextFontsExample::OnButtonClicked );
  157 + stage.Add( mButton );
  158 +
  159 + mLayoutSize = Vector2( stageSize.width*0.5f, stageSize.height*0.10f );
  160 + CreateContainer ( mContainer , mLayoutSize);
  161 + CreateContainer ( mContainer2 , mLayoutSize );
  162 + CreateContainer ( mContainer3 , mLayoutSize );
  163 +
  164 + // Info about Text Label and if font should be fixed or free to change with system
  165 + CreateContainer ( mContainerInfo , mLayoutSize );
  166 + CreateContainer ( mContainer2Info , mLayoutSize );
  167 + CreateContainer ( mContainer3Info , mLayoutSize );
  168 + mContainerInfo.SetParentOrigin( ParentOrigin::TOP_RIGHT );
  169 + mContainer2Info.SetParentOrigin( ParentOrigin::TOP_RIGHT );
  170 + mContainer3Info.SetParentOrigin( ParentOrigin::TOP_RIGHT );
  171 + mContainer.Add( mContainerInfo );
  172 + mContainer2.Add( mContainer2Info );
  173 + mContainer3.Add( mContainer3Info );
  174 + CreateTextLabel ( mLabelInfo, "system free", Color::BLACK, true );
  175 + CreateTextLabel ( mLabel2Info, "json fixed", Color::BLACK, true );
  176 + CreateTextLabel ( mLabel3Info, "SetProp fixed", Color::BLACK, true );
  177 + mContainerInfo.Add( mLabelInfo );
  178 + mContainer2Info.Add( mLabel2Info );
  179 + mContainer3Info.Add( mLabel3Info );
  180 +
  181 + stage.Add( mContainer );
  182 + stage.Add( mContainer2 );
  183 + stage.Add( mContainer3 );
  184 +
  185 + CreateTextLabel ( mLabel, LABEL_TEXT, Color::WHITE );
  186 +
  187 + CreateTextLabel ( mLabel2, LABEL_TEXT, Color::WHITE );
  188 + mLabel2.SetStyleName("textlabel-Rosemary");
  189 +
  190 + CreateTextLabel ( mLabel3, LABEL_TEXT, Color::WHITE );
  191 + mLabel3.SetProperty( TextLabel::Property::FONT_FAMILY, "SamsungOneUI" );
  192 +
  193 + mContainer.SetPosition( 0, 0 );
  194 + mContainer2.SetPosition( 0, stageSize.height*0.25f );
  195 + mContainer3.SetPosition( 0, stageSize.height*0.25f*2 );
  196 +
  197 + mContainer.Add( mLabel );
  198 + mContainer2.Add( mLabel2 );
  199 + mContainer3.Add( mLabel3 );
  200 + }
  201 +
  202 + /**
  203 + * Main key event handler
  204 + */
  205 + void OnKeyEvent(const KeyEvent& event)
  206 + {
  207 + if(event.state == KeyEvent::Down)
  208 + {
  209 + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) )
  210 + {
  211 + mApplication.Quit();
  212 + }
  213 + }
  214 + }
  215 +
  216 +private:
  217 +
  218 + Application& mApplication;
  219 +
  220 + PushButton mButton;
  221 +
  222 + TextLabel mLabel;
  223 + TextLabel mLabel2;
  224 + TextLabel mLabel3;
  225 +
  226 + TextLabel mLabel4;
  227 +
  228 + Control mContainer;
  229 + Control mContainer2;
  230 + Control mContainer3;
  231 + Control mContainer4;
  232 +
  233 + Control mContainerInfo;
  234 + Control mContainer2Info;
  235 + Control mContainer3Info;
  236 + Control mContainer4Info;
  237 +
  238 + TextLabel mLabelInfo;
  239 + TextLabel mLabel2Info;
  240 + TextLabel mLabel3Info;
  241 + TextLabel mLabel4Info;
  242 +
  243 + Vector2 mLayoutSize;
  244 +
  245 + bool mToggle;
  246 +};
  247 +
  248 +void RunTest( Application& application )
  249 +{
  250 + TextFontsExample test( application );
  251 +
  252 + application.MainLoop();
  253 +}
  254 +
  255 +/** Entry point for Linux & Tizen applications */
  256 +int main( int argc, char **argv )
  257 +{
  258 + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH );
  259 +
  260 + RunTest( application );
  261 +
  262 + return 0;
  263 +}
... ...
examples/textured-mesh/textured-mesh-example.cpp
... ... @@ -165,9 +165,7 @@ public:
165 165 mMeshActor.AddRenderer( mRenderer );
166 166 mMeshActor.SetSize(400, 400);
167 167  
168   - Property::Index fadeColorIndex = mMeshActor.RegisterProperty( "uFadeColor", Color::GREEN );
169   -
170   - fadeColorIndex = mRenderer.RegisterProperty( "uFadeColor", Color::MAGENTA );
  168 + Property::Index fadeColorIndex = mRenderer.RegisterProperty( "uFadeColor", Color::MAGENTA );
171 169 mRenderer.SetDepthIndex(0);
172 170  
173 171 mMeshActor.SetParentOrigin( ParentOrigin::TOP_CENTER );
... ... @@ -181,11 +179,10 @@ public:
181 179 mMeshActor2.SetSize(400, 400);
182 180  
183 181 mMeshActor2.RegisterProperty( "a-n-other-property", Color::GREEN );
184   - Property::Index fadeColorIndex2 = mMeshActor2.RegisterProperty( "uFadeColor", Color::GREEN );
185 182  
186 183 mRenderer2.RegisterProperty( "a-n-other-property", Vector3::ZERO );
187 184 mRenderer2.RegisterProperty( "a-coefficient", 0.008f );
188   - fadeColorIndex2 = mRenderer2.RegisterProperty( "uFadeColor", Color::BLUE );
  185 + Property::Index fadeColorIndex2 = mRenderer2.RegisterProperty( "uFadeColor", Color::BLUE );
189 186 mRenderer2.SetDepthIndex(0);
190 187  
191 188 mMeshActor2.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
... ...
packaging/com.samsung.dali-demo.spec
... ... @@ -2,7 +2,7 @@
2 2  
3 3 Name: com.samsung.dali-demo
4 4 Summary: The OpenGLES Canvas Core Demo
5   -Version: 1.1.4
  5 +Version: 1.1.5
6 6 Release: 1
7 7 Group: System/Libraries
8 8 License: Apache-2.0
... ...
resources/images/Logo-for-demo.png 0 โ†’ 100644

38.8 KB

resources/style/demo-theme.json
... ... @@ -22,13 +22,15 @@ distributing this software or its derivatives.
22 22 {
23 23 "styles":
24 24 {
  25 + "textlabel-Rosemary":
  26 + {
  27 + "font-family":"Rosemary"
  28 + },
25 29 "textlabel":
26 30 {
27   - "font-family":"HelveticaNeue",
28 31 "font-style":"Regular",
29 32 "point-size":18
30 33 },
31   -
32 34 "launcherlabel":
33 35 {
34 36 "point-size":18
... ... @@ -57,6 +59,19 @@ distributing this software or its derivatives.
57 59 "buttonlabel":
58 60 {
59 61 "point-size":11
  62 + },
  63 +
  64 + "launcherbackground":
  65 + {
  66 + "background":
  67 + {
  68 + "renderer-type": "gradient-renderer",
  69 + "gradient-center": [240, 400],
  70 + "gradient-radius": 932,
  71 + "gradient-units": "user-space",
  72 + "gradient-stop-color": [[0.247,0.38,0.52,1.0],[0.055,0.18,0.286,1.0]],
  73 + "gradient-stop-offset":[0.0,1.0]
  74 + }
60 75 }
61 76 }
62 77 }
... ...
resources/style/mobile/demo-theme.json
... ... @@ -22,13 +22,15 @@ distributing this software or its derivatives.
22 22 {
23 23 "styles":
24 24 {
  25 + "textlabel-Rosemary":
  26 + {
  27 + "font-family":"Rosemary"
  28 + },
25 29 "textlabel":
26 30 {
27   - "font-family":"SamsungSans",
28 31 "font-style":"Regular",
29 32 "point-size":18
30 33 },
31   -
32 34 "textlabel-font-size-0":
33 35 {
34 36 "point-size":8
... ... @@ -64,7 +66,7 @@ distributing this software or its derivatives.
64 66 {
65 67 "point-size":10
66 68 },
67   -
  69 +
68 70 "scrollview":
69 71 {
70 72 "overshoot-effect-color":"B018"
... ... @@ -78,6 +80,19 @@ distributing this software or its derivatives.
78 80 "buttonlabel":
79 81 {
80 82 "point-size":8
  83 + },
  84 +
  85 + "launcherbackground":
  86 + {
  87 + "background":
  88 + {
  89 + "renderer-type": "gradient-renderer",
  90 + "gradient-center": [360, 640],
  91 + "gradient-radius": 1468,
  92 + "gradient-units": "user-space",
  93 + "gradient-stop-color": [[0.247,0.38,0.52,1.0],[0.055,0.18,0.286,1.0]],
  94 + "gradient-stop-offset":[0.0,1.0]
  95 + }
81 96 }
82 97 }
83 98 }
... ...