const float TRANSITION_DURATION = 2.5f; //2.5 second
const float INITIAL_DEPTH = -10.0f;
+
+/**
+ * @brief Load an image, scaled-down to no more than the stage dimensions.
+ *
+ * Uses image scaling mode ImageAttributes::ScaleToFill to resize the image at
+ * load time to cover the entire stage with pixels with no borders,
+ * and filter mode ImageAttributes::BoxThenLinear to sample the image with
+ * maximum quality.
+ */
+ResourceImage LoadStageFillingImage( const char * const imagePath )
+{
+ Size stageSize = Stage::GetCurrent().GetSize();
+ ImageAttributes attributes;
+ attributes.SetSize( stageSize.x, stageSize.y );
+ attributes.SetFilterMode( ImageAttributes::BoxThenLinear );
+ attributes.SetScalingMode( ImageAttributes::ScaleToFill );
+ return ResourceImage::New( imagePath, attributes );
+}
+
} // namespace
class DissolveEffectApp : public ConnectionTracker
ImageActor mCurrentImage;
ImageActor mNextImage;
unsigned int mIndex;
- Constraint mSizeConstraint;
Toolkit::DissolveEffect mCurrentImageEffect;
Toolkit::DissolveEffect mNextImageEffect;
mParent.SetPositionInheritanceMode( USE_PARENT_POSITION );
mContent.Add( mParent );
- mSizeConstraint= Constraint::New<Vector3>( Actor::SCALE, LocalSource( Actor::SIZE ), ParentSource( Actor::SIZE ), ScaleToFitKeepAspectRatioConstraint() );
-
// show the first image
- mCurrentImage = ImageActor::New( ResourceImage::New( IMAGES[mIndex] ) );
+ mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) );
mCurrentImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION);
- mCurrentImage.ApplyConstraint( mSizeConstraint );
+ mCurrentImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ mCurrentImage.SetSizeScalePolicy( FIT_WITH_ASPECT_RATIO );
mParent.Add( mCurrentImage );
mPanGestureDetector.Attach( mCurrentImage );
mIndex = (mIndex + NUM_IMAGES -1)%NUM_IMAGES;
}
- Image image = ResourceImage::New( IMAGES[ mIndex ] );
+ Image image = LoadStageFillingImage( IMAGES[ mIndex ] );
mNextImage = ImageActor::New( image );
mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION);
- mNextImage.ApplyConstraint( mSizeConstraint );
+ mNextImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ mNextImage.SetSizeScalePolicy( FIT_WITH_ASPECT_RATIO );
mNextImage.SetZ(INITIAL_DEPTH);
mParent.Add( mNextImage );
Vector2 size = Vector2( mCurrentImage.GetCurrentSize() );
mAnimation.AnimateTo( Property(mCurrentImageEffect, mCurrentImageEffect.GetDistortionPropertyName()), 1.0f, AlphaFunctions::Linear );
mNextImage.SetOpacity(0.0f);
- mAnimation.OpacityTo( mNextImage, 1.0, AlphaFunctions::Linear );
+ mAnimation.AnimateTo( Property( mNextImage, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunctions::Linear );
if(mUseHighPrecision)
{
}
else
{
- mAnimation.MoveTo(mNextImage, Vector3(0.0f, 0.0f, 0.0f), AlphaFunctions::Linear);
+ mAnimation.AnimateTo( Property( mNextImage, Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), AlphaFunctions::Linear );
}
mAnimation.FinishedSignal().Connect( this, &DissolveEffectApp::OnTransitionCompleted );
if(mSlideshow)
{
mIndex = (mIndex + 1)%NUM_IMAGES;
- Image image = ResourceImage::New( IMAGES[ mIndex ] );
+ Image image = LoadStageFillingImage( IMAGES[ mIndex ] );
mNextImage = ImageActor::New( image );
mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION);
- mNextImage.ApplyConstraint( mSizeConstraint );
+ mNextImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+ mNextImage.SetSizeScalePolicy( FIT_WITH_ASPECT_RATIO );
mNextImage.SetZ(INITIAL_DEPTH);
mParent.Add( mNextImage );
switch( mCentralLineIndex%4 )
return false; //return false to stop the timer
}
-// Entry point for Linux & SLP applications
+// Entry point for Linux & Tizen applications
int main( int argc, char **argv )
{
Application application = Application::New( &argc, &argv );