Commit 57253de508c4912b6046e028cfe16aa3721f8ef5

Authored by David Steele
2 parents a70ecbcb 8d85ad48

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

Change-Id: Ib9cb3fa0a9efdd506ddce86805dce89755846d57
.gitignore
... ... @@ -37,3 +37,4 @@ dali-builder
37 37 /packaging/home*
38 38 *.mo
39 39 demo-theme.json
  40 +simple-image-wall.js
... ...
build/tizen/CMakeLists.txt
... ... @@ -76,7 +76,7 @@ FOREACH(flag ${LOCAL_MODELS_LIST})
76 76 INSTALL(FILES ${LOCAL_MODELS_DIR}/${flag} DESTINATION ${MODELS_DIR})
77 77 ENDFOREACH(flag)
78 78  
79   -FILE(GLOB LOCAL_SCRIPTS_LIST RELATIVE "${LOCAL_SCRIPTS_DIR}" "${LOCAL_SCRIPTS_DIR}/*")
  79 +FILE(GLOB LOCAL_SCRIPTS_LIST RELATIVE "${LOCAL_SCRIPTS_DIR}" "${LOCAL_SCRIPTS_DIR}/*.json")
80 80 FOREACH(flag ${LOCAL_SCRIPTS_LIST})
81 81 INSTALL(FILES ${LOCAL_SCRIPTS_DIR}/${flag} DESTINATION ${SCRIPTS_DIR})
82 82 ENDFOREACH(flag)
... ... @@ -85,6 +85,8 @@ ENDFOREACH(flag)
85 85 SET(DEMO_STYLE_IMAGE_DIR ${IMAGES_DIR})
86 86 CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/demo-theme.json.in ${LOCAL_STYLE_DIR}/demo-theme.json )
87 87 INSTALL(FILES ${LOCAL_STYLE_DIR}/demo-theme.json DESTINATION ${STYLE_DIR})
  88 +CONFIGURE_FILE( ${LOCAL_SCRIPTS_DIR}/simple-image-wall.js.in ${LOCAL_SCRIPTS_DIR}/simple-image-wall.js )
  89 +INSTALL(FILES ${LOCAL_SCRIPTS_DIR}/simple-image-wall.js DESTINATION ${SCRIPTS_DIR})
88 90  
89 91 SET(PKG_LIST dali-core
90 92 dali-adaptor
... ...
examples/benchmark/benchmark.cpp
1 1 /*
2   - * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -15,12 +15,12 @@
15 15 *
16 16 */
17 17  
  18 +// EXTERNAL INCLUDES
  19 +#include <dali/public-api/rendering/renderer.h>
18 20 #include <dali-toolkit/dali-toolkit.h>
19   -#include <dali/devel-api/rendering/renderer.h>
20   -#include <dali/public-api/common/dali-common.h>
21   -#include <dali/integration-api/resource-policies.h>
22   -#include <dali/integration-api/debug.h>
23   -#include <iostream>
  21 +
  22 +// INTERNAL INCLUDES
  23 +#include "shared/utility.h"
24 24  
25 25 using namespace Dali;
26 26 using namespace Dali::Toolkit;
... ... @@ -183,29 +183,6 @@ const char* FRAGMENT_SHADER_TEXTURE = DALI_COMPOSE_SHADER(
183 183 }\n
184 184 );
185 185  
186   -
187   -Geometry& QuadMesh()
188   -{
189   - static Geometry mesh;
190   - if( !mesh )
191   - {
192   - PropertyBuffer vertexBuffer;
193   - Property::Map vertexFormat;
194   - vertexFormat["aPosition"] = Property::VECTOR2;
195   - vertexFormat["aTexCoord"] = Property::VECTOR2;
196   -
197   - //Create a vertex buffer for vertex positions and texture coordinates
198   - vertexBuffer = PropertyBuffer::New( vertexFormat );
199   - vertexBuffer.SetData( gQuadWithTexture, 4u );
200   -
201   - //Create the geometry
202   - mesh = Geometry::New();
203   - mesh.AddVertexBuffer( vertexBuffer );
204   - mesh.SetGeometryType(Geometry::TRIANGLE_STRIP );
205   - }
206   - return mesh;
207   -}
208   -
209 186 bool gUseMesh(false);
210 187 bool gUseImageActor(false);
211 188 bool gNinePatch(false);
... ... @@ -213,33 +190,16 @@ unsigned int gRowsPerPage(25);
213 190 unsigned int gColumnsPerPage( 25 );
214 191 unsigned int gPageCount(13);
215 192  
216   -Renderer CreateRenderer( unsigned int index )
  193 +Renderer CreateRenderer( unsigned int index, Geometry geometry, Shader shader )
217 194 {
218   -
219   - int numImages = !gNinePatch ? NUM_IMAGES : NUM_NINEPATCH_IMAGES;
220   - static Renderer* renderers = new Renderer[numImages];
221   - if( !renderers[index] )
222   - {
223   - //Create the renderer
224   - Shader shader = Shader::New( VERTEX_SHADER_TEXTURE, FRAGMENT_SHADER_TEXTURE );
225   -
226   - const char* imagePath = !gNinePatch ? IMAGE_PATH[index] : NINEPATCH_IMAGE_PATH[index];
227   - Image image = ResourceImage::New(imagePath);
228   - TextureSet textureSet = TextureSet::New();
229   - textureSet.SetImage( 0u, image );
230   - renderers[index] = Renderer::New( QuadMesh(), shader );
231   - renderers[index].SetTextures( textureSet );
232   - renderers[index].SetProperty( Renderer::Property::BLEND_MODE, BlendMode::OFF );
233   - }
234   - return renderers[index];
235   -}
236   -
237   -Actor CreateMeshActor( unsigned int index)
238   -{
239   - Renderer renderer = CreateRenderer(index);
240   - Actor meshActor = Actor::New();
241   - meshActor.AddRenderer( renderer );
242   - return meshActor;
  195 + Renderer renderer = Renderer::New( geometry, shader );
  196 + const char* imagePath = !gNinePatch ? IMAGE_PATH[index] : NINEPATCH_IMAGE_PATH[index];
  197 + Texture texture = DemoHelper::LoadTexture( imagePath );
  198 + TextureSet textureSet = TextureSet::New();
  199 + textureSet.SetTexture( 0u, texture );
  200 + renderer.SetTextures( textureSet );
  201 + renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::OFF );
  202 + return renderer;
243 203 }
244 204  
245 205 }
... ... @@ -348,15 +308,26 @@ public:
348 308  
349 309 void CreateMeshActors()
350 310 {
  311 + unsigned int numImages = !gNinePatch ? NUM_IMAGES : NUM_NINEPATCH_IMAGES;
  312 +
  313 + //Create all the renderers
  314 + std::vector<Renderer> renderers( numImages );
  315 + Shader shader = Shader::New( VERTEX_SHADER_TEXTURE, FRAGMENT_SHADER_TEXTURE );
  316 + Geometry geometry = DemoHelper::CreateTexturedQuad();
  317 + for( unsigned int i(0); i<numImages; ++i )
  318 + {
  319 + renderers[i] = CreateRenderer( i, geometry, shader );
  320 + }
  321 +
  322 + //Create the actors
351 323 Stage stage = Stage::GetCurrent();
352 324 unsigned int actorCount(mRowsPerPage*mColumnsPerPage * mPageCount);
353 325 mActor.resize(actorCount);
354 326 for( size_t i(0); i<actorCount; ++i )
355 327 {
356   - size_t numImages = !gNinePatch ? NUM_IMAGES : NUM_NINEPATCH_IMAGES;
357   - mActor[i] = CreateMeshActor(i % numImages);
  328 + mActor[i] = Actor::New();
  329 + mActor[i].AddRenderer( renderers[i % numImages] );
358 330 mActor[i].SetSize(0.0f,0.0f,0.0f);
359   -
360 331 stage.Add(mActor[i]);
361 332 }
362 333 }
... ...
examples/compressed-texture-formats/compressed-texture-formats-example.cpp
... ... @@ -15,15 +15,74 @@
15 15 *
16 16 */
17 17  
  18 +// EXTERNAL INCLUDES
  19 +#include <dali/dali.h>
  20 +#include <dali/public-api/rendering/renderer.h>
