- ResourceImage backgroundImage = ResourceImage::New( BACKGROUND_IMAGE, ImageDimensions( stage.GetSize().width, stage.GetSize().height ), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR );
- Toolkit::ImageView background = Toolkit::ImageView::New( backgroundImage );
- background.SetZ( -2.0f );
- background.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- background.SetSize( stage.GetSize() );
- stage.Add( background );
-
- // Make grey pixels for the desired box, the desired height the desired width:
- BufferImage desiredBackground = BufferImage::WHITE();
-
- BufferImage heightBackground = BufferImage::WHITE();
- PixelBuffer* const heightPixel = heightBackground.GetBuffer();
- heightPixel[0] = 0x8f;
- heightPixel[1] = 0x8f;
- heightPixel[2] = 0x8f;
-
- BufferImage widthBackground = BufferImage::WHITE();
- PixelBuffer* const widthPixel = widthBackground.GetBuffer();
- widthPixel[0] = 0x4f;
- widthPixel[1] = 0x4f;
- widthPixel[2] = 0x4f;
-
- mHeightBox = Toolkit::ImageView::New( heightBackground );
- mHeightBox.SetOpacity( 0.2f );
- stage.Add( mHeightBox );
-
- mWidthBox = Toolkit::ImageView::New( widthBackground );
- mWidthBox.SetOpacity( 0.2f );
- stage.Add( mWidthBox );
-
- mDesiredBox = Toolkit::ImageView::New( desiredBackground );
- stage.Add( mDesiredBox );
-
- mDesiredBox.SetSize( stage.GetSize() * mImageStageScale );
- mDesiredBox.SetParentOrigin( ParentOrigin::CENTER );
- mDesiredBox.SetAnchorPoint( AnchorPoint::CENTER );
- mDesiredBox.SetPosition( 0, 0, -1 );
- //mDesiredBox.SetSortModifier(4.f);
-
- mHeightBox.SetSize( stage.GetSize().width, (stage.GetSize() * mImageStageScale).height );
- mHeightBox.SetParentOrigin( ParentOrigin::CENTER );
- mHeightBox.SetAnchorPoint( AnchorPoint::CENTER );
- mHeightBox.SetPosition( 0, 0, -1 );
- //mHeightBox.SetSortModifier(3.f);
-
- mWidthBox.SetSize( (stage.GetSize() * mImageStageScale).width, stage.GetSize().height );
- mWidthBox.SetParentOrigin( ParentOrigin::CENTER );
- mWidthBox.SetAnchorPoint( AnchorPoint::CENTER );
- mWidthBox.SetPosition( 0, 0, -1 );
- //mWidthBox.SetSortModifier(2.f);
-
- // Make a grab-handle for resizing the image:
- mGrabCorner = Toolkit::PushButton::New();
- mGrabCorner.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::WIDTH );
- mGrabCorner.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
- mGrabCorner.SetName( "GrabCorner" );
- mGrabCorner.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT );
- mGrabCorner.SetParentOrigin( ParentOrigin::BOTTOM_RIGHT );
- mGrabCorner.SetSize( Vector2( stage.GetSize().width*0.08f, stage.GetSize().width*0.08f ) );
- mGrabCorner.SetOpacity( 0.6f );
-
- Layer grabCornerLayer = Layer::New();
- grabCornerLayer.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT );
- grabCornerLayer.SetParentOrigin( ParentOrigin::BOTTOM_RIGHT );
-
- grabCornerLayer.Add( mGrabCorner );
- mDesiredBox.Add( grabCornerLayer );
- mPanGestureDetector = PanGestureDetector::New();
- mPanGestureDetector.Attach( mGrabCorner );
- mPanGestureDetector.DetectedSignal().Connect( this, &ImageScalingAndFilteringController::OnPan );
+ Dali::Property::Map backgroundImage;
+ backgroundImage.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE);
+ backgroundImage.Insert(Toolkit::ImageVisual::Property::URL, BACKGROUND_IMAGE);
+ backgroundImage.Insert(Toolkit::ImageVisual::Property::DESIRED_WIDTH, windowSize.width);
+ backgroundImage.Insert(Toolkit::ImageVisual::Property::DESIRED_HEIGHT, windowSize.height);
+ backgroundImage.Insert(Toolkit::ImageVisual::Property::FITTING_MODE, FittingMode::SCALE_TO_FILL);
+ backgroundImage.Insert(Toolkit::ImageVisual::Property::SAMPLING_MODE, SamplingMode::BOX_THEN_NEAREST);
+
+ Toolkit::ImageView background = Toolkit::ImageView::New();
+ background.SetProperty(Toolkit::ImageView::Property::IMAGE, backgroundImage);
+ background.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ background.SetProperty(Actor::Property::SIZE, windowSize);
+ window.Add(background);
+
+ mDesiredBox = Toolkit::ImageView::New(BORDER_IMAGE);
+ background.Add(mDesiredBox);
+
+ mDesiredBox.SetProperty(Actor::Property::SIZE, windowSize * mImageWindowScale);
+ mDesiredBox.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ mDesiredBox.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);