diff --git a/com.samsung.dali-demo.xml b/com.samsung.dali-demo.xml index 419c188..41ea452 100644 --- a/com.samsung.dali-demo.xml +++ b/com.samsung.dali-demo.xml @@ -133,7 +133,7 @@ - + @@ -142,4 +142,10 @@ + + + + + + diff --git a/demo/dali-demo.cpp b/demo/dali-demo.cpp index 5f89db7..680ef8d 100644 --- a/demo/dali-demo.cpp +++ b/demo/dali-demo.cpp @@ -74,6 +74,8 @@ int main(int argc, char **argv) demo.AddExample(Example("image-view-svg.example", DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG)); demo.AddExample(Example("super-blur-bloom.example", DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM)); demo.AddExample(Example("tilt.example", DALI_DEMO_STR_TITLE_TILT_SENSOR)); + demo.AddExample(Example("effects-view.example", DALI_DEMO_STR_TITLE_EFFECTS_VIEW)); + demo.AddExample(Example("native-image-source.example", DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE)); demo.SortAlphabetically( true ); diff --git a/examples/effects-view/effects-view-example.cpp b/examples/effects-view/effects-view-example.cpp new file mode 100644 index 0000000..214f538 --- /dev/null +++ b/examples/effects-view/effects-view-example.cpp @@ -0,0 +1,263 @@ +// +// Copyright (c) 2016 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://floralicense.org/license/ +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// EXTERNAL INCLUDES + +// INTERNAL INCLUDES +#include "shared/view.h" + +#include +#include +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; + +namespace +{ +const char* const TITLE( "EffectsView: effect size = " ); +const char* TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" ); +const char* VIEW_SWAP_IMAGE( DEMO_IMAGE_DIR "icon-change.png" ); +const char* VIEW_SWAP_SELECTED_IMAGE( DEMO_IMAGE_DIR "icon-change-selected.png" ); +const char* TEST_IMAGE( DEMO_IMAGE_DIR "Kid1.svg" ); +} // namespace + +// This example illustrates the capabilities of the EffectsView container +// +class EffectsViewApp : public ConnectionTracker +{ +public: + + /** + * Constructor + */ + EffectsViewApp( Application& application ); + /** + * Destructor + */ + ~EffectsViewApp(); + +private: + + /** + * Initialisation. This method gets called once the main loop of application is up and running + */ + void OnAppInitialize( Application& application ); + + /** + * Create a effect view of drop shadow + * + * @param[in] type The type of effect to be performed by the EffectView. + * @param[in] viewSize Size of the effect view + * @param[in] effectSize The effect size used in image filters. + */ + EffectsView CreateEffectsView( EffectsView::EffectType type, const Vector2& viewSize, int effectSize ); + + /** + * Animate the effect offset and color properties. + * @param[in] effectsView The view whose properties to be animated. + */ + void AnimateEffectProperties( EffectsView& effectsView ); + + /** + * Set title onto the toolbar + * @param[in] effectSize The effect size value to be indicated on the title + */ + void SetTitle(int effectSize); + + /** + * Callback function to change the effect size. + * @param[in] button The button which triggered the callback. + */ + bool ChangeEffectSize( Button button ); + + /** + * Main key event handler + */ + void OnKeyEvent(const KeyEvent& event); + +private: + Application& mApplication; + Layer mContents; + Toolkit::Control mView; + Toolkit::ToolBar mToolBar; + EffectsView mDropShadowView; + EffectsView mEmbossView; + Toolkit::TextLabel mTitleActor; ///< The title on the toolbar + Vector2 mStageSize; + int mEffectSize; +}; + +EffectsViewApp::EffectsViewApp( Application& application ) +: mApplication( application ), + mEffectSize( 2 ) +{ + // Connect to the Application's Init signal + mApplication.InitSignal().Connect( this, &EffectsViewApp::OnAppInitialize ); +} + +EffectsViewApp::~EffectsViewApp() +{ + // Nothing to do here; +} + +void EffectsViewApp::OnAppInitialize( Application& application ) +{ + // The Init signal is received once (only) during the Application lifetime + + Stage stage = Stage::GetCurrent(); + stage.KeyEventSignal().Connect(this, &EffectsViewApp::OnKeyEvent); + stage.SetBackgroundColor( Color::WHITE ); + + mStageSize = stage.GetSize(); + + // Creates a default view with a default tool bar. + // The view is added to the stage. + mContents = DemoHelper::CreateView( application, mView, mToolBar, "", TOOLBAR_IMAGE, "" ); + + // Creates view change button. + Toolkit::PushButton viewButton = Toolkit::PushButton::New(); + viewButton.SetUnselectedImage( VIEW_SWAP_IMAGE ); + viewButton.SetSelectedImage( VIEW_SWAP_SELECTED_IMAGE ); + // Connects the view change button clicked signal to the OnView method. + viewButton.ClickedSignal().Connect( this, &EffectsViewApp::ChangeEffectSize ); + mToolBar.AddControl( viewButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); + + Vector2 effectsViewSize( mStageSize.width, mStageSize.height * 0.25f ); + mDropShadowView = CreateEffectsView( EffectsView::DROP_SHADOW, effectsViewSize, mEffectSize ); + mDropShadowView.SetParentOrigin( ParentOrigin::CENTER ); + mDropShadowView.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); + mDropShadowView.SetZ( -mStageSize.height * 0.1f ); + mContents.Add( mDropShadowView ); + + mEmbossView = CreateEffectsView( EffectsView::EMBOSS, effectsViewSize, mEffectSize ); + mEmbossView.SetParentOrigin( ParentOrigin::CENTER ); + mEmbossView.SetAnchorPoint( AnchorPoint::TOP_CENTER ); + mEmbossView.SetZ( mStageSize.height * 0.1f ); + mContents.Add( mEmbossView ); + + SetTitle( mEffectSize ); +} + + +EffectsView EffectsViewApp::CreateEffectsView( EffectsView::EffectType type, const Vector2& viewSize, int effectSize ) +{ + Toolkit::EffectsView effectsView = Toolkit::EffectsView::New(type); + // set control size + effectsView.SetSize( viewSize.width, viewSize.height ); + // set effect size property + effectsView.SetProperty( EffectsView::Property::EFFECT_SIZE, effectSize ); + + // Create some content + // text + std::string text = ( type == EffectsView::DROP_SHADOW) ? "Drop Shadow" : "Emboss"; + TextLabel textActor( TextLabel::New( text ) ); + textActor.SetParentOrigin( ParentOrigin::CENTER_LEFT ); + textActor.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); + textActor.SetSize( viewSize ); + textActor.SetPosition( viewSize.width*0.4f, viewSize.height*0.3f ); + textActor.SetProperty( TextLabel::Property::POINT_SIZE, DemoHelper::ScalePointSize(14.f) ); + effectsView.Add( textActor ); + + // image + ImageView icon = ImageView::New( TEST_IMAGE ); + icon.SetParentOrigin( ParentOrigin::CENTER_LEFT ); + icon.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); + icon.SetX( viewSize.width*0.1f ); + icon.SetSize( viewSize.height*0.8f, viewSize.height*0.8f ); + effectsView.Add( icon ); + + AnimateEffectProperties( effectsView ); + + return effectsView; +} + +void EffectsViewApp::AnimateEffectProperties( EffectsView& effectsView ) +{ + const float animationTime( 5.0f ); + Animation animation( Animation::New(animationTime) ); + + animation.AnimateTo( Property( effectsView, EffectsView::Property::EFFECT_OFFSET ), Vector3( 2.f,-2.f, 0.0f), TimePeriod(animationTime * 0.0f, animationTime * 0.2f) ); + animation.AnimateTo( Property( effectsView, EffectsView::Property::EFFECT_OFFSET ), Vector3(-2.f,-2.f, 0.0f), TimePeriod(animationTime * 0.2f, animationTime * 0.2f) ); + animation.AnimateTo( Property( effectsView, EffectsView::Property::EFFECT_OFFSET ), Vector3(-2.f, 2.f, 0.0f), TimePeriod(animationTime * 0.4f, animationTime * 0.2f) ); + animation.AnimateTo( Property( effectsView, EffectsView::Property::EFFECT_OFFSET ), Vector3( 4.f, 4.f, 0.0f), TimePeriod(animationTime * 0.6f, animationTime * 0.2f) ); + animation.AnimateTo( Property( effectsView, EffectsView::Property::EFFECT_OFFSET ), Vector3::ZERO, TimePeriod(animationTime * 0.8f, animationTime * 0.2f) ); + + effectsView.SetProperty( EffectsView::Property::EFFECT_COLOR, Color::BLACK ); + animation.AnimateTo( Property( effectsView, EffectsView::Property::EFFECT_COLOR ), Color::BLUE, TimePeriod(animationTime * 0.0f, animationTime * 0.33f) ); + animation.AnimateTo( Property( effectsView, EffectsView::Property::EFFECT_COLOR ), Color::RED, TimePeriod(animationTime * 0.33f, animationTime * 0.33f) ); + animation.AnimateTo( Property( effectsView, EffectsView::Property::EFFECT_COLOR ), Color::BLACK, TimePeriod(animationTime * 0.66f, animationTime * 0.34f)); + + animation.SetLooping( true ); + animation.Play(); +} + +void EffectsViewApp::SetTitle(int effectSize) +{ + std::ostringstream title; + title< +#include + +using namespace Dali; +using namespace Toolkit; + +namespace +{ + const std::string JPG_FILENAME = DEMO_IMAGE_DIR "gallery-medium-4.jpg"; +} + +// This example shows how to create and use a NativeImageSource as the target of the render task. +// +class NativeImageSourceController : public ConnectionTracker +{ +public: + + NativeImageSourceController( Application& application ) + : mApplication( application ) + { + // Connect to the Application's Init signal + mApplication.InitSignal().Connect( this, &NativeImageSourceController::Create ); + } + + ~NativeImageSourceController() + { + // Nothing to do here; + } + + // The Init signal is received once (only) during the Application lifetime + void Create( Application& application ) + { + // Get a handle to the stage + Stage stage = Stage::GetCurrent(); + stage.SetBackgroundColor( Color::WHITE ); + stage.KeyEventSignal().Connect(this, &NativeImageSourceController::OnKeyEvent); + + mButtonRefreshAlways = PushButton::New(); + mButtonRefreshAlways.SetTogglableButton( true ); + mButtonRefreshAlways.SetSelected( true ); + mButtonRefreshAlways.SetLabelText( "Refresh ALWAYS" ); + mButtonRefreshAlways.SetParentOrigin( ParentOrigin::TOP_LEFT ); + mButtonRefreshAlways.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + mButtonRefreshAlways.StateChangedSignal().Connect( this, &NativeImageSourceController::OnButtonSelected ); + stage.Add( mButtonRefreshAlways ); + + mButtonRefreshOnce = PushButton::New(); + mButtonRefreshOnce.SetLabelText( "Refresh ONCE" ); + mButtonRefreshOnce.SetParentOrigin( ParentOrigin::TOP_RIGHT ); + mButtonRefreshOnce.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); + mButtonRefreshOnce.ClickedSignal().Connect( this, &NativeImageSourceController::OnButtonSelected ); + stage.Add( mButtonRefreshOnce); + + CreateScene(); + } + + bool CreateScene() + { + Stage stage = Stage::GetCurrent(); + Vector2 stageSize = stage.GetSize(); + + float buttonHeight = 100.f; + mButtonRefreshAlways.SetSize( stageSize.x / 2.f, buttonHeight ); + mButtonRefreshOnce.SetSize( stageSize.x / 2.f, buttonHeight ); + + Vector2 imageSize( stageSize.x, (stageSize.y-buttonHeight)/2.f ); + + // Create the native image source + NativeImageSourcePtr nativeImageSourcePtr = NativeImageSource::New( imageSize.width, imageSize.height, NativeImageSource::COLOR_DEPTH_DEFAULT ); + + // Create a image view as source actor to be renderer to the native image source + Actor sourceActor = ImageView::New(JPG_FILENAME); + sourceActor.SetParentOrigin( ParentOrigin::CENTER); + sourceActor.SetAnchorPoint( AnchorPoint::CENTER ); + sourceActor.SetY( - (imageSize.height-buttonHeight)/2.f ); + stage.Add( sourceActor ); + + Animation animation = Animation::New(2.f); + Degree relativeRotationDegrees(90.0f); + Radian relativeRotationRadians(relativeRotationDegrees); + animation.AnimateTo( Property( sourceActor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ), AlphaFunction::LINEAR, TimePeriod(0.f, 0.5f)); + animation.AnimateBy( Property( sourceActor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ), AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f)); + animation.AnimateBy( Property( sourceActor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ), AlphaFunction::LINEAR, TimePeriod(1.f, 0.5f)); + animation.AnimateBy( Property( sourceActor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ), AlphaFunction::LINEAR, TimePeriod(1.5f, 0.5f)); + animation.SetLooping(true); + animation.Play(); + + // create a offscreen renderer task to render content into the native image source + FrameBufferImage targetBuffer = FrameBufferImage::New( *nativeImageSourcePtr ); + + CameraActor cameraActor = CameraActor::New(imageSize); + cameraActor.SetParentOrigin(ParentOrigin::TOP_CENTER); + cameraActor.SetParentOrigin( AnchorPoint::TOP_CENTER ); + cameraActor.SetY( buttonHeight + imageSize.height/2.f ); + stage.Add(cameraActor); + + RenderTaskList taskList = stage.GetRenderTaskList(); + mOffscreenRenderTask = taskList.CreateTask(); + mOffscreenRenderTask.SetSourceActor( sourceActor ); + mOffscreenRenderTask.SetClearColor( Color::WHITE ); + mOffscreenRenderTask.SetClearEnabled(true); + mOffscreenRenderTask.SetCameraActor(cameraActor); + mOffscreenRenderTask.GetCameraActor().SetInvertYAxis(true); + mOffscreenRenderTask.SetTargetFrameBuffer( targetBuffer ); + mOffscreenRenderTask.SetRefreshRate( RenderTask::REFRESH_ALWAYS ); + + // Display the native image on the screen + NativeImage nativeImage = NativeImage::New( *nativeImageSourcePtr ); + ImageView nativeImageView = ImageView::New( nativeImage ); + nativeImageView.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); + nativeImageView.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); + stage.Add( nativeImageView ); + + TextLabel textLabel1 = TextLabel::New( "Resource Image" ); + textLabel1.SetParentOrigin( ParentOrigin::TOP_CENTER ); + textLabel1.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); + nativeImageView.Add( textLabel1 ); + + TextLabel textLabel2 = TextLabel::New( "Native Image" ); + textLabel2.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); + textLabel2.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); + nativeImageView.Add( textLabel2 ); + + return false; + } + + bool OnButtonSelected( Toolkit::Button button ) + { + Toolkit::PushButton pushButton = Toolkit::PushButton::DownCast( button ); + if( pushButton == mButtonRefreshAlways ) + { + if( mButtonRefreshAlways.IsSelected() ) + { + mOffscreenRenderTask.SetRefreshRate( RenderTask::REFRESH_ALWAYS ); + } + else + { + mOffscreenRenderTask.SetRefreshRate( RenderTask::REFRESH_ONCE ); + } + } + else if( pushButton == mButtonRefreshOnce ) + { + if( mButtonRefreshAlways.IsSelected() ) + { + mButtonRefreshAlways.SetSelected( false ); + } + mOffscreenRenderTask.SetRefreshRate( RenderTask::REFRESH_ONCE ); + } + + return true; + } + + void OnKeyEvent(const KeyEvent& event) + { + if(event.state == KeyEvent::Down) + { + if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) ) + { + mApplication.Quit(); + } + } + } + +private: + Application& mApplication; + RenderTask mOffscreenRenderTask; + PushButton mButtonRefreshAlways; + PushButton mButtonRefreshOnce; + +}; + +void RunTest( Application& application ) +{ + NativeImageSourceController test( application ); + + application.MainLoop(); +} + +// Entry point for Linux & Tizen applications +// +int main( int argc, char **argv ) +{ + Application application = Application::New( &argc, &argv ); + + RunTest( application ); + + return 0; +} diff --git a/examples/page-turn-view/page-turn-view-example.cpp b/examples/page-turn-view/page-turn-view-example.cpp index d53cfa5..c7b15f8 100644 --- a/examples/page-turn-view/page-turn-view-example.cpp +++ b/examples/page-turn-view/page-turn-view-example.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -78,21 +79,21 @@ class PortraitPageFactory : public PageFactory return 10*NUMBER_OF_PORTRAIT_IMAGE + 1; } /** - * Create an image actor to represent a page. + * Create an image to represent a page. * @param[in] pageId The ID of the page to create. - * @return An image actor, or an uninitialized pointer if the ID is out of range. + * @return An image, or an uninitialized pointer if the ID is out of range. */ - virtual Actor NewPage( unsigned int pageId ) + virtual Image NewPage( unsigned int pageId ) { - ImageActor page; + Image page; if( pageId == 0 ) { - page = ImageActor::New( ResourceImage::New( BOOK_COVER_PORTRAIT ) ); + page = ResourceImage::New( BOOK_COVER_PORTRAIT ); } else { - page = ImageActor::New( ResourceImage::New( PAGE_IMAGES_PORTRAIT[ (pageId-1) % NUMBER_OF_PORTRAIT_IMAGE ] ) ); + page = ResourceImage::New( PAGE_IMAGES_PORTRAIT[ (pageId-1) % NUMBER_OF_PORTRAIT_IMAGE ] ); } return page; @@ -101,6 +102,7 @@ class PortraitPageFactory : public PageFactory class LandscapePageFactory : public PageFactory { + /** * Query the number of pages available from the factory. * The maximum available page has an ID of GetNumberOfPages()-1. @@ -110,29 +112,35 @@ class LandscapePageFactory : public PageFactory return 10*NUMBER_OF_LANDSCAPE_IMAGE / 2 + 1; } /** - * Create an image actor to represent a page. + * Create an image to represent a page. * @param[in] pageId The ID of the page to create. - * @return An image actor, or an uninitialized pointer if the ID is out of range. + * @return An image, or an uninitialized pointer if the ID is out of range. */ - virtual Actor NewPage( unsigned int pageId ) + virtual Image NewPage( unsigned int pageId ) { - ImageActor pageFront; - ImageActor pageBack; + if( mImageSize.GetWidth() == 0u || mImageSize.GetHeight() == 0u ) + { + mImageSize = ResourceImage::GetImageSize(BOOK_COVER_LANDSCAPE); + } + + ImageAtlas atlas = ImageAtlas::New( mImageSize.GetWidth()*2u, mImageSize.GetHeight(), Pixel::RGB888 ); + Vector4 textureRect; if( pageId == 0 ) { - pageFront = ImageActor::New( ResourceImage::New( BOOK_COVER_LANDSCAPE ) ); - pageBack = ImageActor::New( ResourceImage::New( BOOK_COVER_BACK_LANDSCAPE ) ); + atlas.Upload( textureRect, BOOK_COVER_LANDSCAPE, mImageSize ); + atlas.Upload( textureRect, BOOK_COVER_BACK_LANDSCAPE, mImageSize ); } else { unsigned int imageId = (pageId-1)*2; - pageFront = ImageActor::New( ResourceImage::New( PAGE_IMAGES_LANDSCAPE[ imageId % NUMBER_OF_LANDSCAPE_IMAGE ] ) ); - pageBack = ImageActor::New( ResourceImage::New( PAGE_IMAGES_LANDSCAPE[ (imageId+1) % NUMBER_OF_LANDSCAPE_IMAGE ] ) ); + atlas.Upload( textureRect, PAGE_IMAGES_LANDSCAPE[ imageId % NUMBER_OF_LANDSCAPE_IMAGE ], mImageSize ); + atlas.Upload( textureRect, PAGE_IMAGES_LANDSCAPE[ (imageId+1) % NUMBER_OF_LANDSCAPE_IMAGE ], mImageSize ); } - pageFront.Add(pageBack); - return pageFront; + return atlas.GetAtlas(); } + + ImageDimensions mImageSize; }; /** diff --git a/packaging/com.samsung.dali-demo.spec b/packaging/com.samsung.dali-demo.spec index f9a22e6..6a6e8d4 100755 --- a/packaging/com.samsung.dali-demo.spec +++ b/packaging/com.samsung.dali-demo.spec @@ -2,7 +2,7 @@ Name: com.samsung.dali-demo Summary: The OpenGLES Canvas Core Demo -Version: 1.1.29 +Version: 1.1.30 Release: 1 Group: System/Libraries License: Apache-2.0 diff --git a/resources/scripts/background.json b/resources/scripts/background.json index 3787dbb..62ffd08 100644 --- a/resources/scripts/background.json +++ b/resources/scripts/background.json @@ -16,52 +16,83 @@ */ { "stage": [ - // A TextLabel with a red background + // A TextLabel with a color background { "type": "TextLabel", "drawMode": "OVERLAY_2D", "text": "Hello World", - "parentOrigin": "TOP_CENTER", - "anchorPoint": "TOP_CENTER", + "parentOrigin": "TOP_LEFT", + "anchorPoint": "TOP_LEFT", "pointSize": 20, "horizontalAlignment": "CENTER", "verticalAlignment": "CENTER", - "widthResizePolicy":"FILL_TO_PARENT", + "widthResizePolicy":"SIZE_RELATIVE_TO_PARENT", "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", - "sizeModeFactor": [1,0.25,1], + "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], "background":{ "rendererType": "color", - "blendColor": [1, 0, 0, 1] + "blendColor": [ 0.8, 0, 0.2, 1 ] } }, - // A control with a yellow background + // A control with an SVG image { "type": "Control", "relayoutEnabled": false, - "parentOrigin": "CENTER", - "anchorPoint": "BOTTOM_CENTER", - "widthResizePolicy":"FILL_TO_PARENT", + "parentOrigin": "TOP_RIGHT", + "anchorPoint": "TOP_RIGHT", + "widthResizePolicy":"SIZE_RELATIVE_TO_PARENT", "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", - "sizeModeFactor": [1,0.25,1], - "background":{ - "rendererType": "color", - "blendColor": [1, 1, 0, 1] + "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], + "background": { + "rendererType": "svg", + "imageUrl": "{DEMO_IMAGE_DIR}Kid1.svg" + } + }, + + // A control with a border + { + "type": "Control", + "relayoutEnabled": false, + "parentOrigin": "CENTER_LEFT", + "anchorPoint": "CENTER_LEFT", + "widthResizePolicy":"SIZE_RELATIVE_TO_PARENT", + "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", + "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], + "background": { + "rendererType" : "border", + "borderColor" : [ 0.5, 0.5, 0.5, 1 ], + "borderSize" : 15.0 } }, - // A control with an image + // A control with a JPG image { "type": "Control", "relayoutEnabled": false, - "parentOrigin": "CENTER", - "anchorPoint": "TOP_CENTER", - "widthResizePolicy":"FILL_TO_PARENT", + "parentOrigin": "CENTER_RIGHT", + "anchorPoint": "CENTER_RIGHT", + "widthResizePolicy":"SIZE_RELATIVE_TO_PARENT", "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", - "sizeModeFactor": [1,0.25,1], + "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], "background": { "rendererType": "image", - "imageUrl": "{DEMO_IMAGE_DIR}button-background.png" + "imageUrl": "{DEMO_IMAGE_DIR}gallery-large-9.jpg" + } + }, + + // A control with a yellow background + { + "type": "Control", + "relayoutEnabled": false, + "parentOrigin": "BOTTOM_LEFT", + "anchorPoint": "BOTTOM_LEFT", + "widthResizePolicy":"SIZE_RELATIVE_TO_PARENT", + "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", + "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], + "background":{ + "rendererType": "color", + "blendColor": [ 1, 1, 0, 1 ] } }, @@ -69,24 +100,24 @@ { "type": "Control", "relayoutEnabled": false, - "parentOrigin": "BOTTOM_CENTER", - "anchorPoint": "BOTTOM_CENTER", - "widthResizePolicy":"FILL_TO_PARENT", + "parentOrigin": "BOTTOM_RIGHT", + "anchorPoint": "BOTTOM_RIGHT", + "widthResizePolicy":"SIZE_RELATIVE_TO_PARENT", "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", - "sizeModeFactor": [1,0.25,1], + "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], "background": { - "rendererType": "gradient", - "center": [ 0.5, 0.5 ], - "radius": 1.414, - "stopOffset": [ 0.0, 0.3, 0.6, 0.8, 1.0 ], - "stopColor": [ - [ 0.5, 0.78, 0.76, 1.0 ], - [ 0.77, 0.78, 0.28, 0.48 ], - [ 0.84, 0.15, 0.55, 0.75 ], - [ 0.5, 0.78, 0.76, 0.59 ], - [ 1.0, 1.0, 0.0, 1.0 ] - ] - } + "rendererType" : "gradient", + "startPosition" : [ -0.5, -0.5 ], + "endPosition": [ 0.5, 0.5 ], + "stopColor" : [ + [ 1.0, 0.0, 0.0, 1.0 ], + [ 1.0, 0.25, 0.0, 1.0 ], + [ 1.0, 0.5, 0.0, 1.0 ], + [ 1.0, 0.75, 0.0, 1.0 ], + [ 1.0, 1.0, 0.0, 1.0 ] + ], + "stopOffset" : [ 0, 0.25, 0.5, 0.75, 1.0 ] + } } ] } diff --git a/resources/scripts/gradient.json b/resources/scripts/gradient.json deleted file mode 100644 index 17e314c..0000000 --- a/resources/scripts/gradient.json +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -{ - // a tree of actors - "stage": [{ - "type": "Control", - "widthResizePolicy":"FILL_TO_PARENT", - "heightResizePolicy":"FILL_TO_PARENT", - "parentOrigin": "CENTER", - "anchorPoint": "CENTER", - "background": { - "rendererType" : "gradient", - "startPosition" : [-0.5, -0.5], - "endPosition": [0.5,0.5], - "stopColor" : [ - [1,0,0,1], - [1,0.25,0,1], - [1,0.5,0,1], - [1,0.75,0,1], - [1,1,0,1] - ], - "stopOffset" : [ 0, 0.25, 0.5, 0.75, 1.0 ] - } - }] -} diff --git a/shared/dali-demo-strings.h b/shared/dali-demo-strings.h index 8fadcf9..0cdf36e 100644 --- a/shared/dali-demo-strings.h +++ b/shared/dali-demo-strings.h @@ -62,6 +62,7 @@ extern "C" #define DALI_DEMO_STR_TITLE_LINE_MESH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_LINE_MESH") #define DALI_DEMO_STR_TITLE_COLOR_GRADIENT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_COLOR_GRADIENT") #define DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_SUPER_BLUR_BLOOM") +#define DALI_DEMO_STR_TITLE_EFFECTS_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_EFFECTS_VIEW") #else // !INTERNATIONALIZATION_ENABLED @@ -102,6 +103,8 @@ extern "C" #define DALI_DEMO_STR_TITLE_IMAGE_VIEW_ALPHA_BLENDING "Image View Alpha Blending" #define DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG "Image View SVG" #define DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM "Super Blur and Bloom" +#define DALI_DEMO_STR_TITLE_EFFECTS_VIEW "Effects View" +#define DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE "Native Image Source" #endif