18 21 #include <dali-toolkit/dali-toolkit.h>
19 22  
  23 +// INTERNAL INCLUDES
  24 +#include "shared/utility.h"
  25 +
20 26 using namespace Dali;
21 27 using Dali::Toolkit::TextLabel;
22 28  
  29 +namespace
  30 +{
  31 +
23 32 const char* IMAGE_FILENAME_ETC = DEMO_IMAGE_DIR "tx-etc1.ktx";
24 33 const char* IMAGE_FILENAME_ASTC_LINEAR = DEMO_IMAGE_DIR "tx-astc-4x4-linear.ktx";
25 34 const char* IMAGE_FILENAME_ASTC_LINEAR_NATIVE = DEMO_IMAGE_DIR "tx-astc-4x4-linear-native.astc";
26 35  
  36 +
  37 +static const char* VERTEX_SHADER_TEXTURE = DALI_COMPOSE_SHADER(
  38 + attribute mediump vec2 aPosition;\n
  39 + attribute mediump vec2 aTexCoord;\n
  40 + uniform mediump mat4 uMvpMatrix;\n
  41 + uniform mediump vec3 uSize;\n
  42 + varying mediump vec2 vTexCoord;\n
  43 + void main()\n
  44 + {\n
  45 + vec4 position = vec4(aPosition,0.0,1.0)*vec4(uSize,1.0);\n
  46 + gl_Position = uMvpMatrix * position;\n
  47 + vTexCoord = aTexCoord;\n
  48 + }\n
  49 +);
  50 +
  51 +static const char* FRAGMENT_SHADER_TEXTURE = DALI_COMPOSE_SHADER(
  52 + uniform lowp vec4 uColor;\n
  53 + uniform sampler2D sTexture;\n
  54 + varying mediump vec2 vTexCoord;\n
  55 +
  56 + void main()\n
  57 + {\n
  58 + gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
  59 + }\n
  60 +);
  61 +
  62 +/**
  63 + * @brief Create a renderer to render an image and adds it to an actor
  64 + * @param[in] imagePath The path where the image file is located
  65 + * @param[in] actor The actor that will be used to render the image
  66 + * @param[in[ geometry The geometry to use
  67 + * @param[in] shader The shader to use
  68 + */
  69 +void AddImage( const char*imagePath, Actor& actor, Geometry& geometry, Shader& shader )
  70 +{
  71 + //Load the texture
  72 + Texture texture = DemoHelper::LoadTexture( imagePath );
  73 + TextureSet textureSet = TextureSet::New();
  74 + textureSet.SetTexture( 0u, texture );
  75 +
  76 + //Create the renderer
  77 + Renderer renderer = Renderer::New( geometry, shader );
  78 + renderer.SetTextures( textureSet );
  79 +
  80 + //Set actor size and add the renderer
  81 + actor.SetSize( texture.GetWidth(), texture.GetHeight() );
  82 + actor.AddRenderer( renderer );
  83 +}
  84 +
  85 +}
27 86 /**
28 87 * @brief This example shows 3 images, each of a different compressed texture type.
29 88 * If built and run on a OpenGL ES 3.1 compatable target, then all 3 images will display.
... ... @@ -89,26 +148,37 @@ public:
89 148 table.AddChild( textLabel, Toolkit::TableView::CellPosition( 2u, 0u ) );
90 149 table.SetCellAlignment( Toolkit::TableView::CellPosition( 2u, 0u ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER );
91 150  
92   - // Add images.
93   - Toolkit::ImageView imageView = Toolkit::ImageView::New( ResourceImage::New( IMAGE_FILENAME_ETC ) );
94   - imageView.SetAnchorPoint( AnchorPoint::CENTER );
95   - imageView.SetParentOrigin( ParentOrigin::CENTER );
96   - table.AddChild( imageView, Toolkit::TableView::CellPosition( 0u, 1u ) );
97   -
98   - imageView = Toolkit::ImageView::New( ResourceImage::New( IMAGE_FILENAME_ASTC_LINEAR ) );
99   - imageView.SetAnchorPoint( AnchorPoint::CENTER );
100   - imageView.SetParentOrigin( ParentOrigin::CENTER );
101   - table.AddChild( imageView, Toolkit::TableView::CellPosition( 1u, 1u ) );
  151 + //Create the geometry and the shader renderers will use
  152 + Geometry geometry = DemoHelper::CreateTexturedQuad();
  153 + Shader shader = Shader::New( VERTEX_SHADER_TEXTURE, FRAGMENT_SHADER_TEXTURE );
102 154  
103   - imageView = Toolkit::ImageView::New( ResourceImage::New( IMAGE_FILENAME_ASTC_LINEAR_NATIVE ) );
104   - imageView.SetAnchorPoint( AnchorPoint::CENTER );
105   - imageView.SetParentOrigin( ParentOrigin::CENTER );
106   - table.AddChild( imageView, Toolkit::TableView::CellPosition( 2u, 1u ) );
  155 + // Add images.
  156 + Actor actor = Actor::New();
  157 + actor.SetAnchorPoint( AnchorPoint::CENTER );
  158 + actor.SetParentOrigin( ParentOrigin::CENTER );
  159 + AddImage( IMAGE_FILENAME_ETC, actor, geometry, shader );
  160 + table.AddChild( actor, Toolkit::TableView::CellPosition( 0u, 1u ) );
  161 + table.SetCellAlignment( Toolkit::TableView::CellPosition( 0u, 1u ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER );
  162 +
  163 + actor = Actor::New();
  164 + actor.SetAnchorPoint( AnchorPoint::CENTER );
  165 + actor.SetParentOrigin( ParentOrigin::CENTER );
  166 + AddImage( IMAGE_FILENAME_ASTC_LINEAR, actor, geometry, shader );
  167 + table.AddChild( actor, Toolkit::TableView::CellPosition( 1u, 1u ) );
  168 + table.SetCellAlignment( Toolkit::TableView::CellPosition( 1u, 1u ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER );
  169 +
  170 + actor = Actor::New();
  171 + actor.SetAnchorPoint( AnchorPoint::CENTER );
  172 + actor.SetParentOrigin( ParentOrigin::CENTER );
  173 + AddImage( IMAGE_FILENAME_ASTC_LINEAR_NATIVE, actor, geometry, shader );
  174 + table.AddChild( actor, Toolkit::TableView::CellPosition( 2u, 1u ) );
  175 + table.SetCellAlignment( Toolkit::TableView::CellPosition( 2u, 1u ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER );
107 176  
108 177 stage.Add( table );
109 178  
110   - // Respond to a click anywhere on the stage
  179 + // Respond to touch and key signals
111 180 stage.GetRootLayer().TouchSignal().Connect( this, &CompressedTextureFormatsController::OnTouch );
  181 + stage.KeyEventSignal().Connect(this, &CompressedTextureFormatsController::OnKeyEvent);
112 182 }
113 183  
114 184 bool OnTouch( Actor actor, const TouchData& touch )
... ... @@ -118,6 +188,17 @@ public:
118 188 return true;
119 189 }
120 190  
  191 + void OnKeyEvent(const KeyEvent& event)
  192 + {
  193 + if(event.state == KeyEvent::Down)
  194 + {
  195 + if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
  196 + {
  197 + mApplication.Quit();
  198 + }
  199 + }
  200 + }
  201 +
121 202 private:
122 203 Application& mApplication;
123 204 };
... ...
examples/cube-transition-effect/cube-transition-effect-example.cpp
... ... @@ -148,15 +148,22 @@ private:
148 148 /**
149 149 * Callback function of cube transition completed signal
150 150 * @param[in] effect The cube effect used for the transition
151   - * @param[in] image The target Image of the completed transition
  151 + * @param[in] texture The target Texture of the completed transition
152 152 */
153   - void OnTransitionCompleted(Toolkit::CubeTransitionEffect effect, Image image );
  153 + void OnTransitionCompleted(Toolkit::CubeTransitionEffect effect, Texture image );
