Commit 92599bec00306761453eeaaa2a212fbc44ec0ba8
[dali_1.2.28] Merge branch 'devel/master'
Change-Id: I2e61146eca4cb9f4e68c76c0971ba35c2c20a8a3
Showing
20 changed files
with
1768 additions
and
628 deletions
com.samsung.dali-demo.xml
| ... | ... | @@ -177,6 +177,9 @@ |
| 177 | 177 | <label>First Person Camera Game</label> |
| 178 | 178 | </ui-application> |
| 179 | 179 | <ui-application appid="transitions.example" exec="/usr/apps/com.samsung.dali-demo/bin/transitions.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 180 | + <label>Shadow button</label> | |
| 181 | + </ui-application> | |
| 182 | + <ui-application appid="visual-transitions.example" exec="/usr/apps/com.samsung.dali-demo/bin/visual-transitions.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | |
| 180 | 183 | <label>Visual Transitions</label> |
| 181 | 184 | </ui-application> |
| 182 | 185 | <ui-application appid="animated-images.example" exec="/usr/apps/com.samsung.dali-demo/bin/animated-images.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | ... | ... |
examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp
| ... | ... | @@ -18,6 +18,7 @@ |
| 18 | 18 | #include <dali/dali.h> |
| 19 | 19 | #include <dali-toolkit/dali-toolkit.h> |
| 20 | 20 | #include <dali-toolkit/devel-api/controls/popup/popup.h> |
| 21 | +#include <dali-toolkit/public-api/visuals/image-visual-properties.h> | |
| 21 | 22 | #include "shared/view.h" |
| 22 | 23 | #include <iostream> |
| 23 | 24 | |
| ... | ... | @@ -522,21 +523,6 @@ public: |
| 522 | 523 | } |
| 523 | 524 | } |
| 524 | 525 | |
| 525 | - void OnImageLoaded( ResourceImage image ) | |
| 526 | - { | |
| 527 | - DALI_ASSERT_DEBUG( image == mNextImage ); | |
| 528 | - mImageView.SetImage( image ); | |
| 529 | - mImageView.SetSize( Size( image.GetWidth(), image.GetHeight() ) ); | |
| 530 | - mImageLoading = false; | |
| 531 | - | |
| 532 | - // We have finished loading, if a resize had occured during the load, trigger another load now. | |
| 533 | - if( mQueuedImageLoad ) | |
| 534 | - { | |
| 535 | - mQueuedImageLoad = false; | |
| 536 | - LoadImage(); | |
| 537 | - } | |
| 538 | - } | |
| 539 | - | |
| 540 | 526 | bool OnControlTouched( Actor actor, const TouchData& event ) |
| 541 | 527 | { |
| 542 | 528 | if(event.GetPointCount() > 0) |
| ... | ... | @@ -687,21 +673,17 @@ private: |
| 687 | 673 | const char * const path = IMAGE_PATHS[ mCurrentPath ]; |
| 688 | 674 | Stage stage = Stage::GetCurrent(); |
| 689 | 675 | Size imageSize = stage.GetSize() * mImageStageScale; |
| 690 | - const ImageDimensions imageSizeInt = ImageDimensions::FromFloatArray( &imageSize.x ); | |
| 676 | + mImageView.SetSize( imageSize ); | |
| 691 | 677 | |
| 692 | - ResourceImage image = ResourceImage::New( path, imageSizeInt, mFittingMode, mSamplingMode ); | |
| 678 | + Property::Map map; | |
| 679 | + map[Toolkit::ImageVisual::Property::URL] = path; | |
| 680 | + map[Toolkit::ImageVisual::Property::DESIRED_WIDTH] = imageSize.x; | |
| 681 | + map[Toolkit::ImageVisual::Property::DESIRED_HEIGHT] = imageSize.y; | |
| 682 | + map[Toolkit::ImageVisual::Property::FITTING_MODE] = mFittingMode; | |
| 683 | + map[Toolkit::ImageVisual::Property::SAMPLING_MODE] = mSamplingMode; | |
| 693 | 684 | |
| 694 | - // If the image was cached, the load has already occured, bypass hooking the signal. | |
| 695 | - if( image.GetLoadingState() ) | |
| 696 | - { | |
| 697 | - OnImageLoaded( image ); | |
| 698 | - } | |
| 699 | - else | |
| 700 | - { | |
| 701 | - image.LoadingFinishedSignal().Connect( this, &ImageScalingAndFilteringController::OnImageLoaded ); | |
| 702 | - } | |
| 685 | + mImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, map ); | |
| 703 | 686 | |
| 704 | - mNextImage = image; | |
| 705 | 687 | } |
| 706 | 688 | |
| 707 | 689 | void ResizeImage() |
| ... | ... | @@ -710,16 +692,7 @@ private: |
| 710 | 692 | Stage stage = Stage::GetCurrent(); |
| 711 | 693 | Size imageSize = stage.GetSize() * mImageStageScale; |
| 712 | 694 | |
| 713 | - // If an image is already loading, queue another load when it has finished. | |
| 714 | - // This way we get continuous updates instead of constantly re-requesting loads. | |
| 715 | - if( mImageLoading ) | |
| 716 | - { | |
| 717 | - mQueuedImageLoad = true; | |
| 718 | - } | |
| 719 | - else | |
| 720 | - { | |
| 721 | - LoadImage(); | |
| 722 | - } | |
| 695 | + LoadImage(); | |
| 723 | 696 | |
| 724 | 697 | // Border size needs to be modified to take into account the width of the frame. |
| 725 | 698 | Vector2 borderScale( ( imageSize + Vector2( BORDER_WIDTH * 2.0f, BORDER_WIDTH * 2.0f ) ) / stage.GetSize() ); |
| ... | ... | @@ -742,7 +715,6 @@ private: |
| 742 | 715 | Toolkit::ImageView mGrabCorner; |
| 743 | 716 | PanGestureDetector mPanGestureDetector; |
| 744 | 717 | Toolkit::ImageView mImageView; |
| 745 | - ResourceImage mNextImage; //< Currently-loading image | |
| 746 | 718 | Vector2 mImageStageScale; |
| 747 | 719 | int mCurrentPath; |
| 748 | 720 | FittingMode::Type mFittingMode; | ... | ... |
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
| ... | ... | @@ -168,23 +168,6 @@ const char* IMAGE_PATHS[] = { |
| 168 | 168 | const unsigned NUM_IMAGE_PATHS = sizeof(IMAGE_PATHS) / sizeof(IMAGE_PATHS[0]) - 1u; |
| 169 | 169 | |
| 170 | 170 | |
| 171 | -/** | |
| 172 | - * Creates an Image | |
| 173 | - * | |
| 174 | - * @param[in] filename The path of the image. | |
| 175 | - * @param[in] width The width of the image in pixels. | |
| 176 | - * @param[in] height The height of the image in pixels. | |
| 177 | - * @param[in] fittingMode The mode to use when scaling the image to fit the desired dimensions. | |
| 178 | - */ | |
| 179 | -Image CreateImage(const std::string& filename, unsigned int width, unsigned int height, Dali::FittingMode::Type fittingMode ) | |
| 180 | -{ | |
| 181 | -#ifdef DEBUG_PRINT_DIAGNOSTICS | |
| 182 | - fprintf( stderr, "CreateImage(%s, %u, %u, fittingMode=%u)\n", filename.c_str(), width, height, unsigned( fittingMode ) ); | |
| 183 | -#endif | |
| 184 | - Image image = ResourceImage::New( filename, ImageDimensions( width, height ), fittingMode, Dali::SamplingMode::BOX_THEN_LINEAR ); | |
| 185 | - | |
| 186 | - return image; | |
| 187 | -} | |
| 188 | 171 | |
| 189 | 172 | /** |
| 190 | 173 | * Creates an ImageView |
| ... | ... | @@ -194,15 +177,23 @@ Image CreateImage(const std::string& filename, unsigned int width, unsigned int |
| 194 | 177 | * @param[in] height The height of the image in pixels. |
| 195 | 178 | * @param[in] fittingMode The mode to use when scaling the image to fit the desired dimensions. |
| 196 | 179 | */ |
| 197 | -ImageView CreateImageView(const std::string& filename, unsigned int width, unsigned int height, Dali::FittingMode::Type fittingMode ) | |
| 180 | +ImageView CreateImageView(const std::string& filename, int width, int height, Dali::FittingMode::Type fittingMode ) | |
| 198 | 181 | { |
| 199 | - Image img = CreateImage( filename, width, height, fittingMode ); | |
| 200 | - ImageView actor = ImageView::New( img ); | |
| 201 | - actor.SetName( filename ); | |
| 202 | - actor.SetParentOrigin(ParentOrigin::CENTER); | |
| 203 | - actor.SetAnchorPoint(AnchorPoint::CENTER); | |
| 204 | 182 | |
| 205 | - return actor; | |
| 183 | + ImageView imageView = ImageView::New(); | |
| 184 | + | |
| 185 | + Property::Map map; | |
| 186 | + map[Toolkit::ImageVisual::Property::URL] = filename; | |
| 187 | + map[Toolkit::ImageVisual::Property::DESIRED_WIDTH] = width; | |
| 188 | + map[Toolkit::ImageVisual::Property::DESIRED_HEIGHT] = height; | |
| 189 | + map[Toolkit::ImageVisual::Property::FITTING_MODE] = fittingMode; | |
| 190 | + imageView.SetProperty( Toolkit::ImageView::Property::IMAGE, map ); | |
| 191 | + | |
| 192 | + imageView.SetName( filename ); | |
| 193 | + imageView.SetParentOrigin(ParentOrigin::CENTER); | |
| 194 | + imageView.SetAnchorPoint(AnchorPoint::CENTER); | |
| 195 | + | |
| 196 | + return imageView; | |
| 206 | 197 | } |
| 207 | 198 | |
| 208 | 199 | /** Cycle the scaling mode options. */ |
| ... | ... | @@ -494,13 +485,18 @@ public: |
| 494 | 485 | Dali::FittingMode::Type newMode = NextMode( mFittingModes[id] ); |
| 495 | 486 | const Vector2 imageSize = mSizes[actor.GetId()]; |
| 496 | 487 | |
| 497 | - const std::string& url = mResourceUrls[id]; | |
| 498 | - Image newImage = CreateImage( url, imageSize.width + 0.5f, imageSize.height + 0.5f, newMode ); | |
| 499 | 488 | ImageView imageView = ImageView::DownCast( actor ); |
| 500 | - if(imageView) | |
| 489 | + if( imageView) | |
| 501 | 490 | { |
| 502 | - imageView.SetImage( newImage ); | |
| 491 | + Property::Map map; | |
| 492 | + map[Visual::Property::TYPE] = Visual::IMAGE; | |
| 493 | + map[ImageVisual::Property::URL] = mResourceUrls[id]; | |
| 494 | + map[ImageVisual::Property::DESIRED_WIDTH] = imageSize.width + 0.5f; | |
| 495 | + map[ImageVisual::Property::DESIRED_HEIGHT] = imageSize.height + 0.5f; | |
| 496 | + map[ImageVisual::Property::FITTING_MODE] = newMode; | |
| 497 | + imageView.SetProperty( ImageView::Property::IMAGE, map ); | |
| 503 | 498 | } |
| 499 | + | |
| 504 | 500 | mFittingModes[id] = newMode; |
| 505 | 501 | } |
| 506 | 502 | } |
| ... | ... | @@ -542,8 +538,16 @@ public: |
| 542 | 538 | |
| 543 | 539 | const Vector2 imageSize = mSizes[ id ]; |
| 544 | 540 | Dali::FittingMode::Type newMode = NextMode( mFittingModes[ id ] ); |
| 545 | - Image newImage = CreateImage( mResourceUrls[ id ], imageSize.width, imageSize.height, newMode ); | |
| 546 | - gridImageView.SetImage( newImage ); | |
| 541 | + | |
| 542 | + Property::Map map; | |
| 543 | + map[Visual::Property::TYPE] = Visual::IMAGE; | |
| 544 | + map[ImageVisual::Property::URL] = mResourceUrls[id]; | |
| 545 | + map[ImageVisual::Property::DESIRED_WIDTH] = imageSize.width; | |
| 546 | + map[ImageVisual::Property::DESIRED_HEIGHT] = imageSize.height; | |
| 547 | + map[ImageVisual::Property::FITTING_MODE] = newMode; | |
| 548 | + gridImageView.SetProperty( ImageView::Property::IMAGE, map ); | |
| 549 | + | |
| 550 | + | |
| 547 | 551 | |
| 548 | 552 | mFittingModes[ id ] = newMode; |
| 549 | 553 | ... | ... |
examples/mesh-visual/mesh-visual-example.cpp
| ... | ... | @@ -6,65 +6,67 @@ using namespace Dali::Toolkit; |
| 6 | 6 | |
| 7 | 7 | namespace |
| 8 | 8 | { |
| 9 | - //Keeps information about each model for access. | |
| 10 | - struct Model | |
| 11 | - { | |
| 12 | - Control control; // Control housing the mesh visual of the model. | |
| 13 | - Vector2 rotation; // Keeps track of rotation about x and y axis for manual rotation. | |
| 14 | - Animation rotationAnimation; // Automatically rotates when left alone. | |
| 15 | - }; | |
| 9 | +// Keeps information about each model for access. | |
| 10 | +struct Model | |
| 11 | +{ | |
| 12 | + Control control; // Control housing the mesh visual of the model. | |
| 13 | + Vector2 rotation; // Keeps track of rotation about x and y axis for manual rotation. | |
| 14 | + Animation rotationAnimation; // Automatically rotates when left alone. | |
| 15 | +}; | |
| 16 | 16 | |
| 17 | - //Files for meshes | |
| 18 | - const char * const MODEL_FILE_TABLE[] = | |
| 19 | - { | |
| 20 | - DEMO_MODEL_DIR "Dino.obj", | |
| 21 | - DEMO_MODEL_DIR "ToyRobot-Metal.obj", | |
| 22 | - DEMO_MODEL_DIR "Toyrobot-Plastic.obj" | |
| 23 | - }; | |
| 17 | +// Files for meshes | |
| 18 | +const char * const MODEL_FILE_TABLE[] = | |
| 19 | +{ | |
| 20 | + DEMO_MODEL_DIR "Dino.obj", | |
| 21 | + DEMO_MODEL_DIR "ToyRobot-Metal.obj", | |
| 22 | + DEMO_MODEL_DIR "Toyrobot-Plastic.obj" | |
| 23 | +}; | |
| 24 | 24 | |
| 25 | - const char * const MATERIAL_FILE_TABLE[] = | |
| 26 | - { | |
| 27 | - DEMO_MODEL_DIR "Dino.mtl", | |
| 28 | - DEMO_MODEL_DIR "ToyRobot-Metal.mtl", | |
| 29 | - DEMO_MODEL_DIR "Toyrobot-Plastic.mtl" | |
| 30 | - }; | |
| 25 | +const char * const MATERIAL_FILE_TABLE[] = | |
| 26 | +{ | |
| 27 | + DEMO_MODEL_DIR "Dino.mtl", | |
| 28 | + DEMO_MODEL_DIR "ToyRobot-Metal.mtl", | |
| 29 | + DEMO_MODEL_DIR "Toyrobot-Plastic.mtl" | |
| 30 | +}; | |
| 31 | 31 | |
| 32 | - const char * const TEXTURES_PATH( DEMO_IMAGE_DIR "" ); | |
| 32 | +const char * const TEXTURES_PATH( DEMO_IMAGE_DIR "" ); | |
| 33 | 33 | |
| 34 | - //Possible shading modes. | |
| 35 | - MeshVisual::ShadingMode::Value SHADING_MODE_TABLE[] = | |
| 36 | - { | |
| 37 | - MeshVisual::ShadingMode::TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING, | |
| 38 | - MeshVisual::ShadingMode::TEXTURED_WITH_SPECULAR_LIGHTING, | |
| 39 | - MeshVisual::ShadingMode::TEXTURELESS_WITH_DIFFUSE_LIGHTING | |
| 40 | - }; | |
| 41 | - | |
| 42 | - //Button labels. | |
| 43 | - const char * const PAUSE = " || "; | |
| 44 | - const char * const PLAY = " > "; | |
| 45 | - const char * const FIXED = "FIXED"; | |
| 46 | - const char * const MANUAL = "MANUAL"; | |
| 47 | - const char * const FRONT = "FRONT"; | |
| 48 | - const char * const BACK = "BACK"; | |
| 49 | - | |
| 50 | - //Image urls for the light. | |
| 51 | - const char * const LIGHT_URL_FRONT = DEMO_IMAGE_DIR "light-icon-front.png"; | |
| 52 | - const char * const LIGHT_URL_BACK = DEMO_IMAGE_DIR "light-icon-back.png"; | |
| 53 | - | |
| 54 | - const float X_ROTATION_DISPLACEMENT_FACTOR = 60.0f; | |
| 55 | - const float Y_ROTATION_DISPLACEMENT_FACTOR = 60.0f; | |
| 56 | - const float MODEL_SCALE = 0.75f; | |
| 57 | - const float LIGHT_SCALE = 0.15f; | |
| 58 | - const float BUTTONS_OFFSET_BOTTOM = 0.08f; | |
| 59 | - const float BUTTONS_OFFSET_SIDE = 0.2f; | |
| 60 | - const int NUM_MESHES = 2; | |
| 61 | - | |
| 62 | - //Used to identify actors. | |
| 63 | - const int MODEL_TAG = 0; | |
| 64 | - const int LIGHT_TAG = 1; | |
| 65 | - const int LAYER_TAG = 2; | |
| 66 | - | |
| 67 | -} //End namespace | |
| 34 | +// Possible shading modes. | |
| 35 | +MeshVisual::ShadingMode::Value SHADING_MODE_TABLE[] = | |
| 36 | +{ | |
| 37 | + MeshVisual::ShadingMode::TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING, | |
| 38 | + MeshVisual::ShadingMode::TEXTURED_WITH_SPECULAR_LIGHTING, | |
| 39 | + MeshVisual::ShadingMode::TEXTURELESS_WITH_DIFFUSE_LIGHTING | |
| 40 | +}; | |
| 41 | + | |
| 42 | +// Button labels. | |
| 43 | +const char * const PAUSE = " || "; | |
| 44 | +const char * const PLAY = " > "; | |
| 45 | +const char * const FIXED = "FIXED"; | |
| 46 | +const char * const MANUAL = "MANUAL"; | |
| 47 | +const char * const FRONT = "FRONT"; | |
| 48 | +const char * const BACK = "BACK"; | |
| 49 | + | |
| 50 | +// Image urls for the light. | |
| 51 | +const char * const LIGHT_URL_FRONT = DEMO_IMAGE_DIR "light-icon-front.png"; | |
| 52 | +const char * const LIGHT_URL_BACK = DEMO_IMAGE_DIR "light-icon-back.png"; | |
| 53 | + | |
| 54 | +const float X_ROTATION_DISPLACEMENT_FACTOR = 60.0f; | |
| 55 | +const float Y_ROTATION_DISPLACEMENT_FACTOR = 60.0f; | |
| 56 | +const float MODEL_SCALE = 0.75f; | |
| 57 | +const float LIGHT_SCALE = 0.15f; | |
| 58 | +const float BUTTONS_OFFSET_BOTTOM = 0.08f; | |
| 59 | +const float BUTTONS_OFFSET_SIDE = 0.2f; | |
| 60 | +const int NUM_MESHES = 2; | |
| 61 | + | |
| 62 | +// Used to identify actors. | |
| 63 | +const int MODEL_TAG = 0; | |
| 64 | +const int LIGHT_TAG = 1; | |
| 65 | +const int LAYER_TAG = 2; | |
| 66 | + | |
| 67 | +const Vector4 STAGE_COLOR( 211.0f / 255.0f, 211.0f / 255.0f, 211.0f / 255.0f, 1.0f ); ///< The color of the stage | |
| 68 | + | |
| 69 | +} // unnamed namespace | |
| 68 | 70 | |
| 69 | 71 | class MeshVisualController : public ConnectionTracker |
| 70 | 72 | { |
| ... | ... | @@ -93,7 +95,7 @@ public: |
| 93 | 95 | { |
| 94 | 96 | // Get a handle to the stage |
| 95 | 97 | Stage stage = Stage::GetCurrent(); |
| 96 | - stage.SetBackgroundColor( Vector4( 0.0, 0.5, 1.0, 1.0 ) ); | |
| 98 | + stage.SetBackgroundColor( STAGE_COLOR ); | |
| 97 | 99 | |
| 98 | 100 | //Set up root layer to receive touch gestures. |
| 99 | 101 | Layer rootLayer = stage.GetRootLayer(); | ... | ... |
examples/motion-blur/motion-blur-example.cpp
| ... | ... | @@ -37,20 +37,8 @@ namespace // unnamed namespace |
| 37 | 37 | // Demo setup parameters |
| 38 | 38 | // |
| 39 | 39 | |
| 40 | -//#define MULTIPLE_MOTION_BLURRED_ACTORS | |
| 41 | -#ifndef MULTIPLE_MOTION_BLURRED_ACTORS | |
| 42 | - | |
| 43 | 40 | const float MOTION_BLUR_ACTOR_WIDTH = 256; // actor size on screen |
| 44 | 41 | const float MOTION_BLUR_ACTOR_HEIGHT = 256; // "" |
| 45 | - | |
| 46 | -#else //#ifndef MULTIPLE_MOTION_BLURRED_ACTORS | |
| 47 | - | |
| 48 | -const float MOTION_BLUR_ACTOR_WIDTH = 150; // actor size on screen | |
| 49 | -const float MOTION_BLUR_ACTOR_HEIGHT = 112; // "" | |
| 50 | - | |
| 51 | -#endif //#ifndef MULTIPLE_MOTION_BLURRED_ACTORS | |
| 52 | - | |
| 53 | - | |
| 54 | 42 | const unsigned int MOTION_BLUR_NUM_SAMPLES = 8; |
| 55 | 43 | |
| 56 | 44 | const int MOTION_BLUR_NUM_ACTOR_IMAGES = 5; |
| ... | ... | @@ -230,71 +218,6 @@ public: |
| 230 | 218 | // set actor shader to the blur one |
| 231 | 219 | Toolkit::SetMotionBlurProperties( mMotionBlurImageView, MOTION_BLUR_NUM_SAMPLES ); |
| 232 | 220 | |
| 233 | - | |
| 234 | -#ifdef MULTIPLE_MOTION_BLURRED_ACTORS | |
| 235 | - | |
| 236 | - /////////////////////////////////////////////////////// | |
| 237 | - // | |
| 238 | - // Motion blurred actor 2 | |
| 239 | - // | |
| 240 | - | |
| 241 | - mMotionBlurImageView2 = ImageView::New(image); | |
| 242 | - mMotionBlurImageView2.SetParentOrigin( ParentOrigin::CENTER ); | |
| 243 | - mMotionBlurImageView2.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y); | |
| 244 | - mMotionBlurImageView2.SetPosition(mMotionBlurActorSize.x * 1.1f, 0.0f); | |
| 245 | - mMotionBlurImageView.Add( mMotionBlurImageView2 ); | |
| 246 | - | |
| 247 | - // set actor shader to the blur one | |
| 248 | - Toolkit::SetMotionBlurProperties( mMotionBlurImageView2, MOTION_BLUR_NUM_SAMPLES ); | |
| 249 | - mMotionBlurImageView2.SetProperty( Toolkit::ImageView::Property::IMAGE, mMotionBlurEffect ); | |
| 250 | - | |
| 251 | - | |
| 252 | - /////////////////////////////////////////////////////// | |
| 253 | - // | |
| 254 | - // Motion blurred actor 3 | |
| 255 | - // | |
| 256 | - | |
| 257 | - mMotionBlurImageView3 = ImageView::New(image); | |
| 258 | - mMotionBlurImageView3.SetParentOrigin( ParentOrigin::CENTER ); | |
| 259 | - mMotionBlurImageView3.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y); | |
| 260 | - mMotionBlurImageView3.SetPosition(-mMotionBlurActorSize.x * 1.1f, 0.0f); | |
| 261 | - mMotionBlurImageView.Add( mMotionBlurImageView3 ); | |
| 262 | - | |
| 263 | - // set actor shader to the blur one | |
| 264 | - Toolkit::SetMotionBlurProperties( mMotionBlurImageView3, MOTION_BLUR_NUM_SAMPLES ); | |
| 265 | - mMotionBlurImageView3.SetProperty( Toolkit::ImageView::Property::IMAGE, mMotionBlurEffect ); | |
| 266 | - | |
| 267 | - | |
| 268 | - /////////////////////////////////////////////////////// | |
| 269 | - // | |
| 270 | - // Motion blurred actor 4 | |
| 271 | - // | |
| 272 | - | |
| 273 | - mMotionBlurImageView4 = ImageView::New(image); | |
| 274 | - mMotionBlurImageView4.SetParentOrigin( ParentOrigin::CENTER ); | |
| 275 | - mMotionBlurImageView4.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y); | |
| 276 | - mMotionBlurImageView4.SetPosition(0.0f, mMotionBlurActorSize.y * 1.1f); | |
| 277 | - mMotionBlurImageView.Add( mMotionBlurImageView4 ); | |
| 278 | - | |
| 279 | - // set actor shader to the blur one | |
| 280 | - Toolkit::SetMotionBlurProperties( mMotionBlurImageView4, MOTION_BLUR_NUM_SAMPLES ); | |
| 281 | - mMotionBlurImageView4.SetProperty( Toolkit::ImageView::Property::IMAGE, mMotionBlurEffect ); | |
| 282 | - | |
| 283 | - /////////////////////////////////////////////////////// | |
| 284 | - // | |
| 285 | - // Motion blurred actor 5 | |
| 286 | - // | |
| 287 | - | |
| 288 | - mMotionBlurImageView5 = ImageView::New(image); | |
| 289 | - mMotionBlurImageView5.SetParentOrigin( ParentOrigin::CENTER ); | |
| 290 | - mMotionBlurImageView5.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y); | |
| 291 | - mMotionBlurImageView5.SetPosition(0.0f, -mMotionBlurActorSize.y * 1.1f); | |
| 292 | - mMotionBlurImageView.Add( mMotionBlurImageView5 ); | |
| 293 | - | |
| 294 | - // set actor shader to the blur one | |
| 295 | - Toolkit::SetMotionBlurProperties( mMotionBlurImageView5, MOTION_BLUR_NUM_SAMPLES ); | |
| 296 | - mMotionBlurImageView5.SetProperty( Toolkit::ImageView::Property::IMAGE, mMotionBlurEffect ); | |
| 297 | -#endif //#ifdef MULTIPLE_MOTION_BLURRED_ACTORS | |
| 298 | 221 | } |
| 299 | 222 | |
| 300 | 223 | void Rotate( DeviceOrientation orientation ) |
| ... | ... | @@ -494,12 +417,6 @@ public: |
| 494 | 417 | } |
| 495 | 418 | SetImageFittedInBox( mMotionBlurImageView, mMotionBlurEffect, MOTION_BLUR_ACTOR_IMAGES[mCurrentImage], mMotionBlurActorSize.x, mMotionBlurActorSize.y ); |
| 496 | 419 | |
| 497 | -#ifdef MULTIPLE_MOTION_BLURRED_ACTORS | |
| 498 | - mMotionBlurImageView2.SetImage(blurImage); | |
| 499 | - mMotionBlurImageView3.SetImage(blurImage); | |
| 500 | - mMotionBlurImageView4.SetImage(blurImage); | |
| 501 | - mMotionBlurImageView5.SetImage(blurImage); | |
| 502 | -#endif | |
| 503 | 420 | } |
| 504 | 421 | |
| 505 | 422 | |
| ... | ... | @@ -517,13 +434,6 @@ private: |
| 517 | 434 | ImageView mMotionBlurImageView; |
| 518 | 435 | Size mMotionBlurActorSize; |
| 519 | 436 | |
| 520 | -#ifdef MULTIPLE_MOTION_BLURRED_ACTORS | |
| 521 | - ImageView mMotionBlurImageView2; | |
| 522 | - ImageView mMotionBlurImageView3; | |
| 523 | - ImageView mMotionBlurImageView4; | |
| 524 | - ImageView mMotionBlurImageView5; | |
| 525 | -#endif //#ifdef MULTIPLE_MOTION_BLURRED_ACTORS | |
| 526 | - | |
| 527 | 437 | // animate actor to position where user taps screen |
| 528 | 438 | Animation mActorTapMovementAnimation; |
| 529 | 439 | ... | ... |
examples/styling/image-channel-control-impl.cpp
| ... | ... | @@ -37,12 +37,13 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( |
| 37 | 37 | varying mediump vec2 vTexCoord;\n |
| 38 | 38 | uniform sampler2D sTexture;\n |
| 39 | 39 | uniform mediump vec4 uColor;\n |
| 40 | - uniform mediump vec4 mixColor;\n | |
| 40 | + uniform mediump vec3 mixColor;\n | |
| 41 | + uniform mediump float opacity;\n | |
| 41 | 42 | uniform mediump vec3 uChannels;\n |
| 42 | 43 | \n |
| 43 | 44 | void main()\n |
| 44 | 45 | {\n |
| 45 | - gl_FragColor = texture2D( sTexture, vTexCoord ) * mixColor * uColor * vec4(uChannels, 1.0) ;\n | |
| 46 | + gl_FragColor = texture2D( sTexture, vTexCoord ) * vec4(mixColor,opacity) * uColor * vec4(uChannels, 1.0) ;\n | |
| 46 | 47 | }\n |
| 47 | 48 | ); |
| 48 | 49 | ... | ... |
examples/styling/styling-application.cpp
| ... | ... | @@ -178,7 +178,7 @@ void StylingApplication::Create( Application& application ) |
| 178 | 178 | for( int i=0; i<3; ++i ) |
| 179 | 179 | { |
| 180 | 180 | std::ostringstream thumbnailName; thumbnailName << "thumbnail" << i+1; |
| 181 | - ImageView image = ImageView::New( ResourceImage::New( images[i] ) ); | |
| 181 | + ImageView image = ImageView::New( images[i] ); | |
| 182 | 182 | image.SetName( thumbnailName.str() ); |
| 183 | 183 | image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); |
| 184 | 184 | ... | ... |
examples/text-label/text-label-example.cpp
| ... | ... | @@ -80,17 +80,17 @@ struct HSVColorConstraint |
| 80 | 80 | { |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - void operator()(Vector4& current, const PropertyInputContainer& inputs ) | |
| 83 | + void operator()(Vector3& current, const PropertyInputContainer& inputs ) | |
| 84 | 84 | { |
| 85 | - current = hsv2rgb(Vector4(inputs[0]->GetFloat(), saturation, value, current.a)); | |
| 85 | + current = hsv2rgb(Vector3(inputs[0]->GetFloat(), saturation, value)); | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - Vector4 hsv2rgb(Vector4 colorHSV) | |
| 88 | + Vector3 hsv2rgb(Vector3 colorHSV) | |
| 89 | 89 | { |
| 90 | 90 | float r=colorHSV.z*(1+colorHSV.y*(cos(colorHSV.x)-1)); |
| 91 | 91 | float g=colorHSV.z*(1+colorHSV.y*(cos(colorHSV.x-2.09439)-1)); |
| 92 | 92 | float b=colorHSV.z*(1+colorHSV.y*(cos(colorHSV.x+2.09439)-1)); |
| 93 | - return Vector4(r, g, b, colorHSV.a); | |
| 93 | + return Vector3(r, g, b); | |
| 94 | 94 | } |
| 95 | 95 | float hue; |
| 96 | 96 | float saturation; |
| ... | ... | @@ -173,7 +173,7 @@ public: |
| 173 | 173 | Renderer bgRenderer = mLabel.GetRendererAt(0); |
| 174 | 174 | mOverrideMixColorIndex = DevelHandle::GetPropertyIndex( bgRenderer, ColorVisual::Property::MIX_COLOR ); |
| 175 | 175 | |
| 176 | - Constraint constraint = Constraint::New<Vector4>( bgRenderer, mOverrideMixColorIndex, HSVColorConstraint(0.0f, 0.5f, 0.8f)); | |
| 176 | + Constraint constraint = Constraint::New<Vector3>( bgRenderer, mOverrideMixColorIndex, HSVColorConstraint(0.0f, 0.5f, 0.8f)); | |
| 177 | 177 | constraint.AddSource( Source( mLabel, mHueAngleIndex ) ); |
| 178 | 178 | constraint.SetRemoveAction( Constraint::Discard ); |
| 179 | 179 | constraint.Apply(); | ... | ... |
examples/transitions/transition-application.cpp
| ... | ... | @@ -24,6 +24,7 @@ |
| 24 | 24 | |
| 25 | 25 | // External includes |
| 26 | 26 | #include <dali-toolkit/dali-toolkit.h> |
| 27 | +#include <dali-toolkit/devel-api/controls/control-devel.h> | |
| 27 | 28 | #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h> |
| 28 | 29 | #include <dali-toolkit/devel-api/visuals/text-visual-properties.h> |
| 29 | 30 | #include "shadow-button.h" |
| ... | ... | @@ -110,6 +111,9 @@ void TransitionApplication::Create( Application& application ) |
| 110 | 111 | mShadowButton.SetAnchorPoint( AnchorPoint::CENTER ); |
| 111 | 112 | mShadowButton.SetParentOrigin( ParentOrigin::CENTER ); |
| 112 | 113 | mShadowButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 114 | + mShadowButton.SetProperty( DevelControl::Property::STATE, DevelControl::DISABLED ); | |
| 115 | + mShadowButton.SetProperty( DevelControl::Property::SUB_STATE, "UNCHECKED" ); | |
| 116 | + | |
| 113 | 117 | buttonLayout.AddChild( mShadowButton, TableView::CellPosition(1, 1) ); |
| 114 | 118 | |
| 115 | 119 | TableView actionButtonLayout = TableView::New( 1, NUMBER_OF_ACTION_BUTTONS+1 ); |
| ... | ... | @@ -135,7 +139,7 @@ void TransitionApplication::Create( Application& application ) |
| 135 | 139 | mActionButtons[i].ClickedSignal().Connect( this, &TransitionApplication::OnActionButtonClicked ); |
| 136 | 140 | actionButtonLayout.AddChild( mActionButtons[i], TableView::CellPosition( 0, 1+i ) ); |
| 137 | 141 | } |
| 138 | - SetLabelText( mActionButtons[0], "Activate" ); | |
| 142 | + SetLabelText( mActionButtons[0], "Enable" ); | |
| 139 | 143 | SetLabelText( mActionButtons[1], "Check" ); |
| 140 | 144 | mActionButtons[1].SetProperty( Button::Property::DISABLED, true ); |
| 141 | 145 | |
| ... | ... | @@ -154,11 +158,13 @@ bool TransitionApplication::OnActionButtonClicked( Button button ) |
| 154 | 158 | mShadowButton.SetActiveState( ! activeState ); |
| 155 | 159 | if( activeState ) |
| 156 | 160 | { |
| 157 | - SetLabelText( button, "Activate" ); | |
| 161 | + SetLabelText( button, "Enable" ); | |
| 162 | + mShadowButton.SetProperty( DevelControl::Property::STATE, DevelControl::DISABLED ); | |
| 158 | 163 | } |
| 159 | 164 | else |
| 160 | 165 | { |
| 161 | - SetLabelText( button, "Deactivate" ); | |
| 166 | + SetLabelText( button, "Disable" ); | |
| 167 | + mShadowButton.SetProperty( DevelControl::Property::STATE, DevelControl::NORMAL ); | |
| 162 | 168 | } |
| 163 | 169 | mActionButtons[1].SetProperty( Button::Property::DISABLED, activeState ); |
| 164 | 170 | break; |
| ... | ... | @@ -170,10 +176,12 @@ bool TransitionApplication::OnActionButtonClicked( Button button ) |
| 170 | 176 | if( checkState ) |
| 171 | 177 | { |
| 172 | 178 | SetLabelText( button, "Check" ); |
| 179 | + mShadowButton.SetProperty( DevelControl::Property::SUB_STATE, "UNCHECKED" ); | |
| 173 | 180 | } |
| 174 | 181 | else |
| 175 | 182 | { |
| 176 | 183 | SetLabelText( button, "Uncheck" ); |
| 184 | + mShadowButton.SetProperty( DevelControl::Property::SUB_STATE, "CHECKED" ); | |
| 177 | 185 | } |
| 178 | 186 | break; |
| 179 | 187 | } | ... | ... |
examples/visual-transitions/beat-control-impl.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 | +#include "beat-control-impl.h" | |
| 18 | +#include <dali-toolkit/dali-toolkit.h> | |
| 19 | +#include <dali/public-api/object/type-registry-helper.h> | |
| 20 | +#include <dali-toolkit/devel-api/align-enums.h> | |
| 21 | +#include <dali-toolkit/devel-api/visual-factory/visual-factory.h> | |
| 22 | +#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h> | |
| 23 | + | |
| 24 | +#include <cstdio> | |
| 25 | + | |
| 26 | +using namespace Dali; // Needed for macros | |
| 27 | +using namespace Dali::Toolkit; | |
| 28 | + | |
| 29 | +namespace Demo | |
| 30 | +{ | |
| 31 | +namespace Internal | |
| 32 | +{ | |
| 33 | + | |
| 34 | +namespace | |
| 35 | +{ | |
| 36 | + | |
| 37 | +const int BOUNCE_ANIMATION_RUNNING(0x0001); | |
| 38 | +const int FADE_ANIMATION_RUNNING (0x0002); | |
| 39 | +const int X_ANIMATION_RUNNING (0x0004); | |
| 40 | +const int Y_ANIMATION_RUNNING (0x0008); | |
| 41 | + | |
| 42 | + | |
| 43 | +Dali::BaseHandle Create() | |
| 44 | +{ | |
| 45 | + return Demo::BeatControl::New(); | |
| 46 | +} | |
| 47 | + | |
| 48 | +DALI_TYPE_REGISTRATION_BEGIN( BeatControl, Dali::Toolkit::Control, Create ); | |
| 49 | + | |
| 50 | +DALI_PROPERTY_REGISTRATION( Demo, BeatControl, "bounceTransition", STRING, BOUNCE_TRANSITION ); | |
| 51 | +DALI_PROPERTY_REGISTRATION( Demo, BeatControl, "leftTransition", STRING, LEFT_TRANSITION ); | |
| 52 | +DALI_PROPERTY_REGISTRATION( Demo, BeatControl, "upTransition", STRING, UP_TRANSITION ); | |
| 53 | +DALI_PROPERTY_REGISTRATION( Demo, BeatControl, "fadeTransition", STRING, FADE_TRANSITION ); | |
| 54 | +DALI_PROPERTY_REGISTRATION( Demo, BeatControl, "beatVisual", MAP, BEAT_VISUAL ); | |
| 55 | +DALI_TYPE_REGISTRATION_END(); | |
| 56 | + | |
| 57 | + | |
| 58 | +Toolkit::TransitionData ConvertPropertyToTransition( const Property::Value& value ) | |
| 59 | +{ | |
| 60 | + Toolkit::TransitionData transitionData; | |
| 61 | + | |
| 62 | + if( value.GetType() == Property::ARRAY ) | |
| 63 | + { | |
| 64 | + transitionData = Toolkit::TransitionData::New( *value.GetArray()); | |
| 65 | + } | |
| 66 | + else if( value.GetType() == Property::MAP ) | |
| 67 | + { | |
| 68 | + transitionData = Toolkit::TransitionData::New( *value.GetMap() ); | |
| 69 | + } | |
| 70 | + return transitionData; | |
| 71 | +} | |
| 72 | + | |
| 73 | +} // anonymous namespace | |
| 74 | + | |
| 75 | + | |
| 76 | +Internal::BeatControl::BeatControl() | |
| 77 | +: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ), | |
| 78 | + mTransformSize(1.0f, 1.0f), | |
| 79 | + mAnimationPlaying(0) | |
| 80 | +{ | |
| 81 | +} | |
| 82 | + | |
| 83 | +Internal::BeatControl::~BeatControl() | |
| 84 | +{ | |
| 85 | +} | |
| 86 | + | |
| 87 | +Demo::BeatControl Internal::BeatControl::New() | |
| 88 | +{ | |
| 89 | + IntrusivePtr<Internal::BeatControl> impl = new Internal::BeatControl(); | |
| 90 | + Demo::BeatControl handle = Demo::BeatControl( *impl ); | |
| 91 | + impl->Initialize(); | |
| 92 | + return handle; | |
| 93 | +} | |
| 94 | + | |
| 95 | + | |
| 96 | +void BeatControl::StartBounceAnimation() | |
| 97 | +{ | |
| 98 | + if( mAnimation ) | |
| 99 | + { | |
| 100 | + mAnimation.Stop(); | |
| 101 | + mAnimation.FinishedSignal().Disconnect( this, &BeatControl::OnBounceAnimationFinished ); | |
| 102 | + OnBounceAnimationFinished(mAnimation); | |
| 103 | + } | |
| 104 | + | |
| 105 | + mAnimation = CreateTransition( mBounceTransition ); | |
| 106 | + mAnimation.FinishedSignal().Connect( this, &BeatControl::OnBounceAnimationFinished ); | |
| 107 | + mAnimation.Play(); | |
| 108 | + mAnimationPlaying |= BOUNCE_ANIMATION_RUNNING; | |
| 109 | +} | |
| 110 | + | |
| 111 | + | |
| 112 | +void BeatControl::StartXAnimation() | |
| 113 | +{ | |
| 114 | + if( mXAnimation ) | |
| 115 | + { | |
| 116 | + mXAnimation.Stop(); | |
| 117 | + mXAnimation.FinishedSignal().Disconnect( this, &BeatControl::OnXAnimationFinished ); | |
| 118 | + OnXAnimationFinished(mXAnimation); | |
| 119 | + } | |
| 120 | + | |
| 121 | + mXAnimation = CreateTransition( mLeftTransition ); | |
| 122 | + mXAnimation.FinishedSignal().Connect( this, &BeatControl::OnXAnimationFinished ); | |
| 123 | + mXAnimation.Play(); | |
| 124 | + mAnimationPlaying |= X_ANIMATION_RUNNING; | |
| 125 | +} | |
| 126 | + | |
| 127 | +void BeatControl::StartYAnimation() | |
| 128 | +{ | |
| 129 | + if( mYAnimation ) | |
| 130 | + { | |
| 131 | + mYAnimation.Stop(); | |
| 132 | + mYAnimation.FinishedSignal().Disconnect( this, &BeatControl::OnYAnimationFinished ); | |
| 133 | + OnYAnimationFinished(mYAnimation); | |
| 134 | + } | |
| 135 | + | |
| 136 | + mYAnimation = CreateTransition( mUpTransition ); | |
| 137 | + mYAnimation.FinishedSignal().Connect( this, &BeatControl::OnYAnimationFinished ); | |
| 138 | + mYAnimation.Play(); | |
| 139 | + mAnimationPlaying |= Y_ANIMATION_RUNNING; | |
| 140 | +} | |
| 141 | + | |
| 142 | +void BeatControl::StartFadeAnimation() | |
| 143 | +{ | |
| 144 | + if( mFadeAnimation ) | |
| 145 | + { | |
| 146 | + mFadeAnimation.Stop(); | |
| 147 | + mFadeAnimation.FinishedSignal().Disconnect( this, &BeatControl::OnFadeAnimationFinished ); | |
| 148 | + OnFadeAnimationFinished(mFadeAnimation); | |
| 149 | + } | |
| 150 | + | |
| 151 | + mFadeAnimation = CreateTransition( mFadeTransition ); | |
| 152 | + mFadeAnimation.FinishedSignal().Connect( this, &BeatControl::OnFadeAnimationFinished ); | |
| 153 | + mFadeAnimation.Play(); | |
| 154 | + mAnimationPlaying |= FADE_ANIMATION_RUNNING; | |
| 155 | +} | |
| 156 | + | |
| 157 | +void BeatControl::OnBounceAnimationFinished( Animation& src ) | |
| 158 | +{ | |
| 159 | + mAnimationPlaying &= ~BOUNCE_ANIMATION_RUNNING; | |
| 160 | +} | |
| 161 | +void BeatControl::OnXAnimationFinished( Animation& src ) | |
| 162 | +{ | |
| 163 | + mAnimationPlaying &= ~X_ANIMATION_RUNNING; | |
| 164 | +} | |
| 165 | +void BeatControl::OnYAnimationFinished( Animation& src ) | |
| 166 | +{ | |
| 167 | + mAnimationPlaying &= ~Y_ANIMATION_RUNNING; | |
| 168 | +} | |
| 169 | +void BeatControl::OnFadeAnimationFinished( Animation& src ) | |
| 170 | +{ | |
| 171 | + mAnimationPlaying &= ~FADE_ANIMATION_RUNNING; | |
| 172 | +} | |
| 173 | + | |
| 174 | +void BeatControl::OnInitialize() | |
| 175 | +{ | |
| 176 | + Actor self = Self(); | |
| 177 | +} | |
| 178 | + | |
| 179 | +void BeatControl::OnStageConnection( int depth ) | |
| 180 | +{ | |
| 181 | + Control::OnStageConnection( depth ); | |
| 182 | +} | |
| 183 | + | |
| 184 | +void BeatControl::OnStageDisconnection() | |
| 185 | +{ | |
| 186 | + Control::OnStageDisconnection(); | |
| 187 | +} | |
| 188 | + | |
| 189 | +void BeatControl::OnSizeSet( const Vector3& targetSize ) | |
| 190 | +{ | |
| 191 | + Control::OnSizeSet( targetSize ); | |
| 192 | + RelayoutVisuals( Vector2( targetSize ) ); | |
| 193 | +} | |
| 194 | + | |
| 195 | +void BeatControl::OnRelayout( const Vector2& targetSize, RelayoutContainer& container ) | |
| 196 | +{ | |
| 197 | + RelayoutVisuals( targetSize ); | |
| 198 | +} | |
| 199 | + | |
| 200 | +void BeatControl::RelayoutVisuals( const Vector2& targetSize ) | |
| 201 | +{ | |
| 202 | + if( mVisual ) | |
| 203 | + { | |
| 204 | + if( (mAnimationPlaying & (X_ANIMATION_RUNNING | Y_ANIMATION_RUNNING)) == 0) | |
| 205 | + { | |
| 206 | + Vector2 size( targetSize ); | |
| 207 | + Property::Map transformMap; | |
| 208 | + // Make the visual half the size of the control, but leave | |
| 209 | + // origin and anchor point at center, position is relative, but Zer0 | |
| 210 | + transformMap[ DevelVisual::Transform::Property::SIZE ] = mTransformSize; | |
| 211 | + mVisual.SetTransformAndSize( transformMap, size ); | |
| 212 | + } | |
| 213 | + } | |
| 214 | +} | |
| 215 | + | |
| 216 | +Vector3 BeatControl::GetNaturalSize() | |
| 217 | +{ | |
| 218 | + if( mVisual ) | |
| 219 | + { | |
| 220 | + Vector2 naturalSize; | |
| 221 | + mVisual.GetNaturalSize(naturalSize); | |
| 222 | + return Vector3(naturalSize); | |
| 223 | + } | |
| 224 | + return Vector3::ZERO; | |
| 225 | +} | |
| 226 | + | |
| 227 | +void BeatControl::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change ) | |
| 228 | +{ | |
| 229 | + // Chain up. | |
| 230 | + Control::OnStyleChange( styleManager, change ); | |
| 231 | +} | |
| 232 | + | |
| 233 | + | |
| 234 | +/////////////////////////////////////////////////////////// | |
| 235 | +// | |
| 236 | +// Properties | |
| 237 | +// | |
| 238 | + | |
| 239 | +void BeatControl::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value ) | |
| 240 | +{ | |
| 241 | + Demo::BeatControl beatControl = Demo::BeatControl::DownCast( Dali::BaseHandle( object ) ); | |
| 242 | + | |
| 243 | + if( beatControl ) | |
| 244 | + { | |
| 245 | + BeatControl& impl = GetImpl( beatControl ); | |
| 246 | + Actor self = impl.Self(); | |
| 247 | + switch ( index ) | |
| 248 | + { | |
| 249 | + case Demo::BeatControl::Property::BEAT_VISUAL: | |
| 250 | + { | |
| 251 | + bool sizeOnly = false; | |
| 252 | + | |
| 253 | + // Determine if a transform.size property exists in the map, and | |
| 254 | + // save it. | |
| 255 | + Property::Map* map = value.GetMap(); | |
| 256 | + if( map ) | |
| 257 | + { | |
| 258 | + Property::Value* value = map->Find( DevelVisual::Property::TRANSFORM, "transform" ); | |
| 259 | + if( value ) | |
| 260 | + { | |
| 261 | + Property::Map* transformMap = value->GetMap(); | |
| 262 | + if( transformMap ) | |
| 263 | + { | |
| 264 | + Property::Value* sizeValue = transformMap->Find( DevelVisual::Transform::Property::SIZE, "size" ); | |
| 265 | + if( sizeValue ) | |
| 266 | + { | |
| 267 | + sizeValue->Get( impl.mTransformSize ); | |
| 268 | + if( map->Count() == 1 && transformMap->Count() == 1 ) | |
| 269 | + { | |
| 270 | + sizeOnly = true; | |
| 271 | + } | |
| 272 | + } | |
| 273 | + } | |
| 274 | + } | |
| 275 | + if( ! sizeOnly ) | |
| 276 | + { | |
| 277 | + // Only register a visual if there is more than just a size setting | |
| 278 | + impl.mVisual = Toolkit::VisualFactory::Get().CreateVisual( *map ); | |
| 279 | + impl.RegisterVisual( Demo::BeatControl::Property::BEAT_VISUAL, impl.mVisual ); | |
| 280 | + | |
| 281 | + // We have registered a new visual: must trigger size negotiation | |
| 282 | + // in order to call SetTransformAndSize on the visual with the right size: | |
| 283 | + impl.RelayoutRequest(); | |
| 284 | + } | |
| 285 | + } | |
| 286 | + break; | |
| 287 | + } | |
| 288 | + case Demo::BeatControl::Property::BOUNCE_TRANSITION: | |
| 289 | + { | |
| 290 | + impl.mBounceTransition = ConvertPropertyToTransition( value ); | |
| 291 | + break; | |
| 292 | + } | |
| 293 | + case Demo::BeatControl::Property::LEFT_TRANSITION: | |
| 294 | + { | |
| 295 | + impl.mLeftTransition = ConvertPropertyToTransition( value ); | |
| 296 | + break; | |
| 297 | + } | |
| 298 | + case Demo::BeatControl::Property::UP_TRANSITION: | |
| 299 | + { | |
| 300 | + impl.mUpTransition = ConvertPropertyToTransition( value ); | |
| 301 | + break; | |
| 302 | + } | |
| 303 | + case Demo::BeatControl::Property::FADE_TRANSITION: | |
| 304 | + { | |
| 305 | + impl.mFadeTransition = ConvertPropertyToTransition( value ); | |
| 306 | + break; | |
| 307 | + } | |
| 308 | + } | |
| 309 | + } | |
| 310 | +} | |
| 311 | + | |
| 312 | +Property::Value BeatControl::GetProperty( BaseObject* object, Property::Index propertyIndex ) | |
| 313 | +{ | |
| 314 | + Property::Value value; | |
| 315 | + | |
| 316 | + Demo::BeatControl beatControl = Demo::BeatControl::DownCast( Dali::BaseHandle( object ) ); | |
| 317 | + | |
| 318 | + if ( beatControl ) | |
| 319 | + { | |
| 320 | + BeatControl& impl = GetImpl( beatControl ); | |
| 321 | + switch ( propertyIndex ) | |
| 322 | + { | |
| 323 | + case Demo::BeatControl::Property::BEAT_VISUAL: | |
| 324 | + { | |
| 325 | + if( impl.mVisual ) | |
| 326 | + { | |
| 327 | + Property::Map map; | |
| 328 | + impl.mVisual.CreatePropertyMap(map); | |
| 329 | + value = map; | |
| 330 | + } | |
| 331 | + break; | |
| 332 | + } | |
| 333 | + case Demo::BeatControl::Property::BOUNCE_TRANSITION: | |
| 334 | + case Demo::BeatControl::Property::LEFT_TRANSITION: | |
| 335 | + case Demo::BeatControl::Property::UP_TRANSITION: | |
| 336 | + case Demo::BeatControl::Property::FADE_TRANSITION: | |
| 337 | + default: | |
| 338 | + break; | |
| 339 | + } | |
| 340 | + } | |
| 341 | + | |
| 342 | + return value; | |
| 343 | +} | |
| 344 | + | |
| 345 | + | |
| 346 | +} // Internal | |
| 347 | +} // Demo | ... | ... |
examples/visual-transitions/beat-control-impl.h
0 โ 100644
| 1 | +#ifndef DALI_DEMO_INTERNAL_BEAT_CONTROL_IMPL_H | |
| 2 | +#define DALI_DEMO_INTERNAL_BEAT_CONTROL_IMPL_H | |
| 3 | + | |
| 4 | +/* | |
| 5 | + * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 6 | + * | |
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 8 | + * you may not use this file except in compliance with the License. | |
| 9 | + * You may obtain a copy of the License at | |
| 10 | + * | |
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 12 | + * | |
| 13 | + * Unless required by applicable law or agreed to in writing, software | |
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 16 | + * See the License for the specific language governing permissions and | |
| 17 | + * limitations under the License. | |
| 18 | + */ | |
| 19 | + | |
| 20 | +#include "beat-control.h" | |
| 21 | +#include <dali/public-api/animation/animation.h> | |
| 22 | +#include <dali-toolkit/public-api/controls/control-impl.h> | |
| 23 | +#include <dali-toolkit/devel-api/visual-factory/visual-base.h> | |
| 24 | +#include <dali-toolkit/devel-api/visual-factory/transition-data.h> | |
| 25 | + | |
| 26 | +namespace Demo | |
| 27 | +{ | |
| 28 | + | |
| 29 | +namespace Internal // To use TypeRegistry, handle and body classes need the same name | |
| 30 | +{ | |
| 31 | + | |
| 32 | +class BeatControl : public Dali::Toolkit::Internal::Control | |
| 33 | +{ | |
| 34 | +public: | |
| 35 | + /** | |
| 36 | + * Instantiate a new BeatControl object | |
| 37 | + */ | |
| 38 | + static Demo::BeatControl New(); | |
| 39 | + BeatControl(); | |
| 40 | + ~BeatControl(); | |
| 41 | + | |
| 42 | +public: // API | |
| 43 | + void StartBounceAnimation(); | |
| 44 | + | |
| 45 | + void StartXAnimation(); | |
| 46 | + | |
| 47 | + void StartYAnimation(); | |
| 48 | + | |
| 49 | + void StartFadeAnimation(); | |
| 50 | + | |
| 51 | +public: // Properties | |
| 52 | + /** | |
| 53 | + * Called when a property of an object of this type is set. | |
| 54 | + * @param[in] object The object whose property is set. | |
| 55 | + * @param[in] index The property index. | |
| 56 | + * @param[in] value The new property value. | |
| 57 | + */ | |
| 58 | + static void SetProperty( Dali::BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value ); | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * Called to retrieve a property of an object of this type. | |
| 62 | + * @param[in] object The object whose property is to be retrieved. | |
| 63 | + * @param[in] index The property index. | |
| 64 | + * @return The current value of the property. | |
| 65 | + */ | |
| 66 | + static Dali::Property::Value GetProperty( Dali::BaseObject* object, Dali::Property::Index propertyIndex ); | |
| 67 | + | |
| 68 | +private: // From Control | |
| 69 | + /** | |
| 70 | + * @copydoc Toolkit::Control::OnInitialize() | |
| 71 | + */ | |
| 72 | + virtual void OnInitialize(); | |
| 73 | + | |
| 74 | + /** | |
| 75 | + * @copydoc Toolkit::Control::OnStageConnect() | |
| 76 | + */ | |
| 77 | + virtual void OnStageConnection( int depth ); | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * @copydoc Toolkit::Control::OnStageDisconnection() | |
| 81 | + */ | |
| 82 | + virtual void OnStageDisconnection(); | |
| 83 | + | |
| 84 | + /** | |
| 85 | + * @copydoc Toolkit::Control::OnSizeSet() | |
| 86 | + */ | |
| 87 | + virtual void OnSizeSet( const Dali::Vector3& targetSize ); | |
| 88 | + | |
| 89 | + /** | |
| 90 | + * @copydoc Toolkit::Control::OnRelayout() | |
| 91 | + */ | |
| 92 | + virtual void OnRelayout( const Dali::Vector2& targetSize, Dali::RelayoutContainer& container ); | |
| 93 | + /** | |
| 94 | + * @copydoc Toolkit::Control::GetNaturalSize | |
| 95 | + */ | |
| 96 | + virtual Dali::Vector3 GetNaturalSize(); | |
| 97 | + | |
| 98 | + /** | |
| 99 | + * @copydoc Toolkit::Control::OnStyleChange | |
| 100 | + */ | |
| 101 | + virtual void OnStyleChange( Dali::Toolkit::StyleManager styleManager, Dali::StyleChange::Type change ); | |
| 102 | + | |
| 103 | +private: | |
| 104 | + void OnBounceAnimationFinished( Dali::Animation& handle ); | |
| 105 | + void OnXAnimationFinished( Dali::Animation& src ); | |
| 106 | + void OnYAnimationFinished( Dali::Animation& src ); | |
| 107 | + void OnFadeAnimationFinished( Dali::Animation& src ); | |
| 108 | + | |
| 109 | + /** | |
| 110 | + * Relayout the visuals as a result of size negotiation | |
| 111 | + */ | |
| 112 | + void RelayoutVisuals( const Dali::Vector2& targetSize ); | |
| 113 | + | |
| 114 | +private: | |
| 115 | + //undefined | |
| 116 | + BeatControl( const BeatControl& ); | |
| 117 | + BeatControl& operator=( const BeatControl& ); | |
| 118 | + | |
| 119 | +private: | |
| 120 | + // Implementation details | |
| 121 | + Dali::Toolkit::Visual::Base mVisual; | |
| 122 | + Dali::Toolkit::TransitionData mBounceTransition; | |
| 123 | + Dali::Toolkit::TransitionData mLeftTransition; | |
| 124 | + Dali::Toolkit::TransitionData mUpTransition; | |
| 125 | + Dali::Toolkit::TransitionData mFadeTransition; | |
| 126 | + Dali::Animation mAnimation; | |
| 127 | + Dali::Animation mXAnimation; | |
| 128 | + Dali::Animation mYAnimation; | |
| 129 | + Dali::Animation mFadeAnimation; | |
| 130 | + Dali::Vector2 mTransformSize; | |
| 131 | + int mAnimationPlaying; | |
| 132 | +}; | |
| 133 | + | |
| 134 | +} // Internal | |
| 135 | + | |
| 136 | +inline Internal::BeatControl& GetImpl( Demo::BeatControl& handle ) | |
| 137 | +{ | |
| 138 | + DALI_ASSERT_ALWAYS( handle ); | |
| 139 | + Dali::RefObject& object = handle.GetImplementation(); | |
| 140 | + return static_cast<Internal::BeatControl&>(object); | |
| 141 | +} | |
| 142 | + | |
| 143 | +inline const Internal::BeatControl& GetImpl( const Demo::BeatControl& handle ) | |
| 144 | +{ | |
| 145 | + DALI_ASSERT_ALWAYS( handle ); | |
| 146 | + const Dali::RefObject& object = handle.GetImplementation(); | |
| 147 | + return static_cast<const Internal::BeatControl&>(object); | |
| 148 | +} | |
| 149 | + | |
| 150 | +} // Demo | |
| 151 | + | |
| 152 | +#endif // DALI_DEMO_BEAT_CONTROL_IMPL_H | ... | ... |
examples/visual-transitions/beat-control.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 | +#include "beat-control.h" | |
| 18 | +#include "beat-control-impl.h" | |
| 19 | + | |
| 20 | +namespace Demo | |
| 21 | +{ | |
| 22 | + | |
| 23 | +BeatControl::BeatControl() | |
| 24 | +{ | |
| 25 | +} | |
| 26 | + | |
| 27 | +BeatControl::BeatControl( const BeatControl& beatControl ) | |
| 28 | +: Control( beatControl ) | |
| 29 | +{ | |
| 30 | +} | |
| 31 | + | |
| 32 | +BeatControl& BeatControl::operator= ( const BeatControl& rhs ) | |
| 33 | +{ | |
| 34 | + if( &rhs != this ) | |
| 35 | + { | |
| 36 | + Control::operator=( rhs ); | |
| 37 | + } | |
| 38 | + return *this; | |
| 39 | +} | |
| 40 | + | |
| 41 | +BeatControl::~BeatControl() | |
| 42 | +{ | |
| 43 | +} | |
| 44 | + | |
| 45 | +BeatControl BeatControl::New() | |
| 46 | +{ | |
| 47 | + BeatControl beatControl = Internal::BeatControl::New(); | |
| 48 | + return beatControl; | |
| 49 | +} | |
| 50 | + | |
| 51 | +BeatControl BeatControl::New( const std::string& url ) | |
| 52 | +{ | |
| 53 | + BeatControl beatControl = Internal::BeatControl::New(); | |
| 54 | + return beatControl; | |
| 55 | +} | |
| 56 | + | |
| 57 | +BeatControl BeatControl::DownCast( BaseHandle handle ) | |
| 58 | +{ | |
| 59 | + return Control::DownCast< BeatControl, Internal::BeatControl > ( handle ); | |
| 60 | +} | |
| 61 | + | |
| 62 | +void BeatControl::StartBounceAnimation() | |
| 63 | +{ | |
| 64 | + GetImpl(*this).StartBounceAnimation(); | |
| 65 | +} | |
| 66 | + | |
| 67 | +void BeatControl::StartXAnimation() | |
| 68 | +{ | |
| 69 | + GetImpl(*this).StartXAnimation(); | |
| 70 | +} | |
| 71 | +void BeatControl::StartYAnimation() | |
| 72 | +{ | |
| 73 | + GetImpl(*this).StartYAnimation(); | |
| 74 | +} | |
| 75 | +void BeatControl::StartFadeAnimation() | |
| 76 | +{ | |
| 77 | + GetImpl(*this).StartFadeAnimation(); | |
| 78 | +} | |
| 79 | + | |
| 80 | +BeatControl::BeatControl( Internal::BeatControl& implementation ) | |
| 81 | +: Control( implementation ) | |
| 82 | +{ | |
| 83 | +} | |
| 84 | + | |
| 85 | +BeatControl::BeatControl( Dali::Internal::CustomActor* internal ) | |
| 86 | +: Control( internal ) | |
| 87 | +{ | |
| 88 | + VerifyCustomActorPointer< Internal::BeatControl >( internal ) ; | |
| 89 | +} | |
| 90 | + | |
| 91 | + | |
| 92 | +} //namespace Demo | ... | ... |
examples/visual-transitions/beat-control.h
0 โ 100644
| 1 | +#ifndef DALI_DEMO_BEAT_CONTROL_H | |
| 2 | +#define DALI_DEMO_BEAT_CONTROL_H | |
| 3 | + | |
| 4 | +/* | |
| 5 | + * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 6 | + * | |
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 8 | + * you may not use this file except in compliance with the License. | |
| 9 | + * You may obtain a copy of the License at | |
| 10 | + * | |
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 12 | + * | |
| 13 | + * Unless required by applicable law or agreed to in writing, software | |
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 16 | + * See the License for the specific language governing permissions and | |
| 17 | + * limitations under the License. | |
| 18 | + */ | |
| 19 | + | |
| 20 | +#include <dali-toolkit/dali-toolkit.h> | |
| 21 | +#include <string> | |
| 22 | + | |
| 23 | +namespace Demo | |
| 24 | +{ | |
| 25 | + | |
| 26 | +namespace Internal | |
| 27 | +{ | |
| 28 | +// All type registered types need to have the same name for the body and the handle | |
| 29 | +class BeatControl; | |
| 30 | +} | |
| 31 | + | |
| 32 | +/** | |
| 33 | + * Control that allows the RGB channels of an image to be altered. | |
| 34 | + */ | |
| 35 | +class BeatControl : public Dali::Toolkit::Control | |
| 36 | +{ | |
| 37 | +public: | |
| 38 | + /** | |
| 39 | + * The start and end property ranges for this control | |
| 40 | + */ | |
| 41 | + enum PropertyRange | |
| 42 | + { | |
| 43 | + PROPERTY_START_INDEX = Dali::Toolkit::Control::CONTROL_PROPERTY_END_INDEX + 1, | |
| 44 | + PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000, | |
| 45 | + ANIMATABLE_PROPERTY_START_INDEX = Dali::ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX, | |
| 46 | + ANIMATABLE_PROPERTY_END_INDEX = ANIMATABLE_PROPERTY_START_INDEX+1000 | |
| 47 | + }; | |
| 48 | + | |
| 49 | + struct Property | |
| 50 | + { | |
| 51 | + enum | |
| 52 | + { | |
| 53 | + BOUNCE_TRANSITION = PROPERTY_START_INDEX, | |
| 54 | + LEFT_TRANSITION, | |
| 55 | + UP_TRANSITION, | |
| 56 | + FADE_TRANSITION, | |
| 57 | + BEAT_VISUAL | |
| 58 | + }; | |
| 59 | + }; | |
| 60 | + | |
| 61 | +public: // Construction / destruction | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * Create an uninitialized handle | |
| 65 | + */ | |
| 66 | + BeatControl(); | |
| 67 | + | |
| 68 | + /** | |
| 69 | + * Create a new image channel control without an image. Use | |
| 70 | + * SetImage to give this control an image | |
| 71 | + */ | |
| 72 | + static BeatControl New(); | |
| 73 | + | |
| 74 | + /** | |
| 75 | + * Create a new image channel control from a given URL | |
| 76 | + */ | |
| 77 | + static BeatControl New( const std::string& url ); | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * Destructor. This is non-virtual since derived Handle types must not | |
| 81 | + * contain data or virtual methods | |
| 82 | + */ | |
| 83 | + ~BeatControl(); | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * Copy Constructor | |
| 87 | + */ | |
| 88 | + BeatControl( const BeatControl& beatControl ); | |
| 89 | + | |
| 90 | + /** | |
| 91 | + * Assignment Operator | |
| 92 | + */ | |
| 93 | + BeatControl& operator=( const BeatControl& beatControl ); | |
| 94 | + | |
| 95 | + /** | |
| 96 | + * Downcast | |
| 97 | + */ | |
| 98 | + static BeatControl DownCast( BaseHandle handle ); | |
| 99 | + | |
| 100 | +public: // API | |
| 101 | + | |
| 102 | + void StartBounceAnimation(); | |
| 103 | + | |
| 104 | + void StartXAnimation(); | |
| 105 | + | |
| 106 | + void StartYAnimation(); | |
| 107 | + | |
| 108 | + void StartFadeAnimation(); | |
| 109 | + | |
| 110 | +public: // Not for public use | |
| 111 | + /** | |
| 112 | + * Create a handle from an implementation | |
| 113 | + */ | |
| 114 | + BeatControl( Internal::BeatControl& implementation ); | |
| 115 | + | |
| 116 | + /** | |
| 117 | + * Allow the creation of an BeatControl handle from an internal CustomActor pointer | |
| 118 | + */ | |
| 119 | + BeatControl( Dali::Internal::CustomActor* internal ); | |
| 120 | +}; | |
| 121 | + | |
| 122 | +} // namespace Demo | |
| 123 | + | |
| 124 | +#endif // DALI_DEMO_BEAT_CONTROL_H | ... | ... |
examples/visual-transitions/transition-application.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 | + * @file transition-application.cpp | |
| 19 | + * @brief Application class for showing stylable transitions | |
| 20 | + */ | |
| 21 | + | |
| 22 | +// Class include | |
| 23 | +#include "transition-application.h" | |
| 24 | + | |
| 25 | +// External includes | |
| 26 | +#include <dali-toolkit/dali-toolkit.h> | |
| 27 | +#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h> | |
| 28 | +#include <dali-toolkit/devel-api/visuals/text-visual-properties.h> | |
| 29 | +#include "beat-control.h" | |
| 30 | +#include <cstdio> | |
| 31 | +#include <sstream> | |
| 32 | + | |
| 33 | +// Internal includes | |
| 34 | + | |
| 35 | +using namespace Dali; | |
| 36 | +using namespace Dali::Toolkit; | |
| 37 | + | |
| 38 | +namespace Demo | |
| 39 | +{ | |
| 40 | + | |
| 41 | +const char* TransitionApplication::DEMO_THEME_ONE_PATH( DEMO_STYLE_DIR "style-example-theme-one.json" ); | |
| 42 | +const char* DALI_LOGO_PATH( DEMO_IMAGE_DIR "Logo-for-demo.png" ); | |
| 43 | +const char* DALI_ROBOT_MODEL_PATH( DEMO_MODEL_DIR "ToyRobot-Metal.obj" ); | |
| 44 | +const char* DALI_ROBOT_MATERIAL_PATH( DEMO_MODEL_DIR "ToyRobot-Metal.mtl" ); | |
| 45 | + | |
| 46 | + | |
| 47 | +TransitionApplication::TransitionApplication( Application& application ) | |
| 48 | +: mApplication( application ), | |
| 49 | + mTitle(), | |
| 50 | + mBeatControl(), | |
| 51 | + mActionButtons(), | |
| 52 | + mActionIndex( Property::INVALID_INDEX ) | |
| 53 | +{ | |
| 54 | + application.InitSignal().Connect( this, &TransitionApplication::Create ); | |
| 55 | +} | |
| 56 | + | |
| 57 | +TransitionApplication::~TransitionApplication() | |
| 58 | +{ | |
| 59 | +} | |
| 60 | + | |
| 61 | +void TransitionApplication::Create( Application& application ) | |
| 62 | +{ | |
| 63 | + Stage stage = Stage::GetCurrent(); | |
| 64 | + stage.KeyEventSignal().Connect(this, &TransitionApplication::OnKeyEvent); | |
| 65 | + stage.SetBackgroundColor( Vector4( 0.1f, 0.1f, 0.1f, 1.0f ) ); | |
| 66 | + | |
| 67 | + // Hide the indicator bar | |
| 68 | + application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); | |
| 69 | + | |
| 70 | + // Content panes: | |
| 71 | + TableView contentLayout = TableView::New( 4, 1 ); | |
| 72 | + contentLayout.SetName("ContentLayout"); | |
| 73 | + contentLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | |
| 74 | + contentLayout.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | |
| 75 | + contentLayout.SetParentOrigin( ParentOrigin::TOP_LEFT ); | |
| 76 | + contentLayout.SetCellPadding( Vector2( 0.0f, 5.0f ) ); | |
| 77 | + | |
| 78 | + // Assign all rows the size negotiation property of fitting to children | |
| 79 | + | |
| 80 | + stage.Add( contentLayout ); | |
| 81 | + | |
| 82 | + mTitle = TextLabel::New( "Custom Control Transition Example" ); | |
| 83 | + mTitle.SetName( "Title" ); | |
| 84 | + mTitle.SetStyleName("Title"); | |
| 85 | + mTitle.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | |
| 86 | + mTitle.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); | |
| 87 | + mTitle.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); | |
| 88 | + contentLayout.Add( mTitle ); | |
| 89 | + contentLayout.SetFitHeight(0); // Fill width | |
| 90 | + | |
| 91 | + mBeatControl = BeatControl::New(); | |
| 92 | + mBeatControl.SetName("BeatControl"); | |
| 93 | + mBeatControl.SetProperty( BeatControl::Property::BEAT_VISUAL, Property::Map() | |
| 94 | + .Add( DevelVisual::Property::TRANSFORM, Property::Map() | |
| 95 | + .Add( DevelVisual::Transform::Property::SIZE, Vector2(0.5f, 0.5f) ) ) ); | |
| 96 | + | |
| 97 | + mBeatControl.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 98 | + mBeatControl.SetParentOrigin( ParentOrigin::CENTER ); | |
| 99 | + mBeatControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | |
| 100 | + contentLayout.Add( mBeatControl ); | |
| 101 | + // beat control should fill the tableview cell, so no change to default parameters | |
| 102 | + | |
| 103 | + TableView visualTypeLayout = TableView::New( 1, NUMBER_OF_VISUAL_BUTTONS ); | |
| 104 | + visualTypeLayout.SetName("VisualTypeLayout"); | |
| 105 | + visualTypeLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | |
| 106 | + visualTypeLayout.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT ); | |
| 107 | + visualTypeLayout.SetFitHeight( 0 ); | |
| 108 | + | |
| 109 | + contentLayout.Add( visualTypeLayout ); | |
| 110 | + contentLayout.SetFitHeight(2); | |
| 111 | + | |
| 112 | + for( int i=0; i<NUMBER_OF_VISUAL_BUTTONS; ++i ) | |
| 113 | + { | |
| 114 | + Property::Map map; | |
| 115 | + CreateVisualMap( i, map ); | |
| 116 | + map.Add( DevelVisual::Property::TRANSFORM, Property::Map() | |
| 117 | + .Add( DevelVisual::Transform::Property::SIZE, Vector2(0.8f, 0.8f) ) ); | |
| 118 | + mVisualButtons[i] = BeatControl::New(); | |
| 119 | + mVisualButtons[i].SetProperty( BeatControl::Property::BEAT_VISUAL, map ); | |
| 120 | + mVisualButtons[i].SetName("VisualButton"); | |
| 121 | + mVisualButtons[i].SetStyleName("VisualButton"); | |
| 122 | + mVisualButtons[i].SetSize(0, 50); | |
| 123 | + mVisualButtons[i].SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | |
| 124 | + mVisualButtons[i].SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT ); | |
| 125 | + mVisualIndex = mVisualButtons[i].RegisterProperty( "visualId", i, Property::READ_WRITE ); | |
| 126 | + mVisualButtons[i].TouchSignal().Connect( this, &TransitionApplication::OnVisualButtonClicked ); | |
| 127 | + visualTypeLayout.AddChild( mVisualButtons[i], TableView::CellPosition( 0, i ) ); | |
| 128 | + } | |
| 129 | + | |
| 130 | + TableView actionButtonLayout = TableView::New( 1, NUMBER_OF_ACTION_BUTTONS+1 ); | |
| 131 | + actionButtonLayout.SetName("ThemeButtonsLayout"); | |
| 132 | + actionButtonLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | |
| 133 | + actionButtonLayout.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT ); | |
| 134 | + actionButtonLayout.SetFitHeight( 0 ); | |
| 135 | + | |
| 136 | + TextLabel label = TextLabel::New( "Action: "); | |
| 137 | + label.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); | |
| 138 | + label.SetStyleName("ActionLabel"); | |
| 139 | + actionButtonLayout.AddChild( label, TableView::CellPosition( 0, 0 ) ); | |
| 140 | + actionButtonLayout.SetCellAlignment( TableView::CellPosition( 0, 0 ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); | |
| 141 | + | |
| 142 | + for( int i=0; i<NUMBER_OF_ACTION_BUTTONS; ++i ) | |
| 143 | + { | |
| 144 | + mActionButtons[i] = PushButton::New(); | |
| 145 | + mActionButtons[i].SetName("ActionButton"); | |
| 146 | + mActionButtons[i].SetStyleName("ActionButton"); | |
| 147 | + mActionButtons[i].SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | |
| 148 | + mActionButtons[i].SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); | |
| 149 | + mActionIndex = mActionButtons[i].RegisterProperty( "actionId", i, Property::READ_WRITE ); | |
| 150 | + mActionButtons[i].ClickedSignal().Connect( this, &TransitionApplication::OnActionButtonClicked ); | |
| 151 | + actionButtonLayout.AddChild( mActionButtons[i], TableView::CellPosition( 0, 1+i ) ); | |
| 152 | + } | |
| 153 | + mActionButtons[0].SetLabelText( "Bounce" ); | |
| 154 | + mActionButtons[1].SetLabelText( "X" ); | |
| 155 | + mActionButtons[2].SetLabelText( "Y" ); | |
| 156 | + mActionButtons[3].SetLabelText( "Fade" ); | |
| 157 | + | |
| 158 | + contentLayout.Add( actionButtonLayout ); | |
| 159 | + contentLayout.SetFitHeight(3); | |
| 160 | +} | |
| 161 | + | |
| 162 | +void TransitionApplication::CreateVisualMap( int index, Property::Map& map ) | |
| 163 | +{ | |
| 164 | + switch(index) | |
| 165 | + { | |
| 166 | + case 0: | |
| 167 | + { | |
| 168 | + map[ Visual::Property::TYPE ] = Visual::COLOR; | |
| 169 | + map[ ColorVisual::Property::MIX_COLOR ] = Color::YELLOW; | |
| 170 | + break; | |
| 171 | + } | |
| 172 | + case 1: | |
| 173 | + { | |
| 174 | + map[ Visual::Property::TYPE ] = Visual::BORDER; | |
| 175 | + map[ BorderVisual::Property::COLOR ] = Color::GREEN; | |
| 176 | + map[ BorderVisual::Property::SIZE ] = 5; | |
| 177 | + break; | |
| 178 | + } | |
| 179 | + case 2: | |
| 180 | + { | |
| 181 | + map[ Visual::Property::TYPE ] = Visual::GRADIENT; | |
| 182 | + | |
| 183 | + Property::Array stopOffsets; | |
| 184 | + stopOffsets.PushBack( 0.0f ); | |
| 185 | + stopOffsets.PushBack( 0.3f ); | |
| 186 | + stopOffsets.PushBack( 0.6f ); | |
| 187 | + stopOffsets.PushBack( 0.8f ); | |
| 188 | + stopOffsets.PushBack( 1.0f ); | |
| 189 | + map[ GradientVisual::Property::STOP_OFFSET ] = stopOffsets; | |
| 190 | + | |
| 191 | + Property::Array stopColors; | |
| 192 | + stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 255.f )/255.f ); | |
| 193 | + stopColors.PushBack( Vector4( 196.f, 198.f, 71.f, 122.f )/255.f ); | |
| 194 | + stopColors.PushBack( Vector4( 214.f, 37.f, 139.f, 191.f )/255.f ); | |
| 195 | + stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 150.f )/255.f ); | |
| 196 | + stopColors.PushBack( Color::YELLOW ); | |
| 197 | + map[ GradientVisual::Property::STOP_COLOR ] = stopColors; | |
| 198 | + map[ GradientVisual::Property::START_POSITION ] = Vector2(-0.5f, -0.5f ); | |
| 199 | + map[ GradientVisual::Property::END_POSITION ] = Vector2( 0.5f, 0.5f ); | |
| 200 | + break; | |
| 201 | + } | |
| 202 | + case 3: | |
| 203 | + { | |
| 204 | + map[ Visual::Property::TYPE ] = Visual::IMAGE; | |
| 205 | + map[ ImageVisual::Property::URL ] = DALI_LOGO_PATH; | |
| 206 | + break; | |
| 207 | + } | |
| 208 | + case 4: | |
| 209 | + { | |
| 210 | + map[ Visual::Property::TYPE ] = Visual::IMAGE; | |
| 211 | + map[ ImageVisual::Property::URL ] = DEMO_IMAGE_DIR "preMultAlpha.png"; | |
| 212 | + map[ DevelVisual::Property::PREMULTIPLIED_ALPHA ] = true; | |
| 213 | + break; | |
| 214 | + } | |
| 215 | + | |
| 216 | + case 5: | |
| 217 | + { | |
| 218 | + map[ Visual::Property::TYPE ] = Visual::MESH; | |
| 219 | + map[ MeshVisual::Property::OBJECT_URL ] = DALI_ROBOT_MODEL_PATH; | |
| 220 | + map[ MeshVisual::Property::MATERIAL_URL ] = DALI_ROBOT_MATERIAL_PATH; | |
| 221 | + map[ MeshVisual::Property::TEXTURES_PATH ] = DEMO_IMAGE_DIR; | |
| 222 | + map[ MeshVisual::Property::SHADING_MODE ] = MeshVisual::ShadingMode::TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING; | |
| 223 | + break; | |
| 224 | + } | |
| 225 | + | |
| 226 | + case 6: | |
| 227 | + { | |
| 228 | + map[ Visual::Property::TYPE ] = Visual::PRIMITIVE; | |
| 229 | + | |
| 230 | + map[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::BEVELLED_CUBE; | |
| 231 | + map[ PrimitiveVisual::Property::BEVEL_PERCENTAGE ] = 0.3f; | |
| 232 | + map[ PrimitiveVisual::Property::BEVEL_SMOOTHNESS ] = 0.0f; | |
| 233 | + map[ PrimitiveVisual::Property::SCALE_DIMENSIONS ] = Vector3(1.0f,1.0f,0.3f); | |
| 234 | + map[ PrimitiveVisual::Property::MIX_COLOR ] = Vector4(0.7f, 0.5f, 0.05f, 1.0f); | |
| 235 | + | |
| 236 | + break; | |
| 237 | + } | |
| 238 | + | |
| 239 | + case 7: | |
| 240 | + { | |
| 241 | + // NPatch | |
| 242 | + map[ Visual::Property::TYPE ] = Visual::IMAGE; | |
| 243 | + map[ ImageVisual::Property::URL ] = DEMO_IMAGE_DIR "button-up-16.9.png"; | |
| 244 | + break; | |
| 245 | + } | |
| 246 | + case 8: | |
| 247 | + { | |
| 248 | + // SVG | |
| 249 | + map[ Visual::Property::TYPE ] = Visual::IMAGE; | |
| 250 | + map[ ImageVisual::Property::URL ] = DEMO_IMAGE_DIR "Kid1.svg"; | |
| 251 | + break; | |
| 252 | + } | |
| 253 | + | |
| 254 | + case 9: | |
| 255 | + { | |
| 256 | + map[ Visual::Property::TYPE ] = DevelVisual::TEXT; | |
| 257 | + map[ TextVisual::Property::TEXT ] = "Text"; | |
| 258 | + map[ TextVisual::Property::TEXT_COLOR ] = Color::CYAN; | |
| 259 | + map[ TextVisual::Property::POINT_SIZE ] = 10; | |
| 260 | + break; | |
| 261 | + } | |
| 262 | + | |
| 263 | + default: | |
| 264 | + { | |
| 265 | + map[ Visual::Property::TYPE ] = Visual::COLOR; | |
| 266 | + map[ ColorVisual::Property::MIX_COLOR ] = Color::MAGENTA; | |
| 267 | + break; | |
| 268 | + } | |
| 269 | + } | |
| 270 | +} | |
| 271 | + | |
| 272 | +bool TransitionApplication::OnVisualButtonClicked( Actor actor, const TouchData& touchData ) | |
| 273 | +{ | |
| 274 | + if( touchData.GetState(0) == PointState::FINISHED ) | |
| 275 | + { | |
| 276 | + int visual = actor.GetProperty<int>( mVisualIndex ); | |
| 277 | + Property::Map map; | |
| 278 | + CreateVisualMap( visual, map ); | |
| 279 | + map.Add( DevelVisual::Property::TRANSFORM, Property::Map() | |
| 280 | + .Add( DevelVisual::Transform::Property::SIZE, Vector2( 0.5f, 0.5f ) ) ); | |
| 281 | + mBeatControl.SetProperty( BeatControl::Property::BEAT_VISUAL, map ); | |
| 282 | + } | |
| 283 | + return true; | |
| 284 | +} | |
| 285 | + | |
| 286 | +bool TransitionApplication::OnActionButtonClicked( Button button ) | |
| 287 | +{ | |
| 288 | + int action = button.GetProperty<int>( mActionIndex ); | |
| 289 | + switch( action ) | |
| 290 | + { | |
| 291 | + case 0: | |
| 292 | + { | |
| 293 | + mBeatControl.StartBounceAnimation(); | |
| 294 | + break; | |
| 295 | + } | |
| 296 | + case 1: | |
| 297 | + { | |
| 298 | + mBeatControl.StartXAnimation(); | |
| 299 | + break; | |
| 300 | + } | |
| 301 | + case 2: | |
| 302 | + { | |
| 303 | + mBeatControl.StartYAnimation(); | |
| 304 | + break; | |
| 305 | + } | |
| 306 | + case 3: | |
| 307 | + { | |
| 308 | + mBeatControl.StartFadeAnimation(); | |
| 309 | + break; | |
| 310 | + } | |
| 311 | + } | |
| 312 | + | |
| 313 | + return true; | |
| 314 | +} | |
| 315 | + | |
| 316 | +void TransitionApplication::OnKeyEvent( const KeyEvent& keyEvent ) | |
| 317 | +{ | |
| 318 | + static int keyPressed = 0; | |
| 319 | + | |
| 320 | + if( keyEvent.state == KeyEvent::Down) | |
| 321 | + { | |
| 322 | + if( keyPressed == 0 ) // Is this the first down event? | |
| 323 | + { | |
| 324 | + printf("Key pressed: %s %d\n", keyEvent.keyPressedName.c_str(), keyEvent.keyCode ); | |
| 325 | + | |
| 326 | + if( IsKey( keyEvent, DALI_KEY_ESCAPE) || IsKey( keyEvent, DALI_KEY_BACK ) ) | |
| 327 | + { | |
| 328 | + mApplication.Quit(); | |
| 329 | + } | |
| 330 | + else if( keyEvent.keyPressedName.compare("Return") == 0 ) | |
| 331 | + { | |
| 332 | + } | |
| 333 | + } | |
| 334 | + keyPressed = 1; | |
| 335 | + } | |
| 336 | + else if( keyEvent.state == KeyEvent::Up ) | |
| 337 | + { | |
| 338 | + keyPressed = 0; | |
| 339 | + } | |
| 340 | +} | |
| 341 | + | |
| 342 | +} // namespace Demo | ... | ... |
examples/visual-transitions/transition-application.h
0 โ 100644
| 1 | +#ifndef DALI_DEMO_TRANSITION_APPLICATION_H | |
| 2 | +#define DALI_DEMO_TRANSITION_APPLICATION_H | |
| 3 | + | |
| 4 | +/* | |
| 5 | + * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 6 | + * | |
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 8 | + * you may not use this file except in compliance with the License. | |
| 9 | + * You may obtain a copy of the License at | |
| 10 | + * | |
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 12 | + * | |
| 13 | + * Unless required by applicable law or agreed to in writing, software | |
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 16 | + * See the License for the specific language governing permissions and | |
| 17 | + * limitations under the License. | |
| 18 | + */ | |
| 19 | + | |
| 20 | +// External includes | |
| 21 | +#include <dali-toolkit/dali-toolkit.h> | |
| 22 | +//#include <dali-toolkit/devel-api/controls/slider/slider.h> | |
| 23 | +#include <dali-toolkit/devel-api/controls/popup/popup.h> | |
| 24 | +#include "beat-control.h" | |
| 25 | +#include <cstdio> | |
| 26 | +#include <sstream> | |
| 27 | + | |
| 28 | +// Internal includes | |
| 29 | + | |
| 30 | +using namespace Dali; | |
| 31 | +using namespace Dali::Toolkit; | |
| 32 | + | |
| 33 | +namespace Demo | |
| 34 | +{ | |
| 35 | + | |
| 36 | +class TransitionApplication : public ConnectionTracker | |
| 37 | +{ | |
| 38 | +public: | |
| 39 | + static const int NUMBER_OF_ACTION_BUTTONS=4; | |
| 40 | + static const int NUMBER_OF_VISUAL_BUTTONS=10; | |
| 41 | + | |
| 42 | +public: | |
| 43 | + // Constructor | |
| 44 | + TransitionApplication( Application& application ); | |
| 45 | + | |
| 46 | + // Destructor | |
| 47 | + ~TransitionApplication(); | |
| 48 | + | |
| 49 | + // Init signal handler | |
| 50 | + void Create( Application& application ); | |
| 51 | + | |
| 52 | + // Create the GUI components | |
| 53 | + Toolkit::TextLabel CreateTitle( std::string title ); | |
| 54 | + Actor CreateContentPane(); | |
| 55 | + | |
| 56 | + // Key event handler | |
| 57 | + void OnKeyEvent( const KeyEvent& event ); | |
| 58 | + | |
| 59 | + bool OnActionButtonClicked( Button button ); | |
| 60 | + bool OnVisualButtonClicked( Actor actor, const TouchData& touchData ); | |
| 61 | + | |
| 62 | + static const char* DEMO_THEME_ONE_PATH; | |
| 63 | + | |
| 64 | +private: | |
| 65 | + | |
| 66 | + /** Create a visual map | |
| 67 | + * | |
| 68 | + * @param[in] index The index of the visual to create | |
| 69 | + * @param[out] map The map to generate | |
| 70 | + */ | |
| 71 | + void CreateVisualMap( int index, Property::Map& map ); | |
| 72 | + | |
| 73 | + Application& mApplication; | |
| 74 | + TextLabel mTitle; | |
| 75 | + BeatControl mBeatControl; | |
| 76 | + PushButton mActionButtons[NUMBER_OF_ACTION_BUTTONS]; | |
| 77 | + BeatControl mVisualButtons[NUMBER_OF_VISUAL_BUTTONS]; | |
| 78 | + Property::Index mVisualIndex; | |
| 79 | + Property::Index mActionIndex; | |
| 80 | +}; | |
| 81 | + | |
| 82 | +} // Namespace Demo | |
| 83 | + | |
| 84 | + | |
| 85 | +#endif // DALI_DEMO_TRANSITION_APPLICATION_H | ... | ... |
examples/visual-transitions/transition-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 | + * @file transition-example.cpp | |
| 19 | + * @brief Example of stylable transitions. | |
| 20 | + */ | |
| 21 | + | |
| 22 | +// External includes | |
| 23 | +#include <dali/dali.h> | |
| 24 | + | |
| 25 | +// Internal includes | |
| 26 | +#include "transition-application.h" | |
| 27 | + | |
| 28 | + | |
| 29 | +/// Entry point for applications | |
| 30 | +int DALI_EXPORT_API main( int argc, char** argv ) | |
| 31 | +{ | |
| 32 | + const char* themeName = Demo::TransitionApplication::DEMO_THEME_ONE_PATH; | |
| 33 | + | |
| 34 | + Application application = Application::New( &argc, &argv, themeName ); | |
| 35 | + Demo::TransitionApplication transitionApplication( application ); | |
| 36 | + application.MainLoop(); | |
| 37 | + return 0; | |
| 38 | +} | ... | ... |
packaging/com.samsung.dali-demo.spec
resources/style/mobile/style-example-theme-one.json.in
| ... | ... | @@ -73,9 +73,9 @@ |
| 73 | 73 | [ |
| 74 | 74 | { |
| 75 | 75 | "target":"imageVisual", |
| 76 | - "property":"mixColor", | |
| 77 | - "initialValue":[1,1,1,0], | |
| 78 | - "targetValue":[1,1,1,1], | |
| 76 | + "property":"opacity", | |
| 77 | + "initialValue":0, | |
| 78 | + "targetValue":1, | |
| 79 | 79 | "animator": |
| 80 | 80 | { |
| 81 | 81 | "alphaFunction":"EASE_IN_OUT", |
| ... | ... | @@ -96,8 +96,8 @@ |
| 96 | 96 | [ |
| 97 | 97 | { |
| 98 | 98 | "target":"imageVisual", |
| 99 | - "property":"mixColor", | |
| 100 | - "targetValue":[1,1,1,0], | |
| 99 | + "property":"opacity", | |
| 100 | + "targetValue":0, | |
| 101 | 101 | "animator": |
| 102 | 102 | { |
| 103 | 103 | "alphaFunction":"EASE_IN_OUT", |
| ... | ... | @@ -117,262 +117,306 @@ |
| 117 | 117 | }, |
| 118 | 118 | "ShadowButton": |
| 119 | 119 | { |
| 120 | - "backgroundVisual":{ | |
| 121 | - "visualType":"IMAGE", | |
| 122 | - "url":"{STYLE_DIR}/images/shadowButtonBg.9.png", | |
| 123 | - "mixColor":[1,1,1,0] | |
| 124 | - }, | |
| 125 | - "checkboxBgVisual":{ | |
| 126 | - "visualType":"IMAGE", | |
| 127 | - "url":"{STYLE_DIR}/images/CheckBg.png", | |
| 128 | - "transform":{ | |
| 129 | - "size":[0.09, 0.28], | |
| 130 | - "offset":[30,0], | |
| 131 | - "offsetSizeMode":[1,1,0,0], | |
| 132 | - "origin":"CENTER_BEGIN", | |
| 133 | - "anchorPoint":"CENTER_BEGIN" | |
| 134 | - } | |
| 135 | - }, | |
| 136 | - "checkboxFgVisual":{ | |
| 137 | - "visualType":"IMAGE", | |
| 138 | - "url":"{STYLE_DIR}/images/Tick.png", | |
| 139 | - "transform":{ | |
| 140 | - "size":[0.09, 0.28], | |
| 141 | - "offset":[30,0], | |
| 142 | - "offsetSizeMode":[1,1,0,0], | |
| 143 | - "origin":"CENTER_BEGIN", | |
| 144 | - "anchorPoint":"CENTER_BEGIN" | |
| 145 | - } | |
| 146 | - }, | |
| 147 | - "labelVisual":{ | |
| 148 | - "visualType":"TEXT", | |
| 149 | - "text":"Don't show again", | |
| 150 | - "pointSize":8, | |
| 151 | - "horizontalAlignment":"END", | |
| 152 | - "verticalAlignment":"CENTER", | |
| 153 | - "textColor":[1,1,1,1], | |
| 154 | - "mixColor":[0.3, 0.3, 0.3, 1], | |
| 155 | - "transform":{ | |
| 156 | - "size":[0.9, 0.9], | |
| 157 | - "offset":[-30,0], | |
| 158 | - "offsetSizeMode":[1,1,0,0], | |
| 159 | - "origin":"CENTER_END", | |
| 160 | - "anchorPoint":"CENTER_END" | |
| 161 | - } | |
| 162 | - }, | |
| 163 | - "activeTransition": | |
| 164 | - [ | |
| 120 | + "states": | |
| 121 | + { | |
| 122 | + "NORMAL": | |
| 165 | 123 | { |
| 166 | - "target":"checkboxBgVisual", | |
| 167 | - "property":"size", | |
| 168 | - "initialValue":[0.09, 0.28], | |
| 169 | - "targetValue":[0.12, 0.37], | |
| 170 | - "animator": | |
| 124 | + "visuals": | |
| 171 | 125 | { |
| 172 | - "alphaFunction":"EASE_OUT_BACK", | |
| 173 | - "timePeriod": | |
| 174 | - { | |
| 175 | - "duration":0.8, | |
| 176 | - "delay":0 | |
| 126 | + "backgroundVisual":{ | |
| 127 | + "visualType":"IMAGE", | |
| 128 | + "url":"{STYLE_DIR}/images/shadowButtonBg.9.png" | |
| 129 | + }, | |
| 130 | + | |
| 131 | + "checkboxBgVisual":{ | |
| 132 | + "visualType":"IMAGE", | |
| 133 | + "url":"{STYLE_DIR}/images/CheckBg.png", | |
| 134 | + "transform":{ | |
| 135 | + "size":[0.09, 0.28], | |
| 136 | + "offset":[30,0], | |
| 137 | + "offsetSizeMode":[1,1,0,0], | |
| 138 | + "origin":"CENTER_BEGIN", | |
| 139 | + "anchorPoint":"CENTER_BEGIN" | |
| 140 | + } | |
| 141 | + }, | |
| 142 | + | |
| 143 | + "labelVisual":{ | |
| 144 | + "visualType":"TEXT", | |
| 145 | + "text":"Don't show again", | |
| 146 | + "pointSize":8, | |
| 147 | + "horizontalAlignment":"END", | |
| 148 | + "verticalAlignment":"CENTER", | |
| 149 | + "textColor":[1,1,1,1], | |
| 150 | + "mixColor":[0, 0, 0, 1], | |
| 151 | + "transform":{ | |
| 152 | + "size":[0.9, 0.9], | |
| 153 | + "offset":[-30,0], | |
| 154 | + "offsetSizeMode":[1,1,0,0], | |
| 155 | + "origin":"CENTER_END", | |
| 156 | + "anchorPoint":"CENTER_END" | |
| 157 | + } | |
| 177 | 158 | } |
| 178 | - } | |
| 179 | - }, | |
| 180 | - { | |
| 181 | - "target":"backgroundVisual", | |
| 182 | - "property":"mixColor", | |
| 183 | - "initialValue":[1,1,1,0], | |
| 184 | - "targetValue":[1,1,1,1], | |
| 185 | - "animator": | |
| 159 | + }, | |
| 160 | + | |
| 161 | + "states": | |
| 186 | 162 | { |
| 187 | - "alphaFunction":"EASE_OUT_BACK", | |
| 188 | - "timePeriod": | |
| 163 | + "CHECKED": | |
| 189 | 164 | { |
| 190 | - "duration":0.8, | |
| 191 | - "delay":0 | |
| 192 | - } | |
| 193 | - } | |
| 194 | - }, | |
| 195 | - { | |
| 196 | - "target":"backgroundVisual", | |
| 197 | - "property":"size", | |
| 198 | - "initialValue":[0.9, 0.9], | |
| 199 | - "targetValue":[1, 1], | |
| 200 | - "animator": | |
| 201 | - { | |
| 202 | - "alphaFunction":"EASE_OUT_BACK", | |
| 203 | - "timePeriod": | |
| 204 | - { | |
| 205 | - "duration":0.8, | |
| 206 | - "delay":0 | |
| 207 | - } | |
| 208 | - } | |
| 209 | - }, | |
| 210 | - { | |
| 211 | - "target":"checkboxFgVisual", | |
| 212 | - "property":"size", | |
| 213 | - "initialValue":[0.09, 0.28], | |
| 214 | - "targetValue":[0.12, 0.37], | |
| 215 | - "animator": | |
| 216 | - { | |
| 217 | - "alphaFunction":"EASE_OUT_BACK", | |
| 218 | - "timePeriod": | |
| 165 | + "visuals": | |
| 166 | + { | |
| 167 | + "checkboxFgVisual":{ | |
| 168 | + "visualType":"IMAGE", | |
| 169 | + "url":"{STYLE_DIR}/images/Tick.png", | |
| 170 | + "transform":{ | |
| 171 | + "size":[0.09, 0.28], | |
| 172 | + "offset":[30,0], | |
| 173 | + "offsetSizeMode":[1,1,0,0], | |
| 174 | + "origin":"CENTER_BEGIN", | |
| 175 | + "anchorPoint":"CENTER_BEGIN" | |
| 176 | + } | |
| 177 | + } | |
| 178 | + }, | |
| 179 | + "entryTransition": | |
| 180 | + [ | |
| 181 | + { | |
| 182 | + "target":"checkboxFgVisual", | |
| 183 | + "property":"pixelArea", | |
| 184 | + "initialValue":[0.0, 0.0, 0.0, 1.0], | |
| 185 | + "targetValue":[0.0, 0.0, 1.0, 1.0], | |
| 186 | + "animator": | |
| 187 | + { | |
| 188 | + "alphaFunction":"EASE_IN", | |
| 189 | + "timePeriod": | |
| 190 | + { | |
| 191 | + "duration":0.4, | |
| 192 | + "delay":0 | |
| 193 | + } | |
| 194 | + } | |
| 195 | + }, | |
| 196 | + { | |
| 197 | + "target":"checkboxFgVisual", | |
| 198 | + "property":"size", | |
| 199 | + "initialValue":[0.0, 0.37], | |
| 200 | + "targetValue":[0.12, 0.37], | |
| 201 | + "animator": | |
| 202 | + { | |
| 203 | + "alphaFunction":"EASE_IN", | |
| 204 | + "timePeriod": | |
| 205 | + { | |
| 206 | + "duration":0.4, | |
| 207 | + "delay":0 | |
| 208 | + } | |
| 209 | + } | |
| 210 | + } | |
| 211 | + ], | |
| 212 | + "exitTransition": | |
| 213 | + [ | |
| 214 | + { | |
| 215 | + "target":"checkboxFgVisual", | |
| 216 | + "property":"pixelArea", | |
| 217 | + "initialValue":[0.0, 0.0, 1.0, 1.0], | |
| 218 | + "targetValue":[0.0, 0.0, 0.0, 1.0], | |
| 219 | + "animator": | |
| 220 | + { | |
| 221 | + "alphaFunction":"EASE_OUT", | |
| 222 | + "timePeriod": | |
| 223 | + { | |
| 224 | + "duration":0.4, | |
| 225 | + "delay":0 | |
| 226 | + } | |
| 227 | + } | |
| 228 | + }, | |
| 229 | + { | |
| 230 | + "target":"checkboxFgVisual", | |
| 231 | + "property":"size", | |
| 232 | + "targetValue":[0.0, 0.37], | |
| 233 | + "animator": | |
| 234 | + { | |
| 235 | + "alphaFunction":"EASE_OUT", | |
| 236 | + "timePeriod": | |
| 237 | + { | |
| 238 | + "duration":0.4, | |
| 239 | + "delay":0 | |
| 240 | + } | |
| 241 | + } | |
| 242 | + } | |
| 243 | + ] | |
| 244 | + }, | |
| 245 | + "UNCHECKED": | |
| 219 | 246 | { |
| 220 | - "duration":0.8, | |
| 221 | - "delay":0 | |
| 222 | 247 | } |
| 223 | 248 | } |
| 224 | 249 | }, |
| 250 | + //"FOCUSED" | |
| 251 | + "DISABLED": | |
| 225 | 252 | { |
| 226 | - "target":"labelVisual", | |
| 227 | - "property":"mixColor", | |
| 228 | - "initialValue":[0.2, 0.2, 0.2, 1.0], | |
| 229 | - "targetValue":[0, 0, 0, 1], | |
| 230 | - "animator": | |
| 253 | + "visuals": | |
| 231 | 254 | { |
| 232 | - "alphaFunction":"EASE_OUT_BACK", | |
| 233 | - "timePeriod": | |
| 234 | - { | |
| 235 | - "duration":0.8, | |
| 236 | - "delay":0 | |
| 255 | + "checkboxBgVisual":{ | |
| 256 | + "visualType":"IMAGE", | |
| 257 | + "url":"{STYLE_DIR}/images/CheckBg.png", | |
| 258 | + "transform":{ | |
| 259 | + "size":[0.09, 0.28], | |
| 260 | + "offset":[30,0], | |
| 261 | + "offsetSizeMode":[1,1,0,0], | |
| 262 | + "origin":"CENTER_BEGIN", | |
| 263 | + "anchorPoint":"CENTER_BEGIN" | |
| 264 | + } | |
| 265 | + }, | |
| 266 | + | |
| 267 | + "checkboxFgVisual":{ | |
| 268 | + "visualType":"IMAGE", | |
| 269 | + "url":"{STYLE_DIR}/images/Tick.png", | |
| 270 | + "transform":{ | |
| 271 | + "size":[0.09, 0.28], | |
| 272 | + "offset":[30,0], | |
| 273 | + "offsetSizeMode":[1,1,0,0], | |
| 274 | + "origin":"CENTER_BEGIN", | |
| 275 | + "anchorPoint":"CENTER_BEGIN" | |
| 276 | + } | |
| 277 | + }, | |
| 278 | + | |
| 279 | + "labelVisual":{ | |
| 280 | + "visualType":"TEXT", | |
| 281 | + "text":"Don't show again", | |
| 282 | + "pointSize":8, | |
| 283 | + "horizontalAlignment":"END", | |
| 284 | + "verticalAlignment":"CENTER", | |
| 285 | + "textColor":[1,1,1,1], | |
| 286 | + "mixColor":[0.3, 0.3, 0.3, 1], | |
| 287 | + "transform":{ | |
| 288 | + "size":[0.9, 0.9], | |
| 289 | + "offset":[-30,0], | |
| 290 | + "offsetSizeMode":[1,1,0,0], | |
| 291 | + "origin":"CENTER_END", | |
| 292 | + "anchorPoint":"CENTER_END" | |
| 293 | + } | |
| 237 | 294 | } |
| 238 | 295 | } |
| 239 | 296 | } |
| 240 | - ], | |
| 241 | - "inactiveTransition": | |
| 297 | + }, | |
| 298 | + "transitions": | |
| 242 | 299 | [ |
| 243 | 300 | { |
| 244 | - "target":"checkboxBgVisual", | |
| 245 | - "property":"size", | |
| 246 | - "initialValue":[0.12, 0.37], | |
| 247 | - "targetValue":[0.09, 0.28], | |
| 301 | + "from":"DISABLED", | |
| 302 | + "to":"NORMAL", | |
| 303 | + "visualName":"backgroundVisual", | |
| 304 | + "effect":"FADE_IN", | |
| 248 | 305 | "animator": |
| 249 | 306 | { |
| 250 | 307 | "alphaFunction":"EASE_OUT_BACK", |
| 251 | - "timePeriod": | |
| 252 | - { | |
| 253 | - "duration":0.8, | |
| 254 | - "delay":0 | |
| 255 | - } | |
| 308 | + "duration":0.8 | |
| 256 | 309 | } |
| 257 | 310 | }, |
| 258 | 311 | { |
| 259 | - "target":"backgroundVisual", | |
| 260 | - "property":"mixColor", | |
| 261 | - "targetValue":[1,1,1,0], | |
| 312 | + "from":"DISABLED", | |
| 313 | + "to":"NORMAL", | |
| 314 | + "visualName":"*", | |
| 262 | 315 | "animator": |
| 263 | 316 | { |
| 264 | 317 | "alphaFunction":"EASE_OUT_BACK", |
| 265 | - "timePeriod": | |
| 266 | - { | |
| 267 | - "duration":0.8, | |
| 268 | - "delay":0 | |
| 269 | - } | |
| 318 | + "duration":0.8 | |
| 270 | 319 | } |
| 271 | 320 | }, |
| 272 | 321 | { |
| 273 | - "target":"checkboxFgVisual", | |
| 274 | - "property":"size", | |
| 275 | - "initialValue":[0.12, 0.37], | |
| 276 | - "targetValue":[0.09, 0.28], | |
| 322 | + "from":"NORMAL", | |
| 323 | + "to":"DISABLED", | |
| 324 | + "visualName":"backgroundVisual", | |
| 325 | + "effect":"FADE_OUT", | |
| 277 | 326 | "animator": |
| 278 | 327 | { |
| 279 | 328 | "alphaFunction":"EASE_OUT_BACK", |
| 280 | - "timePeriod": | |
| 281 | - { | |
| 282 | - "duration":0.8, | |
| 283 | - "delay":0 | |
| 284 | - } | |
| 329 | + "duration":0.8 | |
| 285 | 330 | } |
| 286 | 331 | }, |
| 287 | 332 | { |
| 288 | - "target":"labelVisual", | |
| 289 | - "property":"mixColor", | |
| 290 | - "targetValue":[0.4, 0.4, 0.4, 1.0], | |
| 333 | + "from":"NORMAL", | |
| 334 | + "to":"DISABLED", | |
| 335 | + "visualName":"*", | |
| 291 | 336 | "animator": |
| 292 | 337 | { |
| 293 | 338 | "alphaFunction":"EASE_OUT_BACK", |
| 294 | - "timePeriod": | |
| 295 | - { | |
| 296 | - "duration":0.8, | |
| 297 | - "delay":0 | |
| 298 | - } | |
| 339 | + "duration":0.8 | |
| 299 | 340 | } |
| 300 | - }, | |
| 341 | + } | |
| 342 | + ] | |
| 343 | + }, | |
| 344 | + "BeatControl": | |
| 345 | + { | |
| 346 | + "beatVisual":{ | |
| 347 | + "visualType":"IMAGE", | |
| 348 | + "url":"{APPLICATION_RESOURCE_PATH}/images/Logo-for-demo.png" | |
| 349 | + }, | |
| 350 | + | |
| 351 | + "bounceTransition": | |
| 352 | + [ | |
| 301 | 353 | { |
| 302 | - "target":"backgroundVisual", | |
| 354 | + "target":"beatVisual", | |
| 303 | 355 | "property":"size", |
| 304 | - "targetValue":[0.9, 0.9], | |
| 356 | + "initialValue":[0.5, 0.5], | |
| 357 | + "targetValue":[0.75, 0.75], | |
| 305 | 358 | "animator": |
| 306 | 359 | { |
| 307 | - "alphaFunction":"EASE_OUT_BACK", | |
| 360 | + "alphaFunction":"BOUNCE", | |
| 308 | 361 | "timePeriod": |
| 309 | 362 | { |
| 310 | - "duration":0.8, | |
| 363 | + "duration":0.5, | |
| 311 | 364 | "delay":0 |
| 312 | 365 | } |
| 313 | 366 | } |
| 314 | 367 | } |
| 315 | 368 | ], |
| 316 | - "checkTransition": | |
| 369 | + | |
| 370 | + "leftTransition": | |
| 317 | 371 | [ |
| 318 | 372 | { |
| 319 | - "target":"checkboxFgVisual", | |
| 320 | - "property":"pixelArea", | |
| 321 | - "initialValue":[0.0, 0.0, 0.0, 1.0], | |
| 322 | - "targetValue":[0.0, 0.0, 1.0, 1.0], | |
| 323 | - "animator": | |
| 324 | - { | |
| 325 | - "alphaFunction":"EASE_IN", | |
| 326 | - "timePeriod": | |
| 327 | - { | |
| 328 | - "duration":0.4, | |
| 329 | - "delay":0 | |
| 330 | - } | |
| 331 | - } | |
| 332 | - }, | |
| 333 | - { | |
| 334 | - "target":"checkboxFgVisual", | |
| 335 | - "property":"size", | |
| 336 | - "initialValue":[0.0, 0.37], | |
| 337 | - "targetValue":[0.12, 0.37], | |
| 373 | + "target":"beatVisual", | |
| 374 | + "property":"offset", | |
| 375 | + "initialValue":[0, 0], | |
| 376 | + "targetValue":[0.25, 0], | |
| 338 | 377 | "animator": |
| 339 | 378 | { |
| 340 | - "alphaFunction":"EASE_IN", | |
| 379 | + "alphaFunction":"BOUNCE", | |
| 341 | 380 | "timePeriod": |
| 342 | 381 | { |
| 343 | - "duration":0.4, | |
| 382 | + "duration":0.5, | |
| 344 | 383 | "delay":0 |
| 345 | 384 | } |
| 346 | 385 | } |
| 347 | 386 | } |
| 348 | 387 | ], |
| 349 | - "uncheckTransition": | |
| 388 | + | |
| 389 | + "upTransition": | |
| 350 | 390 | [ |
| 351 | 391 | { |
| 352 | - "target":"checkboxFgVisual", | |
| 353 | - "property":"pixelArea", | |
| 354 | - "initialValue":[0.0, 0.0, 1.0, 1.0], | |
| 355 | - "targetValue":[0.0, 0.0, 0.0, 1.0], | |
| 392 | + "target":"beatVisual", | |
| 393 | + "property":"offset", | |
| 394 | + "initialValue":[0, 0], | |
| 395 | + "targetValue":[0, 0.25], | |
| 356 | 396 | "animator": |
| 357 | 397 | { |
| 358 | - "alphaFunction":"EASE_OUT", | |
| 398 | + "alphaFunction":"BOUNCE", | |
| 359 | 399 | "timePeriod": |
| 360 | 400 | { |
| 361 | - "duration":0.4, | |
| 401 | + "duration":0.5, | |
| 362 | 402 | "delay":0 |
| 363 | 403 | } |
| 364 | 404 | } |
| 365 | - }, | |
| 405 | + } | |
| 406 | + ], | |
| 407 | + | |
| 408 | + "fadeTransition": | |
| 409 | + [ | |
| 366 | 410 | { |
| 367 | - "target":"checkboxFgVisual", | |
| 368 | - "property":"size", | |
| 369 | - "targetValue":[0.0, 0.37], | |
| 411 | + "target":"beatVisual", | |
| 412 | + "property":"opacity", | |
| 413 | + "targetValue":0, | |
| 370 | 414 | "animator": |
| 371 | 415 | { |
| 372 | - "alphaFunction":"EASE_OUT", | |
| 416 | + "alphaFunction":"BOUNCE", | |
| 373 | 417 | "timePeriod": |
| 374 | 418 | { |
| 375 | - "duration":0.4, | |
| 419 | + "duration":0.8, | |
| 376 | 420 | "delay":0 |
| 377 | 421 | } |
| 378 | 422 | } | ... | ... |
resources/style/style-example-theme-one.json.in
| ... | ... | @@ -73,9 +73,9 @@ |
| 73 | 73 | [ |
| 74 | 74 | { |
| 75 | 75 | "target":"imageVisual", |
| 76 | - "property":"mixColor", | |
| 77 | - "initialValue":[1,1,1,0], | |
| 78 | - "targetValue":[1,1,1,1], | |
| 76 | + "property":"opacity", | |
| 77 | + "initialValue":0, | |
| 78 | + "targetValue":1, | |
| 79 | 79 | "animator": |
| 80 | 80 | { |
| 81 | 81 | "alphaFunction":"EASE_IN_OUT", |
| ... | ... | @@ -96,8 +96,8 @@ |
| 96 | 96 | [ |
| 97 | 97 | { |
| 98 | 98 | "target":"imageVisual", |
| 99 | - "property":"mixColor", | |
| 100 | - "targetValue":[1,1,1,0], | |
| 99 | + "property":"opacity", | |
| 100 | + "targetValue":0, | |
| 101 | 101 | "animator": |
| 102 | 102 | { |
| 103 | 103 | "alphaFunction":"EASE_IN_OUT", |
| ... | ... | @@ -117,262 +117,306 @@ |
| 117 | 117 | }, |
| 118 | 118 | "ShadowButton": |
| 119 | 119 | { |
| 120 | - "backgroundVisual":{ | |
| 121 | - "visualType":"IMAGE", | |
| 122 | - "url":"{STYLE_DIR}/images/shadowButtonBg.9.png", | |
| 123 | - "mixColor":[1,1,1,0] | |
| 124 | - }, | |
| 125 | - "checkboxBgVisual":{ | |
| 126 | - "visualType":"IMAGE", | |
| 127 | - "url":"{STYLE_DIR}/images/CheckBg.png", | |
| 128 | - "transform":{ | |
| 129 | - "size":[0.09, 0.28], | |
| 130 | - "offset":[30,0], | |
| 131 | - "offsetSizeMode":[1,1,0,0], | |
| 132 | - "origin":"CENTER_BEGIN", | |
| 133 | - "anchorPoint":"CENTER_BEGIN" | |
| 134 | - } | |
| 135 | - }, | |
| 136 | - "checkboxFgVisual":{ | |
| 137 | - "visualType":"IMAGE", | |
| 138 | - "url":"{STYLE_DIR}/images/Tick.png", | |
| 139 | - "transform":{ | |
| 140 | - "size":[0.09, 0.28], | |
| 141 | - "offset":[30,0], | |
| 142 | - "offsetSizeMode":[1,1,0,0], | |
| 143 | - "origin":"CENTER_BEGIN", | |
| 144 | - "anchorPoint":"CENTER_BEGIN" | |
| 145 | - } | |
| 146 | - }, | |
| 147 | - "labelVisual":{ | |
| 148 | - "visualType":"TEXT", | |
| 149 | - "text":"Don't show again", | |
| 150 | - "pointSize":20, | |
| 151 | - "horizontalAlignment":"END", | |
| 152 | - "verticalAlignment":"CENTER", | |
| 153 | - "textColor":[1,1,1,1], | |
| 154 | - "mixColor":[0.3, 0.3, 0.3, 1], | |
| 155 | - "transform":{ | |
| 156 | - "size":[0.9, 0.9], | |
| 157 | - "offset":[-30,0], | |
| 158 | - "offsetSizeMode":[1,1,0,0], | |
| 159 | - "origin":"CENTER_END", | |
| 160 | - "anchorPoint":"CENTER_END" | |
| 161 | - } | |
| 162 | - }, | |
| 163 | - "activeTransition": | |
| 164 | - [ | |
| 120 | + "states": | |
| 121 | + { | |
| 122 | + "NORMAL": | |
| 165 | 123 | { |
| 166 | - "target":"checkboxBgVisual", | |
| 167 | - "property":"size", | |
| 168 | - "initialValue":[0.09, 0.28], | |
| 169 | - "targetValue":[0.12, 0.37], | |
| 170 | - "animator": | |
| 124 | + "visuals": | |
| 171 | 125 | { |
| 172 | - "alphaFunction":"EASE_OUT_BACK", | |
| 173 | - "timePeriod": | |
| 174 | - { | |
| 175 | - "duration":0.8, | |
| 176 | - "delay":0 | |
| 126 | + "backgroundVisual":{ | |
| 127 | + "visualType":"IMAGE", | |
| 128 | + "url":"{STYLE_DIR}/images/shadowButtonBg.9.png" | |
| 129 | + }, | |
| 130 | + | |
| 131 | + "checkboxBgVisual":{ | |
| 132 | + "visualType":"IMAGE", | |
| 133 | + "url":"{STYLE_DIR}/images/CheckBg.png", | |
| 134 | + "transform":{ | |
| 135 | + "size":[0.09, 0.28], | |
| 136 | + "offset":[30,0], | |
| 137 | + "offsetSizeMode":[1,1,0,0], | |
| 138 | + "origin":"CENTER_BEGIN", | |
| 139 | + "anchorPoint":"CENTER_BEGIN" | |
| 140 | + } | |
| 141 | + }, | |
| 142 | + | |
| 143 | + "labelVisual":{ | |
| 144 | + "visualType":"TEXT", | |
| 145 | + "text":"Don't show again", | |
| 146 | + "pointSize":20, | |
| 147 | + "horizontalAlignment":"END", | |
| 148 | + "verticalAlignment":"CENTER", | |
| 149 | + "textColor":[1,1,1,1], | |
| 150 | + "mixColor":[0, 0, 0, 1], | |
| 151 | + "transform":{ | |
| 152 | + "size":[0.9, 0.9], | |
| 153 | + "offset":[-30,0], | |
| 154 | + "offsetSizeMode":[1,1,0,0], | |
| 155 | + "origin":"CENTER_END", | |
| 156 | + "anchorPoint":"CENTER_END" | |
| 157 | + } | |
| 177 | 158 | } |
| 178 | - } | |
| 179 | - }, | |
| 180 | - { | |
| 181 | - "target":"backgroundVisual", | |
| 182 | - "property":"mixColor", | |
| 183 | - "initialValue":[1,1,1,0], | |
| 184 | - "targetValue":[1,1,1,1], | |
| 185 | - "animator": | |
| 159 | + }, | |
| 160 | + | |
| 161 | + "states": | |
| 186 | 162 | { |
| 187 | - "alphaFunction":"EASE_OUT_BACK", | |
| 188 | - "timePeriod": | |
| 163 | + "CHECKED": | |
| 189 | 164 | { |
| 190 | - "duration":0.8, | |
| 191 | - "delay":0 | |
| 192 | - } | |
| 193 | - } | |
| 194 | - }, | |
| 195 | - { | |
| 196 | - "target":"backgroundVisual", | |
| 197 | - "property":"size", | |
| 198 | - "initialValue":[0.9, 0.9], | |
| 199 | - "targetValue":[1, 1], | |
| 200 | - "animator": | |
| 201 | - { | |
| 202 | - "alphaFunction":"EASE_OUT_BACK", | |
| 203 | - "timePeriod": | |
| 204 | - { | |
| 205 | - "duration":0.8, | |
| 206 | - "delay":0 | |
| 207 | - } | |
| 208 | - } | |
| 209 | - }, | |
| 210 | - { | |
| 211 | - "target":"checkboxFgVisual", | |
| 212 | - "property":"size", | |
| 213 | - "initialValue":[0.09, 0.28], | |
| 214 | - "targetValue":[0.12, 0.37], | |
| 215 | - "animator": | |
| 216 | - { | |
| 217 | - "alphaFunction":"EASE_OUT_BACK", | |
| 218 | - "timePeriod": | |
| 165 | + "visuals": | |
| 166 | + { | |
| 167 | + "checkboxFgVisual":{ | |
| 168 | + "visualType":"IMAGE", | |
| 169 | + "url":"{STYLE_DIR}/images/Tick.png", | |
| 170 | + "transform":{ | |
| 171 | + "size":[0.09, 0.28], | |
| 172 | + "offset":[30,0], | |
| 173 | + "offsetSizeMode":[1,1,0,0], | |
| 174 | + "origin":"CENTER_BEGIN", | |
| 175 | + "anchorPoint":"CENTER_BEGIN" | |
| 176 | + } | |
| 177 | + } | |
| 178 | + }, | |
| 179 | + "entryTransition": | |
| 180 | + [ | |
| 181 | + { | |
| 182 | + "target":"checkboxFgVisual", | |
| 183 | + "property":"pixelArea", | |
| 184 | + "initialValue":[0.0, 0.0, 0.0, 1.0], | |
| 185 | + "targetValue":[0.0, 0.0, 1.0, 1.0], | |
| 186 | + "animator": | |
| 187 | + { | |
| 188 | + "alphaFunction":"EASE_IN", | |
| 189 | + "timePeriod": | |
| 190 | + { | |
| 191 | + "duration":0.4, | |
| 192 | + "delay":0 | |
| 193 | + } | |
| 194 | + } | |
| 195 | + }, | |
| 196 | + { | |
| 197 | + "target":"checkboxFgVisual", | |
| 198 | + "property":"size", | |
| 199 | + "initialValue":[0.0, 0.37], | |
| 200 | + "targetValue":[0.12, 0.37], | |
| 201 | + "animator": | |
| 202 | + { | |
| 203 | + "alphaFunction":"EASE_IN", | |
| 204 | + "timePeriod": | |
| 205 | + { | |
| 206 | + "duration":0.4, | |
| 207 | + "delay":0 | |
| 208 | + } | |
| 209 | + } | |
| 210 | + } | |
| 211 | + ], | |
| 212 | + "exitTransition": | |
| 213 | + [ | |
| 214 | + { | |
| 215 | + "target":"checkboxFgVisual", | |
| 216 | + "property":"pixelArea", | |
| 217 | + "initialValue":[0.0, 0.0, 1.0, 1.0], | |
| 218 | + "targetValue":[0.0, 0.0, 0.0, 1.0], | |
| 219 | + "animator": | |
| 220 | + { | |
| 221 | + "alphaFunction":"EASE_OUT", | |
| 222 | + "timePeriod": | |
| 223 | + { | |
| 224 | + "duration":0.4, | |
| 225 | + "delay":0 | |
| 226 | + } | |
| 227 | + } | |
| 228 | + }, | |
| 229 | + { | |
| 230 | + "target":"checkboxFgVisual", | |
| 231 | + "property":"size", | |
| 232 | + "targetValue":[0.0, 0.37], | |
| 233 | + "animator": | |
| 234 | + { | |
| 235 | + "alphaFunction":"EASE_OUT", | |
| 236 | + "timePeriod": | |
| 237 | + { | |
| 238 | + "duration":0.4, | |
| 239 | + "delay":0 | |
| 240 | + } | |
| 241 | + } | |
| 242 | + } | |
| 243 | + ] | |
| 244 | + }, | |
| 245 | + "UNCHECKED": | |
| 219 | 246 | { |
| 220 | - "duration":0.8, | |
| 221 | - "delay":0 | |
| 222 | 247 | } |
| 223 | 248 | } |
| 224 | 249 | }, |
| 250 | + //"FOCUSED" | |
| 251 | + "DISABLED": | |
| 225 | 252 | { |
| 226 | - "target":"labelVisual", | |
| 227 | - "property":"mixColor", | |
| 228 | - "initialValue":[0.2, 0.2, 0.2, 1.0], | |
| 229 | - "targetValue":[0, 0, 0, 1], | |
| 230 | - "animator": | |
| 253 | + "visuals": | |
| 231 | 254 | { |
| 232 | - "alphaFunction":"EASE_OUT_BACK", | |
| 233 | - "timePeriod": | |
| 234 | - { | |
| 235 | - "duration":0.8, | |
| 236 | - "delay":0 | |
| 255 | + "checkboxBgVisual":{ | |
| 256 | + "visualType":"IMAGE", | |
| 257 | + "url":"{STYLE_DIR}/images/CheckBg.png", | |
| 258 | + "transform":{ | |
| 259 | + "size":[0.09, 0.28], | |
| 260 | + "offset":[30,0], | |
| 261 | + "offsetSizeMode":[1,1,0,0], | |
| 262 | + "origin":"CENTER_BEGIN", | |
| 263 | + "anchorPoint":"CENTER_BEGIN" | |
| 264 | + } | |
| 265 | + }, | |
| 266 | + | |
| 267 | + "checkboxFgVisual":{ | |
| 268 | + "visualType":"IMAGE", | |
| 269 | + "url":"{STYLE_DIR}/images/Tick.png", | |
| 270 | + "transform":{ | |
| 271 | + "size":[0.09, 0.28], | |
| 272 | + "offset":[30,0], | |
| 273 | + "offsetSizeMode":[1,1,0,0], | |
| 274 | + "origin":"CENTER_BEGIN", | |
| 275 | + "anchorPoint":"CENTER_BEGIN" | |
| 276 | + } | |
| 277 | + }, | |
| 278 | + | |
| 279 | + "labelVisual":{ | |
| 280 | + "visualType":"TEXT", | |
| 281 | + "text":"Don't show again", | |
| 282 | + "pointSize":20, | |
| 283 | + "horizontalAlignment":"END", | |
| 284 | + "verticalAlignment":"CENTER", | |
| 285 | + "textColor":[1,1,1,1], | |
| 286 | + "mixColor":[0.3, 0.3, 0.3, 1], | |
| 287 | + "transform":{ | |
| 288 | + "size":[0.9, 0.9], | |
| 289 | + "offset":[-30,0], | |
| 290 | + "offsetSizeMode":[1,1,0,0], | |
| 291 | + "origin":"CENTER_END", | |
| 292 | + "anchorPoint":"CENTER_END" | |
| 293 | + } | |
| 237 | 294 | } |
| 238 | 295 | } |
| 239 | 296 | } |
| 240 | - ], | |
| 241 | - "inactiveTransition": | |
| 297 | + }, | |
| 298 | + "transitions": | |
| 242 | 299 | [ |
| 243 | 300 | { |
| 244 | - "target":"checkboxBgVisual", | |
| 245 | - "property":"size", | |
| 246 | - "initialValue":[0.12, 0.37], | |
| 247 | - "targetValue":[0.09, 0.28], | |
| 301 | + "from":"DISABLED", | |
| 302 | + "to":"NORMAL", | |
| 303 | + "visualName":"backgroundVisual", | |
| 304 | + "effect":"FADE_IN", | |
| 248 | 305 | "animator": |
| 249 | 306 | { |
| 250 | 307 | "alphaFunction":"EASE_OUT_BACK", |
| 251 | - "timePeriod": | |
| 252 | - { | |
| 253 | - "duration":0.8, | |
| 254 | - "delay":0 | |
| 255 | - } | |
| 308 | + "duration":0.8 | |
| 256 | 309 | } |
| 257 | 310 | }, |
| 258 | 311 | { |
| 259 | - "target":"backgroundVisual", | |
| 260 | - "property":"mixColor", | |
| 261 | - "targetValue":[1,1,1,0], | |
| 312 | + "from":"DISABLED", | |
| 313 | + "to":"NORMAL", | |
| 314 | + "visualName":"*", | |
| 262 | 315 | "animator": |
| 263 | 316 | { |
| 264 | 317 | "alphaFunction":"EASE_OUT_BACK", |
| 265 | - "timePeriod": | |
| 266 | - { | |
| 267 | - "duration":0.8, | |
| 268 | - "delay":0 | |
| 269 | - } | |
| 318 | + "duration":0.8 | |
| 270 | 319 | } |
| 271 | 320 | }, |
| 272 | 321 | { |
| 273 | - "target":"checkboxFgVisual", | |
| 274 | - "property":"size", | |
| 275 | - "initialValue":[0.12, 0.37], | |
| 276 | - "targetValue":[0.09, 0.28], | |
| 322 | + "from":"NORMAL", | |
| 323 | + "to":"DISABLED", | |
| 324 | + "visualName":"backgroundVisual", | |
| 325 | + "effect":"FADE_OUT", | |
| 277 | 326 | "animator": |
| 278 | 327 | { |
| 279 | 328 | "alphaFunction":"EASE_OUT_BACK", |
| 280 | - "timePeriod": | |
| 281 | - { | |
| 282 | - "duration":0.8, | |
| 283 | - "delay":0 | |
| 284 | - } | |
| 329 | + "duration":0.8 | |
| 285 | 330 | } |
| 286 | 331 | }, |
| 287 | 332 | { |
| 288 | - "target":"labelVisual", | |
| 289 | - "property":"mixColor", | |
| 290 | - "targetValue":[0.4, 0.4, 0.4, 1.0], | |
| 333 | + "from":"NORMAL", | |
| 334 | + "to":"DISABLED", | |
| 335 | + "visualName":"*", | |
| 291 | 336 | "animator": |
| 292 | 337 | { |
| 293 | 338 | "alphaFunction":"EASE_OUT_BACK", |
| 294 | - "timePeriod": | |
| 295 | - { | |
| 296 | - "duration":0.8, | |
| 297 | - "delay":0 | |
| 298 | - } | |
| 339 | + "duration":0.8 | |
| 299 | 340 | } |
| 300 | - }, | |
| 341 | + } | |
| 342 | + ] | |
| 343 | + }, | |
| 344 | + "BeatControl": | |
| 345 | + { | |
| 346 | + "beatVisual":{ | |
| 347 | + "visualType":"IMAGE", | |
| 348 | + "url":"{APPLICATION_RESOURCE_PATH}/images/Logo-for-demo.png" | |
| 349 | + }, | |
| 350 | + | |
| 351 | + "bounceTransition": | |
| 352 | + [ | |
| 301 | 353 | { |
| 302 | - "target":"backgroundVisual", | |
| 354 | + "target":"beatVisual", | |
| 303 | 355 | "property":"size", |
| 304 | - "targetValue":[0.9, 0.9], | |
| 356 | + "initialValue":[0.5, 0.5], | |
| 357 | + "targetValue":[0.75, 0.75], | |
| 305 | 358 | "animator": |
| 306 | 359 | { |
| 307 | - "alphaFunction":"EASE_OUT_BACK", | |
| 360 | + "alphaFunction":"BOUNCE", | |
| 308 | 361 | "timePeriod": |
| 309 | 362 | { |
| 310 | - "duration":0.8, | |
| 363 | + "duration":0.5, | |
| 311 | 364 | "delay":0 |
| 312 | 365 | } |
| 313 | 366 | } |
| 314 | 367 | } |
| 315 | 368 | ], |
| 316 | - "checkTransition": | |
| 369 | + | |
| 370 | + "leftTransition": | |
| 317 | 371 | [ |
| 318 | 372 | { |
| 319 | - "target":"checkboxFgVisual", | |
| 320 | - "property":"pixelArea", | |
| 321 | - "initialValue":[0.0, 0.0, 0.0, 1.0], | |
| 322 | - "targetValue":[0.0, 0.0, 1.0, 1.0], | |
| 323 | - "animator": | |
| 324 | - { | |
| 325 | - "alphaFunction":"EASE_IN", | |
| 326 | - "timePeriod": | |
| 327 | - { | |
| 328 | - "duration":0.4, | |
| 329 | - "delay":0 | |
| 330 | - } | |
| 331 | - } | |
| 332 | - }, | |
| 333 | - { | |
| 334 | - "target":"checkboxFgVisual", | |
| 335 | - "property":"size", | |
| 336 | - "initialValue":[0.0, 0.37], | |
| 337 | - "targetValue":[0.12, 0.37], | |
| 373 | + "target":"beatVisual", | |
| 374 | + "property":"offset", | |
| 375 | + "initialValue":[0, 0], | |
| 376 | + "targetValue":[0.25, 0], | |
| 338 | 377 | "animator": |
| 339 | 378 | { |
| 340 | - "alphaFunction":"EASE_IN", | |
| 379 | + "alphaFunction":"BOUNCE", | |
| 341 | 380 | "timePeriod": |
| 342 | 381 | { |
| 343 | - "duration":0.4, | |
| 382 | + "duration":0.5, | |
| 344 | 383 | "delay":0 |
| 345 | 384 | } |
| 346 | 385 | } |
| 347 | 386 | } |
| 348 | 387 | ], |
| 349 | - "uncheckTransition": | |
| 388 | + | |
| 389 | + "upTransition": | |
| 350 | 390 | [ |
| 351 | 391 | { |
| 352 | - "target":"checkboxFgVisual", | |
| 353 | - "property":"pixelArea", | |
| 354 | - "initialValue":[0.0, 0.0, 1.0, 1.0], | |
| 355 | - "targetValue":[0.0, 0.0, 0.0, 1.0], | |
| 392 | + "target":"beatVisual", | |
| 393 | + "property":"offset", | |
| 394 | + "initialValue":[0, 0], | |
| 395 | + "targetValue":[0, 0.25], | |
| 356 | 396 | "animator": |
| 357 | 397 | { |
| 358 | - "alphaFunction":"EASE_OUT", | |
| 398 | + "alphaFunction":"BOUNCE", | |
| 359 | 399 | "timePeriod": |
| 360 | 400 | { |
| 361 | - "duration":0.4, | |
| 401 | + "duration":0.5, | |
| 362 | 402 | "delay":0 |
| 363 | 403 | } |
| 364 | 404 | } |
| 365 | - }, | |
| 405 | + } | |
| 406 | + ], | |
| 407 | + | |
| 408 | + "fadeTransition": | |
| 409 | + [ | |
| 366 | 410 | { |
| 367 | - "target":"checkboxFgVisual", | |
| 368 | - "property":"size", | |
| 369 | - "targetValue":[0.0, 0.37], | |
| 411 | + "target":"beatVisual", | |
| 412 | + "property":"opacity", | |
| 413 | + "targetValue":0, | |
| 370 | 414 | "animator": |
| 371 | 415 | { |
| 372 | - "alphaFunction":"EASE_OUT", | |
| 416 | + "alphaFunction":"BOUNCE", | |
| 373 | 417 | "timePeriod": |
| 374 | 418 | { |
| 375 | - "duration":0.4, | |
| 419 | + "duration":0.8, | |
| 376 | 420 | "delay":0 |
| 377 | 421 | } |
| 378 | 422 | } | ... | ... |
shared/utility.h
| ... | ... | @@ -36,17 +36,6 @@ Dali::PixelData LoadPixelData( const char* imagePath, |
| 36 | 36 | return loader.GetPixelData(); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | -/** | |
| 40 | - * @deprecated, dont use this anymore | |
| 41 | - */ | |
| 42 | -Dali::Image LoadImage( const char* imagePath, | |
| 43 | - Dali::ImageDimensions size = Dali::ImageDimensions(), | |
| 44 | - Dali::FittingMode::Type fittingMode = Dali::FittingMode::DEFAULT, | |
| 45 | - Dali::SamplingMode::Type samplingMode = Dali::SamplingMode::DEFAULT ) | |
| 46 | -{ | |
| 47 | - return Dali::ResourceImage::New( imagePath, size, fittingMode, samplingMode ); | |
| 48 | -} | |
| 49 | - | |
| 50 | 39 | Dali::Texture LoadTexture( const char* imagePath, |
| 51 | 40 | Dali::ImageDimensions size = Dali::ImageDimensions(), |
| 52 | 41 | Dali::FittingMode::Type fittingMode = Dali::FittingMode::DEFAULT, |
| ... | ... | @@ -62,23 +51,6 @@ Dali::Texture LoadTexture( const char* imagePath, |
| 62 | 51 | return texture; |
| 63 | 52 | } |
| 64 | 53 | |
| 65 | -/** | |
| 66 | - * @brief Load an bitmap resource. | |
| 67 | - * @deprecated, dont use this anymore | |
| 68 | - * | |
| 69 | - * If it is required to scaled-down to no more than the stage dimensions, | |
| 70 | - * uses image scaling mode FittingMode::SCALE_TO_FILL to resize the image at | |
| 71 | - * load time to cover the entire stage with pixels with no borders, | |
| 72 | - * and filter mode BOX_THEN_LINEAR to sample the image with | |
| 73 | - * maximum quality. | |
| 74 | - */ | |
| 75 | - | |
| 76 | -Dali::Image LoadStageFillingImage( const char* imagePath ) | |
| 77 | -{ | |
| 78 | - Dali::Vector2 stageSize = Dali::Stage::GetCurrent().GetSize(); | |
| 79 | - return LoadImage( imagePath, Dali::ImageDimensions( stageSize.x, stageSize.y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); | |
| 80 | -} | |
| 81 | - | |
| 82 | 54 | Dali::Texture LoadStageFillingTexture( const char* imagePath ) |
| 83 | 55 | { |
| 84 | 56 | Dali::Vector2 stageSize = Dali::Stage::GetCurrent().GetSize(); | ... | ... |