Commit 586db76f7e87f7ea15558c546dc50ac67251f1ed
1 parent
e09e8052
Gradient Renderer example property names updated
GradientRenderer property names changed in dali-toolkit so reflected here stopOffset nolonger set in code as uses defaults gradient json script added Change-Id: I1412be7fe7d7abeaee847a49dfcdacba806d3efd
Showing
4 changed files
with
61 additions
and
23 deletions
examples/gradients/gradients-example.cpp
| @@ -80,20 +80,22 @@ public: | @@ -80,20 +80,22 @@ public: | ||
| 80 | // ---- Gradient for background | 80 | // ---- Gradient for background |
| 81 | 81 | ||
| 82 | mGradientMap.Insert("rendererType", "gradient"); | 82 | mGradientMap.Insert("rendererType", "gradient"); |
| 83 | + | ||
| 83 | Property::Array stopOffsets; | 84 | Property::Array stopOffsets; |
| 84 | stopOffsets.PushBack( 0.0f ); | 85 | stopOffsets.PushBack( 0.0f ); |
| 85 | stopOffsets.PushBack( 0.3f ); | 86 | stopOffsets.PushBack( 0.3f ); |
| 86 | stopOffsets.PushBack( 0.6f ); | 87 | stopOffsets.PushBack( 0.6f ); |
| 87 | stopOffsets.PushBack( 0.8f ); | 88 | stopOffsets.PushBack( 0.8f ); |
| 88 | - stopOffsets.PushBack( 1.f ); | ||
| 89 | - mGradientMap.Insert("gradientStopOffset", stopOffsets); | 89 | + stopOffsets.PushBack( 1.0f ); |
| 90 | + mGradientMap.Insert("stopOffset", stopOffsets ); | ||
| 91 | + | ||
| 90 | Property::Array stopColors; | 92 | Property::Array stopColors; |
| 91 | stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 255.f )/255.f ); | 93 | stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 255.f )/255.f ); |
| 92 | stopColors.PushBack( Vector4( 196.f, 198.f, 71.f, 122.f )/255.f ); | 94 | stopColors.PushBack( Vector4( 196.f, 198.f, 71.f, 122.f )/255.f ); |
| 93 | stopColors.PushBack( Vector4( 214.f, 37.f, 139.f, 191.f )/255.f ); | 95 | stopColors.PushBack( Vector4( 214.f, 37.f, 139.f, 191.f )/255.f ); |
| 94 | stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 150.f )/255.f ); | 96 | stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 150.f )/255.f ); |
| 95 | stopColors.PushBack( Color::YELLOW ); | 97 | stopColors.PushBack( Color::YELLOW ); |
| 96 | - mGradientMap.Insert("gradientStopColor", stopColors); | 98 | + mGradientMap.Insert("stopColor", stopColors); |
| 97 | 99 | ||
| 98 | OnChangeIconClicked( changeButton ); | 100 | OnChangeIconClicked( changeButton ); |
| 99 | } | 101 | } |
| @@ -106,30 +108,30 @@ public: | @@ -106,30 +108,30 @@ public: | ||
| 106 | { | 108 | { |
| 107 | case 0: // linear gradient with units as objectBoundingBox | 109 | case 0: // linear gradient with units as objectBoundingBox |
| 108 | { | 110 | { |
| 109 | - gradientMap.Insert("gradientStartPosition", Vector2( 0.5f, 0.5f )); | ||
| 110 | - gradientMap.Insert("gradientEndPosition", Vector2( -0.5f, -0.5f )); | 111 | + gradientMap.Insert("startPosition", Vector2( 0.5f, 0.5f )); |
| 112 | + gradientMap.Insert("endPosition", Vector2( -0.5f, -0.5f )); | ||
| 111 | break; | 113 | break; |
| 112 | } | 114 | } |
| 113 | case 1: // linear gradient with units as userSpaceOnUse | 115 | case 1: // linear gradient with units as userSpaceOnUse |
| 114 | { | 116 | { |
| 115 | Vector2 halfStageSize = Stage::GetCurrent().GetSize()*0.5f; | 117 | Vector2 halfStageSize = Stage::GetCurrent().GetSize()*0.5f; |
| 116 | - gradientMap.Insert("gradientStartPosition", halfStageSize); | ||
| 117 | - gradientMap.Insert("gradientEndPosition", -halfStageSize ); | ||
| 118 | - gradientMap.Insert("gradientUnits", "userSpace"); | 118 | + gradientMap.Insert("startPosition", halfStageSize); |
| 119 | + gradientMap.Insert("endPosition", -halfStageSize ); | ||
| 120 | + gradientMap.Insert("units", "userSpace"); | ||
| 119 | break; | 121 | break; |
| 120 | } | 122 | } |
| 121 | case 2: // radial gradient with units as objectBoundingBox | 123 | case 2: // radial gradient with units as objectBoundingBox |
| 122 | { | 124 | { |
| 123 | - gradientMap.Insert("gradientCenter", Vector2(0.5f, 0.5f)); | ||
| 124 | - gradientMap.Insert("gradientRadius", 1.414f); | 125 | + gradientMap.Insert("center", Vector2(0.5f, 0.5f)); |
| 126 | + gradientMap.Insert("radius", 1.414f); | ||
| 125 | break; | 127 | break; |
| 126 | } | 128 | } |
| 127 | default: // radial gradient with units as userSpaceOnUse | 129 | default: // radial gradient with units as userSpaceOnUse |
| 128 | { | 130 | { |
| 129 | Vector2 stageSize = Stage::GetCurrent().GetSize(); | 131 | Vector2 stageSize = Stage::GetCurrent().GetSize(); |
| 130 | - gradientMap.Insert("gradientCenter", stageSize*0.5f); | ||
| 131 | - gradientMap.Insert("gradientRadius", stageSize.Length()); | ||
| 132 | - gradientMap.Insert("gradientUnits", "userSpace"); | 132 | + gradientMap.Insert("center", stageSize*0.5f); |
| 133 | + gradientMap.Insert("radius", stageSize.Length()); | ||
| 134 | + gradientMap.Insert("units", "userSpace"); | ||
| 133 | break; | 135 | break; |
| 134 | } | 136 | } |
| 135 | } | 137 | } |
resources/scripts/gradient.json
0 → 100644
| 1 | +/* | ||
| 2 | + * Copyright (c) 2016 Samsung Electronics Co., Ltd. | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + * | ||
| 16 | + */ | ||
| 17 | +{ | ||
| 18 | + // a tree of actors | ||
| 19 | + "stage": [{ | ||
| 20 | + "type": "Control", | ||
| 21 | + "size": [400,600,1], | ||
| 22 | + "parentOrigin": "CENTER", | ||
| 23 | + "anchorPoint": "CENTER", | ||
| 24 | + "background": { | ||
| 25 | + "rendererType" : "gradient", | ||
| 26 | + "startPosition" : [-0.5, -0.5], | ||
| 27 | + "endPosition": [0.5,0.5], | ||
| 28 | + "stopColor" : [ | ||
| 29 | + [1,0,0,1], | ||
| 30 | + [1,0.25,0,1], | ||
| 31 | + [1,0.5,0,1], | ||
| 32 | + [1,0.75,0,1], | ||
| 33 | + [1,1,0,1] | ||
| 34 | + ], | ||
| 35 | + "stopOffset" : [ 0, 0.25, 0.5, 0.75, 1.0 ] | ||
| 36 | + } | ||
| 37 | + }] | ||
| 38 | +} |
resources/style/demo-theme.json.in
| @@ -70,11 +70,10 @@ | @@ -70,11 +70,10 @@ | ||
| 70 | "background": | 70 | "background": |
| 71 | { | 71 | { |
| 72 | "rendererType": "gradient", | 72 | "rendererType": "gradient", |
| 73 | - "gradientCenter": [240, 400], | ||
| 74 | - "gradientRadius": 932, | ||
| 75 | - "gradientUnits": "userSpace", | ||
| 76 | - "gradientStopColor": [[0.247,0.38,0.52,1.0],[0.055,0.18,0.286,1.0]], | ||
| 77 | - "gradientStopOffset":[0.0,1.0] | 73 | + "center": [240, 400], |
| 74 | + "radius": 932, | ||
| 75 | + "units": "userSpace", | ||
| 76 | + "stopColor": [[0.247,0.38,0.52,1.0],[0.055,0.18,0.286,1.0]] | ||
| 78 | } | 77 | } |
| 79 | } | 78 | } |
| 80 | } | 79 | } |
resources/style/mobile/demo-theme.json.in
| @@ -83,11 +83,10 @@ | @@ -83,11 +83,10 @@ | ||
| 83 | "background": | 83 | "background": |
| 84 | { | 84 | { |
| 85 | "rendererType": "gradient", | 85 | "rendererType": "gradient", |
| 86 | - "gradientCenter": [360, 640], | ||
| 87 | - "gradientRadius": 1468, | ||
| 88 | - "gradientUnits": "userSpace", | ||
| 89 | - "gradientStopColor": [[0.247,0.38,0.52,1.0],[0.055,0.18,0.286,1.0]], | ||
| 90 | - "gradientStopOffset":[0.0,1.0] | 86 | + "center": [360, 640], |
| 87 | + "radius": 1468, | ||
| 88 | + "units": "userSpace", | ||
| 89 | + "stopColor": [[0.247,0.38,0.52,1.0],[0.055,0.18,0.286,1.0]] | ||
| 91 | } | 90 | } |
| 92 | } | 91 | } |
| 93 | } | 92 | } |