154 154 /**
155 155 * Callback function of timer tick
156 156 * The timer is used to count the image display duration in slideshow,
157 157 */
158 158 bool OnTimerTick();
159 159  
  160 + /**
  161 + * Loads image, resizes it to the size of stage and creates a textue out of it
  162 + * @param[in] filepath Path to the image file
  163 + * @return New texture object
  164 + */
  165 + Texture LoadStageFillingTexture( const char* filepath );
  166 +
160 167 private:
161 168 Application& mApplication;
162 169 Toolkit::Control mView;
... ... @@ -166,8 +173,8 @@ private:
166 173  
167 174 Vector2 mViewSize;
168 175  
169   - Image mCurrentImage;
170   - Image mNextImage;
  176 + Texture mCurrentTexture;
  177 + Texture mNextTexture;
171 178 unsigned int mIndex;
172 179 bool mIsImageLoading;
173 180  
... ... @@ -232,7 +239,7 @@ void CubeTransitionApp::OnInit( Application&amp; application )
232 239 mViewSize = Stage::GetCurrent().GetSize();
233 240  
234 241 // show the first image
235   - mCurrentImage = DemoHelper::LoadStageFillingImage( IMAGES[mIndex] );
  242 + mCurrentTexture = LoadStageFillingTexture( IMAGES[mIndex] );
236 243  
237 244 //use small cubes
238 245 mCubeWaveEffect = Toolkit::CubeTransitionWaveEffect::New( NUM_ROWS_WAVE, NUM_COLUMNS_WAVE );
... ... @@ -242,7 +249,7 @@ void CubeTransitionApp::OnInit( Application&amp; application )
242 249  
243 250 mCubeWaveEffect.SetSize( mViewSize );
244 251 mCubeWaveEffect.SetParentOrigin( ParentOrigin::CENTER );
245   - mCubeWaveEffect.SetCurrentImage( mCurrentImage );
  252 + mCubeWaveEffect.SetCurrentTexture( mCurrentTexture );
246 253  
247 254 // use big cubes
248 255 mCubeCrossEffect = Toolkit::CubeTransitionCrossEffect::New(NUM_ROWS_CROSS, NUM_COLUMNS_CROSS );
... ... @@ -252,7 +259,7 @@ void CubeTransitionApp::OnInit( Application&amp; application )
252 259  
253 260 mCubeCrossEffect.SetSize( mViewSize );
254 261 mCubeCrossEffect.SetParentOrigin( ParentOrigin::CENTER );
255   - mCubeCrossEffect.SetCurrentImage( mCurrentImage );
  262 + mCubeCrossEffect.SetCurrentTexture( mCurrentTexture );
256 263  
257 264 mCubeFoldEffect = Toolkit::CubeTransitionFoldEffect::New( NUM_ROWS_FOLD, NUM_COLUMNS_FOLD );
258 265 mCubeFoldEffect.SetTransitionDuration( ANIMATION_DURATION_FOLD );
... ... @@ -260,7 +267,7 @@ void CubeTransitionApp::OnInit( Application&amp; application )
260 267  
261 268 mCubeFoldEffect.SetSize( mViewSize );
262 269 mCubeFoldEffect.SetParentOrigin( ParentOrigin::CENTER );
263   - mCubeFoldEffect.SetCurrentImage( mCurrentImage );
  270 + mCubeFoldEffect.SetCurrentTexture( mCurrentTexture );
264 271  
265 272 mViewTimer = Timer::New( VIEWINGTIME );
266 273 mViewTimer.TickSignal().Connect( this, &CubeTransitionApp::OnTimerTick );
... ... @@ -303,11 +310,11 @@ void CubeTransitionApp::OnPanGesture( Actor actor, const PanGesture&amp; gesture )
303 310  
304 311 void CubeTransitionApp::GoToNextImage()
305 312 {
306   - mNextImage = DemoHelper::LoadStageFillingImage( IMAGES[ mIndex ] );
307   - mCurrentEffect.SetTargetImage( mNextImage );
  313 + mNextTexture = LoadStageFillingTexture( IMAGES[ mIndex ] );
  314 + mCurrentEffect.SetTargetTexture( mNextTexture );
308 315 mIsImageLoading = false;
309 316 mCurrentEffect.StartTransition( mPanPosition, mPanDisplacement );
310   - mCurrentImage = mNextImage;
  317 + mCurrentTexture = mNextTexture;
311 318 }
312 319  
313 320 bool CubeTransitionApp::OnEffectButtonClicked( Toolkit::Button button )
... ... @@ -339,7 +346,7 @@ bool CubeTransitionApp::OnEffectButtonClicked( Toolkit::Button button )
339 346  
340 347 // Set the current image to cube transition effect
341 348 // only need to set at beginning or change from another effect
342   - mCurrentEffect.SetCurrentImage( mCurrentImage );
  349 + mCurrentEffect.SetCurrentTexture( mCurrentTexture );
343 350 return true;
344 351 }
345 352  
... ... @@ -365,7 +372,7 @@ bool CubeTransitionApp::OnSildeshowButtonClicked( Toolkit::Button button )
365 372 return true;
366 373 }
367 374  
368   -void CubeTransitionApp::OnTransitionCompleted(Toolkit::CubeTransitionEffect effect, Image image )
  375 +void CubeTransitionApp::OnTransitionCompleted(Toolkit::CubeTransitionEffect effect, Texture texture )
