Commit a70ecbcb1da52ba43a31e6412d7e476e74338a2e
[dali_1.1.42] Merge branch 'devel/master'
Change-Id: I904cf0c597f9e16c83518e805099ae3cd34f3be6
Showing
33 changed files
with
329 additions
and
297 deletions
demo/dali-table-view.cpp
| @@ -485,7 +485,6 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit | @@ -485,7 +485,6 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit | ||
| 485 | Toolkit::ImageView DaliTableView::NewStencilImage() | 485 | Toolkit::ImageView DaliTableView::NewStencilImage() |
| 486 | { | 486 | { |
| 487 | Toolkit::ImageView stencil = ImageView::New( TILE_BACKGROUND_ALPHA ); | 487 | Toolkit::ImageView stencil = ImageView::New( TILE_BACKGROUND_ALPHA ); |
| 488 | - | ||
| 489 | stencil.SetParentOrigin( ParentOrigin::CENTER ); | 488 | stencil.SetParentOrigin( ParentOrigin::CENTER ); |
| 490 | stencil.SetAnchorPoint( AnchorPoint::CENTER ); | 489 | stencil.SetAnchorPoint( AnchorPoint::CENTER ); |
| 491 | stencil.SetDrawMode( DrawMode::STENCIL ); | 490 | stencil.SetDrawMode( DrawMode::STENCIL ); |
| @@ -717,6 +716,7 @@ void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage dis | @@ -717,6 +716,7 @@ void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage dis | ||
| 717 | Dali::Property::Map effect = Toolkit::CreateDistanceFieldEffect(); | 716 | Dali::Property::Map effect = Toolkit::CreateDistanceFieldEffect(); |
| 718 | dfActor.SetProperty( Toolkit::ImageView::Property::IMAGE, effect ); | 717 | dfActor.SetProperty( Toolkit::ImageView::Property::IMAGE, effect ); |
| 719 | dfActor.SetColor( BUBBLE_COLOR[ i%NUMBER_OF_BUBBLE_COLOR ] ); | 718 | dfActor.SetColor( BUBBLE_COLOR[ i%NUMBER_OF_BUBBLE_COLOR ] ); |
| 719 | + | ||
| 720 | layer.Add( dfActor ); | 720 | layer.Add( dfActor ); |
| 721 | } | 721 | } |
| 722 | 722 | ||
| @@ -790,8 +790,7 @@ void DaliTableView::GenerateCircle( const Size& size, std::vector< unsigned char | @@ -790,8 +790,7 @@ void DaliTableView::GenerateCircle( const Size& size, std::vector< unsigned char | ||
| 790 | 790 | ||
| 791 | ImageView DaliTableView::CreateLogo( std::string imagePath ) | 791 | ImageView DaliTableView::CreateLogo( std::string imagePath ) |
| 792 | { | 792 | { |
| 793 | - Image image = ResourceImage::New( imagePath ); | ||
| 794 | - ImageView logo = ImageView::New( image ); | 793 | + ImageView logo = ImageView::New( imagePath ); |
| 795 | 794 | ||
| 796 | logo.SetAnchorPoint( AnchorPoint::CENTER ); | 795 | logo.SetAnchorPoint( AnchorPoint::CENTER ); |
| 797 | logo.SetParentOrigin( ParentOrigin::CENTER ); | 796 | logo.SetParentOrigin( ParentOrigin::CENTER ); |
demo/dali-table-view.h
| @@ -159,7 +159,7 @@ private: // Application callbacks & implementation | @@ -159,7 +159,7 @@ private: // Application callbacks & implementation | ||
| 159 | * Signal emitted when any tile has been pressed | 159 | * Signal emitted when any tile has been pressed |
| 160 | * | 160 | * |
| 161 | * @param[in] actor The Actor representing this tile. | 161 | * @param[in] actor The Actor representing this tile. |
| 162 | - * @param[in] event The TouchEvent | 162 | + * @param[in] event The Touch information. |
| 163 | * | 163 | * |
| 164 | * @return Consume flag | 164 | * @return Consume flag |
| 165 | */ | 165 | */ |
| @@ -220,7 +220,7 @@ private: // Application callbacks & implementation | @@ -220,7 +220,7 @@ private: // Application callbacks & implementation | ||
| 220 | * (other than those touches consumed by OnTilePressed) | 220 | * (other than those touches consumed by OnTilePressed) |
| 221 | * | 221 | * |
| 222 | * @param[in] actor The Actor touched. | 222 | * @param[in] actor The Actor touched. |
| 223 | - * @param[in] event The TouchEvent | 223 | + * @param[in] event The Touch information. |
| 224 | * | 224 | * |
| 225 | * @return Consume flag | 225 | * @return Consume flag |
| 226 | */ | 226 | */ |
emscripten-examples/dali-toy.js
| @@ -1583,7 +1583,7 @@ var javascriptSources = | @@ -1583,7 +1583,7 @@ var javascriptSources = | ||
| 1583 | "\n" + | 1583 | "\n" + |
| 1584 | "function onTouched(actor, e) {\n" + | 1584 | "function onTouched(actor, e) {\n" + |
| 1585 | " for(var i = 0; i < e.points.length; i++) {\n" + | 1585 | " for(var i = 0; i < e.points.length; i++) {\n" + |
| 1586 | - " if(e.points[i].state === \"Down\") {\n" + | 1586 | + " if(e.points[i].state === \"DOWN\") {\n" + |
| 1587 | " console.log(e);\n" + | 1587 | " console.log(e);\n" + |
| 1588 | " animation.play();\n" + | 1588 | " animation.play();\n" + |
| 1589 | " return;\n" + | 1589 | " return;\n" + |
| @@ -1591,7 +1591,7 @@ var javascriptSources = | @@ -1591,7 +1591,7 @@ var javascriptSources = | ||
| 1591 | " }\n" + | 1591 | " }\n" + |
| 1592 | "}\n" + | 1592 | "}\n" + |
| 1593 | "\n" + | 1593 | "\n" + |
| 1594 | - "actor2.connect(\"touched\", onTouched);\n" + | 1594 | + "actor2.connect(\"touch\", onTouched);\n" + |
| 1595 | "\n" + | 1595 | "\n" + |
| 1596 | "\n" + | 1596 | "\n" + |
| 1597 | "" | 1597 | "" |
| @@ -3843,7 +3843,7 @@ function path() { | @@ -3843,7 +3843,7 @@ function path() { | ||
| 3843 | } | 3843 | } |
| 3844 | 3844 | ||
| 3845 | // conditional animation | 3845 | // conditional animation |
| 3846 | -// when("myimage", condition("touched", "inside", 0, 100), | 3846 | +// when("myimage", condition("touch", "inside", 0, 100), |
| 3847 | // | 3847 | // |
| 3848 | function condition(propertyName, conditionType, arg0, arg1) | 3848 | function condition(propertyName, conditionType, arg0, arg1) |
| 3849 | { | 3849 | { |
| @@ -4108,7 +4108,7 @@ function _makeCallback(args) { | @@ -4108,7 +4108,7 @@ function _makeCallback(args) { | ||
| 4108 | // then("play", "myanim"), | 4108 | // then("play", "myanim"), |
| 4109 | // thenOnChild("myimage", "child", "hide"), | 4109 | // thenOnChild("myimage", "child", "hide"), |
| 4110 | // animate("name"), | 4110 | // animate("name"), |
| 4111 | -// animateTo("position", | 4111 | +// animateTo("position", |
| 4112 | // ) | 4112 | // ) |
| 4113 | function doNow(args) { | 4113 | function doNow(args) { |
| 4114 | "use strict"; | 4114 | "use strict"; |
| @@ -4121,10 +4121,10 @@ function doNow(args) { | @@ -4121,10 +4121,10 @@ function doNow(args) { | ||
| 4121 | 4121 | ||
| 4122 | function _makeSensibleTouched(func, state) { // dali giving all mouse events on touched signal --- is this correct?? @todo | 4122 | function _makeSensibleTouched(func, state) { // dali giving all mouse events on touched signal --- is this correct?? @todo |
| 4123 | "use strict"; | 4123 | "use strict"; |
| 4124 | - return function(actor, touchEvent){ | 4124 | + return function(actor, touch){ |
| 4125 | var doit = false; | 4125 | var doit = false; |
| 4126 | - for(var i = 0; i < touchEvent.points.length; i++) { | ||
| 4127 | - if(touchEvent.points[i].state === state) { | 4126 | + for(var i = 0; i < touch.points.length; i++) { |
| 4127 | + if(touch.points[i].state === state) { | ||
| 4128 | doit = true; | 4128 | doit = true; |
| 4129 | break; | 4129 | break; |
| 4130 | } | 4130 | } |
| @@ -4142,7 +4142,7 @@ function _makeSensibleTouched(func, state) { // dali giving all mouse events on | @@ -4142,7 +4142,7 @@ function _makeSensibleTouched(func, state) { // dali giving all mouse events on | ||
| 4142 | 4142 | ||
| 4143 | // if( signalName === "touchedDown" ) { // fix as touched signal is really "mouseState"? | 4143 | // if( signalName === "touchedDown" ) { // fix as touched signal is really "mouseState"? |
| 4144 | // f = _makeSensibleTouchedDown(func); | 4144 | // f = _makeSensibleTouchedDown(func); |
| 4145 | -// signalName = "touched"; | 4145 | +// signalName = "touch"; |
| 4146 | // } | 4146 | // } |
| 4147 | 4147 | ||
| 4148 | // for(var ai = 0; ai < actors.length; ai++) { | 4148 | // for(var ai = 0; ai < actors.length; ai++) { |
| @@ -4152,9 +4152,9 @@ function _makeSensibleTouched(func, state) { // dali giving all mouse events on | @@ -4152,9 +4152,9 @@ function _makeSensibleTouched(func, state) { // dali giving all mouse events on | ||
| 4152 | // } | 4152 | // } |
| 4153 | 4153 | ||
| 4154 | 4154 | ||
| 4155 | -// when("myimage", condition("touched", "inside", 0, 100), | 4155 | +// when("myimage", condition("touch", "inside", 0, 100), |
| 4156 | // or | 4156 | // or |
| 4157 | -// when("myimage", "touched", | 4157 | +// when("myimage", "touch", |
| 4158 | // call(myfunction), | 4158 | // call(myfunction), |
| 4159 | // call(myfunction, arg1), | 4159 | // call(myfunction, arg1), |
| 4160 | // and("animation-ends"), | 4160 | // and("animation-ends"), |
| @@ -4206,32 +4206,28 @@ function when() { | @@ -4206,32 +4206,28 @@ function when() { | ||
| 4206 | f = _makeCallback(arguments); | 4206 | f = _makeCallback(arguments); |
| 4207 | 4207 | ||
| 4208 | if( signal === "touchedDown" ) { // fix as touched signal is really "mouseState"? | 4208 | if( signal === "touchedDown" ) { // fix as touched signal is really "mouseState"? |
| 4209 | - f = _makeSensibleTouched(f, "Down"); | ||
| 4210 | - signal = "touched"; | 4209 | + f = _makeSensibleTouched(f, "DOWN"); |
| 4210 | + signal = "touch"; | ||
| 4211 | } | 4211 | } |
| 4212 | if( signal === "touchedUp" ) { // fix as touched signal is really "mouseState"? | 4212 | if( signal === "touchedUp" ) { // fix as touched signal is really "mouseState"? |
| 4213 | - f = _makeSensibleTouched(f, "Up"); | ||
| 4214 | - signal = "touched"; | 4213 | + f = _makeSensibleTouched(f, "UP"); |
| 4214 | + signal = "touch"; | ||
| 4215 | } | 4215 | } |
| 4216 | if( signal === "touchedMotion" ) { // fix as touched signal is really "mouseState"? | 4216 | if( signal === "touchedMotion" ) { // fix as touched signal is really "mouseState"? |
| 4217 | - f = _makeSensibleTouched(f, "Motion"); | ||
| 4218 | - signal = "touched"; | 4217 | + f = _makeSensibleTouched(f, "MOTION"); |
| 4218 | + signal = "touch"; | ||
| 4219 | } | 4219 | } |
| 4220 | if( signal === "touchedLeave" ) { // fix as touched signal is really "mouseState"? | 4220 | if( signal === "touchedLeave" ) { // fix as touched signal is really "mouseState"? |
| 4221 | - f = _makeSensibleTouched(f, "Leave"); | ||
| 4222 | - signal = "touched"; | 4221 | + f = _makeSensibleTouched(f, "LEAVE"); |
| 4222 | + signal = "touch"; | ||
| 4223 | } | 4223 | } |
| 4224 | if( signal === "touchedStationary" ) { // fix as touched signal is really "mouseState"? | 4224 | if( signal === "touchedStationary" ) { // fix as touched signal is really "mouseState"? |
| 4225 | - f = _makeSensibleTouched(f, "Stationary"); | ||
| 4226 | - signal = "touched"; | 4225 | + f = _makeSensibleTouched(f, "STATIONARY"); |
| 4226 | + signal = "touch"; | ||
| 4227 | } | 4227 | } |
| 4228 | if( signal === "touchedInterrupted" ) { // fix as touched signal is really "mouseState"? | 4228 | if( signal === "touchedInterrupted" ) { // fix as touched signal is really "mouseState"? |
| 4229 | - f = _makeSensibleTouched(f, "Interrupted"); | ||
| 4230 | - signal = "touched"; | ||
| 4231 | - } | ||
| 4232 | - if( signal === "touchedLast" ) { // fix as touched signal is really "mouseState"? | ||
| 4233 | - f = _makeSensibleTouched(f, "Last"); | ||
| 4234 | - signal = "touched"; | 4229 | + f = _makeSensibleTouched(f, "INTERRUPTED"); |
| 4230 | + signal = "touch"; | ||
| 4235 | } | 4231 | } |
| 4236 | 4232 | ||
| 4237 | for(ai = 0; ai < actors.length; ai++) { | 4233 | for(ai = 0; ai < actors.length; ai++) { |
| @@ -4253,9 +4249,9 @@ function when() { | @@ -4253,9 +4249,9 @@ function when() { | ||
| 4253 | } | 4249 | } |
| 4254 | } | 4250 | } |
| 4255 | 4251 | ||
| 4256 | -// when("myimage", condition("touched", "inside", 0, 100), | 4252 | +// when("myimage", condition("touch", "inside", 0, 100), |
| 4257 | // or | 4253 | // or |
| 4258 | -// when("myimage", "touched", | 4254 | +// when("myimage", "touch", |
| 4259 | // *** | 4255 | // *** |
| 4260 | // dali.ActorWrapper.prototype.connect = function(signalName, callback) { | 4256 | // dali.ActorWrapper.prototype.connect = function(signalName, callback) { |
| 4261 | // if(d.action === "set") { | 4257 | // if(d.action === "set") { |
| @@ -4399,9 +4395,9 @@ function when() { | @@ -4399,9 +4395,9 @@ function when() { | ||
| 4399 | // ) | 4395 | // ) |
| 4400 | // ) | 4396 | // ) |
| 4401 | 4397 | ||
| 4402 | -// when("myimage", condition("touched", "inside", 0, 100), | 4398 | +// when("myimage", condition("touch", "inside", 0, 100), |
| 4403 | // or | 4399 | // or |
| 4404 | -// when("myimage", "touched", | 4400 | +// when("myimage", "touch", |
| 4405 | // call(myfunction), | 4401 | // call(myfunction), |
| 4406 | // call(myfunction, arg1), | 4402 | // call(myfunction, arg1), |
| 4407 | // and("animation-ends"), | 4403 | // and("animation-ends"), |
| @@ -4690,25 +4686,25 @@ Test.prototype.hierarchy = function() { | @@ -4690,25 +4686,25 @@ Test.prototype.hierarchy = function() { | ||
| 4690 | dali.stage.add(actor); | 4686 | dali.stage.add(actor); |
| 4691 | 4687 | ||
| 4692 | var hello = new dali.Actor(); | 4688 | var hello = new dali.Actor(); |
| 4693 | - // hello.connect("touched", onTouched); | 4689 | + // hello.connect("touch", onTouched); |
| 4694 | hello.text = "hello"; | 4690 | hello.text = "hello"; |
| 4695 | hello.name = hello.text; | 4691 | hello.name = hello.text; |
| 4696 | actor.add(hello); | 4692 | actor.add(hello); |
| 4697 | 4693 | ||
| 4698 | var hellochild = new dali.Actor(); | 4694 | var hellochild = new dali.Actor(); |
| 4699 | - // hellochild.connect("touched", onTouched); | 4695 | + // hellochild.connect("touch", onTouched); |
| 4700 | hellochild.text = "hello-child"; | 4696 | hellochild.text = "hello-child"; |
| 4701 | hellochild.name = hellochild.text; | 4697 | hellochild.name = hellochild.text; |
| 4702 | hello.add(hellochild); | 4698 | hello.add(hellochild); |
| 4703 | 4699 | ||
| 4704 | var hellochild2 = new dali.Actor(); | 4700 | var hellochild2 = new dali.Actor(); |
| 4705 | - // hellochild2.connect("touched", onTouched); | 4701 | + // hellochild2.connect("touch", onTouched); |
| 4706 | hellochild2.text = "hello-child2"; | 4702 | hellochild2.text = "hello-child2"; |
| 4707 | hellochild2.name = hellochild2.text; | 4703 | hellochild2.name = hellochild2.text; |
| 4708 | hello.add(hellochild2); | 4704 | hello.add(hellochild2); |
| 4709 | 4705 | ||
| 4710 | var hellochildchild = new dali.Actor(); | 4706 | var hellochildchild = new dali.Actor(); |
| 4711 | - // hellochildchild.connect("touched", onTouched); | 4707 | + // hellochildchild.connect("touch", onTouched); |
| 4712 | hellochildchild.text = "hello-child-child1"; | 4708 | hellochildchild.text = "hello-child-child1"; |
| 4713 | hellochildchild.name = "hello-child-child1"; | 4709 | hellochildchild.name = "hello-child-child1"; |
| 4714 | hellochildchild.name = hellochildchild.text; | 4710 | hellochildchild.name = hellochildchild.text; |
| @@ -4747,7 +4743,7 @@ Test.prototype.hierarchy = function() { | @@ -4747,7 +4743,7 @@ Test.prototype.hierarchy = function() { | ||
| 4747 | 4743 | ||
| 4748 | assert(root.findChildByName("none") === null); | 4744 | assert(root.findChildByName("none") === null); |
| 4749 | 4745 | ||
| 4750 | - // actor.connect("touched", onTouched); | 4746 | + // actor.connect("touch", onTouched); |
| 4751 | 4747 | ||
| 4752 | // var inserted = new dali.TextActor(); // TextActor no more RIP | 4748 | // var inserted = new dali.TextActor(); // TextActor no more RIP |
| 4753 | // inserted.parentOrigin = [0.5, 0.5, 0.5]; | 4749 | // inserted.parentOrigin = [0.5, 0.5, 0.5]; |
examples/blocks/blocks-example.cpp
| @@ -362,6 +362,17 @@ private: | @@ -362,6 +362,17 @@ private: | ||
| 362 | 362 | ||
| 363 | mBrickCount = 0; | 363 | mBrickCount = 0; |
| 364 | 364 | ||
| 365 | + if( mBrickImageMap.Empty() ) | ||
| 366 | + { | ||
| 367 | + Vector2 stageSize(Stage::GetCurrent().GetSize()); | ||
| 368 | + const Vector2 brickSize(BRICK_SIZE * Vector2(stageSize.x, stageSize.x)); | ||
| 369 | + | ||
| 370 | + mBrickImageMap["desiredWidth"] = static_cast<int>( brickSize.width ); | ||
| 371 | + mBrickImageMap["desiredHeight"] = static_cast<int>( brickSize.height ); | ||
| 372 | + mBrickImageMap["fittingMode"] = "SCALE_TO_FILL"; | ||
| 373 | + mBrickImageMap["samplingMode"] = "BOX_THEN_LINEAR"; | ||
| 374 | + } | ||
| 375 | + | ||
| 365 | switch(level%TOTAL_LEVELS) | 376 | switch(level%TOTAL_LEVELS) |
| 366 | { | 377 | { |
| 367 | case 0: | 378 | case 0: |
| @@ -519,14 +530,11 @@ private: | @@ -519,14 +530,11 @@ private: | ||
| 519 | */ | 530 | */ |
| 520 | Actor CreateBrick( const Vector2& position, int type ) | 531 | Actor CreateBrick( const Vector2& position, int type ) |
| 521 | { | 532 | { |
| 522 | - Vector2 stageSize(Stage::GetCurrent().GetSize()); | ||
| 523 | - const Vector2 brickSize(BRICK_SIZE * Vector2(stageSize.x, stageSize.x)); | ||
| 524 | - | ||
| 525 | - Image img = ResourceImage::New( BRICK_IMAGE_PATH[type], Dali::ImageDimensions( 128, 64 ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); | ||
| 526 | - ImageView brick = ImageView::New(img); | 533 | + mBrickImageMap["url"] = BRICK_IMAGE_PATH[type]; |
| 534 | + ImageView brick = ImageView::New(); | ||
| 535 | + brick.SetProperty( ImageView::Property::IMAGE, mBrickImageMap ); | ||
| 527 | brick.SetParentOrigin(ParentOrigin::TOP_LEFT); | 536 | brick.SetParentOrigin(ParentOrigin::TOP_LEFT); |
| 528 | brick.SetAnchorPoint(AnchorPoint::CENTER); | 537 | brick.SetAnchorPoint(AnchorPoint::CENTER); |
| 529 | - brick.SetSize( brickSize ); | ||
| 530 | brick.SetPosition( Vector3( position ) ); | 538 | brick.SetPosition( Vector3( position ) ); |
| 531 | 539 | ||
| 532 | // Add a constraint on the brick between it and the ball generating a collision-property | 540 | // Add a constraint on the brick between it and the ball generating a collision-property |
| @@ -815,6 +823,7 @@ private: | @@ -815,6 +823,7 @@ private: | ||
| 815 | Animation mWobbleAnimation; ///< Paddle's animation when hit (wobbles) | 823 | Animation mWobbleAnimation; ///< Paddle's animation when hit (wobbles) |
| 816 | Property::Index mWobbleProperty; ///< The wobble property (generated from animation) | 824 | Property::Index mWobbleProperty; ///< The wobble property (generated from animation) |
| 817 | Actor mLevelContainer; ///< The level container (contains bricks) | 825 | Actor mLevelContainer; ///< The level container (contains bricks) |
| 826 | + Property::Map mBrickImageMap; ///< The property map used to load the brick | ||
| 818 | 827 | ||
| 819 | // actor - dragging functionality | 828 | // actor - dragging functionality |
| 820 | 829 |
examples/bubble-effect/bubble-effect-example.cpp
| @@ -19,6 +19,7 @@ | @@ -19,6 +19,7 @@ | ||
| 19 | #include <dali-toolkit/dali-toolkit.h> | 19 | #include <dali-toolkit/dali-toolkit.h> |
| 20 | #include <dali-toolkit/devel-api/controls/bubble-effect/bubble-emitter.h> | 20 | #include <dali-toolkit/devel-api/controls/bubble-effect/bubble-emitter.h> |
| 21 | #include "shared/view.h" | 21 | #include "shared/view.h" |
| 22 | +#include "shared/utility.h" | ||
| 22 | 23 | ||
| 23 | using namespace Dali; | 24 | using namespace Dali; |
| 24 | 25 | ||
| @@ -53,20 +54,6 @@ const unsigned int NUM_BUBBLE_SHAPE_IMAGES( sizeof( BUBBLE_SHAPE_IMAGES ) / size | @@ -53,20 +54,6 @@ const unsigned int NUM_BUBBLE_SHAPE_IMAGES( sizeof( BUBBLE_SHAPE_IMAGES ) / size | ||
| 53 | const Vector2 DEFAULT_BUBBLE_SIZE( 10.f, 30.f ); | 54 | const Vector2 DEFAULT_BUBBLE_SIZE( 10.f, 30.f ); |
| 54 | const unsigned int DEFAULT_NUMBER_OF_BUBBLES( 1000 ); | 55 | const unsigned int DEFAULT_NUMBER_OF_BUBBLES( 1000 ); |
| 55 | 56 | ||
| 56 | -/** | ||
| 57 | - * @brief Load an image, scaled-down to no more than the stage dimensions. | ||
| 58 | - * | ||
| 59 | - * Uses image scaling mode FittingMode::SCALE_TO_FILL to resize the image at | ||
| 60 | - * load time to cover the entire stage with pixels with no borders, | ||
| 61 | - * and filter mode BOX_THEN_LINEAR to sample the image with | ||
| 62 | - * maximum quality. | ||
| 63 | - */ | ||
| 64 | -ResourceImage LoadStageFillingImage( const char * const imagePath ) | ||
| 65 | -{ | ||
| 66 | - Size stageSize = Stage::GetCurrent().GetSize(); | ||
| 67 | - return ResourceImage::New( imagePath, Dali::ImageDimensions( stageSize.x, stageSize.y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); | ||
| 68 | -} | ||
| 69 | - | ||
| 70 | }// end LOCAL_STUFF | 57 | }// end LOCAL_STUFF |
| 71 | 58 | ||
| 72 | // This example shows the usage of BubbleEmitter which displays lots of moving bubbles on the stage. | 59 | // This example shows the usage of BubbleEmitter which displays lots of moving bubbles on the stage. |
| @@ -130,10 +117,10 @@ private: | @@ -130,10 +117,10 @@ private: | ||
| 130 | 117 | ||
| 131 | // Create and initialize the BubbleEmitter object | 118 | // Create and initialize the BubbleEmitter object |
| 132 | mBubbleEmitter = Toolkit::BubbleEmitter::New( stageSize, | 119 | mBubbleEmitter = Toolkit::BubbleEmitter::New( stageSize, |
| 133 | - ResourceImage::New( BUBBLE_SHAPE_IMAGES[mCurrentBubbleShapeImageId] ), | 120 | + DemoHelper::LoadImage( BUBBLE_SHAPE_IMAGES[mCurrentBubbleShapeImageId] ), |
| 134 | DEFAULT_NUMBER_OF_BUBBLES, | 121 | DEFAULT_NUMBER_OF_BUBBLES, |
| 135 | DEFAULT_BUBBLE_SIZE); | 122 | DEFAULT_BUBBLE_SIZE); |
| 136 | - mBackgroundImage = LoadStageFillingImage( BACKGROUND_IMAGES[mCurrentBackgroundImageId] ); | 123 | + mBackgroundImage = DemoHelper::LoadStageFillingImage( BACKGROUND_IMAGES[mCurrentBackgroundImageId] ); |
| 137 | mBubbleEmitter.SetBackground( mBackgroundImage, mHSVDelta ); | 124 | mBubbleEmitter.SetBackground( mBackgroundImage, mHSVDelta ); |
| 138 | 125 | ||
| 139 | // Get the root actor of all bubbles, and add it to stage. | 126 | // Get the root actor of all bubbles, and add it to stage. |
| @@ -253,7 +240,7 @@ private: | @@ -253,7 +240,7 @@ private: | ||
| 253 | { | 240 | { |
| 254 | if(button == mChangeBackgroundButton) | 241 | if(button == mChangeBackgroundButton) |
| 255 | { | 242 | { |
| 256 | - mBackgroundImage = LoadStageFillingImage( BACKGROUND_IMAGES[ ++mCurrentBackgroundImageId % NUM_BACKGROUND_IMAGES ] ); | 243 | + mBackgroundImage = DemoHelper::LoadStageFillingImage( BACKGROUND_IMAGES[ ++mCurrentBackgroundImageId % NUM_BACKGROUND_IMAGES ] ); |
| 257 | 244 | ||
| 258 | mBubbleEmitter.SetBackground( mBackgroundImage, mHSVDelta ); | 245 | mBubbleEmitter.SetBackground( mBackgroundImage, mHSVDelta ); |
| 259 | 246 | ||
| @@ -261,7 +248,7 @@ private: | @@ -261,7 +248,7 @@ private: | ||
| 261 | } | 248 | } |
| 262 | else if( button == mChangeBubbleShapeButton ) | 249 | else if( button == mChangeBubbleShapeButton ) |
| 263 | { | 250 | { |
| 264 | - mBubbleEmitter.SetShapeImage( ResourceImage::New( BUBBLE_SHAPE_IMAGES[ ++mCurrentBubbleShapeImageId % NUM_BUBBLE_SHAPE_IMAGES ] ) ); | 251 | + mBubbleEmitter.SetShapeImage( DemoHelper::LoadImage( BUBBLE_SHAPE_IMAGES[ ++mCurrentBubbleShapeImageId % NUM_BUBBLE_SHAPE_IMAGES ] ) ); |
| 265 | } | 252 | } |
| 266 | return true; | 253 | return true; |
| 267 | } | 254 | } |
examples/buttons/buttons-example.cpp
| @@ -157,7 +157,7 @@ class ButtonsController: public ConnectionTracker | @@ -157,7 +157,7 @@ class ButtonsController: public ConnectionTracker | ||
| 157 | 157 | ||
| 158 | // Radio 1 | 158 | // Radio 1 |
| 159 | { | 159 | { |
| 160 | - Toolkit::ImageView image = Toolkit::ImageView::New( ResourceImage::New( SMALL_IMAGE_1 ) ); | 160 | + Toolkit::ImageView image = Toolkit::ImageView::New( SMALL_IMAGE_1 ); |
| 161 | image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); | 161 | image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); |
| 162 | 162 | ||
| 163 | mRadioButtonImage1 = Dali::Toolkit::RadioButton::New( "1" ); | 163 | mRadioButtonImage1 = Dali::Toolkit::RadioButton::New( "1" ); |
| @@ -174,7 +174,7 @@ class ButtonsController: public ConnectionTracker | @@ -174,7 +174,7 @@ class ButtonsController: public ConnectionTracker | ||
| 174 | { | 174 | { |
| 175 | radioY += RADIO_LABEL_THUMBNAIL_SIZE + RADIO_IMAGE_SPACING; | 175 | radioY += RADIO_LABEL_THUMBNAIL_SIZE + RADIO_IMAGE_SPACING; |
| 176 | 176 | ||
| 177 | - Toolkit::ImageView image = Toolkit::ImageView::New( ResourceImage::New( SMALL_IMAGE_2 ) ); | 177 | + Toolkit::ImageView image = Toolkit::ImageView::New( SMALL_IMAGE_2 ); |
| 178 | image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); | 178 | image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); |
| 179 | 179 | ||
| 180 | mRadioButtonImage2 = Dali::Toolkit::RadioButton::New( "2" ); | 180 | mRadioButtonImage2 = Dali::Toolkit::RadioButton::New( "2" ); |
| @@ -190,7 +190,7 @@ class ButtonsController: public ConnectionTracker | @@ -190,7 +190,7 @@ class ButtonsController: public ConnectionTracker | ||
| 190 | { | 190 | { |
| 191 | radioY += RADIO_LABEL_THUMBNAIL_SIZE + RADIO_IMAGE_SPACING; | 191 | radioY += RADIO_LABEL_THUMBNAIL_SIZE + RADIO_IMAGE_SPACING; |
| 192 | 192 | ||
| 193 | - Toolkit::ImageView image = Toolkit::ImageView::New( ResourceImage::New( SMALL_IMAGE_3 ) ); | 193 | + Toolkit::ImageView image = Toolkit::ImageView::New( SMALL_IMAGE_3 ); |
| 194 | image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); | 194 | image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); |
| 195 | 195 | ||
| 196 | mRadioButtonImage3 = Dali::Toolkit::RadioButton::New( "3" ); | 196 | mRadioButtonImage3 = Dali::Toolkit::RadioButton::New( "3" ); |
| @@ -213,11 +213,7 @@ class ButtonsController: public ConnectionTracker | @@ -213,11 +213,7 @@ class ButtonsController: public ConnectionTracker | ||
| 213 | radioGroup2Background.AddChild( mUpdateButton, Toolkit::TableView::CellPosition( 1, 0 ) ); | 213 | radioGroup2Background.AddChild( mUpdateButton, Toolkit::TableView::CellPosition( 1, 0 ) ); |
| 214 | 214 | ||
| 215 | // ImageView to display selected image | 215 | // ImageView to display selected image |
| 216 | - mBigImage1 = ResourceImage::New( BIG_IMAGE_1 ); | ||
| 217 | - mBigImage2 = ResourceImage::New( BIG_IMAGE_2 ); | ||
| 218 | - mBigImage3 = ResourceImage::New( BIG_IMAGE_3 ); | ||
| 219 | - | ||
| 220 | - mImage = Toolkit::ImageView::New( mBigImage1 ); | 216 | + mImage = Toolkit::ImageView::New( BIG_IMAGE_1 ); |
| 221 | mImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | 217 | mImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 222 | mImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); | 218 | mImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); |
| 223 | radioGroup2Background.AddChild( mImage, Toolkit::TableView::CellPosition( 0, 1, 2, 1 ) ); | 219 | radioGroup2Background.AddChild( mImage, Toolkit::TableView::CellPosition( 0, 1, 2, 1 ) ); |
| @@ -257,7 +253,7 @@ class ButtonsController: public ConnectionTracker | @@ -257,7 +253,7 @@ class ButtonsController: public ConnectionTracker | ||
| 257 | textLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); | 253 | textLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); |
| 258 | textLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); | 254 | textLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); |
| 259 | 255 | ||
| 260 | - Toolkit::ImageView image = Toolkit::ImageView::New( ResourceImage::New( ENABLED_IMAGE ) ); | 256 | + Toolkit::ImageView image = Toolkit::ImageView::New( ENABLED_IMAGE ); |
| 261 | image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); | 257 | image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); |
| 262 | image.SetPadding( Padding( DP(20.0f), 0.0f, 0.0f, 0.0f ) ); | 258 | image.SetPadding( Padding( DP(20.0f), 0.0f, 0.0f, 0.0f ) ); |
| 263 | tableView.AddChild( image, Toolkit::TableView::CellPosition( 0, 1 ) ); | 259 | tableView.AddChild( image, Toolkit::TableView::CellPosition( 0, 1 ) ); |
| @@ -425,15 +421,15 @@ class ButtonsController: public ConnectionTracker | @@ -425,15 +421,15 @@ class ButtonsController: public ConnectionTracker | ||
| 425 | { | 421 | { |
| 426 | if( mRadioButtonImage1.IsSelected() ) | 422 | if( mRadioButtonImage1.IsSelected() ) |
| 427 | { | 423 | { |
| 428 | - mImage.SetImage( mBigImage1 ); | 424 | + mImage.SetImage( BIG_IMAGE_1 ); |
| 429 | } | 425 | } |
| 430 | else if( mRadioButtonImage2.IsSelected() ) | 426 | else if( mRadioButtonImage2.IsSelected() ) |
| 431 | { | 427 | { |
| 432 | - mImage.SetImage( mBigImage2 ); | 428 | + mImage.SetImage( BIG_IMAGE_2 ); |
| 433 | } | 429 | } |
| 434 | else if( mRadioButtonImage3.IsSelected() ) | 430 | else if( mRadioButtonImage3.IsSelected() ) |
| 435 | { | 431 | { |
| 436 | - mImage.SetImage( mBigImage3 ); | 432 | + mImage.SetImage( BIG_IMAGE_3 ); |
| 437 | } | 433 | } |
| 438 | return true; | 434 | return true; |
| 439 | } | 435 | } |
| @@ -500,9 +496,6 @@ private: | @@ -500,9 +496,6 @@ private: | ||
| 500 | Animation mAnimation; | 496 | Animation mAnimation; |
| 501 | float mLastPoint; | 497 | float mLastPoint; |
| 502 | 498 | ||
| 503 | - Image mBigImage1; | ||
| 504 | - Image mBigImage2; | ||
| 505 | - Image mBigImage3; | ||
| 506 | Toolkit::ImageView mImage; | 499 | Toolkit::ImageView mImage; |
| 507 | }; | 500 | }; |
| 508 | 501 |
examples/cube-transition-effect/cube-transition-effect-example.cpp
| @@ -20,6 +20,7 @@ | @@ -20,6 +20,7 @@ | ||
| 20 | 20 | ||
| 21 | // INTERNAL INCLUDES | 21 | // INTERNAL INCLUDES |
| 22 | #include "shared/view.h" | 22 | #include "shared/view.h" |
| 23 | +#include "shared/utility.h" | ||
| 23 | 24 | ||
| 24 | #include <dali/dali.h> | 25 | #include <dali/dali.h> |
| 25 | #include <dali-toolkit/dali-toolkit.h> | 26 | #include <dali-toolkit/dali-toolkit.h> |
| @@ -98,20 +99,6 @@ const float CUBE_DISPLACEMENT_CROSS(30.f); | @@ -98,20 +99,6 @@ const float CUBE_DISPLACEMENT_CROSS(30.f); | ||
| 98 | // The duration of the current image staying on screen when slideshow is on | 99 | // The duration of the current image staying on screen when slideshow is on |
| 99 | const int VIEWINGTIME = 2000; // 2 seconds | 100 | const int VIEWINGTIME = 2000; // 2 seconds |
| 100 | 101 | ||
| 101 | -/** | ||
| 102 | - * @brief Load an image, scaled-down to no more than the stage dimensions. | ||
| 103 | - * | ||
| 104 | - * Uses image scaling mode SCALE_TO_FILL to resize the image at | ||
| 105 | - * load time to cover the entire stage with pixels with no borders, | ||
| 106 | - * and filter mode BOX_THEN_LINEAR to sample the image with | ||
| 107 | - * maximum quality. | ||
| 108 | - */ | ||
| 109 | -ResourceImage LoadStageFillingImage( const char * const imagePath ) | ||
| 110 | -{ | ||
| 111 | - Size stageSize = Stage::GetCurrent().GetSize(); | ||
| 112 | - return ResourceImage::New( imagePath, ImageDimensions( stageSize.x, stageSize.y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); | ||
| 113 | -} | ||
| 114 | - | ||
| 115 | } // namespace | 102 | } // namespace |
| 116 | 103 | ||
| 117 | class CubeTransitionApp : public ConnectionTracker | 104 | class CubeTransitionApp : public ConnectionTracker |
| @@ -143,12 +130,6 @@ private: | @@ -143,12 +130,6 @@ private: | ||
| 143 | */ | 130 | */ |
| 144 | void GoToNextImage(); | 131 | void GoToNextImage(); |
| 145 | /** | 132 | /** |
| 146 | - * Callback function of image resource loading succeed | ||
| 147 | - * Start the transition | ||
| 148 | - * @param[in] image The image content of the imageActor for transition | ||
| 149 | - */ | ||
| 150 | - void OnImageLoaded(ResourceImage image); | ||
| 151 | - /** | ||
| 152 | * Main key event handler | 133 | * Main key event handler |
| 153 | */ | 134 | */ |
| 154 | void OnKeyEvent(const KeyEvent& event); | 135 | void OnKeyEvent(const KeyEvent& event); |
| @@ -185,8 +166,8 @@ private: | @@ -185,8 +166,8 @@ private: | ||
| 185 | 166 | ||
| 186 | Vector2 mViewSize; | 167 | Vector2 mViewSize; |
| 187 | 168 | ||
| 188 | - ResourceImage mCurrentImage; | ||
| 189 | - ResourceImage mNextImage; | 169 | + Image mCurrentImage; |
| 170 | + Image mNextImage; | ||
| 190 | unsigned int mIndex; | 171 | unsigned int mIndex; |
| 191 | bool mIsImageLoading; | 172 | bool mIsImageLoading; |
| 192 | 173 | ||
| @@ -251,7 +232,7 @@ void CubeTransitionApp::OnInit( Application& application ) | @@ -251,7 +232,7 @@ void CubeTransitionApp::OnInit( Application& application ) | ||
| 251 | mViewSize = Stage::GetCurrent().GetSize(); | 232 | mViewSize = Stage::GetCurrent().GetSize(); |
| 252 | 233 | ||
| 253 | // show the first image | 234 | // show the first image |
| 254 | - mCurrentImage = LoadStageFillingImage( IMAGES[mIndex] ); | 235 | + mCurrentImage = DemoHelper::LoadStageFillingImage( IMAGES[mIndex] ); |
| 255 | 236 | ||
| 256 | //use small cubes | 237 | //use small cubes |
| 257 | mCubeWaveEffect = Toolkit::CubeTransitionWaveEffect::New( NUM_ROWS_WAVE, NUM_COLUMNS_WAVE ); | 238 | mCubeWaveEffect = Toolkit::CubeTransitionWaveEffect::New( NUM_ROWS_WAVE, NUM_COLUMNS_WAVE ); |
| @@ -322,25 +303,11 @@ void CubeTransitionApp::OnPanGesture( Actor actor, const PanGesture& gesture ) | @@ -322,25 +303,11 @@ void CubeTransitionApp::OnPanGesture( Actor actor, const PanGesture& gesture ) | ||
| 322 | 303 | ||
| 323 | void CubeTransitionApp::GoToNextImage() | 304 | void CubeTransitionApp::GoToNextImage() |
| 324 | { | 305 | { |
| 325 | - mNextImage = LoadStageFillingImage( IMAGES[ mIndex ] ); | 306 | + mNextImage = DemoHelper::LoadStageFillingImage( IMAGES[ mIndex ] ); |
| 326 | mCurrentEffect.SetTargetImage( mNextImage ); | 307 | mCurrentEffect.SetTargetImage( mNextImage ); |
| 327 | - if( mNextImage.GetLoadingState() == ResourceLoadingSucceeded ) | ||
| 328 | - { | ||
| 329 | - mIsImageLoading = false; | ||
| 330 | - OnImageLoaded( mNextImage ); | ||
| 331 | - } | ||
| 332 | - else | ||
| 333 | - { | ||
| 334 | - mIsImageLoading = true; | ||
| 335 | - mNextImage.LoadingFinishedSignal().Connect( this, &CubeTransitionApp::OnImageLoaded ); | ||
| 336 | - } | ||
| 337 | -} | ||
| 338 | - | ||
| 339 | -void CubeTransitionApp::OnImageLoaded(ResourceImage image) | ||
| 340 | -{ | ||
| 341 | - mIsImageLoading = false; | ||
| 342 | - mCurrentEffect.StartTransition( mPanPosition, mPanDisplacement ); | ||
| 343 | - mCurrentImage = mNextImage; | 308 | + mIsImageLoading = false; |
| 309 | + mCurrentEffect.StartTransition( mPanPosition, mPanDisplacement ); | ||
| 310 | + mCurrentImage = mNextImage; | ||
| 344 | } | 311 | } |
| 345 | 312 | ||
| 346 | bool CubeTransitionApp::OnEffectButtonClicked( Toolkit::Button button ) | 313 | bool CubeTransitionApp::OnEffectButtonClicked( Toolkit::Button button ) |
examples/dissolve-effect/dissolve-effect-example.cpp
| @@ -80,17 +80,27 @@ const float TRANSITION_DURATION = 2.5f; //2.5 second | @@ -80,17 +80,27 @@ const float TRANSITION_DURATION = 2.5f; //2.5 second | ||
| 80 | const float INITIAL_DEPTH = 10.0f; | 80 | const float INITIAL_DEPTH = 10.0f; |
| 81 | 81 | ||
| 82 | /** | 82 | /** |
| 83 | - * @brief Load an image, scaled-down to no more than the stage dimensions. | 83 | + * @brief Create an image view with an image which would be scaled-down to no more than the stage dimensions. |
| 84 | * | 84 | * |
| 85 | * Uses image scaling mode SCALE_TO_FILL to resize the image at | 85 | * Uses image scaling mode SCALE_TO_FILL to resize the image at |
| 86 | * load time to cover the entire stage with pixels with no borders, | 86 | * load time to cover the entire stage with pixels with no borders, |
| 87 | - * and filter mode BOX_THEN_LINEAR to sample the image with | ||
| 88 | - * maximum quality. | 87 | + * and filter mode BOX_THEN_LINEAR to sample the image with maximum quality. |
| 89 | */ | 88 | */ |
| 90 | -ResourceImage LoadStageFillingImage( const char * const imagePath ) | 89 | +Toolkit::ImageView CreateStageFillingImageView( const char * const imagePath ) |
| 91 | { | 90 | { |
| 92 | Size stageSize = Stage::GetCurrent().GetSize(); | 91 | Size stageSize = Stage::GetCurrent().GetSize(); |
| 93 | - return ResourceImage::New( imagePath, ImageDimensions( stageSize.x, stageSize.y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); | 92 | + Toolkit::ImageView imageView = Toolkit::ImageView::New(); |
| 93 | + Property::Map map; | ||
| 94 | + map["rendererType"] = "image"; | ||
| 95 | + map["url"] = imagePath; | ||
| 96 | + map["desiredWidth"] = stageSize.x; | ||
| 97 | + map["desiredHeight"] = stageSize.y; | ||
| 98 | + map["fittingMode"] = "SCALE_TO_FILL"; | ||
| 99 | + map["samplingMode"] = "BOX_THEN_LINEAR"; | ||
| 100 | + map["synchronousLoading"] = true; | ||
| 101 | + imageView.SetProperty( Toolkit::ImageView::Property::IMAGE, map ); | ||
| 102 | + | ||
| 103 | + return imageView; | ||
| 94 | } | 104 | } |
| 95 | 105 | ||
| 96 | } // namespace | 106 | } // namespace |
| @@ -181,16 +191,7 @@ private: | @@ -181,16 +191,7 @@ private: | ||
| 181 | bool mTimerReady; | 191 | bool mTimerReady; |
| 182 | unsigned int mCentralLineIndex; | 192 | unsigned int mCentralLineIndex; |
| 183 | 193 | ||
| 184 | - Image mIconPlay; | ||
| 185 | - Image mIconPlaySelected; | ||
| 186 | - Image mIconStop; | ||
| 187 | - Image mIconStopSelected; | ||
| 188 | Toolkit::PushButton mPlayStopButton; | 194 | Toolkit::PushButton mPlayStopButton; |
| 189 | - | ||
| 190 | - Image mIconHighP; | ||
| 191 | - Image mIconHighPSelected; | ||
| 192 | - Image mIconMediumP; | ||
| 193 | - Image mIconMediumPSelected; | ||
| 194 | Toolkit::PushButton mEffectChangeButton; | 195 | Toolkit::PushButton mEffectChangeButton; |
| 195 | }; | 196 | }; |
| 196 | 197 | ||
| @@ -219,13 +220,9 @@ void DissolveEffectApp::OnInit( Application& application ) | @@ -219,13 +220,9 @@ void DissolveEffectApp::OnInit( Application& application ) | ||
| 219 | mContent = DemoHelper::CreateView( application, mView,mToolBar, "", TOOLBAR_IMAGE, "" ); | 220 | mContent = DemoHelper::CreateView( application, mView,mToolBar, "", TOOLBAR_IMAGE, "" ); |
| 220 | 221 | ||
| 221 | // Add an effect-changing button on the right of the tool bar. | 222 | // Add an effect-changing button on the right of the tool bar. |
| 222 | - mIconHighP = ResourceImage::New( EFFECT_HIGHP_IMAGE ); | ||
| 223 | - mIconHighPSelected = ResourceImage::New( EFFECT_HIGHP_IMAGE_SELECTED ); | ||
| 224 | - mIconMediumP = ResourceImage::New( EFFECT_MEDIUMP_IMAGE ); | ||
| 225 | - mIconMediumPSelected = ResourceImage::New( EFFECT_MEDIUMP_IMAGE_SELECTED ); | ||
| 226 | mEffectChangeButton = Toolkit::PushButton::New(); | 223 | mEffectChangeButton = Toolkit::PushButton::New(); |
| 227 | - mEffectChangeButton.SetButtonImage( mIconHighP ); | ||
| 228 | - mEffectChangeButton.SetSelectedImage( mIconHighPSelected ); | 224 | + mEffectChangeButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, EFFECT_HIGHP_IMAGE ); |
| 225 | + mEffectChangeButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, EFFECT_HIGHP_IMAGE_SELECTED ); | ||
| 229 | mEffectChangeButton.ClickedSignal().Connect( this, &DissolveEffectApp::OnEffectButtonClicked ); | 226 | mEffectChangeButton.ClickedSignal().Connect( this, &DissolveEffectApp::OnEffectButtonClicked ); |
| 230 | mToolBar.AddControl( mEffectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); | 227 | mToolBar.AddControl( mEffectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); |
| 231 | 228 | ||
| @@ -234,13 +231,9 @@ void DissolveEffectApp::OnInit( Application& application ) | @@ -234,13 +231,9 @@ void DissolveEffectApp::OnInit( Application& application ) | ||
| 234 | mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter ); | 231 | mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter ); |
| 235 | 232 | ||
| 236 | // Add an slide-show button on the right of the title | 233 | // Add an slide-show button on the right of the title |
| 237 | - mIconPlay = ResourceImage::New( PLAY_ICON ); | ||
| 238 | - mIconPlaySelected = ResourceImage::New( PLAY_ICON_SELECTED ); | ||
| 239 | - mIconStop = ResourceImage::New( STOP_ICON ); | ||
| 240 | - mIconStopSelected = ResourceImage::New( STOP_ICON_SELECTED ); | ||
| 241 | mPlayStopButton = Toolkit::PushButton::New(); | 234 | mPlayStopButton = Toolkit::PushButton::New(); |
| 242 | - mPlayStopButton.SetButtonImage( mIconPlay ); | ||
| 243 | - mPlayStopButton.SetSelectedImage( mIconPlaySelected ); | 235 | + mPlayStopButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, PLAY_ICON ); |
| 236 | + mPlayStopButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, PLAY_ICON_SELECTED ); | ||
| 244 | mPlayStopButton.ClickedSignal().Connect( this, &DissolveEffectApp::OnSildeshowButtonClicked ); | 237 | mPlayStopButton.ClickedSignal().Connect( this, &DissolveEffectApp::OnSildeshowButtonClicked ); |
| 245 | mToolBar.AddControl( mPlayStopButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING ); | 238 | mToolBar.AddControl( mPlayStopButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING ); |
| 246 | 239 | ||
| @@ -259,7 +252,7 @@ void DissolveEffectApp::OnInit( Application& application ) | @@ -259,7 +252,7 @@ void DissolveEffectApp::OnInit( Application& application ) | ||
| 259 | mContent.Add( mParent ); | 252 | mContent.Add( mParent ); |
| 260 | 253 | ||
| 261 | // show the first image | 254 | // show the first image |
| 262 | - mCurrentImage = Toolkit::ImageView::New( LoadStageFillingImage( IMAGES[mIndex] ) ); | 255 | + mCurrentImage = CreateStageFillingImageView( IMAGES[mIndex] ); |
| 263 | mCurrentImage.SetParentOrigin( ParentOrigin::CENTER ); | 256 | mCurrentImage.SetParentOrigin( ParentOrigin::CENTER ); |
| 264 | mCurrentImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | 257 | mCurrentImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 265 | mCurrentImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); | 258 | mCurrentImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); |
| @@ -268,7 +261,8 @@ void DissolveEffectApp::OnInit( Application& application ) | @@ -268,7 +261,8 @@ void DissolveEffectApp::OnInit( Application& application ) | ||
| 268 | mPanGestureDetector.Attach( mCurrentImage ); | 261 | mPanGestureDetector.Attach( mCurrentImage ); |
| 269 | 262 | ||
| 270 | mDissolveEffect = Dali::Toolkit::CreateDissolveEffect( mUseHighPrecision ); | 263 | mDissolveEffect = Dali::Toolkit::CreateDissolveEffect( mUseHighPrecision ); |
| 271 | - mEmptyEffect.Insert( "shader", Property::Value() ); | 264 | + Property::Map emptyShaderMap; |
| 265 | + mEmptyEffect.Insert( "shader", emptyShaderMap ); | ||
| 272 | } | 266 | } |
| 273 | 267 | ||
| 274 | // signal handler, called when the pan gesture is detected | 268 | // signal handler, called when the pan gesture is detected |
| @@ -291,8 +285,7 @@ void DissolveEffectApp::OnPanGesture( Actor actor, const PanGesture& gesture ) | @@ -291,8 +285,7 @@ void DissolveEffectApp::OnPanGesture( Actor actor, const PanGesture& gesture ) | ||
| 291 | mIndex = (mIndex + NUM_IMAGES -1)%NUM_IMAGES; | 285 | mIndex = (mIndex + NUM_IMAGES -1)%NUM_IMAGES; |
| 292 | } | 286 | } |
| 293 | 287 | ||
| 294 | - Image image = LoadStageFillingImage( IMAGES[ mIndex ] ); | ||
| 295 | - mNextImage = Toolkit::ImageView::New( image ); | 288 | + mNextImage = CreateStageFillingImageView( IMAGES[ mIndex ] ); |
| 296 | mNextImage.SetParentOrigin( ParentOrigin::CENTER ); | 289 | mNextImage.SetParentOrigin( ParentOrigin::CENTER ); |
| 297 | mNextImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | 290 | mNextImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 298 | mNextImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); | 291 | mNextImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); |
| @@ -348,14 +341,14 @@ bool DissolveEffectApp::OnEffectButtonClicked( Toolkit::Button button ) | @@ -348,14 +341,14 @@ bool DissolveEffectApp::OnEffectButtonClicked( Toolkit::Button button ) | ||
| 348 | if(mUseHighPrecision) | 341 | if(mUseHighPrecision) |
| 349 | { | 342 | { |
| 350 | mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_HIGHP) ); | 343 | mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_HIGHP) ); |
| 351 | - mEffectChangeButton.SetButtonImage( mIconHighP ); | ||
| 352 | - mEffectChangeButton.SetSelectedImage( mIconHighPSelected ); | 344 | + mEffectChangeButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, EFFECT_HIGHP_IMAGE ); |
| 345 | + mEffectChangeButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, EFFECT_HIGHP_IMAGE_SELECTED ); | ||
| 353 | } | 346 | } |
| 354 | else | 347 | else |
| 355 | { | 348 | { |
| 356 | mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_MEDIUMP) ); | 349 | mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_MEDIUMP) ); |
| 357 | - mEffectChangeButton.SetButtonImage( mIconMediumP ); | ||
| 358 | - mEffectChangeButton.SetSelectedImage( mIconMediumPSelected ); | 350 | + mEffectChangeButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, EFFECT_MEDIUMP_IMAGE ); |
| 351 | + mEffectChangeButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, EFFECT_MEDIUMP_IMAGE_SELECTED ); | ||
| 359 | } | 352 | } |
| 360 | 353 | ||
| 361 | return true; | 354 | return true; |
| @@ -366,16 +359,16 @@ bool DissolveEffectApp::OnSildeshowButtonClicked( Toolkit::Button button ) | @@ -366,16 +359,16 @@ bool DissolveEffectApp::OnSildeshowButtonClicked( Toolkit::Button button ) | ||
| 366 | mSlideshow = !mSlideshow; | 359 | mSlideshow = !mSlideshow; |
| 367 | if( mSlideshow ) | 360 | if( mSlideshow ) |
| 368 | { | 361 | { |
| 369 | - mPlayStopButton.SetButtonImage( mIconStop ); | ||
| 370 | - mPlayStopButton.SetSelectedImage( mIconStopSelected ); | 362 | + mPlayStopButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, STOP_ICON ); |
| 363 | + mPlayStopButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, STOP_ICON_SELECTED ); | ||
| 371 | mPanGestureDetector.Detach( mParent ); | 364 | mPanGestureDetector.Detach( mParent ); |
| 372 | mViewTimer.Start(); | 365 | mViewTimer.Start(); |
| 373 | mTimerReady = false; | 366 | mTimerReady = false; |
| 374 | } | 367 | } |
| 375 | else | 368 | else |
| 376 | { | 369 | { |
| 377 | - mPlayStopButton.SetButtonImage( mIconPlay ); | ||
| 378 | - mPlayStopButton.SetSelectedImage( mIconPlaySelected ); | 370 | + mPlayStopButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, PLAY_ICON ); |
| 371 | + mPlayStopButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, PLAY_ICON_SELECTED ); | ||
| 379 | mTimerReady = true; | 372 | mTimerReady = true; |
| 380 | mPanGestureDetector.Attach( mParent ); | 373 | mPanGestureDetector.Attach( mParent ); |
| 381 | } | 374 | } |
| @@ -384,7 +377,10 @@ bool DissolveEffectApp::OnSildeshowButtonClicked( Toolkit::Button button ) | @@ -384,7 +377,10 @@ bool DissolveEffectApp::OnSildeshowButtonClicked( Toolkit::Button button ) | ||
| 384 | 377 | ||
| 385 | void DissolveEffectApp::OnTransitionCompleted( Animation& source ) | 378 | void DissolveEffectApp::OnTransitionCompleted( Animation& source ) |
| 386 | { | 379 | { |
| 387 | - mNextImage.SetProperty( Toolkit::ImageView::Property::IMAGE, mEmptyEffect ); | 380 | + if(mUseHighPrecision) |
| 381 | + { | ||
| 382 | + mNextImage.SetProperty( Toolkit::ImageView::Property::IMAGE, mEmptyEffect ); | ||
| 383 | + } | ||
| 388 | mParent.Remove( mCurrentImage ); | 384 | mParent.Remove( mCurrentImage ); |
| 389 | mPanGestureDetector.Detach( mCurrentImage ); | 385 | mPanGestureDetector.Detach( mCurrentImage ); |
| 390 | mCurrentImage = mNextImage; | 386 | mCurrentImage = mNextImage; |
| @@ -404,8 +400,7 @@ bool DissolveEffectApp::OnTimerTick() | @@ -404,8 +400,7 @@ bool DissolveEffectApp::OnTimerTick() | ||
| 404 | if(mSlideshow) | 400 | if(mSlideshow) |
| 405 | { | 401 | { |
| 406 | mIndex = (mIndex + 1)%NUM_IMAGES; | 402 | mIndex = (mIndex + 1)%NUM_IMAGES; |
| 407 | - Image image = LoadStageFillingImage( IMAGES[ mIndex ] ); | ||
| 408 | - mNextImage = Toolkit::ImageView::New( image ); | 403 | + mNextImage = CreateStageFillingImageView( IMAGES[ mIndex ] ); |
| 409 | mNextImage.SetParentOrigin( ParentOrigin::CENTER ); | 404 | mNextImage.SetParentOrigin( ParentOrigin::CENTER ); |
| 410 | mNextImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | 405 | mNextImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 411 | mNextImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); | 406 | mNextImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); |
examples/gradients/gradients-example.cpp
| @@ -143,13 +143,6 @@ public: | @@ -143,13 +143,6 @@ public: | ||
| 143 | return true; | 143 | return true; |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | - bool OnTouch( Actor actor, const TouchEvent& touch ) | ||
| 147 | - { | ||
| 148 | - // quit the application | ||
| 149 | - mApplication.Quit(); | ||
| 150 | - return true; | ||
| 151 | - } | ||
| 152 | - | ||
| 153 | void OnKeyEvent(const KeyEvent& event) | 146 | void OnKeyEvent(const KeyEvent& event) |
| 154 | { | 147 | { |
| 155 | if(event.state == KeyEvent::Down) | 148 | if(event.state == KeyEvent::Down) |
examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp
| @@ -284,8 +284,7 @@ public: | @@ -284,8 +284,7 @@ public: | ||
| 284 | 284 | ||
| 285 | // Back and next image buttons in corners of stage: | 285 | // Back and next image buttons in corners of stage: |
| 286 | unsigned int playWidth = std::min( stage.GetSize().x * (1 / 5.0f), 58.0f ); | 286 | unsigned int playWidth = std::min( stage.GetSize().x * (1 / 5.0f), 58.0f ); |
| 287 | - Image playImage = ResourceImage::New( DALI_ICON_PLAY, ImageDimensions( playWidth, playWidth ), FittingMode::SHRINK_TO_FIT, SamplingMode::BOX_THEN_LINEAR ); | ||
| 288 | - Toolkit::ImageView imagePrevious = Toolkit::ImageView::New( playImage ); | 287 | + Toolkit::ImageView imagePrevious = Toolkit::ImageView::New( DALI_ICON_PLAY, ImageDimensions( playWidth, playWidth ) ); |
| 289 | 288 | ||
| 290 | // Last image button: | 289 | // Last image button: |
| 291 | imagePrevious.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | 290 | imagePrevious.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| @@ -298,7 +297,7 @@ public: | @@ -298,7 +297,7 @@ public: | ||
| 298 | imagePrevious.TouchSignal().Connect( this, &ImageScalingAndFilteringController::OnControlTouched ); | 297 | imagePrevious.TouchSignal().Connect( this, &ImageScalingAndFilteringController::OnControlTouched ); |
| 299 | 298 | ||
| 300 | // Next image button: | 299 | // Next image button: |
| 301 | - Toolkit::ImageView imageNext = Toolkit::ImageView::New( playImage ); | 300 | + Toolkit::ImageView imageNext = Toolkit::ImageView::New( DALI_ICON_PLAY, ImageDimensions( playWidth, playWidth ) ); |
| 302 | imageNext.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); | 301 | imageNext.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); |
| 303 | imageNext.SetY( playWidth * 0.5f ); | 302 | imageNext.SetY( playWidth * 0.5f ); |
| 304 | imageNext.SetX( stage.GetSize().x - playWidth * 0.5f ); | 303 | imageNext.SetX( stage.GetSize().x - playWidth * 0.5f ); |
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
| @@ -475,7 +475,7 @@ public: | @@ -475,7 +475,7 @@ public: | ||
| 475 | /** | 475 | /** |
| 476 | * Upon Touching an image (Release), change its scaling mode and make it spin, provided we're not scrolling. | 476 | * Upon Touching an image (Release), change its scaling mode and make it spin, provided we're not scrolling. |
| 477 | * @param[in] actor The actor touched | 477 | * @param[in] actor The actor touched |
| 478 | - * @param[in] event The TouchEvent. | 478 | + * @param[in] event The Touch information. |
| 479 | */ | 479 | */ |
| 480 | bool OnTouchImage( Actor actor, const TouchData& event ) | 480 | bool OnTouchImage( Actor actor, const TouchData& event ) |
| 481 | { | 481 | { |
examples/image-view-alpha-blending/image-view-alpha-blending-example.cpp
| @@ -19,6 +19,11 @@ | @@ -19,6 +19,11 @@ | ||
| 19 | 19 | ||
| 20 | using namespace Dali; | 20 | using namespace Dali; |
| 21 | 21 | ||
| 22 | +namespace | ||
| 23 | +{ | ||
| 24 | +const char* const IMAGE_PATH ( DEMO_IMAGE_DIR "gallery-large-20.jpg" ); | ||
| 25 | +} | ||
| 26 | + | ||
| 22 | class ImageViewAlphaBlendApp : public ConnectionTracker | 27 | class ImageViewAlphaBlendApp : public ConnectionTracker |
| 23 | { | 28 | { |
| 24 | public: | 29 | public: |
| @@ -47,10 +52,9 @@ private: | @@ -47,10 +52,9 @@ private: | ||
| 47 | Vector4 green1 = Vector4( 0.f, 0.25f, 0.f, 0.25f ); | 52 | Vector4 green1 = Vector4( 0.f, 0.25f, 0.f, 0.25f ); |
| 48 | BufferImage redGreen0 = CreateBufferImage( Color::RED, green0 ); | 53 | BufferImage redGreen0 = CreateBufferImage( Color::RED, green0 ); |
| 49 | BufferImage redGreen1 = CreateBufferImage( Color::RED, green1 ); | 54 | BufferImage redGreen1 = CreateBufferImage( Color::RED, green1 ); |
| 50 | - ResourceImage testImage = ResourceImage::New( DEMO_IMAGE_DIR "gallery-large-20.jpg" ); | ||
| 51 | float imageSize = 512.f; | 55 | float imageSize = 512.f; |
| 52 | 56 | ||
| 53 | - Toolkit::ImageView imageView0 = Toolkit::ImageView::New( testImage ); | 57 | + Toolkit::ImageView imageView0 = Toolkit::ImageView::New( IMAGE_PATH ); |
| 54 | imageView0.SetSize(imageSize, imageSize); | 58 | imageView0.SetSize(imageSize, imageSize); |
| 55 | imageView0.SetParentOrigin( ParentOrigin::CENTER ); | 59 | imageView0.SetParentOrigin( ParentOrigin::CENTER ); |
| 56 | imageView0.SetY( -imageSize*0.5f ); | 60 | imageView0.SetY( -imageSize*0.5f ); |
| @@ -60,7 +64,7 @@ private: | @@ -60,7 +64,7 @@ private: | ||
| 60 | imageView1.SetSize(imageSize, imageSize); | 64 | imageView1.SetSize(imageSize, imageSize); |
| 61 | imageView0.Add(imageView1); | 65 | imageView0.Add(imageView1); |
| 62 | 66 | ||
| 63 | - Toolkit::ImageView imageView2 = Toolkit::ImageView::New( testImage); | 67 | + Toolkit::ImageView imageView2 = Toolkit::ImageView::New( IMAGE_PATH ); |
| 64 | imageView2.SetSize(imageSize, imageSize); | 68 | imageView2.SetSize(imageSize, imageSize); |
| 65 | imageView2.SetParentOrigin( ParentOrigin::CENTER ); | 69 | imageView2.SetParentOrigin( ParentOrigin::CENTER ); |
| 66 | imageView2.SetY( imageSize*0.5f ); | 70 | imageView2.SetY( imageSize*0.5f ); |
examples/mesh-sorting/mesh-sorting-example.cpp
| @@ -24,6 +24,7 @@ | @@ -24,6 +24,7 @@ | ||
| 24 | 24 | ||
| 25 | // INTERNAL INCLUDES | 25 | // INTERNAL INCLUDES |
| 26 | #include "shared/view.h" | 26 | #include "shared/view.h" |
| 27 | +#include "shared/utility.h" | ||
| 27 | 28 | ||
| 28 | using namespace Dali; | 29 | using namespace Dali; |
| 29 | 30 | ||
| @@ -164,9 +165,9 @@ public: | @@ -164,9 +165,9 @@ public: | ||
| 164 | 165 | ||
| 165 | for( unsigned i=0; i<NUMBER_OF_SAMPLES; ++i) | 166 | for( unsigned i=0; i<NUMBER_OF_SAMPLES; ++i) |
| 166 | { | 167 | { |
| 167 | - Image image = ResourceImage::New( IMAGES[i] ); | 168 | + Texture texture = DemoHelper::LoadTexture( IMAGES[i] ); |
| 168 | TextureSet textureSet = TextureSet::New(); | 169 | TextureSet textureSet = TextureSet::New(); |
| 169 | - textureSet.SetImage( 0u, image ); | 170 | + textureSet.SetTexture( 0u, texture ); |
| 170 | if( i==0 ) { firstTextureSet = textureSet; } | 171 | if( i==0 ) { firstTextureSet = textureSet; } |
| 171 | 172 | ||
| 172 | Renderer renderer = Renderer::New( mGeometry, mShader ); | 173 | Renderer renderer = Renderer::New( mGeometry, mShader ); |
examples/metaball-explosion/metaball-explosion-example.cpp
| @@ -25,6 +25,7 @@ | @@ -25,6 +25,7 @@ | ||
| 25 | #include <dali-toolkit/dali-toolkit.h> | 25 | #include <dali-toolkit/dali-toolkit.h> |
| 26 | 26 | ||
| 27 | #include "shared/view.h" | 27 | #include "shared/view.h" |
| 28 | +#include "shared/utility.h" | ||
| 28 | 29 | ||
| 29 | using namespace Dali; | 30 | using namespace Dali; |
| 30 | using namespace Dali::Toolkit; | 31 | using namespace Dali::Toolkit; |
| @@ -328,7 +329,7 @@ void MetaballExplosionController::Create( Application& app ) | @@ -328,7 +329,7 @@ void MetaballExplosionController::Create( Application& app ) | ||
| 328 | stage.SetBackgroundColor(Color::BLACK); | 329 | stage.SetBackgroundColor(Color::BLACK); |
| 329 | 330 | ||
| 330 | //Set background image for the view | 331 | //Set background image for the view |
| 331 | - mBackImage = ResourceImage::New( BACKGROUND_IMAGE ); | 332 | + mBackImage = DemoHelper::LoadImage( BACKGROUND_IMAGE ); |
| 332 | 333 | ||
| 333 | srand((unsigned)time(0)); | 334 | srand((unsigned)time(0)); |
| 334 | 335 |
examples/metaball-refrac/metaball-refrac-example.cpp
| @@ -21,6 +21,7 @@ | @@ -21,6 +21,7 @@ | ||
| 21 | 21 | ||
| 22 | #include <cstdio> | 22 | #include <cstdio> |
| 23 | #include <string> | 23 | #include <string> |
| 24 | +#include "shared/utility.h" | ||
| 24 | 25 | ||
| 25 | using namespace Dali; | 26 | using namespace Dali; |
| 26 | using namespace Dali::Toolkit; | 27 | using namespace Dali::Toolkit; |
| @@ -270,7 +271,7 @@ void MetaballRefracController::Create( Application& app ) | @@ -270,7 +271,7 @@ void MetaballRefracController::Create( Application& app ) | ||
| 270 | stage.SetBackgroundColor(Color::BLACK); | 271 | stage.SetBackgroundColor(Color::BLACK); |
| 271 | 272 | ||
| 272 | //Set background image for the view | 273 | //Set background image for the view |
| 273 | - mBackImage = ResourceImage::New( BACKGROUND_IMAGE ); | 274 | + mBackImage = DemoHelper::LoadImage( BACKGROUND_IMAGE ); |
| 274 | 275 | ||
| 275 | mGravity = Vector2(GRAVITY_X,GRAVITY_Y); | 276 | mGravity = Vector2(GRAVITY_X,GRAVITY_Y); |
| 276 | mGravityVar = Vector2(0,0); | 277 | mGravityVar = Vector2(0,0); |
examples/model3d-view/model3d-view-example.cpp
| @@ -76,8 +76,7 @@ public: | @@ -76,8 +76,7 @@ public: | ||
| 76 | Vector2 screenSize = stage.GetSize(); | 76 | Vector2 screenSize = stage.GetSize(); |
| 77 | 77 | ||
| 78 | //Add background | 78 | //Add background |
| 79 | - Image imageBackground = ResourceImage::New( BACKGROUND_IMAGE ); | ||
| 80 | - Toolkit::ImageView backView = Toolkit::ImageView::New(imageBackground); | 79 | + Toolkit::ImageView backView = Toolkit::ImageView::New(BACKGROUND_IMAGE); |
| 81 | backView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | 80 | backView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 82 | stage.Add(backView); | 81 | stage.Add(backView); |
| 83 | 82 |
examples/motion-blur/motion-blur-example.cpp
| @@ -95,16 +95,24 @@ const float BUTTON_TITLE_LABEL_Y_OFFSET = 0.05f; | @@ -95,16 +95,24 @@ const float BUTTON_TITLE_LABEL_Y_OFFSET = 0.05f; | ||
| 95 | const float ORIENTATION_DURATION = 0.5f; ///< Time to rotate to new orientation. | 95 | const float ORIENTATION_DURATION = 0.5f; ///< Time to rotate to new orientation. |
| 96 | 96 | ||
| 97 | /** | 97 | /** |
| 98 | - * @brief Load an image, scaled-down to no more than the dimensions passed in. | 98 | + * @brief Set an image to image view, scaled-down to no more than the dimensions passed in. |
| 99 | * | 99 | * |
| 100 | * Uses SHRINK_TO_FIT which ensures the resulting image is | 100 | * Uses SHRINK_TO_FIT which ensures the resulting image is |
| 101 | - * smaller than or equal to the specified dimensions while preserving its | ||
| 102 | - * original aspect ratio. | 101 | + * smaller than or equal to the specified dimensions while preserving its original aspect ratio. |
| 103 | */ | 102 | */ |
| 104 | -ResourceImage LoadImageFittedInBox( const char * const imagePath, uint32_t maxWidth, uint32_t maxHeight ) | 103 | +void SetImageFittedInBox( ImageView& imageView, Property::Map& shaderEffect, const char * const imagePath, int maxWidth, int maxHeight ) |
| 105 | { | 104 | { |
| 105 | + Property::Map map; | ||
| 106 | + map["rendererType"] = "image"; | ||
| 107 | + map["url"] = imagePath; | ||
| 106 | // Load the image nicely scaled-down to fit within the specified max width and height: | 108 | // Load the image nicely scaled-down to fit within the specified max width and height: |
| 107 | - return ResourceImage::New( imagePath, ImageDimensions( maxWidth, maxHeight ), FittingMode::SHRINK_TO_FIT, Dali::SamplingMode::BOX_THEN_LINEAR ); | 109 | + map["desiredWidth"] = maxWidth; |
| 110 | + map["desiredHeight"] = maxHeight; | ||
| 111 | + map["fittingMode"] = "SHRINK_TO_FIT"; | ||
| 112 | + map["samplingMode"] = "BOX_THEN_LINEAR"; | ||
| 113 | + map.Merge( shaderEffect ); | ||
| 114 | + | ||
| 115 | + imageView.SetProperty( ImageView::Property::IMAGE, map ); | ||
| 108 | } | 116 | } |
| 109 | 117 | ||
| 110 | } // unnamed namespace | 118 | } // unnamed namespace |
| @@ -207,8 +215,9 @@ public: | @@ -207,8 +215,9 @@ public: | ||
| 207 | mMotionBlurActorSize = Size( std::min( stageSize.x * 0.3f, MOTION_BLUR_ACTOR_WIDTH ), std::min( stageSize.y * 0.3f, MOTION_BLUR_ACTOR_HEIGHT ) ); | 215 | mMotionBlurActorSize = Size( std::min( stageSize.x * 0.3f, MOTION_BLUR_ACTOR_WIDTH ), std::min( stageSize.y * 0.3f, MOTION_BLUR_ACTOR_HEIGHT ) ); |
| 208 | mMotionBlurActorSize = Size( std::min( mMotionBlurActorSize.x, mMotionBlurActorSize.y ), std::min( mMotionBlurActorSize.x, mMotionBlurActorSize.y ) ); | 216 | mMotionBlurActorSize = Size( std::min( mMotionBlurActorSize.x, mMotionBlurActorSize.y ), std::min( mMotionBlurActorSize.x, mMotionBlurActorSize.y ) ); |
| 209 | 217 | ||
| 210 | - Image image = LoadImageFittedInBox( MOTION_BLUR_ACTOR_IMAGE1, mMotionBlurActorSize.x, mMotionBlurActorSize.y ); | ||
| 211 | - mMotionBlurImageView = ImageView::New(image); | 218 | + mMotionBlurEffect = CreateMotionBlurEffect(); |
| 219 | + mMotionBlurImageView = ImageView::New(); | ||
| 220 | + SetImageFittedInBox( mMotionBlurImageView, mMotionBlurEffect, MOTION_BLUR_ACTOR_IMAGE1, mMotionBlurActorSize.x, mMotionBlurActorSize.y ); | ||
| 212 | mMotionBlurImageView.SetParentOrigin( ParentOrigin::CENTER ); | 221 | mMotionBlurImageView.SetParentOrigin( ParentOrigin::CENTER ); |
| 213 | mMotionBlurImageView.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y); | 222 | mMotionBlurImageView.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y); |
| 214 | 223 | ||
| @@ -219,7 +228,6 @@ public: | @@ -219,7 +228,6 @@ public: | ||
| 219 | 228 | ||
| 220 | // set actor shader to the blur one | 229 | // set actor shader to the blur one |
| 221 | Toolkit::SetMotionBlurProperties( mMotionBlurImageView, MOTION_BLUR_NUM_SAMPLES ); | 230 | Toolkit::SetMotionBlurProperties( mMotionBlurImageView, MOTION_BLUR_NUM_SAMPLES ); |
| 222 | - mMotionBlurImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, mMotionBlurEffect ); | ||
| 223 | 231 | ||
| 224 | 232 | ||
| 225 | #ifdef MULTIPLE_MOTION_BLURRED_ACTORS | 233 | #ifdef MULTIPLE_MOTION_BLURRED_ACTORS |
| @@ -483,10 +491,8 @@ public: | @@ -483,10 +491,8 @@ public: | ||
| 483 | { | 491 | { |
| 484 | mCurrentImage = 0; | 492 | mCurrentImage = 0; |
| 485 | } | 493 | } |
| 494 | + SetImageFittedInBox( mMotionBlurImageView, mMotionBlurEffect, MOTION_BLUR_ACTOR_IMAGES[mCurrentImage], mMotionBlurActorSize.x, mMotionBlurActorSize.y ); | ||
| 486 | 495 | ||
| 487 | - Image blurImage = LoadImageFittedInBox( MOTION_BLUR_ACTOR_IMAGES[mCurrentImage], mMotionBlurActorSize.x, mMotionBlurActorSize.y ); | ||
| 488 | - | ||
| 489 | - mMotionBlurImageView.SetImage(blurImage); | ||
| 490 | #ifdef MULTIPLE_MOTION_BLURRED_ACTORS | 496 | #ifdef MULTIPLE_MOTION_BLURRED_ACTORS |
| 491 | mMotionBlurImageView2.SetImage(blurImage); | 497 | mMotionBlurImageView2.SetImage(blurImage); |
| 492 | mMotionBlurImageView3.SetImage(blurImage); | 498 | mMotionBlurImageView3.SetImage(blurImage); |
examples/motion-stretch/motion-stretch-example.cpp
| @@ -175,8 +175,10 @@ public: | @@ -175,8 +175,10 @@ public: | ||
| 175 | // | 175 | // |
| 176 | // Motion stretched actor | 176 | // Motion stretched actor |
| 177 | // | 177 | // |
| 178 | - | ||
| 179 | - mMotionStretchImageView = ImageView::New( MOTION_STRETCH_ACTOR_IMAGE1 ); | 178 | + mMotionStretchEffect = Toolkit::CreateMotionStretchEffect(); |
| 179 | + mMotionStretchEffect["url"] = MOTION_STRETCH_ACTOR_IMAGE1; | ||
| 180 | + mMotionStretchImageView = ImageView::New(); | ||
| 181 | + mMotionStretchImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, mMotionStretchEffect ); | ||
| 180 | mMotionStretchImageView.SetParentOrigin( ParentOrigin::CENTER ); | 182 | mMotionStretchImageView.SetParentOrigin( ParentOrigin::CENTER ); |
| 181 | mMotionStretchImageView.SetAnchorPoint( AnchorPoint::CENTER ); | 183 | mMotionStretchImageView.SetAnchorPoint( AnchorPoint::CENTER ); |
| 182 | mMotionStretchImageView.SetSize( MOTION_STRETCH_ACTOR_WIDTH, MOTION_STRETCH_ACTOR_HEIGHT ); | 184 | mMotionStretchImageView.SetSize( MOTION_STRETCH_ACTOR_WIDTH, MOTION_STRETCH_ACTOR_HEIGHT ); |
| @@ -184,9 +186,7 @@ public: | @@ -184,9 +186,7 @@ public: | ||
| 184 | mContentLayer.Add( mMotionStretchImageView ); | 186 | mContentLayer.Add( mMotionStretchImageView ); |
| 185 | 187 | ||
| 186 | // Create shader used for doing motion stretch | 188 | // Create shader used for doing motion stretch |
| 187 | - mMotionStretchEffect = Toolkit::CreateMotionStretchEffect(); | ||
| 188 | Toolkit::SetMotionStretchProperties( mMotionStretchImageView ); | 189 | Toolkit::SetMotionStretchProperties( mMotionStretchImageView ); |
| 189 | - mMotionStretchImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, mMotionStretchEffect ); | ||
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | ////////////////////////////////////////////////////////////// | 192 | ////////////////////////////////////////////////////////////// |
| @@ -390,8 +390,8 @@ public: | @@ -390,8 +390,8 @@ public: | ||
| 390 | mCurrentImage = 0; | 390 | mCurrentImage = 0; |
| 391 | } | 391 | } |
| 392 | 392 | ||
| 393 | - Image stretchImage = ResourceImage::New( MOTION_STRETCH_ACTOR_IMAGES[mCurrentImage] ); | ||
| 394 | - mMotionStretchImageView.SetImage(stretchImage); | 393 | + mMotionStretchEffect["url"] = MOTION_STRETCH_ACTOR_IMAGES[mCurrentImage]; |
| 394 | + mMotionStretchImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, mMotionStretchEffect ); | ||
| 395 | } | 395 | } |
| 396 | 396 | ||
| 397 | 397 |
examples/new-window/new-window-example.cpp
| @@ -24,6 +24,7 @@ | @@ -24,6 +24,7 @@ | ||
| 24 | 24 | ||
| 25 | // INTERNAL INCLUDES | 25 | // INTERNAL INCLUDES |
| 26 | #include "shared/view.h" | 26 | #include "shared/view.h" |
| 27 | +#include "shared/utility.h" | ||
| 27 | 28 | ||
| 28 | using namespace Dali; | 29 | using namespace Dali; |
| 29 | using namespace Dali::Toolkit; | 30 | using namespace Dali::Toolkit; |
| @@ -187,8 +188,7 @@ void NewWindowController::Create( Application& app ) | @@ -187,8 +188,7 @@ void NewWindowController::Create( Application& app ) | ||
| 187 | "Context recovery" ); | 188 | "Context recovery" ); |
| 188 | 189 | ||
| 189 | Size stageSize = stage.GetSize(); | 190 | Size stageSize = stage.GetSize(); |
| 190 | - Image backgroundImage = ResourceImage::New( BACKGROUND_IMAGE, Dali::ImageDimensions( stageSize.x, stageSize.y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); | ||
| 191 | - ImageView backgroundActor = ImageView::New( backgroundImage ); | 191 | + ImageView backgroundActor = ImageView::New( BACKGROUND_IMAGE, Dali::ImageDimensions( stageSize.x, stageSize.y ) ); |
| 192 | backgroundActor.SetParentOrigin( ParentOrigin::CENTER ); | 192 | backgroundActor.SetParentOrigin( ParentOrigin::CENTER ); |
| 193 | mContentLayer.Add(backgroundActor); | 193 | mContentLayer.Add(backgroundActor); |
| 194 | 194 | ||
| @@ -212,16 +212,15 @@ void NewWindowController::Create( Application& app ) | @@ -212,16 +212,15 @@ void NewWindowController::Create( Application& app ) | ||
| 212 | logoLayoutActor.SetScale(0.5f); | 212 | logoLayoutActor.SetScale(0.5f); |
| 213 | backgroundActor.Add(logoLayoutActor); | 213 | backgroundActor.Add(logoLayoutActor); |
| 214 | 214 | ||
| 215 | - Image image = ResourceImage::New(LOGO_IMAGE); | ||
| 216 | - ImageView imageView = ImageView::New(image); | 215 | + ImageView imageView = ImageView::New( LOGO_IMAGE ); |
| 217 | imageView.SetName("daliLogo"); | 216 | imageView.SetName("daliLogo"); |
| 218 | imageView.SetParentOrigin(ParentOrigin::CENTER); | 217 | imageView.SetParentOrigin(ParentOrigin::CENTER); |
| 219 | imageView.SetAnchorPoint(AnchorPoint::BOTTOM_CENTER); | 218 | imageView.SetAnchorPoint(AnchorPoint::BOTTOM_CENTER); |
| 220 | logoLayoutActor.Add(imageView); | 219 | logoLayoutActor.Add(imageView); |
| 221 | 220 | ||
| 222 | ImageView mirrorImageView = CreateBlurredMirrorImage(LOGO_IMAGE); | 221 | ImageView mirrorImageView = CreateBlurredMirrorImage(LOGO_IMAGE); |
| 223 | - mirrorImageView.SetParentOrigin(ParentOrigin::CENTER); | ||
| 224 | - mirrorImageView.SetAnchorPoint(AnchorPoint::TOP_CENTER); | 222 | + mirrorImageView.SetParentOrigin(ParentOrigin::TOP_CENTER); |
| 223 | + mirrorImageView.SetAnchorPoint(AnchorPoint::BOTTOM_CENTER); | ||
| 225 | logoLayoutActor.Add(mirrorImageView); | 224 | logoLayoutActor.Add(mirrorImageView); |
| 226 | 225 | ||
| 227 | AddBubbles( backgroundActor, stage.GetSize()); | 226 | AddBubbles( backgroundActor, stage.GetSize()); |
| @@ -241,10 +240,10 @@ void NewWindowController::Destroy( Application& app ) | @@ -241,10 +240,10 @@ void NewWindowController::Destroy( Application& app ) | ||
| 241 | void NewWindowController::AddBubbles( Actor& parentActor, const Vector2& stageSize) | 240 | void NewWindowController::AddBubbles( Actor& parentActor, const Vector2& stageSize) |
| 242 | { | 241 | { |
| 243 | mEmitter = Toolkit::BubbleEmitter::New( stageSize, | 242 | mEmitter = Toolkit::BubbleEmitter::New( stageSize, |
| 244 | - ResourceImage::New( DEMO_IMAGE_DIR "bubble-ball.png" ), | 243 | + DemoHelper::LoadImage( DEMO_IMAGE_DIR "bubble-ball.png" ), |
| 245 | 200, Vector2( 5.0f, 5.0f ) ); | 244 | 200, Vector2( 5.0f, 5.0f ) ); |
| 246 | 245 | ||
| 247 | - Image background = ResourceImage::New(BACKGROUND_IMAGE); | 246 | + Image background = DemoHelper::LoadImage(BACKGROUND_IMAGE); |
| 248 | mEmitter.SetBackground( background, Vector3(0.5f, 0.f,0.5f) ); | 247 | mEmitter.SetBackground( background, Vector3(0.5f, 0.f,0.5f) ); |
| 249 | mEmitter.SetBubbleDensity( 9.f ); | 248 | mEmitter.SetBubbleDensity( 9.f ); |
| 250 | Actor bubbleRoot = mEmitter.GetRootActor(); | 249 | Actor bubbleRoot = mEmitter.GetRootActor(); |
| @@ -275,10 +274,10 @@ void NewWindowController::AddMeshActor( Actor& parentActor ) | @@ -275,10 +274,10 @@ void NewWindowController::AddMeshActor( Actor& parentActor ) | ||
| 275 | colorMeshActor.SetName("ColorMeshActor"); | 274 | colorMeshActor.SetName("ColorMeshActor"); |
| 276 | 275 | ||
| 277 | // Create a textured mesh | 276 | // Create a textured mesh |
| 278 | - Image effectImage = ResourceImage::New(EFFECT_IMAGE); | 277 | + Texture effectTexture = DemoHelper::LoadTexture(EFFECT_IMAGE); |
| 279 | Shader shaderTextureMesh = Shader::New( VERTEX_TEXTURE_MESH, FRAGMENT_TEXTURE_MESH ); | 278 | Shader shaderTextureMesh = Shader::New( VERTEX_TEXTURE_MESH, FRAGMENT_TEXTURE_MESH ); |
| 280 | TextureSet textureSet = TextureSet::New(); | 279 | TextureSet textureSet = TextureSet::New(); |
| 281 | - textureSet.SetImage( 0u, effectImage ); | 280 | + textureSet.SetTexture( 0u, effectTexture ); |
| 282 | Renderer textureMeshRenderer = Renderer::New( meshGeometry, shaderTextureMesh ); | 281 | Renderer textureMeshRenderer = Renderer::New( meshGeometry, shaderTextureMesh ); |
| 283 | textureMeshRenderer.SetTextures( textureSet ); | 282 | textureMeshRenderer.SetTextures( textureSet ); |
| 284 | 283 | ||
| @@ -320,8 +319,7 @@ void NewWindowController::AddBlendingImageActor( Actor& parentActor ) | @@ -320,8 +319,7 @@ void NewWindowController::AddBlendingImageActor( Actor& parentActor ) | ||
| 320 | Property::Map map; | 319 | Property::Map map; |
| 321 | map[ "shader" ] = customShader; | 320 | map[ "shader" ] = customShader; |
| 322 | 321 | ||
| 323 | - Image baseImage = ResourceImage::New(BASE_IMAGE); | ||
| 324 | - ImageView blendActor = ImageView::New( baseImage ); | 322 | + ImageView blendActor = ImageView::New( BASE_IMAGE ); |
| 325 | blendActor.SetProperty( ImageView::Property::IMAGE, map ); | 323 | blendActor.SetProperty( ImageView::Property::IMAGE, map ); |
| 326 | blendActor.RegisterProperty( "alpha", 0.5f ); | 324 | blendActor.RegisterProperty( "alpha", 0.5f ); |
| 327 | 325 | ||
| @@ -345,10 +343,9 @@ void NewWindowController::AddTextLabel( Actor& parentActor ) | @@ -345,10 +343,9 @@ void NewWindowController::AddTextLabel( Actor& parentActor ) | ||
| 345 | 343 | ||
| 346 | ImageView NewWindowController::CreateBlurredMirrorImage(const char* imageName) | 344 | ImageView NewWindowController::CreateBlurredMirrorImage(const char* imageName) |
| 347 | { | 345 | { |
| 348 | - Image image = ResourceImage::New(imageName); | 346 | + Image image = DemoHelper::LoadImage(imageName); |
| 349 | 347 | ||
| 350 | - Uint16Pair intFboSize = ResourceImage::GetImageSize(imageName); | ||
| 351 | - Vector2 FBOSize = Vector2( intFboSize.GetWidth(), intFboSize.GetHeight() ); | 348 | + Vector2 FBOSize = Vector2( image.GetWidth(), image.GetHeight() ); |
| 352 | FrameBufferImage fbo = FrameBufferImage::New( FBOSize.width, FBOSize.height, Pixel::RGBA8888); | 349 | FrameBufferImage fbo = FrameBufferImage::New( FBOSize.width, FBOSize.height, Pixel::RGBA8888); |
| 353 | 350 | ||
| 354 | GaussianBlurView gbv = GaussianBlurView::New(5, 2.0f, Pixel::RGBA8888, 0.5f, 0.5f, true); | 351 | GaussianBlurView gbv = GaussianBlurView::New(5, 2.0f, Pixel::RGBA8888, 0.5f, 0.5f, true); |
examples/page-turn-view/page-turn-view-example.cpp
| @@ -18,6 +18,7 @@ | @@ -18,6 +18,7 @@ | ||
| 18 | #include <dali/dali.h> | 18 | #include <dali/dali.h> |
| 19 | #include <dali-toolkit/dali-toolkit.h> | 19 | #include <dali-toolkit/dali-toolkit.h> |
| 20 | #include <dali-toolkit/devel-api/image-atlas/image-atlas.h> | 20 | #include <dali-toolkit/devel-api/image-atlas/image-atlas.h> |
| 21 | +#include <dali/devel-api/images/atlas.h> | ||
| 21 | 22 | ||
| 22 | #include <assert.h> | 23 | #include <assert.h> |
| 23 | #include <cstdlib> | 24 | #include <cstdlib> |
| @@ -25,6 +26,7 @@ | @@ -25,6 +26,7 @@ | ||
| 25 | #include <iostream> | 26 | #include <iostream> |
| 26 | 27 | ||
| 27 | #include "shared/view.h" | 28 | #include "shared/view.h" |
| 29 | +#include "shared/utility.h" | ||
| 28 | 30 | ||
| 29 | using namespace Dali; | 31 | using namespace Dali; |
| 30 | using namespace Dali::Toolkit; | 32 | using namespace Dali::Toolkit; |
| @@ -39,9 +41,9 @@ const char* const CHANGE_IMAGE_ICON_SELECTED( DEMO_IMAGE_DIR "icon-change-select | @@ -39,9 +41,9 @@ const char* const CHANGE_IMAGE_ICON_SELECTED( DEMO_IMAGE_DIR "icon-change-select | ||
| 39 | // set a ratio to modify the current page number when the rotation is changed | 41 | // set a ratio to modify the current page number when the rotation is changed |
| 40 | const float PAGE_NUMBER_CORRESPONDING_RATIO(1.25f); | 42 | const float PAGE_NUMBER_CORRESPONDING_RATIO(1.25f); |
| 41 | 43 | ||
| 42 | -const char* BOOK_COVER_PORTRAIT = ( DEMO_IMAGE_DIR "book-portrait-cover.jpg" ); | ||
| 43 | -const char* BOOK_COVER_LANDSCAPE = ( DEMO_IMAGE_DIR "book-landscape-cover.jpg" ); | ||
| 44 | -const char* BOOK_COVER_BACK_LANDSCAPE = ( DEMO_IMAGE_DIR "book-landscape-cover-back.jpg" ); | 44 | +const char* BOOK_COVER_PORTRAIT( DEMO_IMAGE_DIR "book-portrait-cover.jpg" ); |
| 45 | +const char* BOOK_COVER_LANDSCAPE( DEMO_IMAGE_DIR "book-landscape-cover.jpg" ); | ||
| 46 | +const char* BOOK_COVER_BACK_LANDSCAPE( DEMO_IMAGE_DIR "book-landscape-cover-back.jpg" ); | ||
| 45 | 47 | ||
| 46 | const char* PAGE_IMAGES_PORTRAIT[] = | 48 | const char* PAGE_IMAGES_PORTRAIT[] = |
| 47 | { | 49 | { |
| @@ -66,6 +68,21 @@ const char* PAGE_IMAGES_LANDSCAPE[] = | @@ -66,6 +68,21 @@ const char* PAGE_IMAGES_LANDSCAPE[] = | ||
| 66 | }; | 68 | }; |
| 67 | const unsigned int NUMBER_OF_LANDSCAPE_IMAGE( sizeof(PAGE_IMAGES_LANDSCAPE) / sizeof(PAGE_IMAGES_LANDSCAPE[0]) ); | 69 | const unsigned int NUMBER_OF_LANDSCAPE_IMAGE( sizeof(PAGE_IMAGES_LANDSCAPE) / sizeof(PAGE_IMAGES_LANDSCAPE[0]) ); |
| 68 | 70 | ||
| 71 | +Atlas LoadImages( const char*imagePath1, const char* imagePath2 ) | ||
| 72 | +{ | ||
| 73 | + PixelData pixelData1 = DemoHelper::LoadPixelData( imagePath1, ImageDimensions(), FittingMode::DEFAULT, SamplingMode::DEFAULT ); | ||
| 74 | + PixelData pixelData2 = DemoHelper::LoadPixelData( imagePath2, ImageDimensions(), FittingMode::DEFAULT, SamplingMode::DEFAULT ); | ||
| 75 | + | ||
| 76 | + unsigned int width = pixelData1.GetWidth()+pixelData2.GetWidth(); | ||
| 77 | + unsigned int height = pixelData1.GetHeight() > pixelData2.GetHeight() ? pixelData1.GetHeight() : pixelData2.GetHeight(); | ||
| 78 | + | ||
| 79 | + Atlas image = Atlas::New( width, height ); | ||
| 80 | + image.Upload( pixelData1, 0u, 0u ); | ||
| 81 | + image.Upload( pixelData2, pixelData1.GetWidth(), 0u ); | ||
| 82 | + | ||
| 83 | + return image; | ||
| 84 | +} | ||
| 85 | + | ||
| 69 | }// end LOCAL STUFF | 86 | }// end LOCAL STUFF |
| 70 | 87 | ||
| 71 | class PortraitPageFactory : public PageFactory | 88 | class PortraitPageFactory : public PageFactory |
| @@ -85,15 +102,15 @@ class PortraitPageFactory : public PageFactory | @@ -85,15 +102,15 @@ class PortraitPageFactory : public PageFactory | ||
| 85 | */ | 102 | */ |
| 86 | virtual Image NewPage( unsigned int pageId ) | 103 | virtual Image NewPage( unsigned int pageId ) |
| 87 | { | 104 | { |
| 88 | - Image page; | 105 | + Atlas page; |
| 89 | 106 | ||
| 90 | if( pageId == 0 ) | 107 | if( pageId == 0 ) |
| 91 | { | 108 | { |
| 92 | - page = ResourceImage::New( BOOK_COVER_PORTRAIT ); | 109 | + page = DemoHelper::LoadImage( BOOK_COVER_PORTRAIT ); |
| 93 | } | 110 | } |
| 94 | else | 111 | else |
| 95 | { | 112 | { |
| 96 | - page = ResourceImage::New( PAGE_IMAGES_PORTRAIT[ (pageId-1) % NUMBER_OF_PORTRAIT_IMAGE ] ); | 113 | + page = DemoHelper::LoadImage( PAGE_IMAGES_PORTRAIT[ (pageId-1) % NUMBER_OF_PORTRAIT_IMAGE ] ); |
| 97 | } | 114 | } |
| 98 | 115 | ||
| 99 | return page; | 116 | return page; |
| @@ -118,29 +135,20 @@ class LandscapePageFactory : public PageFactory | @@ -118,29 +135,20 @@ class LandscapePageFactory : public PageFactory | ||
| 118 | */ | 135 | */ |
| 119 | virtual Image NewPage( unsigned int pageId ) | 136 | virtual Image NewPage( unsigned int pageId ) |
| 120 | { | 137 | { |
| 121 | - if( mImageSize.GetWidth() == 0u || mImageSize.GetHeight() == 0u ) | ||
| 122 | - { | ||
| 123 | - mImageSize = ResourceImage::GetImageSize(BOOK_COVER_LANDSCAPE); | ||
| 124 | - } | ||
| 125 | 138 | ||
| 126 | - ImageAtlas atlas = ImageAtlas::New( mImageSize.GetWidth()*2u, mImageSize.GetHeight(), Pixel::RGB888 ); | ||
| 127 | - Vector4 textureRect; | 139 | + Atlas page; |
| 128 | if( pageId == 0 ) | 140 | if( pageId == 0 ) |
| 129 | { | 141 | { |
| 130 | - atlas.Upload( textureRect, BOOK_COVER_LANDSCAPE, mImageSize ); | ||
| 131 | - atlas.Upload( textureRect, BOOK_COVER_BACK_LANDSCAPE, mImageSize ); | 142 | + page = LoadImages( BOOK_COVER_LANDSCAPE, BOOK_COVER_BACK_LANDSCAPE ); |
| 132 | } | 143 | } |
| 133 | else | 144 | else |
| 134 | { | 145 | { |
| 135 | unsigned int imageId = (pageId-1)*2; | 146 | unsigned int imageId = (pageId-1)*2; |
| 136 | - atlas.Upload( textureRect, PAGE_IMAGES_LANDSCAPE[ imageId % NUMBER_OF_LANDSCAPE_IMAGE ], mImageSize ); | ||
| 137 | - atlas.Upload( textureRect, PAGE_IMAGES_LANDSCAPE[ (imageId+1) % NUMBER_OF_LANDSCAPE_IMAGE ], mImageSize ); | 147 | + page = LoadImages( PAGE_IMAGES_LANDSCAPE[ imageId % NUMBER_OF_LANDSCAPE_IMAGE ], PAGE_IMAGES_LANDSCAPE[ (imageId+1) % NUMBER_OF_LANDSCAPE_IMAGE ] ); |
| 138 | } | 148 | } |
| 139 | 149 | ||
| 140 | - return atlas.GetAtlas(); | 150 | + return page; |
| 141 | } | 151 | } |
| 142 | - | ||
| 143 | - ImageDimensions mImageSize; | ||
| 144 | }; | 152 | }; |
| 145 | 153 | ||
| 146 | /** | 154 | /** |
examples/perf-scroll/perf-scroll.cpp
| @@ -23,6 +23,8 @@ | @@ -23,6 +23,8 @@ | ||
| 23 | #include <dali/integration-api/debug.h> | 23 | #include <dali/integration-api/debug.h> |
| 24 | #include <iostream> | 24 | #include <iostream> |
| 25 | 25 | ||
| 26 | +#include "shared/utility.h" | ||
| 27 | + | ||
| 26 | using namespace Dali; | 28 | using namespace Dali; |
| 27 | using namespace Dali::Toolkit; | 29 | using namespace Dali::Toolkit; |
| 28 | 30 | ||
| @@ -225,10 +227,10 @@ Renderer CreateRenderer( unsigned int index ) | @@ -225,10 +227,10 @@ Renderer CreateRenderer( unsigned int index ) | ||
| 225 | Shader shader = Shader::New( VERTEX_SHADER_TEXTURE, FRAGMENT_SHADER_TEXTURE ); | 227 | Shader shader = Shader::New( VERTEX_SHADER_TEXTURE, FRAGMENT_SHADER_TEXTURE ); |
| 226 | 228 | ||
| 227 | const char* imagePath = !gNinePatch ? IMAGE_PATH[index] : NINEPATCH_IMAGE_PATH[index]; | 229 | const char* imagePath = !gNinePatch ? IMAGE_PATH[index] : NINEPATCH_IMAGE_PATH[index]; |
| 228 | - Image image = ResourceImage::New( imagePath ); | 230 | + Texture texture = DemoHelper::LoadTexture( imagePath ); |
| 229 | 231 | ||
| 230 | TextureSet textureSet = TextureSet::New(); | 232 | TextureSet textureSet = TextureSet::New(); |
| 231 | - textureSet.SetImage( 0u, image ); | 233 | + textureSet.SetTexture( 0u, texture ); |
| 232 | renderers[index] = Renderer::New( QuadMesh(), shader ); | 234 | renderers[index] = Renderer::New( QuadMesh(), shader ); |
| 233 | renderers[index].SetTextures( textureSet ); | 235 | renderers[index].SetTextures( textureSet ); |
| 234 | renderers[index].SetProperty( Renderer::Property::BLEND_MODE, BlendMode::OFF ); | 236 | renderers[index].SetProperty( Renderer::Property::BLEND_MODE, BlendMode::OFF ); |
examples/point-mesh/point-mesh-example.cpp
| @@ -21,6 +21,7 @@ | @@ -21,6 +21,7 @@ | ||
| 21 | 21 | ||
| 22 | // INTERNAL INCLUDES | 22 | // INTERNAL INCLUDES |
| 23 | #include "shared/view.h" | 23 | #include "shared/view.h" |
| 24 | +#include "shared/utility.h" | ||
| 24 | 25 | ||
| 25 | using namespace Dali; | 26 | using namespace Dali; |
| 26 | 27 | ||
| @@ -152,14 +153,14 @@ public: | @@ -152,14 +153,14 @@ public: | ||
| 152 | // Hide the indicator bar | 153 | // Hide the indicator bar |
| 153 | application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); | 154 | application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); |
| 154 | 155 | ||
| 155 | - Image image0 = ResourceImage::New( MATERIAL_SAMPLE ); | ||
| 156 | - Image image1 = ResourceImage::New( MATERIAL_SAMPLE2 ); | 156 | + Texture texture0 = DemoHelper::LoadTexture( MATERIAL_SAMPLE ); |
| 157 | + Texture texture1 = DemoHelper::LoadTexture( MATERIAL_SAMPLE2 ); | ||
| 157 | 158 | ||
| 158 | Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); | 159 | Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); |
| 159 | 160 | ||
| 160 | TextureSet textureSet = TextureSet::New(); | 161 | TextureSet textureSet = TextureSet::New(); |
| 161 | - textureSet.SetImage( 0u, image0 ); | ||
| 162 | - textureSet.SetImage( 1u, image1 ); | 162 | + textureSet.SetTexture( 0u, texture0 ); |
| 163 | + textureSet.SetTexture( 1u, texture1 ); | ||
| 163 | 164 | ||
| 164 | Geometry geometry = CreateGeometry(); | 165 | Geometry geometry = CreateGeometry(); |
| 165 | 166 |
examples/popup/popup-example.cpp
| @@ -712,11 +712,6 @@ private: | @@ -712,11 +712,6 @@ private: | ||
| 712 | bool mContextual; ///< True if currently using the contextual popup mode. | 712 | bool mContextual; ///< True if currently using the contextual popup mode. |
| 713 | bool mAnimationFade; ///< True if currently using the fade animation. | 713 | bool mAnimationFade; ///< True if currently using the fade animation. |
| 714 | 714 | ||
| 715 | - ResourceImage mContextButtonDisabledImage; ///< The disabled context button icon. | ||
| 716 | - ResourceImage mContextButtonEnabledImage; ///< The enabled context button icon. | ||
| 717 | - ResourceImage mAnimationButtonZoomImage; ///< The zoom animation button icon. | ||
| 718 | - ResourceImage mAnimationButtonFadeImage; ///< The fade animation button icon. | ||
| 719 | - | ||
| 720 | Toolkit::Popup mPopup; ///< The current example popup. | 715 | Toolkit::Popup mPopup; ///< The current example popup. |
| 721 | 716 | ||
| 722 | Toolkit::ItemView mItemView; ///< ItemView to hold test images | 717 | Toolkit::ItemView mItemView; ///< ItemView to hold test images |
examples/radial-menu/radial-menu-example.cpp
| @@ -172,8 +172,7 @@ void RadialMenuExample::OnInit(Application& app) | @@ -172,8 +172,7 @@ void RadialMenuExample::OnInit(Application& app) | ||
| 172 | mRadialSweepView3.SetInitialActorAngle(Degree(-110)); | 172 | mRadialSweepView3.SetInitialActorAngle(Degree(-110)); |
| 173 | mRadialSweepView3.SetFinalActorAngle(Degree(0)); | 173 | mRadialSweepView3.SetFinalActorAngle(Degree(0)); |
| 174 | 174 | ||
| 175 | - Image dial = ResourceImage::New( TEST_DIAL_FILENAME ); | ||
| 176 | - mDialView = ImageView::New( dial ); | 175 | + mDialView = ImageView::New( TEST_DIAL_FILENAME ); |
| 177 | mDialView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); | 176 | mDialView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); |
| 178 | mDialView.SetParentOrigin( ParentOrigin::CENTER ); | 177 | mDialView.SetParentOrigin( ParentOrigin::CENTER ); |
| 179 | mDialView.SetScale(scale); | 178 | mDialView.SetScale(scale); |
| @@ -254,8 +253,7 @@ RadialSweepView RadialMenuExample::CreateSweepView( std::string imageName, | @@ -254,8 +253,7 @@ RadialSweepView RadialMenuExample::CreateSweepView( std::string imageName, | ||
| 254 | Degree finalAngle) | 253 | Degree finalAngle) |
| 255 | { | 254 | { |
| 256 | // Create the image | 255 | // Create the image |
| 257 | - Image image = ResourceImage::New(imageName); | ||
| 258 | - mImageView = ImageView::New(image); | 256 | + mImageView = ImageView::New(imageName); |
| 259 | mImageView.SetParentOrigin(ParentOrigin::CENTER); | 257 | mImageView.SetParentOrigin(ParentOrigin::CENTER); |
| 260 | mImageView.SetAnchorPoint(AnchorPoint::CENTER); | 258 | mImageView.SetAnchorPoint(AnchorPoint::CENTER); |
| 261 | mImageView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); | 259 | mImageView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); |
examples/refraction-effect/refraction-effect-example.cpp
| @@ -26,6 +26,7 @@ | @@ -26,6 +26,7 @@ | ||
| 26 | 26 | ||
| 27 | // INTERNAL INCLUDES | 27 | // INTERNAL INCLUDES |
| 28 | #include "shared/view.h" | 28 | #include "shared/view.h" |
| 29 | +#include "shared/utility.h" | ||
| 29 | 30 | ||
| 30 | using namespace Dali; | 31 | using namespace Dali; |
| 31 | 32 | ||
| @@ -74,19 +75,6 @@ struct LightOffsetConstraint | @@ -74,19 +75,6 @@ struct LightOffsetConstraint | ||
| 74 | }; | 75 | }; |
| 75 | 76 | ||
| 76 | /** | 77 | /** |
| 77 | - * @brief Load an image, scaled-down to no more than the stage dimensions. | ||
| 78 | - * | ||
| 79 | - * Uses image scaling mode SCALE_TO_FILL to resize the image at | ||
| 80 | - * load time to cover the entire stage with pixels with no borders, | ||
| 81 | - * and filter mode BOX_THEN_LINEAR to sample the image with maximum quality. | ||
| 82 | - */ | ||
| 83 | -ResourceImage LoadStageFillingImage( const char * const imagePath ) | ||
| 84 | -{ | ||
| 85 | - Size stageSize = Stage::GetCurrent().GetSize(); | ||
| 86 | - return ResourceImage::New( imagePath, ImageDimensions( stageSize.x, stageSize.y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); | ||
| 87 | -} | ||
| 88 | - | ||
| 89 | -/** | ||
| 90 | * structure of the vertex in the mesh | 78 | * structure of the vertex in the mesh |
| 91 | */ | 79 | */ |
| 92 | struct Vertex | 80 | struct Vertex |
| @@ -280,9 +268,9 @@ private: | @@ -280,9 +268,9 @@ private: | ||
| 280 | mShaderFlat = Shader::New( VERTEX_SHADER_FLAT, FRAGMENT_SHADER_FLAT ); | 268 | mShaderFlat = Shader::New( VERTEX_SHADER_FLAT, FRAGMENT_SHADER_FLAT ); |
| 281 | mGeometry = CreateGeometry( MESH_FILES[mCurrentMeshId] ); | 269 | mGeometry = CreateGeometry( MESH_FILES[mCurrentMeshId] ); |
| 282 | 270 | ||
| 283 | - Image texture = LoadStageFillingImage( TEXTURE_IMAGES[mCurrentTextureId] ); | 271 | + Texture texture = DemoHelper::LoadStageFillingTexture( TEXTURE_IMAGES[mCurrentTextureId] ); |
| 284 | mTextureSet = TextureSet::New(); | 272 | mTextureSet = TextureSet::New(); |
| 285 | - mTextureSet.SetImage( 0u, texture ); | 273 | + mTextureSet.SetTexture( 0u, texture ); |
| 286 | 274 | ||
| 287 | mRenderer = Renderer::New( mGeometry, mShaderFlat ); | 275 | mRenderer = Renderer::New( mGeometry, mShaderFlat ); |
| 288 | mRenderer.SetTextures( mTextureSet ); | 276 | mRenderer.SetTextures( mTextureSet ); |
| @@ -343,8 +331,8 @@ private: | @@ -343,8 +331,8 @@ private: | ||
| 343 | bool OnChangeTexture( Toolkit::Button button ) | 331 | bool OnChangeTexture( Toolkit::Button button ) |
| 344 | { | 332 | { |
| 345 | mCurrentTextureId = ( mCurrentTextureId + 1 ) % NUM_TEXTURE_IMAGES; | 333 | mCurrentTextureId = ( mCurrentTextureId + 1 ) % NUM_TEXTURE_IMAGES; |
| 346 | - Image texture = LoadStageFillingImage( TEXTURE_IMAGES[mCurrentTextureId] ); | ||
| 347 | - mTextureSet.SetImage( 0u, texture ); | 334 | + Texture texture = DemoHelper::LoadStageFillingTexture( TEXTURE_IMAGES[mCurrentTextureId] ); |
| 335 | + mTextureSet.SetTexture( 0u, texture ); | ||
| 348 | return true; | 336 | return true; |
| 349 | } | 337 | } |
| 350 | 338 |
examples/scroll-view/scroll-view-example.cpp
| @@ -450,11 +450,18 @@ private: | @@ -450,11 +450,18 @@ private: | ||
| 450 | * @param[in] width the width of the image in texels | 450 | * @param[in] width the width of the image in texels |
| 451 | * @param[in] height the height of the image in texels. | 451 | * @param[in] height the height of the image in texels. |
| 452 | */ | 452 | */ |
| 453 | - ImageView CreateImage( const std::string& filename, unsigned int width = IMAGE_THUMBNAIL_WIDTH, unsigned int height = IMAGE_THUMBNAIL_HEIGHT ) | 453 | + ImageView CreateImage( const std::string& filename, int width = IMAGE_THUMBNAIL_WIDTH, int height = IMAGE_THUMBNAIL_HEIGHT ) |
| 454 | { | 454 | { |
| 455 | - Image img = ResourceImage::New(filename, ImageDimensions( width, height ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); | 455 | + ImageView actor = ImageView::New(); |
| 456 | + Property::Map map; | ||
| 457 | + map["rendererType"] = "image"; | ||
| 458 | + map["url"] = filename; | ||
| 459 | + map["desiredWidth"] = width; | ||
| 460 | + map["desiredHeight"] = height; | ||
| 461 | + map["fittingMode"] = "SCALE_TO_FILL"; | ||
| 462 | + map["samplingMode"] = "BOX_THEN_LINEAR"; | ||
| 463 | + actor.SetProperty( ImageView::Property::IMAGE, map ); | ||
| 456 | 464 | ||
| 457 | - ImageView actor = ImageView::New(img); | ||
| 458 | actor.SetName( filename ); | 465 | actor.SetName( filename ); |
| 459 | actor.SetParentOrigin(ParentOrigin::CENTER); | 466 | actor.SetParentOrigin(ParentOrigin::CENTER); |
| 460 | actor.SetAnchorPoint(AnchorPoint::CENTER); | 467 | actor.SetAnchorPoint(AnchorPoint::CENTER); |
| @@ -487,7 +494,7 @@ private: | @@ -487,7 +494,7 @@ private: | ||
| 487 | * Upon Touching an image (Release), make it spin | 494 | * Upon Touching an image (Release), make it spin |
| 488 | * (provided we're not scrolling). | 495 | * (provided we're not scrolling). |
| 489 | * @param[in] actor The actor touched | 496 | * @param[in] actor The actor touched |
| 490 | - * @param[in] event The TouchEvent. | 497 | + * @param[in] event The touch information. |
| 491 | */ | 498 | */ |
| 492 | bool OnTouchImage( Actor actor, const TouchData& event ) | 499 | bool OnTouchImage( Actor actor, const TouchData& event ) |
| 493 | { | 500 | { |
examples/super-blur-bloom/super-blur-bloom-example.cpp
| @@ -19,6 +19,7 @@ | @@ -19,6 +19,7 @@ | ||
| 19 | #include <dali-toolkit/devel-api/controls/super-blur-view/super-blur-view.h> | 19 | #include <dali-toolkit/devel-api/controls/super-blur-view/super-blur-view.h> |
| 20 | #include <dali-toolkit/devel-api/controls/bloom-view/bloom-view.h> | 20 | #include <dali-toolkit/devel-api/controls/bloom-view/bloom-view.h> |
| 21 | #include "shared/view.h" | 21 | #include "shared/view.h" |
| 22 | +#include "shared/utility.h" | ||
| 22 | 23 | ||
| 23 | using namespace Dali; | 24 | using namespace Dali; |
| 24 | 25 | ||
| @@ -42,20 +43,7 @@ const char* BACKGROUND_IMAGES[]= | @@ -42,20 +43,7 @@ const char* BACKGROUND_IMAGES[]= | ||
| 42 | DEMO_IMAGE_DIR "background-magnifier.jpg", | 43 | DEMO_IMAGE_DIR "background-magnifier.jpg", |
| 43 | }; | 44 | }; |
| 44 | const unsigned int NUM_BACKGROUND_IMAGES( sizeof( BACKGROUND_IMAGES ) / sizeof( BACKGROUND_IMAGES[0] ) ); | 45 | const unsigned int NUM_BACKGROUND_IMAGES( sizeof( BACKGROUND_IMAGES ) / sizeof( BACKGROUND_IMAGES[0] ) ); |
| 45 | -} | ||
| 46 | 46 | ||
| 47 | -/** | ||
| 48 | - * @brief Load an image, scaled-down to no more than the stage dimensions. | ||
| 49 | - * | ||
| 50 | - * Uses image scaling mode FittingMode::SCALE_TO_FILL to resize the image at | ||
| 51 | - * load time to cover the entire stage with pixels with no borders, | ||
| 52 | - * and filter mode BOX_THEN_LINEAR to sample the image with | ||
| 53 | - * maximum quality. | ||
| 54 | - */ | ||
| 55 | -ResourceImage LoadStageFillingImage( const char * const imagePath ) | ||
| 56 | -{ | ||
| 57 | - Size stageSize = Stage::GetCurrent().GetSize(); | ||
| 58 | - return ResourceImage::New( imagePath, Dali::ImageDimensions( stageSize.x, stageSize.y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); | ||
| 59 | } | 47 | } |
| 60 | 48 | ||
| 61 | class BlurExample : public ConnectionTracker | 49 | class BlurExample : public ConnectionTracker |
| @@ -116,7 +104,7 @@ private: | @@ -116,7 +104,7 @@ private: | ||
| 116 | mSuperBlurView.SetParentOrigin( ParentOrigin::CENTER ); | 104 | mSuperBlurView.SetParentOrigin( ParentOrigin::CENTER ); |
| 117 | mSuperBlurView.SetAnchorPoint( AnchorPoint::CENTER ); | 105 | mSuperBlurView.SetAnchorPoint( AnchorPoint::CENTER ); |
| 118 | mSuperBlurView.BlurFinishedSignal().Connect(this, &BlurExample::OnBlurFinished); | 106 | mSuperBlurView.BlurFinishedSignal().Connect(this, &BlurExample::OnBlurFinished); |
| 119 | - mCurrentImage = LoadStageFillingImage( BACKGROUND_IMAGES[mImageIndex] ); | 107 | + mCurrentImage = DemoHelper::LoadStageFillingImage( BACKGROUND_IMAGES[mImageIndex] ); |
| 120 | mSuperBlurView.SetImage( mCurrentImage ); | 108 | mSuperBlurView.SetImage( mCurrentImage ); |
| 121 | mBackground.Add( mSuperBlurView ); | 109 | mBackground.Add( mSuperBlurView ); |
| 122 | mIsBlurring = true; | 110 | mIsBlurring = true; |
| @@ -215,7 +203,7 @@ private: | @@ -215,7 +203,7 @@ private: | ||
| 215 | } | 203 | } |
| 216 | 204 | ||
| 217 | mImageIndex = (mImageIndex+1u)%NUM_BACKGROUND_IMAGES; | 205 | mImageIndex = (mImageIndex+1u)%NUM_BACKGROUND_IMAGES; |
| 218 | - mCurrentImage = LoadStageFillingImage( BACKGROUND_IMAGES[mImageIndex] ); | 206 | + mCurrentImage = DemoHelper::LoadStageFillingImage( BACKGROUND_IMAGES[mImageIndex] ); |
| 219 | 207 | ||
| 220 | if( mSuperBlurView.OnStage() ) | 208 | if( mSuperBlurView.OnStage() ) |
| 221 | { | 209 | { |
examples/text-field/text-field-example.cpp
| @@ -87,8 +87,8 @@ public: | @@ -87,8 +87,8 @@ public: | ||
| 87 | button.SetSelectedImage( FOLDER_OPEN_ICON_IMAGE ); | 87 | button.SetSelectedImage( FOLDER_OPEN_ICON_IMAGE ); |
| 88 | button.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | 88 | button.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 89 | button.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | 89 | button.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); |
| 90 | - ResourceImage imageClosed = ResourceImage::New( FOLDER_ICON_IMAGE ); | ||
| 91 | - button.SetSize( imageClosed.GetWidth(), imageClosed.GetHeight() ); | 90 | + ImageDimensions imageSize = ResourceImage::GetImageSize( FOLDER_ICON_IMAGE ); |
| 91 | + button.SetSize( imageSize.GetWidth(), imageSize.GetHeight() ); | ||
| 92 | 92 | ||
| 93 | return button; | 93 | return button; |
| 94 | } | 94 | } |
examples/text-label/text-label-example.cpp
| @@ -111,11 +111,10 @@ public: | @@ -111,11 +111,10 @@ public: | ||
| 111 | stage.Add( mContainer ); | 111 | stage.Add( mContainer ); |
| 112 | 112 | ||
| 113 | // Resize the center layout when the corner is grabbed | 113 | // Resize the center layout when the corner is grabbed |
| 114 | - mGrabCorner = Control::New(); | 114 | + mGrabCorner = ImageView::New( BACKGROUND_IMAGE ); |
| 115 | mGrabCorner.SetName( "GrabCorner" ); | 115 | mGrabCorner.SetName( "GrabCorner" ); |
| 116 | mGrabCorner.SetAnchorPoint( AnchorPoint::TOP_CENTER ); | 116 | mGrabCorner.SetAnchorPoint( AnchorPoint::TOP_CENTER ); |
| 117 | mGrabCorner.SetParentOrigin( ParentOrigin::BOTTOM_RIGHT ); | 117 | mGrabCorner.SetParentOrigin( ParentOrigin::BOTTOM_RIGHT ); |
| 118 | - mGrabCorner.SetBackgroundImage( ResourceImage::New( BACKGROUND_IMAGE ) ); | ||
| 119 | mGrabCorner.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); | 118 | mGrabCorner.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); |
| 120 | mContainer.Add( mGrabCorner ); | 119 | mContainer.Add( mGrabCorner ); |
| 121 | 120 |
examples/textured-mesh/textured-mesh-example.cpp
| @@ -21,6 +21,7 @@ | @@ -21,6 +21,7 @@ | ||
| 21 | 21 | ||
| 22 | // INTERNAL INCLUDES | 22 | // INTERNAL INCLUDES |
| 23 | #include "shared/view.h" | 23 | #include "shared/view.h" |
| 24 | +#include "shared/utility.h" | ||
| 24 | 25 | ||
| 25 | using namespace Dali; | 26 | using namespace Dali; |
| 26 | 27 | ||
| @@ -140,15 +141,15 @@ public: | @@ -140,15 +141,15 @@ public: | ||
| 140 | // Hide the indicator bar | 141 | // Hide the indicator bar |
| 141 | application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); | 142 | application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); |
| 142 | 143 | ||
| 143 | - mImage = ResourceImage::New( MATERIAL_SAMPLE ); | ||
| 144 | - Image image = ResourceImage::New( MATERIAL_SAMPLE2 ); | 144 | + Texture texture1 = DemoHelper::LoadTexture( MATERIAL_SAMPLE ); |
| 145 | + Texture texture2 = DemoHelper::LoadTexture( MATERIAL_SAMPLE2 ); | ||
| 145 | 146 | ||
| 146 | mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); | 147 | mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); |
| 147 | mTextureSet1 = TextureSet::New(); | 148 | mTextureSet1 = TextureSet::New(); |
| 148 | - mTextureSet1.SetImage( 0u, mImage ); | 149 | + mTextureSet1.SetTexture( 0u, texture1 ); |
| 149 | 150 | ||
| 150 | mTextureSet2 = TextureSet::New(); | 151 | mTextureSet2 = TextureSet::New(); |
| 151 | - mTextureSet2.SetImage( 0u, image ); | 152 | + mTextureSet2.SetTexture( 0u, texture2 ); |
| 152 | 153 | ||
| 153 | mGeometry = CreateGeometry(); | 154 | mGeometry = CreateGeometry(); |
| 154 | 155 | ||
| @@ -258,7 +259,6 @@ private: | @@ -258,7 +259,6 @@ private: | ||
| 258 | Application& mApplication; ///< Application instance | 259 | Application& mApplication; ///< Application instance |
| 259 | Vector3 mStageSize; ///< The size of the stage | 260 | Vector3 mStageSize; ///< The size of the stage |
| 260 | 261 | ||
| 261 | - Image mImage; | ||
| 262 | Shader mShader; | 262 | Shader mShader; |
| 263 | TextureSet mTextureSet1; | 263 | TextureSet mTextureSet1; |
| 264 | TextureSet mTextureSet2; | 264 | TextureSet mTextureSet2; |
packaging/com.samsung.dali-demo.spec
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | 2 | ||
| 3 | Name: com.samsung.dali-demo | 3 | Name: com.samsung.dali-demo |
| 4 | Summary: The OpenGLES Canvas Core Demo | 4 | Summary: The OpenGLES Canvas Core Demo |
| 5 | -Version: 1.1.41 | 5 | +Version: 1.1.42 |
| 6 | Release: 1 | 6 | Release: 1 |
| 7 | Group: System/Libraries | 7 | Group: System/Libraries |
| 8 | License: Apache-2.0 | 8 | License: Apache-2.0 |
shared/utility.h
0 โ 100644
| 1 | +#ifndef __DALI_DEMO_UTILITY_H__ | ||
| 2 | +#define __DALI_DEMO_UTILITY_H__ | ||
| 3 | + | ||
| 4 | +/* | ||
| 5 | + * Copyright (c) 2014 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 | + | ||
| 21 | +#include <dali/dali.h> | ||
| 22 | +#include <dali/devel-api/images/atlas.h> | ||
| 23 | +#include <dali/devel-api/rendering/texture.h> | ||
| 24 | +#include <dali/devel-api/adaptor-framework/bitmap-loader.h> | ||
| 25 | + | ||
| 26 | +namespace DemoHelper | ||
| 27 | +{ | ||
| 28 | + | ||
| 29 | +Dali::PixelData LoadPixelData( const char* imagePath, | ||
| 30 | + Dali::ImageDimensions size, | ||
| 31 | + Dali::FittingMode::Type fittingMode, | ||
| 32 | + Dali::SamplingMode::Type samplingMode ) | ||
| 33 | +{ | ||
| 34 | + Dali::BitmapLoader loader = Dali::BitmapLoader::New( imagePath, size, fittingMode, samplingMode ); | ||
| 35 | + loader.Load(); | ||
| 36 | + return loader.GetPixelData(); | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | + | ||
| 40 | +Dali::Atlas LoadImage( const char* imagePath, | ||
| 41 | + Dali::ImageDimensions size = Dali::ImageDimensions(), | ||
| 42 | + Dali::FittingMode::Type fittingMode = Dali::FittingMode::DEFAULT, | ||
| 43 | + Dali::SamplingMode::Type samplingMode = Dali::SamplingMode::DEFAULT ) | ||
| 44 | +{ | ||
| 45 | + Dali::PixelData pixelData = LoadPixelData(imagePath, size, fittingMode, samplingMode); | ||
| 46 | + Dali::Atlas image =Dali:: Atlas::New( pixelData.GetWidth(), pixelData.GetHeight(), pixelData.GetPixelFormat() ); | ||
| 47 | + image.Upload( pixelData, 0u, 0u ); | ||
| 48 | + | ||
| 49 | + return image; | ||
| 50 | +} | ||
| 51 | + | ||
| 52 | +Dali::Texture LoadTexture( const char* imagePath, | ||
| 53 | + Dali::ImageDimensions size = Dali::ImageDimensions(), | ||
| 54 | + Dali::FittingMode::Type fittingMode = Dali::FittingMode::DEFAULT, | ||
| 55 | + Dali::SamplingMode::Type samplingMode = Dali::SamplingMode::DEFAULT ) | ||
| 56 | +{ | ||
| 57 | + Dali::PixelData pixelData = LoadPixelData(imagePath, size, fittingMode, samplingMode); | ||
| 58 | + Dali::Texture texture = Dali::Texture::New( Dali::TextureType::TEXTURE_2D, | ||
| 59 | + pixelData.GetPixelFormat(), | ||
| 60 | + pixelData.GetWidth(), | ||
| 61 | + pixelData.GetHeight() ); | ||
| 62 | + texture.Upload( pixelData ); | ||
| 63 | + | ||
| 64 | + return texture; | ||
| 65 | +} | ||
| 66 | + | ||
| 67 | +/** | ||
| 68 | + * @brief Load an bitmap resource. | ||
| 69 | + * | ||
| 70 | + * If it is required to scaled-down to no more than the stage dimensions, | ||
| 71 | + * uses image scaling mode FittingMode::SCALE_TO_FILL to resize the image at | ||
| 72 | + * load time to cover the entire stage with pixels with no borders, | ||
| 73 | + * and filter mode BOX_THEN_LINEAR to sample the image with | ||
| 74 | + * maximum quality. | ||
| 75 | + */ | ||
| 76 | + | ||
| 77 | +Dali::Atlas LoadStageFillingImage( const char* imagePath ) | ||
| 78 | +{ | ||
| 79 | + Dali::Vector2 stageSize = Dali::Stage::GetCurrent().GetSize(); | ||
| 80 | + return LoadImage( imagePath, Dali::ImageDimensions( stageSize.x, stageSize.y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); | ||
| 81 | +} | ||
| 82 | + | ||
| 83 | +Dali::Texture LoadStageFillingTexture( const char* imagePath ) | ||
| 84 | +{ | ||
| 85 | + Dali::Vector2 stageSize = Dali::Stage::GetCurrent().GetSize(); | ||
| 86 | + return LoadTexture( imagePath, Dali::ImageDimensions( stageSize.x, stageSize.y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); | ||
| 87 | +} | ||
| 88 | + | ||
| 89 | +} // DemoHelper | ||
| 90 | + | ||
| 91 | +#endif // __DALI_DEMO_HELPER_VIEW_H__ |
shared/view.h
| @@ -77,10 +77,11 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, | @@ -77,10 +77,11 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, | ||
| 77 | toolBarLayer.RaiseToTop(); | 77 | toolBarLayer.RaiseToTop(); |
| 78 | 78 | ||
| 79 | // Tool bar | 79 | // Tool bar |
| 80 | - Dali::Image image = Dali::ResourceImage::New( toolbarImagePath ); | ||
| 81 | toolBar = Dali::Toolkit::ToolBar::New(); | 80 | toolBar = Dali::Toolkit::ToolBar::New(); |
| 82 | toolBar.SetName( "TOOLBAR" ); | 81 | toolBar.SetName( "TOOLBAR" ); |
| 83 | - toolBar.SetBackgroundImage( image ); | 82 | + Dali::Property::Map background; |
| 83 | + background["url"] = toolbarImagePath; | ||
| 84 | + toolBar.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, background ); | ||
| 84 | toolBar.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); | 85 | toolBar.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); |
| 85 | toolBar.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); | 86 | toolBar.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); |
| 86 | toolBar.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS ); | 87 | toolBar.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS ); |
| @@ -129,8 +130,15 @@ Dali::Layer CreateView( Dali::Application& application, | @@ -129,8 +130,15 @@ Dali::Layer CreateView( Dali::Application& application, | ||
| 129 | // Set background image, loading it at screen resolution: | 130 | // Set background image, loading it at screen resolution: |
| 130 | if ( !backgroundImagePath.empty() ) | 131 | if ( !backgroundImagePath.empty() ) |
| 131 | { | 132 | { |
| 132 | - Dali::Image backgroundImage = Dali::ResourceImage::New( backgroundImagePath, Dali::ImageDimensions( stage.GetSize().x, stage.GetSize().y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); | ||
| 133 | - view.SetBackgroundImage( backgroundImage ); | 133 | + Dali::Property::Map map; |
| 134 | + map["rendererType"] = "image"; | ||
| 135 | + map["url"] = backgroundImagePath; | ||
| 136 | + map["desiredWidth"] = stage.GetSize().x; | ||
| 137 | + map["desiredHeight"] = stage.GetSize().y; | ||
| 138 | + map["fittingMode"] = "SCALE_TO_FILL"; | ||
| 139 | + map["samplingMode"] = "BOX_THEN_LINEAR"; | ||
| 140 | + map["synchronousLoading"] = true; | ||
| 141 | + view.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map ); | ||
| 134 | } | 142 | } |
| 135 | 143 | ||
| 136 | // FIXME | 144 | // FIXME |