Commit d23654c73e240cb25c8e22778793ccabf0affb77

Authored by Nick Holland
2 parents fc74c49e c782943e

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

Change-Id: I0a13417c13f05c2e20da7bfda68fff7ce0fbdab8
com.samsung.dali-demo.xml
... ... @@ -115,4 +115,7 @@
115 115 <ui-application appid="gradients.example" exec="/usr/apps/com.samsung.dali-demo/bin/gradients.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
116 116 <label>Color Gradient</label>
117 117 </ui-application>
  118 + <ui-application appid="image-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/image-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
  119 + <label>Image View</label>
  120 + </ui-application>
118 121 </manifest>
... ...
demo/dali-demo.cpp
... ... @@ -66,6 +66,7 @@ int main(int argc, char **argv)
66 66 demo.AddExample(Example("textured-mesh.example", DALI_DEMO_STR_TITLE_TEXTURED_MESH));
67 67 demo.AddExample(Example("line-mesh.example", DALI_DEMO_STR_TITLE_LINE_MESH));
68 68 demo.AddExample(Example("gradients.example", DALI_DEMO_STR_TITLE_COLOR_GRADIENT));
  69 + demo.AddExample(Example("image-view.example", DALI_DEMO_STR_TITLE_IMAGE_VIEW));
69 70  
70 71 demo.SortAlphabetically( true );
71 72  
... ...
examples/benchmark/benchmark.cpp
... ... @@ -249,7 +249,7 @@ Actor CreateMeshActor( unsigned int index)
249 249 // -p NumberOfPages (Modifies the nimber of pages )
250 250 // --use-imageview ( Use ImageView instead of ImageActor )
251 251 // --use-mesh ( Use new renderer API (as ImageView) but shares renderers between actors when possible )
252   -// --use-nine-patch ( Use nine patch images )
  252 +// --nine-patch ( Use nine patch images )
253 253  
254 254 //
255 255 class Benchmark : public ConnectionTracker
... ...
examples/cube-transition-effect/cube-transition-effect-example.cpp
... ... @@ -167,9 +167,9 @@ private:
167 167 /**
168 168 * Callback function of cube transition completed signal
169 169 * @param[in] effect The cube effect used for the transition
170   - * @param[in] imageActor The target imageActor of the completed transition
  170 + * @param[in] image The target Image of the completed transition
171 171 */
172   - void OnTransitionCompleted(Toolkit::CubeTransitionEffect effect, ImageActor imageActor);
  172 + void OnTransitionCompleted(Toolkit::CubeTransitionEffect effect, Image image );