369 376 {
370 377 if( mSlideshow )
371 378 {
... ... @@ -385,6 +392,17 @@ bool CubeTransitionApp::OnTimerTick()
385 392 return false;
386 393 }
387 394  
  395 +Texture CubeTransitionApp::LoadStageFillingTexture( const char* filepath )
  396 +{
  397 + ImageDimensions dimensions( Stage::GetCurrent().GetSize().x, Stage::GetCurrent().GetSize().y );
  398 + BitmapLoader loader = BitmapLoader::New( filepath, dimensions, FittingMode::SCALE_TO_FILL );
  399 + loader.Load();
  400 + PixelData pixelData = loader.GetPixelData();
  401 + Texture texture = Texture::New( TextureType::TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight() );
  402 + texture.Upload( pixelData );
  403 + return texture;
  404 +}
  405 +
388 406 void CubeTransitionApp::OnKeyEvent(const KeyEvent& event)
389 407 {
390 408 if(event.state == KeyEvent::Down)
... ...
examples/image-view/image-view-example.cpp
... ... @@ -35,15 +35,7 @@ const char* IMAGE_PATH[] = {
35 35 DEMO_IMAGE_DIR "heartsframe.9.png",
36 36 };
37 37  
38   -const char* RESOURCE_IMAGE_PATH[] = {
39   - DEMO_IMAGE_DIR "contacts-image.png",
40   - DEMO_IMAGE_DIR "gallery-small-27.jpg",
41   - DEMO_IMAGE_DIR "selection-popup-bg.8.9.png",
42   - DEMO_IMAGE_DIR "heartsframe.9.png",
43   -};
44   -
45 38 const unsigned int NUM_IMAGES = sizeof(IMAGE_PATH) / sizeof(char*);
46   -const unsigned int NUM_RESOURCE_IMAGES = sizeof(RESOURCE_IMAGE_PATH) / sizeof(char*);
47 39  
48 40 const unsigned int COLUMNS = 3;
49 41 const unsigned int ROWS = 4;
... ... @@ -59,7 +51,6 @@ class ImageViewController: public ConnectionTracker
59 51 mCurrentPositionToggle( 0, 0 ),
60 52 mCurrentPositionImage( 0, 0 ),
61 53 mToggleOff( true ),
62   - mUseResource( false ),
63 54 mImageIdx( 1 )
64 55 {
65 56 // Connect to the Application's Init signal
... ... @@ -131,14 +122,6 @@ class ImageViewController: public ConnectionTracker
131 122 button2.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
132 123 buttonsTable.AddChild( button2, Toolkit::TableView::CellPosition( 1, 0 ) );
133 124  
134   - Toolkit::CheckBoxButton button3 = Toolkit::CheckBoxButton::New();
135   - button3.SetLabelText( "Use Resource Images" );
136   - button3.SetParentOrigin( ParentOrigin::CENTER );
137   - button3.SetAnchorPoint( AnchorPoint::CENTER );
138   - button3.ClickedSignal().Connect( this, &ImageViewController::UseResourceImagesClicked );
139   - button3.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
140   - buttonsTable.AddChild( button3, Toolkit::TableView::CellPosition( 2, 0 ) );
141   -
142 125 mContentLayer.Add(buttonsTable);
143 126  
144 127 Stage::GetCurrent().KeyEventSignal().Connect(this, &ImageViewController::OnKeyEvent);
... ... @@ -177,15 +160,7 @@ private:
177 160 {
178 161 Toolkit::ImageView imageView = mImageViews[ mCurrentPositionImage.columnIndex ][ mCurrentPositionImage.rowIndex ];
179 162  
180   - if( mUseResource )
181   - {
182   - ResourceImage image = ResourceImage::New( RESOURCE_IMAGE_PATH[ mImageIdx ] );
183   - imageView.SetImage( image );
184   - }
185   - else
186   - {
187   - imageView.SetImage( IMAGE_PATH[ mImageIdx ] );
188   - }
  163 + imageView.SetImage( IMAGE_PATH[ mImageIdx ] );
189 164  
190 165 ++mCurrentPositionImage.columnIndex;
191 166 if( mCurrentPositionImage.columnIndex == COLUMNS )
... ... @@ -198,8 +173,7 @@ private:
198 173 mCurrentPositionImage.rowIndex = 0;
199 174 ++mImageIdx;
200 175  
201   - int numImages = mUseResource ? NUM_RESOURCE_IMAGES : NUM_IMAGES;
202   - if( mImageIdx == numImages )
  176 + if( mImageIdx == NUM_IMAGES )
203 177 {
204 178 mImageIdx = 0;
205 179 }
... ... @@ -208,19 +182,6 @@ private:
208 182 return true;
209 183 }
210 184  
211   - bool UseResourceImagesClicked( Toolkit::Button button )
212   - {
213   - mUseResource = !mUseResource;
214   -
215   - int numImages = mUseResource ? NUM_RESOURCE_IMAGES : NUM_IMAGES;
216   - if( mImageIdx >= numImages )
217   - {
218   - mImageIdx = 0;
219   - }
220   -
221   - return true;
222   - }
223   -
224 185 /**
225 186 * Main key event handler
226 187 */
... ... @@ -248,7 +209,6 @@ private:
248 209 Toolkit::TableView::CellPosition mCurrentPositionImage;
249 210  
250 211 bool mToggleOff;
251   - bool mUseResource;
252 212 int mImageIdx;
253 213  
254 214 };
... ...
examples/line-mesh/line-mesh-example.cpp
1 1 /*
2   - * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -16,7 +16,7 @@
16 16 */
17 17  
18 18 // EXTERNAL INCLUDES
19   -#include <dali/devel-api/rendering/renderer.h>
  19 +#include <dali/public-api/rendering/renderer.h>
20 20 #include <dali-toolkit/dali-toolkit.h>
21 21  
22 22 // INTERNAL INCLUDES
... ...
examples/mesh-morph/mesh-morph-example.cpp
1 1 /*
2   - * Copyright (c) 2014 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -16,7 +16,7 @@
16 16 */
17 17  
18 18 // EXTERNAL INCLUDES
19   -#include <dali/devel-api/rendering/renderer.h>
  19 +#include <dali/public-api/rendering/renderer.h>
20 20 #include <dali-toolkit/dali-toolkit.h>
21 21  
22 22 // INTERNAL INCLUDES
... ...
examples/mesh-sorting/mesh-sorting-example.cpp
1 1 /*
2   - * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -16,7 +16,7 @@
16 16 */
17 17  
18 18 // EXTERNAL INCLUDES
19   -#include <dali/devel-api/rendering/renderer.h>
  19 +#include <dali/public-api/rendering/renderer.h>
20 20 #include <dali-toolkit/dali-toolkit.h>
21 21 #include <stdio.h>
22 22 #include <sstream>
... ... @@ -85,34 +85,6 @@ void main()
85 85 }
86 86 );
87 87  
88   -Geometry CreateGeometry()
89   -{
90   - // Create vertices
91   - const float halfQuadSize = .5f;
92   - struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; };
93   - TexturedQuadVertex texturedQuadVertexData[4] = {
94   - { Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f) },
95   - { Vector2( halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f) },
96   - { Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f) },
97   - { Vector2( halfQuadSize, halfQuadSize), Vector2(1.f, 1.f) } };
98   -
99   - Property::Map texturedQuadVertexFormat;
100   - texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
101   - texturedQuadVertexFormat["aTexCoord"] = Property::VECTOR2;
102   - PropertyBuffer texturedQuadVertices = PropertyBuffer::New( texturedQuadVertexFormat );
103   - texturedQuadVertices.SetData( texturedQuadVertexData, 4 );
104   -
105   - // Create indices
106   - unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 };
107   -
108   - // Create the geometry object
109   - Geometry texturedQuadGeometry = Geometry::New();
110   - texturedQuadGeometry.AddVertexBuffer( texturedQuadVertices );
111   - texturedQuadGeometry.SetIndexBuffer( &indexData[0], sizeof(indexData)/sizeof(unsigned short) );
112   -
113   - return texturedQuadGeometry;
114   -}
115   -
116 88 } // anonymous namespace
117 89  
118 90 // This example shows how to use a simple mesh
... ... @@ -159,7 +131,7 @@ public:
159 131 application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE );
160 132  
161 133 mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
162   - mGeometry = CreateGeometry();
  134 + mGeometry = DemoHelper::CreateTexturedQuad();
