Commit 66b0b0035ad29440e1b609c938ddfdaec40d5e54
1 parent
9acf87a2
Changed Image Scaling Irregular Grid example to not use deprecated ImageView::GetImage method.
Change-Id: I0f513af3b3a8c2c128dbfe06533874e740ae701d
Showing
1 changed file
with
8 additions
and
3 deletions
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
| ... | ... | @@ -463,6 +463,7 @@ public: |
| 463 | 463 | image.SetSize( imageSize ); |
| 464 | 464 | image.TouchedSignal().Connect( this, &ImageScalingIrregularGridController::OnTouchImage ); |
| 465 | 465 | mFittingModes[image.GetId()] = fittingMode; |
| 466 | + mResourceUrls[image.GetId()] = imageSource.configuration.path; | |
| 466 | 467 | mSizes[image.GetId()] = imageSize; |
| 467 | 468 | |
| 468 | 469 | gridActor.Add( image ); |
| ... | ... | @@ -493,10 +494,13 @@ public: |
| 493 | 494 | Dali::FittingMode::Type newMode = NextMode( mFittingModes[id] ); |
| 494 | 495 | const Vector2 imageSize = mSizes[actor.GetId()]; |
| 495 | 496 | |
| 497 | + const std::string& url = mResourceUrls[id]; | |
| 498 | + Image newImage = CreateImage( url, imageSize.width + 0.5f, imageSize.height + 0.5f, newMode ); | |
| 496 | 499 | ImageView imageView = ImageView::DownCast( actor ); |
| 497 | - Image oldImage = imageView.GetImage(); | |
| 498 | - Image newImage = CreateImage( ResourceImage::DownCast(oldImage).GetUrl(), imageSize.width + 0.5f, imageSize.height + 0.5f, newMode ); | |
| 499 | - imageView.SetImage( newImage ); | |
| 500 | + if(imageView) | |
| 501 | + { | |
| 502 | + imageView.SetImage( newImage ); | |
| 503 | + } | |
| 500 | 504 | mFittingModes[id] = newMode; |
| 501 | 505 | } |
| 502 | 506 | } |
| ... | ... | @@ -597,6 +601,7 @@ private: |
| 597 | 601 | ScrollBar mScrollBarHorizontal; |
| 598 | 602 | bool mScrolling; ///< ScrollView scrolling state (true = scrolling, false = stationary) |
| 599 | 603 | std::map<unsigned, Dali::FittingMode::Type> mFittingModes; ///< Stores the current scaling mode of each image, keyed by image actor id. |
| 604 | + std::map<unsigned, std::string> mResourceUrls; ///< Stores the url of each image, keyed by image actor id. | |
| 600 | 605 | std::map<unsigned, Vector2> mSizes; ///< Stores the current size of each image, keyed by image actor id. |
| 601 | 606 | }; |
| 602 | 607 | ... | ... |