173 173 /**
174 174 * Callback function of timer tick
175 175 * The timer is used to count the image display duration in slideshow,
... ... @@ -181,13 +181,12 @@ private:
181 181 Toolkit::Control mView;
182 182 Toolkit::ToolBar mToolBar;
183 183 Layer mContent;
184   - Toolkit::TextLabel mTitleActor;
185   - Actor mParent;
  184 + Toolkit::TextLabel mTitle;
186 185  
187 186 Vector2 mViewSize;
188 187  
189   - ImageActor mCurrentImage;
190   - ImageActor mNextImage;
  188 + ResourceImage mCurrentImage;
  189 + ResourceImage mNextImage;
191 190 unsigned int mIndex;
192 191 bool mIsImageLoading;
193 192  
... ... @@ -238,8 +237,8 @@ void CubeTransitionApp::OnInit( Application&amp; application )
238 237 mToolBar.AddControl( mEffectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
239 238  
240 239 // Add title to the tool bar.
241   - mTitleActor = DemoHelper::CreateToolBarLabel( APPLICATION_TITLE_WAVE );
242   - mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter );
  240 + mTitle = DemoHelper::CreateToolBarLabel( APPLICATION_TITLE_WAVE );
  241 + mToolBar.AddControl( mTitle, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter );
243 242  
244 243 //Add an slideshow icon on the right of the title
245 244 mSlideshowButton = Toolkit::PushButton::New();
... ... @@ -251,53 +250,55 @@ void CubeTransitionApp::OnInit( Application&amp; application )
251 250 // Set size to stage size to avoid seeing a black border on transition
252 251 mViewSize = Stage::GetCurrent().GetSize();
253 252  
254   - mParent = Actor::New();
255   - mParent.SetSize( mViewSize );
256   - mParent.SetPositionInheritanceMode( USE_PARENT_POSITION );
257   - mContent.Add( mParent );
258   -
259   - // use pan gesture to detect the cursor or finger movement
260   - mPanGestureDetector = PanGestureDetector::New();
261   - mPanGestureDetector.DetectedSignal().Connect( this, &CubeTransitionApp::OnPanGesture );
262   - mPanGestureDetector.Attach( mParent );
  253 + // show the first image
  254 + mCurrentImage = LoadStageFillingImage( IMAGES[mIndex] );
263 255  
264 256 //use small cubes
265   - mCubeWaveEffect = Toolkit::CubeTransitionWaveEffect::New(NUM_ROWS_WAVE, NUM_COLUMNS_WAVE, mViewSize);
  257 + mCubeWaveEffect = Toolkit::CubeTransitionWaveEffect::New( NUM_ROWS_WAVE, NUM_COLUMNS_WAVE );
266 258 mCubeWaveEffect.SetTransitionDuration( ANIMATION_DURATION_WAVE );
267 259 mCubeWaveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT_WAVE );
268 260 mCubeWaveEffect.TransitionCompletedSignal().Connect(this, &CubeTransitionApp::OnTransitionCompleted);
269   - mParent.Add(mCubeWaveEffect.GetRoot());
  261 +
  262 + mCubeWaveEffect.SetSize( mViewSize );
  263 + mCubeWaveEffect.SetPositionInheritanceMode( USE_PARENT_POSITION );
  264 + mCubeWaveEffect.SetCurrentImage( mCurrentImage );
  265 +
270 266 // use big cubes
271   - mCubeCrossEffect = Toolkit::CubeTransitionCrossEffect::New(NUM_ROWS_CROSS, NUM_COLUMNS_CROSS, mViewSize);
272   - mCubeCrossEffect.SetTransitionDuration( ANIMATION_DURATION_CROSS);
  267 + mCubeCrossEffect = Toolkit::CubeTransitionCrossEffect::New(NUM_ROWS_CROSS, NUM_COLUMNS_CROSS );
  268 + mCubeCrossEffect.SetTransitionDuration( ANIMATION_DURATION_CROSS );
273 269 mCubeCrossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT_CROSS );
274 270 mCubeCrossEffect.TransitionCompletedSignal().Connect(this, &CubeTransitionApp::OnTransitionCompleted);
275   - mParent.Add(mCubeCrossEffect.GetRoot());
276 271  
277   - mCubeFoldEffect = Toolkit::CubeTransitionFoldEffect::New(NUM_ROWS_FOLD, NUM_COLUMNS_FOLD, mViewSize);
278   - mCubeFoldEffect.SetTransitionDuration( ANIMATION_DURATION_FOLD);
  272 + mCubeCrossEffect.SetSize( mViewSize );
  273 + mCubeCrossEffect.SetPositionInheritanceMode( USE_PARENT_POSITION );
  274 + mCubeCrossEffect.SetCurrentImage( mCurrentImage );
  275 +
  276 + mCubeFoldEffect = Toolkit::CubeTransitionFoldEffect::New( NUM_ROWS_FOLD, NUM_COLUMNS_FOLD );
  277 + mCubeFoldEffect.SetTransitionDuration( ANIMATION_DURATION_FOLD );
279 278 mCubeFoldEffect.TransitionCompletedSignal().Connect(this, &CubeTransitionApp::OnTransitionCompleted);
280   - mParent.Add(mCubeFoldEffect.GetRoot());
  279 +
  280 + mCubeFoldEffect.SetSize( mViewSize );
  281 + mCubeFoldEffect.SetPositionInheritanceMode( USE_PARENT_POSITION );
  282 + mCubeFoldEffect.SetCurrentImage( mCurrentImage );
281 283  
282 284 mViewTimer = Timer::New( VIEWINGTIME );
283 285 mViewTimer.TickSignal().Connect( this, &CubeTransitionApp::OnTimerTick );
284 286  
285   - // show the first image
286   - mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) );
287   - mCurrentImage.SetPositionInheritanceMode( USE_PARENT_POSITION );
288   - mCurrentImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
289   - mCurrentImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO );
290   - mParent.Add( mCurrentImage );
291 287  
292 288 mCurrentEffect = mCubeWaveEffect;
293   - mCurrentEffect.SetCurrentImage( mCurrentImage );
  289 + mContent.Add( mCurrentEffect );
  290 +
  291 + // use pan gesture to detect the cursor or finger movement
  292 + mPanGestureDetector = PanGestureDetector::New();
  293 + mPanGestureDetector.DetectedSignal().Connect( this, &CubeTransitionApp::OnPanGesture );
  294 + mPanGestureDetector.Attach( mContent );
294 295 }
295 296  
296 297 // signal handler, called when the pan gesture is detected
297 298 void CubeTransitionApp::OnPanGesture( Actor actor, const PanGesture& gesture )
298 299 {
299 300 // does not response when the transition has not finished
300   - if( mIsImageLoading || mCubeWaveEffect.IsTransiting() || mCubeCrossEffect.IsTransiting() || mCubeFoldEffect.IsTransiting() || mSlideshow )
  301 + if( mIsImageLoading || mCubeWaveEffect.IsTransitioning() || mCubeCrossEffect.IsTransitioning() || mCubeFoldEffect.IsTransitioning() || mSlideshow )
301 302 {
302 303 return;
303 304 }
... ... @@ -321,22 +322,17 @@ void CubeTransitionApp::OnPanGesture( Actor actor, const PanGesture&amp; gesture )
321 322  
322 323 void CubeTransitionApp::GoToNextImage()
323 324 {
324   - ResourceImage image = LoadStageFillingImage( IMAGES[ mIndex ] );
325   - mNextImage = ImageActor::New( image );
326   -
327   - mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION);
328   - mNextImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
329   - mNextImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO );
330   - mCurrentEffect.SetTargetImage(mNextImage);
331   - if( image.GetLoadingState() == ResourceLoadingSucceeded )
  325 + mNextImage = LoadStageFillingImage( IMAGES[ mIndex ] );
  326 + mCurrentEffect.SetTargetImage( mNextImage );
  327 + if( mNextImage.GetLoadingState() == ResourceLoadingSucceeded )
332 328 {
333 329 mIsImageLoading = false;
334   - OnImageLoaded( image );
  330 + OnImageLoaded( mNextImage );
335 331 }
336 332 else
337 333 {
338 334 mIsImageLoading = true;
339   - image.LoadingFinishedSignal().Connect( this, &CubeTransitionApp::OnImageLoaded );
  335 + mNextImage.LoadingFinishedSignal().Connect( this, &CubeTransitionApp::OnImageLoaded );
340 336 }
341 337 }
342 338  
... ... @@ -344,17 +340,16 @@ void CubeTransitionApp::OnImageLoaded(ResourceImage image)
344 340 {
345 341 mIsImageLoading = false;
346 342 mCurrentEffect.StartTransition( mPanPosition, mPanDisplacement );
347   - mParent.Remove(mCurrentImage);
348   - mParent.Add(mNextImage);
349 343 mCurrentImage = mNextImage;
350 344 }
351 345  
352 346 bool CubeTransitionApp::OnEffectButtonClicked( Toolkit::Button button )
353 347 {
  348 + mContent.Remove( mCurrentEffect );
354 349 if(mCurrentEffect == mCubeWaveEffect)
355 350 {
356 351 mCurrentEffect = mCubeCrossEffect;
357   - mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_CROSS) );
  352 + mTitle.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_CROSS) );
358 353 mEffectChangeButton.SetUnselectedImage( EFFECT_CROSS_IMAGE );
359 354 mEffectChangeButton.SetSelectedImage( EFFECT_CROSS_IMAGE_SELECTED );
360 355  
... ... @@ -362,21 +357,22 @@ bool CubeTransitionApp::OnEffectButtonClicked( Toolkit::Button button )
362 357 else if(mCurrentEffect == mCubeCrossEffect)
363 358 {
364 359 mCurrentEffect = mCubeFoldEffect;
365   - mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_FOLD) );
  360 + mTitle.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_FOLD) );
366 361 mEffectChangeButton.SetUnselectedImage( EFFECT_FOLD_IMAGE );
367 362 mEffectChangeButton.SetSelectedImage( EFFECT_FOLD_IMAGE_SELECTED );
368 363 }
369 364 else
370 365 {
371 366 mCurrentEffect = mCubeWaveEffect;
372   - mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_WAVE) );
  367 + mTitle.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_WAVE) );
373 368 mEffectChangeButton.SetUnselectedImage( EFFECT_WAVE_IMAGE );
374 369 mEffectChangeButton.SetSelectedImage( EFFECT_WAVE_IMAGE_SELECTED );
375 370 }
  371 + mContent.Add( mCurrentEffect );
376 372  
377 373 // Set the current image to cube transition effect
378 374 // only need to set at beginning or change from another effect
379   - mCurrentEffect.SetCurrentImage(mCurrentImage);
  375 + mCurrentEffect.SetCurrentImage( mCurrentImage );
380 376 return true;
381 377 }
382 378  
... ... @@ -385,7 +381,7 @@ bool CubeTransitionApp::OnSildeshowButtonClicked( Toolkit::Button button )
385 381 mSlideshow = !mSlideshow;
386 382 if( mSlideshow )
387 383 {
388   - mPanGestureDetector.Detach( mParent );
  384 + mPanGestureDetector.Detach( mContent );
389 385 mSlideshowButton.SetUnselectedImage( SLIDE_SHOW_STOP_ICON );
390 386 mSlideshowButton.SetSelectedImage( SLIDE_SHOW_STOP_ICON_SELECTED );
391 387 mPanPosition = Vector2( mViewSize.width, mViewSize.height*0.5f );
... ... @@ -394,7 +390,7 @@ bool CubeTransitionApp::OnSildeshowButtonClicked( Toolkit::Button button )
394 390 }
395 391 else
396 392 {
397   - mPanGestureDetector.Attach( mParent );
  393 + mPanGestureDetector.Attach( mContent );
398 394 mSlideshowButton.SetUnselectedImage( SLIDE_SHOW_START_ICON );
399 395 mSlideshowButton.SetSelectedImage( SLIDE_SHOW_START_ICON_SELECTED );
400 396 mViewTimer.Stop();
... ... @@ -402,7 +398,7 @@ bool CubeTransitionApp::OnSildeshowButtonClicked( Toolkit::Button button )
402 398 return true;
403 399 }
404 400  
405   -void CubeTransitionApp::OnTransitionCompleted(Toolkit::CubeTransitionEffect effect, ImageActor imageActor)
  401 +void CubeTransitionApp::OnTransitionCompleted(Toolkit::CubeTransitionEffect effect, Image image )
406 402 {
407 403 if( mSlideshow )
408 404 {
... ...
examples/image-view/image-view-example.cpp 0 → 100644
  1 +/*
  2 + * Copyright (c) 2015 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 +#include "shared/view.h"
  19 +#include <dali/dali.h>
  20 +#include <dali-toolkit/dali-toolkit.h>
  21 +#include <dali-toolkit/devel-api/controls/slider/slider.h>
  22 +
  23 +using namespace Dali;
  24 +
  25 +namespace
  26 +{
  27 +
  28 +const char* BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-gradient.jpg" );
  29 +const char* TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" );
  30 +const char* APPLICATION_TITLE( "Image view" );
  31 +
  32 +const char* IMAGE_PATH[] = {
  33 + DALI_IMAGE_DIR "blocks-ball.png",
  34 + DALI_IMAGE_DIR "gallery-small-23.jpg",
  35 + DALI_IMAGE_DIR "selection-popup-bg.2.9.png",
  36 + DALI_IMAGE_DIR "heartsframe.9.png",
  37 +};
  38 +
  39 +const char* RESOURCE_IMAGE_PATH[] = {
  40 + DALI_IMAGE_DIR "contacts-image.png",
  41 + DALI_IMAGE_DIR "gallery-small-27.jpg",
  42 + DALI_IMAGE_DIR "selection-popup-bg.8.9.png",
  43 + DALI_IMAGE_DIR "heartsframe.9.png",
  44 +};
  45 +
  46 +const unsigned int NUM_IMAGES = sizeof(IMAGE_PATH) / sizeof(char*);
  47 +const unsigned int NUM_RESOURCE_IMAGES = sizeof(RESOURCE_IMAGE_PATH) / sizeof(char*);
  48 +
  49 +const unsigned int COLUMNS = 3;
  50 +const unsigned int ROWS = 4;
  51 +
  52 +} // namespace
  53 +
  54 +class ImageViewController: public ConnectionTracker
  55 +{
  56 + public:
  57 +
  58 + ImageViewController( Application& application )
  59 + : mApplication( application ),
  60 + mCurrentPositionToggle( 0, 0 ),
  61 + mCurrentPositionImage( 0, 0 ),
  62 + mToggleOff( true ),
  63 + mUseResource( false ),
  64 + mImageIdx( 1 )
  65 + {
  66 + // Connect to the Application's Init signal
  67 + mApplication.InitSignal().Connect( this, &ImageViewController::Create );
  68 + }
  69 +
  70 + ~ImageViewController()
  71 + {
  72 + // Nothing to do here
  73 + }
  74 +
  75 + void Create( Application& application )
  76 + {
  77 + // The Init signal is received once (only) during the Application lifetime
  78 +
  79 + // Creates a default view with a default tool bar.
  80 + // The view is added to the stage.
  81 + mContentLayer = DemoHelper::CreateView( application,
  82 + mView,
  83 + mToolBar,
  84 + BACKGROUND_IMAGE,
  85 + TOOLBAR_IMAGE,
  86 + APPLICATION_TITLE );
  87 +
  88 +
  89 + mTable = Toolkit::TableView::New( ROWS, COLUMNS );
  90 + mTable.SetAnchorPoint( AnchorPoint::CENTER );
  91 + mTable.SetParentOrigin( ParentOrigin::CENTER );
  92 + mTable.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS );
  93 + Vector3 offset( -50.0f, -350.0f, 0.0f );
  94 + mTable.SetSizeModeFactor( offset );
  95 +
  96 + mContentLayer.Add( mTable );
  97 +
  98 + for( unsigned int y = 0; y < ROWS; ++y )
  99 + {
  100 + for( unsigned int x = 0; x < COLUMNS; ++x )
  101 + {
  102 + mImageViews[x][y] = Toolkit::ImageView::New( IMAGE_PATH[ 0 ] );
  103 + mImageViews[x][y].SetParentOrigin( ParentOrigin::CENTER );
  104 + mImageViews[x][y].SetAnchorPoint( AnchorPoint::CENTER );
  105 + mImageViews[x][y].SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
  106 +
  107 + mTable.AddChild( mImageViews[x][y], Toolkit::TableView::CellPosition( y, x ) );
  108 + }
  109 + }
  110 +
  111 + Toolkit::TableView buttonsTable = Toolkit::TableView::New( 3, 1 );
  112 + buttonsTable.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
  113 + buttonsTable.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
  114 + buttonsTable.SetFitHeight( 0 );
  115 + buttonsTable.SetFitHeight( 1 );
  116 + buttonsTable.SetFitHeight( 2 );
  117 + buttonsTable.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  118 +
  119 + Toolkit::PushButton button = Toolkit::PushButton::New();
  120 + button.SetLabelText( "Toggle on/off stage" );
  121 + button.SetParentOrigin( ParentOrigin::CENTER );
  122 + button.SetAnchorPoint( AnchorPoint::CENTER );
  123 + button.ClickedSignal().Connect( this, &ImageViewController::ToggleImageOnStage );
  124 + button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  125 + buttonsTable.AddChild( button, Toolkit::TableView::CellPosition( 0, 0 ) );
  126 +
  127 + Toolkit::PushButton button2 = Toolkit::PushButton::New();
  128 + button2.SetLabelText( "Change Image" );
  129 + button2.SetParentOrigin( ParentOrigin::CENTER );
  130 + button2.SetAnchorPoint( AnchorPoint::CENTER );
  131 + button2.ClickedSignal().Connect( this, &ImageViewController::ChangeImageClicked );
  132 + button2.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  133 + buttonsTable.AddChild( button2, Toolkit::TableView::CellPosition( 1, 0 ) );
  134 +
  135 + Toolkit::CheckBoxButton button3 = Toolkit::CheckBoxButton::New();
  136 + button3.SetLabelText( "Use Resource Images" );
  137 + button3.SetParentOrigin( ParentOrigin::CENTER );
  138 + button3.SetAnchorPoint( AnchorPoint::CENTER );
  139 + button3.ClickedSignal().Connect( this, &ImageViewController::UseResourceImagesClicked );
  140 + button3.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  141 + buttonsTable.AddChild( button3, Toolkit::TableView::CellPosition( 2, 0 ) );
  142 +
  143 + mContentLayer.Add(buttonsTable);
  144 + }
  145 +
  146 +private:
  147 + bool ToggleImageOnStage( Toolkit::Button button )
  148 + {
  149 + Toolkit::ImageView imageView = mImageViews[ mCurrentPositionToggle.columnIndex ][ mCurrentPositionToggle.rowIndex ];
  150 +
  151 + if( mToggleOff )
  152 + {
  153 + imageView.Unparent();
  154 + }
  155 + else
  156 + {
  157 + mTable.AddChild( imageView, mCurrentPositionToggle );
  158 + }
  159 +
  160 + ++mCurrentPositionToggle.columnIndex;
  161 + if( mCurrentPositionToggle.columnIndex == COLUMNS )
  162 + {
  163 + mCurrentPositionToggle.columnIndex = 0;
  164 + ++mCurrentPositionToggle.rowIndex;
  165 + }
  166 + if( mCurrentPositionToggle.rowIndex == ROWS )
  167 + {
  168 + mCurrentPositionToggle.rowIndex = 0;
  169 + mToggleOff = !mToggleOff;
  170 + }
  171 +
  172 + return true;
  173 + }
  174 +
  175 + bool ChangeImageClicked( Toolkit::Button button )
  176 + {
  177 + Toolkit::ImageView imageView = mImageViews[ mCurrentPositionImage.columnIndex ][ mCurrentPositionImage.rowIndex ];
  178 +
  179 + if( mUseResource )
  180 + {
  181 + ResourceImage image = ResourceImage::New( RESOURCE_IMAGE_PATH[ mImageIdx ] );
  182 + imageView.SetImage( image );
  183 + }
  184 + else
  185 + {
  186 + imageView.SetImage( IMAGE_PATH[ mImageIdx ] );
  187 + }
  188 +
  189 + ++mCurrentPositionImage.columnIndex;
  190 + if( mCurrentPositionImage.columnIndex == COLUMNS )
  191 + {
  192 + mCurrentPositionImage.columnIndex = 0;
  193 + ++mCurrentPositionImage.rowIndex;
  194 + }
  195 + if( mCurrentPositionImage.rowIndex == ROWS )
  196 + {
  197 + mCurrentPositionImage.rowIndex = 0;
  198 + ++mImageIdx;
  199 +
  200 + int numImages = mUseResource ? NUM_RESOURCE_IMAGES : NUM_IMAGES;
  201 + if( mImageIdx == numImages )
  202 + {
  203 + mImageIdx = 0;
  204 + }
  205 + }
  206 +
  207 + return true;
  208 + }
  209 +
  210 + bool UseResourceImagesClicked( Toolkit::Button button )
  211 + {
  212 + mUseResource = !mUseResource;
  213 +
  214 + int numImages = mUseResource ? NUM_RESOURCE_IMAGES : NUM_IMAGES;
  215 + if( mImageIdx >= numImages )
  216 + {
  217 + mImageIdx = 0;
  218 + }
  219 +
  220 + return true;
  221 + }
  222 +
  223 +private:
  224 + Application& mApplication;
  225 +
  226 + Toolkit::Control mView; ///< The View instance.
  227 + Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
  228 + Layer mContentLayer; ///< Content layer
  229 + Toolkit::TableView mTable;
  230 + Toolkit::ImageView mImageViews[ COLUMNS ][ ROWS ];
  231 +
  232 + Toolkit::TableView::CellPosition mCurrentPositionToggle;
  233 + Toolkit::TableView::CellPosition mCurrentPositionImage;
  234 +
  235 + bool mToggleOff;
  236 + bool mUseResource;
  237 + int mImageIdx;
  238 +
  239 +};
  240 +
  241 +void RunTest( Application& application )
  242 +{
  243 + ImageViewController test( application );
  244 +
  245 + application.MainLoop();
  246 +}
  247 +
  248 +// Entry point for Linux & Tizen applications
  249 +//
  250 +int main( int argc, char **argv )
  251 +{
  252 + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH );
  253 +
  254 + RunTest( application );
  255 +
  256 + return 0;
  257 +}
... ...
examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp
... ... @@ -199,8 +199,7 @@ public:
199 199 mShadowView.SetPointLightFieldOfView( Math::PI / 2.0f);
200 200 mContents.Add(mShadowView);
201 201  
202   - Image brickWall = ResourceImage::New(DALI_IMAGE_DIR "brick-wall.jpg");
203   - mShadowPlaneBg = ImageActor::New(brickWall);
  202 + mShadowPlaneBg = ImageView::New( DALI_IMAGE_DIR "brick-wall.jpg" );
204 203 mShadowPlaneBg.SetParentOrigin(ParentOrigin::CENTER);
205 204 mShadowPlaneBg.SetAnchorPoint(AnchorPoint::CENTER);
206 205 mShadowPlaneBg.SetName("Plane");
... ... @@ -208,7 +207,7 @@ public:
208 207 mContents.Add(mShadowPlaneBg);
209 208 mShadowPlaneBg.SetPosition(Vector3(50.0f, 50.0f, -200.0f));
210 209  
211   - mShadowView.SetShadowPlane(mShadowPlaneBg);
  210 + mShadowView.SetShadowPlaneBackground(mShadowPlaneBg);
212 211 mShadowView.Activate();
213 212  
214 213 mLightAnchor = Actor::New();
... ... @@ -454,8 +453,8 @@ private:
454 453 Animation mSceneAnimation;
455 454 bool mPaused;
456 455 Toolkit::ShadowView mShadowView;
457   - ImageActor mShadowPlaneBg;
458   - ImageActor mShadowPlane;
  456 + ImageView mShadowPlaneBg;
  457 + ImageView mShadowPlane;
459 458 Actor mCastingLight;
460 459 Actor mLightAnchor;
461 460 ImageView mImageActor1;
... ...
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.7
  5 +Version: 1.1.8
6 6 Release: 1
7 7 Group: System/Libraries
8 8 License: Apache-2.0
... ...
resources/images/heartsframe.9.png 0 → 100644

21.2 KB

shared/dali-demo-strings.h
... ... @@ -94,6 +94,7 @@ extern &quot;C&quot;
94 94 #define DALI_DEMO_STR_TITLE_TEXTURED_MESH "Mesh Texture"
95 95 #define DALI_DEMO_STR_TITLE_LINE_MESH "Mesh Line"
96 96 #define DALI_DEMO_STR_TITLE_COLOR_GRADIENT "Color Gradient"
  97 +#define DALI_DEMO_STR_TITLE_IMAGE_VIEW "Image View"
97 98  
98 99 #endif
99 100  
... ...