Commit 1ec5c447e248403f0eae38cbcf17e95a431a2296
1 parent
026431e2
Updated alpha blend demo to handle scale/crop
Change-Id: I6ddbf61182eb8cb01ce5b25699e747fcab6c68b2
Showing
1 changed file
with
15 additions
and
2 deletions
examples/alpha-blending-cpu/alpha-blending-cpu-example.cpp
| ... | ... | @@ -28,8 +28,8 @@ const char* const IMAGE_PATH_1 ( DEMO_IMAGE_DIR "people-small-7b.jpg" ); // 100x |
| 28 | 28 | const char* const IMAGE_PATH_2 ( DEMO_IMAGE_DIR "people-medium-7.jpg" ); |
| 29 | 29 | const char* const IMAGE_PATH_3 ( DEMO_IMAGE_DIR "people-medium-7-rgb565.png" ); // is compressed |
| 30 | 30 | const char* const IMAGE_PATH_4 ( DEMO_IMAGE_DIR "people-medium-7-masked.png" ); // has alpha channel |
| 31 | -const char* const MASK_IMAGE_PATH_1 ( DEMO_IMAGE_DIR "store_mask_profile_f.png" ); | |
| 32 | -const char* const MASK_IMAGE_PATH_2 ( DEMO_IMAGE_DIR "store_mask_profile_n.png" ); // 300x300 | |
| 31 | +const char* const MASK_IMAGE_PATH_1 ( DEMO_IMAGE_DIR "store_mask_profile_n.png" ); // 300x300 | |
| 32 | +const char* const MASK_IMAGE_PATH_2 ( DEMO_IMAGE_DIR "store_mask_profile_f.png" ); | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | class ImageViewAlphaBlendApp : public ConnectionTracker |
| ... | ... | @@ -108,10 +108,23 @@ private: |
| 108 | 108 | |
| 109 | 109 | const char* mask = masks[mImageCombinationIndex%2 ]; // Cycle through masks |
| 110 | 110 | const char* image = images[(mImageCombinationIndex/2)%4]; // then images |
| 111 | + | |
| 111 | 112 | Property::Map map; |
| 112 | 113 | map.Add( Toolkit::Visual::Property::TYPE, Toolkit::Visual::Type::IMAGE ); |
| 113 | 114 | map.Add( Toolkit::ImageVisual::Property::URL, image ); |
| 114 | 115 | map.Add( Toolkit::DevelImageVisual::Property::ALPHA_MASK_URL, mask ); |
| 116 | + | |
| 117 | + if( mImageCombinationIndex%2 == 0 ) | |
| 118 | + { | |
| 119 | + map.Add( Toolkit::DevelImageVisual::Property::MASK_CONTENT_SCALE, 1.f ); | |
| 120 | + map.Add( Toolkit::DevelImageVisual::Property::CROP_TO_MASK, false ); | |
| 121 | + } | |
| 122 | + else | |
| 123 | + { | |
| 124 | + map.Add( Toolkit::DevelImageVisual::Property::MASK_CONTENT_SCALE, 1.6f ); | |
| 125 | + map.Add( Toolkit::DevelImageVisual::Property::CROP_TO_MASK, true ); | |
| 126 | + } | |
| 127 | + | |
| 115 | 128 | mImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, map ); |
| 116 | 129 | |
| 117 | 130 | mImageLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, strrchr(image, '/') ); | ... | ... |