163 135  
164 136 TextureSet firstTextureSet;
165 137  
... ...
examples/metaball-explosion/metaball-explosion-example.cpp
1 1 /*
2   - * Copyright (c) 2014 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -15,13 +15,14 @@
15 15 *
16 16 */
17 17  
18   -//External includes
  18 +// EXTERNAL INCLUDES
19 19 #include <cstdio>
20 20 #include <string>
21 21  
22   -//Internal includes
  22 +// INTERNAL INCLUDES
23 23 #include <dali/dali.h>
24   -#include <dali/devel-api/rendering/renderer.h>
  24 +#include <dali/devel-api/images/texture-set-image.h>
  25 +#include <dali/public-api/rendering/renderer.h>
25 26 #include <dali-toolkit/dali-toolkit.h>
26 27  
27 28 #include "shared/view.h"
... ... @@ -551,8 +552,8 @@ void MetaballExplosionController::AddRefractionImage()
551 552  
552 553 //Create new texture set
553 554 TextureSet textureSet = TextureSet::New();
554   - textureSet.SetImage( 0u, mBackImage );
555   - textureSet.SetImage( 1u, fbo );
  555 + TextureSetImage( textureSet, 0u, mBackImage );
  556 + TextureSetImage( textureSet, 1u, fbo );
556 557  
557 558 //Create geometry
558 559 Geometry metaballGeom = CreateGeometryComposition();
... ...
examples/metaball-refrac/metaball-refrac-example.cpp
1 1 /*
2   - * Copyright (c) 2014 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -16,7 +16,8 @@
16 16 */
17 17  
18 18 #include <dali/dali.h>
19   -#include <dali/devel-api/rendering/renderer.h>
  19 +#include <dali/devel-api/images/texture-set-image.h>
  20 +#include <dali/public-api/rendering/renderer.h>
20 21 #include <dali-toolkit/dali-toolkit.h>
21 22  
22 23 #include <cstdio>
... ... @@ -532,15 +533,15 @@ void MetaballRefracController::AddRefractionImage()
532 533  
533 534 //Create new texture set
534 535 mTextureSetRefraction = TextureSet::New();
535   - mTextureSetRefraction.SetImage( 0u, mBackImage );
536   - mTextureSetRefraction.SetImage( 1u, mMetaballFBO );
  536 + TextureSetImage( mTextureSetRefraction, 0u, mBackImage );
  537 + TextureSetImage( mTextureSetRefraction, 1u, mMetaballFBO );
537 538  
538 539 //Create normal shader
539 540 mShaderNormal = Shader::New( METABALL_VERTEX_SHADER, FRAG_SHADER );
540 541  
541 542 //Create new texture set
542 543 mTextureSetNormal = TextureSet::New();
543   - mTextureSetNormal.SetImage( 0u, mBackImage );
  544 + TextureSetImage( mTextureSetNormal, 0u, mBackImage );
544 545  
545 546 //Create actor
546 547 mCompositionActor = Actor::New( );
... ...
examples/native-image-source/native-image-source-example.cpp
... ... @@ -15,15 +15,111 @@
15 15 *
16 16 */
17 17  
  18 +// EXTERNAL INCLUDES
18 19 #include <dali/dali.h>
  20 +#include <dali/devel-api/images/native-image-interface-extension.h>
  21 +#include <dali/public-api/rendering/renderer.h>
  22 +#include <dali/public-api/rendering/frame-buffer.h>
19 23 #include <dali-toolkit/dali-toolkit.h>
  24 +#include <cstring>
  25 +
  26 +// INTERNAL INCLUDES
  27 +#include "shared/utility.h"
20 28  
21 29 using namespace Dali;
22 30 using namespace Toolkit;
23 31  
24 32 namespace
25 33 {
26   - const std::string JPG_FILENAME = DEMO_IMAGE_DIR "gallery-medium-4.jpg";
  34 +
  35 +/**
  36 + * @brief Creates a shader used to render a native image
  37 + * @param[in] nativeImageInterface The native image interface
  38 + * @return A shader to render the native image
  39 + */
  40 +Shader CreateShader( NativeImageInterface& nativeImageInterface )
  41 +{
  42 + static const char* DEFAULT_SAMPLER_TYPENAME = "sampler2D";
  43 +
  44 + static const char* VERTEX_SHADER_TEXTURE = DALI_COMPOSE_SHADER(
  45 + attribute mediump vec2 aPosition;\n
  46 + attribute mediump vec2 aTexCoord;\n
  47 + uniform mediump mat4 uMvpMatrix;\n
  48 + uniform mediump vec3 uSize;\n
  49 + varying mediump vec2 vTexCoord;\n
  50 + void main()\n
  51 + {\n
  52 + vec4 position = vec4(aPosition,0.0,1.0)*vec4(uSize,1.0);\n
  53 + gl_Position = uMvpMatrix * position;\n
  54 + vTexCoord = aTexCoord;\n
  55 + }\n
  56 + );
  57 +
  58 + static const char* FRAGMENT_SHADER_TEXTURE = DALI_COMPOSE_SHADER(
  59 + uniform lowp vec4 uColor;\n
  60 + uniform sampler2D sTexture;\n
  61 + varying mediump vec2 vTexCoord;\n
  62 +
  63 + void main()\n
  64 + {\n
  65 + gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
  66 + }\n
  67 + );
  68 +
  69 + NativeImageInterface::Extension* extension( nativeImageInterface.GetExtension() );
  70 + if( extension )
  71 + {
  72 + std::string fragmentShader;
  73 +
  74 + //Get custom fragment shader prefix
  75 + const char* fragmentPreFix = extension->GetCustomFragmentPreFix();
  76 + if( fragmentPreFix )
  77 + {
  78 + fragmentShader = fragmentPreFix;
  79 + fragmentShader += FRAGMENT_SHADER_TEXTURE;
  80 + }
  81 + else
  82 + {
  83 + fragmentShader = FRAGMENT_SHADER_TEXTURE;
  84 + }
  85 +
  86 + //Get custom sampler type name
  87 + const char* customSamplerTypename = extension->GetCustomSamplerTypename();
  88 + if( customSamplerTypename )
  89 + {
  90 + fragmentShader.replace( fragmentShader.find( DEFAULT_SAMPLER_TYPENAME ), strlen(DEFAULT_SAMPLER_TYPENAME), customSamplerTypename );
  91 + }
  92 +
  93 + return Shader::New( VERTEX_SHADER_TEXTURE, fragmentShader );
  94 + }
  95 + else
  96 + {
  97 + return Shader::New( VERTEX_SHADER_TEXTURE, FRAGMENT_SHADER_TEXTURE );
  98 + }
  99 +}
  100 +
  101 +/**
  102 + * @brief Creates an actor to render a native image
  103 + * @param[in] texture The texture creates from a native image
  104 + * @param[in] nativeImageInterface The native image interface used to create the texture
  105 + * @return An actor that renders the texture
  106 + */
  107 +Actor CreateNativeActor( Texture texture, NativeImageInterface& nativeImageInterface )
  108 +{
  109 + Actor actor = Actor::New();
  110 + Geometry geometry = DemoHelper::CreateTexturedQuad();
  111 + Shader shader = CreateShader(nativeImageInterface);
  112 + Renderer renderer = Renderer::New( geometry, shader );
  113 + TextureSet textureSet = TextureSet::New();
  114 + textureSet.SetTexture( 0u, texture );
  115 + renderer.SetTextures( textureSet );
  116 +
  117 + actor.AddRenderer( renderer );
  118 + actor.SetSize( texture.GetWidth(), texture.GetHeight() );
  119 + return actor;
  120 +}
  121 +
  122 +const std::string JPG_FILENAME = DEMO_IMAGE_DIR "gallery-medium-4.jpg";
27 123 }
28 124  
29 125 // This example shows how to create and use a NativeImageSource as the target of the render task.
... ... @@ -103,7 +199,9 @@ public:
103 199 animation.Play();
104 200  
105 201 // create a offscreen renderer task to render content into the native image source
106   - FrameBufferImage targetBuffer = FrameBufferImage::New( *nativeImageSourcePtr );
  202 + Texture nativeTexture = Texture::New( *nativeImageSourcePtr );
  203 + FrameBuffer targetBuffer = FrameBuffer::New( nativeTexture.GetWidth(), nativeTexture.GetHeight(), FrameBuffer::COLOR );
  204 + targetBuffer.AttachColorTexture( nativeTexture );
