+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.KeyEventSignal().Connect(this, &ImageViewPixelAreaApp::OnKeyEvent);
+
+ Toolkit::ToolBar toolBar;
+ Toolkit::Control background;
+ // Creates a default view with a default tool bar.
+ mContent = DemoHelper::CreateView( application,
+ background,
+ toolBar,
+ "",
+ TOOLBAR_IMAGE,
+ APPLICATION_TITLE );
+
+ // Add a button to switch the scene. (right of toolbar)
+ Toolkit::PushButton switchButton = Toolkit::PushButton::New();
+ switchButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, BUTTON_ICON );
+ switchButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, BUTTON_ICON_SELECTED );
+ switchButton.ClickedSignal().Connect( this, &ImageViewPixelAreaApp::OnButtonClicked );
+ toolBar.AddControl( switchButton,
+ DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage,
+ Toolkit::Alignment::HorizontalRight,
+ DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
+
+
+ // for testing image WITH automatic atlasing
+ visualPropertyMap[0][ Toolkit::ImageVisual::Property::URL ] = SMALL_TEST_IMAGE;
+ visualPropertyMap[0][ Toolkit::ImageVisual::Property::DESIRED_WIDTH ] = 500;
+ visualPropertyMap[0][ Toolkit::ImageVisual::Property::DESIRED_HEIGHT ] = 500;
+ visualPropertyMap[0][ Toolkit::ImageVisual::Property::WRAP_MODE_U ] = WrapMode::CLAMP_TO_EDGE;
+ visualPropertyMap[0][ Toolkit::ImageVisual::Property::WRAP_MODE_V ] = WrapMode::MIRRORED_REPEAT;
+ visualPropertyMap[0][ Toolkit::ImageVisual::Property::PIXEL_AREA ] = ORIGINAL_PIXEL_AREA;
+
+ // for testing image WITHOUT automatic atlasing
+ visualPropertyMap[1][ Toolkit::ImageVisual::Property::URL ] = BIG_TEST_IMAGE;
+ visualPropertyMap[1][ Toolkit::ImageVisual::Property::DESIRED_WIDTH ] = 640;
+ visualPropertyMap[1][ Toolkit::ImageVisual::Property::DESIRED_HEIGHT ] = 720;
+ visualPropertyMap[1][ Toolkit::ImageVisual::Property::WRAP_MODE_U ] = WrapMode::MIRRORED_REPEAT;
+ visualPropertyMap[1][ Toolkit::ImageVisual::Property::WRAP_MODE_V ] = WrapMode::REPEAT;
+ visualPropertyMap[1][ Toolkit::ImageVisual::Property::PIXEL_AREA ] = ORIGINAL_PIXEL_AREA;
+
+ CreateScene( visualPropertyMap[0] );
+
+ mWrapLabel = Toolkit::TextLabel::New(" Automatic atlasing\n WrapMode: CLAMP_TO_EDGE, MIRRORED_REPEAT");
+ mWrapLabel.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER );
+ mWrapLabel.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_CENTER );
+ mWrapLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+ mWrapLabel.SetProperty( Toolkit::TextLabel::Property::MULTI_LINE, true );
+ mWrapLabel.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
+ mContent.Add( mWrapLabel );
+
+ mPixelAreaLabel = Toolkit::TextLabel::New( " Use ImageVisual::Property::PIXEL_AREA\n " );
+ mPixelAreaLabel.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER );
+ mPixelAreaLabel.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_CENTER );
+ mPixelAreaLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+ mPixelAreaLabel.SetProperty( Toolkit::TextLabel::Property::MULTI_LINE, true );
+ mPixelAreaLabel.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
+ mWrapLabel.Add( mPixelAreaLabel );
+ }
+
+ void CreateScene( const Property::Value& propertyMap )
+ {