107 205  
108 206 CameraActor cameraActor = CameraActor::New(imageSize);
109 207 cameraActor.SetParentOrigin(ParentOrigin::TOP_CENTER);
... ... @@ -118,25 +216,24 @@ public:
118 216 mOffscreenRenderTask.SetClearEnabled(true);
119 217 mOffscreenRenderTask.SetCameraActor(cameraActor);
120 218 mOffscreenRenderTask.GetCameraActor().SetInvertYAxis(true);
121   - mOffscreenRenderTask.SetTargetFrameBuffer( targetBuffer );
  219 + mOffscreenRenderTask.SetFrameBuffer( targetBuffer );
122 220 mOffscreenRenderTask.SetRefreshRate( RenderTask::REFRESH_ALWAYS );
123 221  
124 222 // Display the native image on the screen
125   - NativeImage nativeImage = NativeImage::New( *nativeImageSourcePtr );
126   - ImageView nativeImageView = ImageView::New( nativeImage );
127   - nativeImageView.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
128   - nativeImageView.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
129   - stage.Add( nativeImageView );
  223 + Actor nativeImageActor = CreateNativeActor( nativeTexture, *nativeImageSourcePtr );
  224 + nativeImageActor.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
  225 + nativeImageActor.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
  226 + stage.Add( nativeImageActor );
130 227  
131 228 TextLabel textLabel1 = TextLabel::New( "Resource Image" );
132 229 textLabel1.SetParentOrigin( ParentOrigin::TOP_CENTER );
133 230 textLabel1.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
134   - nativeImageView.Add( textLabel1 );
  231 + nativeImageActor.Add( textLabel1 );
135 232  
136 233 TextLabel textLabel2 = TextLabel::New( "Native Image" );
137 234 textLabel2.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
138 235 textLabel2.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
139   - nativeImageView.Add( textLabel2 );
  236 + nativeImageActor.Add( textLabel2 );
140 237  
141 238 return false;
142 239 }
... ...
examples/new-window/new-window-example.cpp
1 1 /*
2   - * Copyright (c) 2014 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -15,7 +15,8 @@
15 15 */
16 16  
17 17 // EXTERNAL INCLUDES
18   -#include <dali/devel-api/rendering/renderer.h>
  18 +#include <dali/devel-api/images/texture-set-image.h>
  19 +#include <dali/public-api/rendering/renderer.h>
19 20 #include <dali-toolkit/dali-toolkit.h>
20 21 #include <dali-toolkit/devel-api/controls/bubble-effect/bubble-emitter.h>
21 22  
... ... @@ -329,7 +330,8 @@ void NewWindowController::AddBlendingImageActor( Actor&amp; parentActor )
329 330 blendActor.SetSize(140, 140);
330 331 parentActor.Add(blendActor);
331 332  
332   - blendActor.GetRendererAt(0u).GetTextures().SetImage( 1u, fb2 );
  333 + TextureSet textureSet = blendActor.GetRendererAt(0u).GetTextures();
  334 + TextureSetImage( textureSet, 1u, fb2 );
333 335 }
334 336  
335 337 void NewWindowController::AddTextLabel( Actor& parentActor )
... ...
examples/perf-scroll/perf-scroll.cpp
1 1 /*
2   - * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -15,13 +15,8 @@
15 15 *
16 16 */
17 17  
  18 +#include <dali/public-api/rendering/renderer.h>
18 19 #include <dali-toolkit/dali-toolkit.h>
19   -#include <dali/devel-api/rendering/renderer.h>
20   -#include <dali/devel-api/rendering/sampler.h>
21   -#include <dali/public-api/common/dali-common.h>
22   -#include <dali/integration-api/resource-policies.h>
23   -#include <dali/integration-api/debug.h>
24   -#include <iostream>
25 20  
26 21 #include "shared/utility.h"
27 22  
... ... @@ -186,29 +181,6 @@ const char* FRAGMENT_SHADER_TEXTURE = DALI_COMPOSE_SHADER(
186 181 }\n
187 182 );
188 183  
189   -
190   -Geometry& QuadMesh()
191   -{
192   - static Geometry mesh;
193   - if( !mesh )
194   - {
195   - PropertyBuffer vertexBuffer;
196   - Property::Map vertexFormat;
197   - vertexFormat["aPosition"] = Property::VECTOR2;
198   - vertexFormat["aTexCoord"] = Property::VECTOR2;
199   -
200   - //Create a vertex buffer for vertex positions and texture coordinates
201   - vertexBuffer = PropertyBuffer::New( vertexFormat );
202   - vertexBuffer.SetData( gQuadWithTexture, 4u );
203   -
204   - //Create the geometry
205   - mesh = Geometry::New();
206   - mesh.AddVertexBuffer( vertexBuffer );
207   - mesh.SetGeometryType( Geometry::TRIANGLE_STRIP );
208   - }
209   - return mesh;
210   -}
211   -
212 184 bool gUseMesh(false);
213 185 bool gNinePatch(false);
214 186 unsigned int gRowsPerPage(15);
... ... @@ -216,35 +188,18 @@ unsigned int gColumnsPerPage(15);
216 188 unsigned int gPageCount(10);
217 189 float gDuration(10.0f);
218 190  
219   -Renderer CreateRenderer( unsigned int index )
  191 +Renderer CreateRenderer( unsigned int index, Geometry geometry, Shader shader )
220 192 {
221   -
222   - int numImages = !gNinePatch ? NUM_IMAGES : NUM_NINEPATCH_IMAGES;
223   - static Renderer* renderers = new Renderer[numImages];
224   - if( !renderers[index] )
225   - {
226   - //Create the renderer
227   - Shader shader = Shader::New( VERTEX_SHADER_TEXTURE, FRAGMENT_SHADER_TEXTURE );
228   -
229   - const char* imagePath = !gNinePatch ? IMAGE_PATH[index] : NINEPATCH_IMAGE_PATH[index];
230   - Texture texture = DemoHelper::LoadTexture( imagePath );
231   -
232   - TextureSet textureSet = TextureSet::New();
233   - textureSet.SetTexture( 0u, texture );
234   - renderers[index] = Renderer::New( QuadMesh(), shader );
235   - renderers[index].SetTextures( textureSet );
236   - renderers[index].SetProperty( Renderer::Property::BLEND_MODE, BlendMode::OFF );
237   - }
238   - return renderers[index];
  193 + Renderer renderer = Renderer::New( geometry, shader );
  194 + const char* imagePath = !gNinePatch ? IMAGE_PATH[index] : NINEPATCH_IMAGE_PATH[index];
  195 + Texture texture = DemoHelper::LoadTexture( imagePath );
  196 + TextureSet textureSet = TextureSet::New();
  197 + textureSet.SetTexture( 0u, texture );
  198 + renderer.SetTextures( textureSet );
  199 + renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::OFF );
  200 + return renderer;
239 201 }
240 202  
241   -Actor CreateMeshActor( unsigned int index)
242   -{
243   - Renderer renderer = CreateRenderer( index );
244   - Actor meshActor = Actor::New();
245   - meshActor.AddRenderer( renderer );
246   - return meshActor;
247   -}
248 203  
249 204 }
250 205 // Test application to compare performance between ImageActor and ImageView
... ... @@ -333,18 +288,27 @@ public:
333 288  
334 289 void CreateMeshActors()
335 290 {
336   - Stage stage = Stage::GetCurrent();
  291 + unsigned int numImages = !gNinePatch ? NUM_IMAGES : NUM_NINEPATCH_IMAGES;
337 292  
338   - unsigned int actorCount( mRowsPerPage * mColumnsPerPage * mPageCount );
339   - mActor.resize( actorCount );
  293 + //Create all the renderers
  294 + std::vector<Renderer> renderers( numImages );
  295 + Shader shader = Shader::New( VERTEX_SHADER_TEXTURE, FRAGMENT_SHADER_TEXTURE );
  296 + Geometry geometry = DemoHelper::CreateTexturedQuad();
  297 + for( unsigned int i(0); i<numImages; ++i )
  298 + {
  299 + renderers[i] = CreateRenderer( i, geometry, shader );
  300 + }
340 301  
  302 + //Create the actors
  303 + Stage stage = Stage::GetCurrent();
  304 + unsigned int actorCount(mRowsPerPage*mColumnsPerPage * mPageCount);
  305 + mActor.resize(actorCount);
341 306 for( size_t i(0); i<actorCount; ++i )
342 307 {
343   - size_t numImages = !gNinePatch ? NUM_IMAGES : NUM_NINEPATCH_IMAGES;
344   - mActor[i] = CreateMeshActor( i % numImages );
  308 + mActor[i] = Actor::New();
  309 + mActor[i].AddRenderer( renderers[i % numImages] );
345 310 mActor[i].SetSize(0.0f,0.0f,0.0f);
346   -
347   - mParent.Add( mActor[i] );
  311 + mParent.Add(mActor[i]);
348 312 }
349 313 }
350 314  
... ...
examples/point-mesh/point-mesh-example.cpp
1 1 /*
2   - * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -16,7 +16,7 @@
16 16 */
17 17  
18 18 // EXTERNAL INCLUDES
19   -#include <dali/devel-api/rendering/renderer.h>
  19 +#include <dali/public-api/rendering/renderer.h>
20 20 #include <dali-toolkit/dali-toolkit.h>
21 21  
22 22 // INTERNAL INCLUDES
... ...
examples/radial-menu/radial-sweep-view-impl.cpp
1 1 /*
2   - * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -17,7 +17,7 @@
17 17  
18 18 #include "radial-sweep-view-impl.h"
19 19  
20   -#include <dali/devel-api/rendering/renderer.h>
  20 +#include <dali/public-api/rendering/renderer.h>
21 21 #include <sstream>
22 22  
23 23 using namespace Dali;
... ...
examples/refraction-effect/refraction-effect-example.cpp
1 1 /*
2   - * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -17,7 +17,7 @@
17 17  
18 18 // EXTERNAL INCLUDES
19 19 #include <dali/dali.h>
20   -#include <dali/devel-api/rendering/renderer.h>
  20 +#include <dali/public-api/rendering/renderer.h>
21 21 #include <dali-toolkit/dali-toolkit.h>
22 22  
23 23 #include <fstream>
... ...
examples/textured-mesh/textured-mesh-example.cpp
1 1 /*
2   - * Copyright (c) 2014 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -16,7 +16,7 @@
16 16 */
17 17  
18 18 // EXTERNAL INCLUDES
19   -#include <dali/devel-api/rendering/renderer.h>
  19 +#include <dali/public-api/rendering/renderer.h>
20 20 #include <dali-toolkit/dali-toolkit.h>
21 21  
22 22 // INTERNAL INCLUDES
... ... @@ -62,34 +62,6 @@ void main()
62 62 }
63 63 );
64 64  
65   -Geometry CreateGeometry()
66   -{
67   - // Create vertices
68   - const float halfQuadSize = .5f;
69   - struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; };
70   - TexturedQuadVertex texturedQuadVertexData[4] = {
71   - { Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f) },
72   - { Vector2( halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f) },
73   - { Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f) },
74   - { Vector2( halfQuadSize, halfQuadSize), Vector2(1.f, 1.f) } };
75   -
76   - Property::Map texturedQuadVertexFormat;
77   - texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
78   - texturedQuadVertexFormat["aTexCoord"] = Property::VECTOR2;
79   - PropertyBuffer texturedQuadVertices = PropertyBuffer::New( texturedQuadVertexFormat );
80   - texturedQuadVertices.SetData( texturedQuadVertexData, 4 );
81   -
82   - // Create indices
83   - unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 };
84   -
85   - // Create the geometry object
86   - Geometry texturedQuadGeometry = Geometry::New();
87   - texturedQuadGeometry.AddVertexBuffer( texturedQuadVertices );
88   - texturedQuadGeometry.SetIndexBuffer( &indexData[0], sizeof(indexData)/sizeof(indexData[0]) );
89   -
90   - return texturedQuadGeometry;
91   -}
92   -
93 65 /**
94 66 * Sinusoidal curve starting at zero with 2 cycles
95 67 */
... ... @@ -151,7 +123,7 @@ public:
151 123 mTextureSet2 = TextureSet::New();
152 124 mTextureSet2.SetTexture( 0u, texture2 );
153 125  
154   - mGeometry = CreateGeometry();
  126 + mGeometry = DemoHelper::CreateTexturedQuad();
155 127  
156 128 mRenderer = Renderer::New( mGeometry, mShader );
157 129 mRenderer.SetTextures( mTextureSet1 );
... ...
packaging/com.samsung.dali-demo.spec
... ... @@ -2,7 +2,7 @@
2 2  
3 3 Name: com.samsung.dali-demo
4 4 Summary: The OpenGLES Canvas Core Demo
5   -Version: 1.1.42
  5 +Version: 1.1.43
6 6 Release: 1
7 7 Group: System/Libraries
8 8 License: Apache-2.0
... ...
resources/scripts/simple-image-wall.js renamed to resources/scripts/simple-image-wall.js.in
... ... @@ -2,27 +2,12 @@
2 2 //
3 3 // Example usage of Dali API
4 4 //
5   -//
6   -//
7   -// get the dali-demo image directory path
8   -// hard code for the device to /usr/apps/com.samsung.dali-demo/images/
9   -var imageDir = dali.DALI_DATA_DIRECTORY;
10   -
11   -if (imageDir != "/usr/share/dali//") {
12   - imageDir = imageDir.substring(0, imageDir.lastIndexOf("dali/"));
13   - imageDir += "com.samsung.dali-demo/images/";
14   -} else // on device
15   -{
16   - imageDir = "/usr/apps/com.samsung.dali-demo/images/";
17   -}
18 5  
  6 +var imageDir = "@DEMO_STYLE_IMAGE_DIR@";
19 7  
20 8 var NUMBER_OF_IMAGES = 40; // for now use 16 ( demo files go up to 30)
21   -var DEMO_IMAGES = []; // array to store Dali Images
22   -var VIDEO_WALL_ACTORS = []; // array to store Image actors
23 9 var VIDEO_WALL_ROWS = 7; // use 3 rows for the video wall
24 10 var VIDEO_WALL_COLUMNS = 12; // use 12 columns for the video wall
25   -var VIDEO_WALL_TOTAL_ITEMS = VIDEO_WALL_COLUMNS * VIDEO_WALL_ROWS; // total items
26 11 var VIDEO_WALL_ITEM_SIZE = 128; // width / height of a item in the video wall
27 12 var BORDER_SIZE = 5;
28 13 var VIDEO_WALL_ITEM_SIZE_NO_BORDER = VIDEO_WALL_ITEM_SIZE - BORDER_SIZE;
... ... @@ -39,14 +24,6 @@ daliApp.getFileName = function(index) {
39 24 return fileName;
40 25 }
41 26  
42   -// load the images
43   -daliApp.loadImages = function() {
44   - for (index = 0; index < NUMBER_OF_IMAGES; ++index) {
45   - fileName = imageDir + daliApp.getFileName(index);
46   - DEMO_IMAGES[index] = new dali.ResourceImage( { url:fileName } );
47   - }
48   -}
49   -
50 27 daliApp.createRootActor = function() {
51 28 wallRootActor = new dali.Actor();
52 29 wallRootActor.parentOrigin = dali.CENTER;
... ... @@ -54,8 +31,6 @@ daliApp.createRootActor = function() {
54 31 dali.stage.add(wallRootActor);
55 32 }
56 33  
57   -
58   -
59 34 daliApp.getWallActorIndex = function(x, y) {
60 35 return x + y * VIDEO_WALL_COLUMNS;
61 36 }
... ... @@ -67,16 +42,16 @@ daliApp.createActors = function() {
67 42 for (x = 0; x < VIDEO_WALL_COLUMNS; ++x) {
68 43  
69 44 var actorIndex = daliApp.getWallActorIndex(x, y);
70   - var imageActor = new dali.ImageActor();
  45 + var imageView = new dali.Control("ImageView");
71 46  
72 47 // wrap image index between 0 and NUMBER_OF_IMAGES
73 48 var imageIndex = actorIndex % NUMBER_OF_IMAGES;
74 49  
75   - imageActor.setImage(DEMO_IMAGES[imageIndex]);
  50 + imageView.image = imageDir + daliApp.getFileName(imageIndex);
76 51  
77   - imageActor.parentOrigin = dali.CENTER;
78   - imageActor.anchorPoint = dali.CENTER;
79   - imageActor.size = [VIDEO_WALL_ITEM_SIZE_NO_BORDER, VIDEO_WALL_ITEM_SIZE_NO_BORDER, 1.0]; // start with zero size so it zooms up
  52 + imageView.parentOrigin = dali.CENTER;
  53 + imageView.anchorPoint = dali.CENTER;
  54 + imageView.size = [VIDEO_WALL_ITEM_SIZE_NO_BORDER, VIDEO_WALL_ITEM_SIZE_NO_BORDER, 1.0]; // start with zero size so it zooms up
80 55  
81 56 var xPosition = x * VIDEO_WALL_ITEM_SIZE;
82 57 // as the middle the wall is at zero (relative to wallRootActor), we need to subtract half the wall width.
... ... @@ -86,23 +61,16 @@ daliApp.createActors = function() {
86 61 var yPosition = y * VIDEO_WALL_ITEM_SIZE;
87 62 yPosition = yPosition - (VIDEO_WALL_HEIGHT / 2) + (VIDEO_WALL_ITEM_SIZE / 2);
88 63  
89   - imageActor.position = [xPosition, yPosition, 0.0];
90   - // store the actor
91   - VIDEO_WALL_ACTORS[actorIndex] = imageActor;
  64 + imageView.position = [xPosition, yPosition, 0.0];
92 65  
93 66 // Add to the video wall root actor.
94   - wallRootActor.add(imageActor);
  67 + wallRootActor.add(imageView);
95 68 }
96 69 }
97 70 }
98 71  
99 72 function Initialise() {
100   -
101   - daliApp.loadImages();
102   -
103 73 daliApp.createActors();
104   -
105   -
106 74 }
107 75  
108 76 Initialise();
... ...
shared/utility.h
1   -#ifndef __DALI_DEMO_UTILITY_H__
2   -#define __DALI_DEMO_UTILITY_H__
  1 +#ifndef DALI_DEMO_UTILITY_H
  2 +#define DALI_DEMO_UTILITY_H
3 3  
4 4 /*
5   - * Copyright (c) 2014 Samsung Electronics Co., Ltd.
  5 + * Copyright (c) 2016 Samsung Electronics Co., Ltd.
6 6 *
7 7 * Licensed under the Apache License, Version 2.0 (the "License");
8 8 * you may not use this file except in compliance with the License.
... ... @@ -20,8 +20,9 @@
20 20  
21 21 #include <dali/dali.h>
22 22 #include <dali/devel-api/images/atlas.h>
23   -#include <dali/devel-api/rendering/texture.h>
24 23 #include <dali/devel-api/adaptor-framework/bitmap-loader.h>
  24 +#include <dali/public-api/rendering/geometry.h>
  25 +#include <dali/public-api/rendering/texture.h>
25 26  
26 27 namespace DemoHelper
27 28 {
... ... @@ -86,6 +87,35 @@ Dali::Texture LoadStageFillingTexture( const char* imagePath )
86 87 return LoadTexture( imagePath, Dali::ImageDimensions( stageSize.x, stageSize.y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR );
87 88 }
88 89  
  90 +Dali::Geometry CreateTexturedQuad()
  91 +{
  92 + struct Vertex
  93 + {
  94 + Dali::Vector2 position;
  95 + Dali::Vector2 texCoord;
  96 + };
  97 +
  98 + static const Vertex data[] = {{ Dali::Vector2( -0.5f, -0.5f ), Dali::Vector2( 0.0f, 0.0f ) },
  99 + { Dali::Vector2( 0.5f, -0.5f ), Dali::Vector2( 1.0f, 0.0f ) },
  100 + { Dali::Vector2( -0.5f, 0.5f ), Dali::Vector2( 0.0f, 1.0f ) },
  101 + { Dali::Vector2( 0.5f, 0.5f ), Dali::Vector2( 1.0f, 1.0f ) }};
  102 +
  103 + Dali::PropertyBuffer vertexBuffer;
  104 + Dali::Property::Map vertexFormat;
  105 + vertexFormat["aPosition"] = Dali::Property::VECTOR2;
  106 + vertexFormat["aTexCoord"] = Dali::Property::VECTOR2;
  107 +
  108 + //Create a vertex buffer for vertex positions and texture coordinates
  109 + vertexBuffer = Dali::PropertyBuffer::New( vertexFormat );
  110 + vertexBuffer.SetData( data, 4u );
  111 +
  112 + //Create the geometry
  113 + Dali::Geometry geometry = Dali::Geometry::New();
  114 + geometry.AddVertexBuffer( vertexBuffer );
  115 + geometry.SetGeometryType(Dali::Geometry::TRIANGLE_STRIP );
  116 +
  117 + return geometry;
  118 +}
89 119 } // DemoHelper
90 120  
91   -#endif // __DALI_DEMO_HELPER_VIEW_H__
  121 +#endif // DALI_DEMO_UTILITY_H
... ...