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
Toolkit::View mView;
Toolkit::ToolBar mToolBar;
Layer mContent;
- Toolkit::TextView mTitleActor;
Actor mParent;
ImageActor mCurrentImage;
mToolBar.AddControl( mEffectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
// Add title to the tool bar.
- mTitleActor = Toolkit::TextView::New();
- mTitleActor.SetText( APPLICATION_TITLE_HIGHP );
- mTitleActor.SetStyleToCurrentText(DemoHelper::GetDefaultTextStyle());
- mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter );
+ // TODO
// Add an slide-show button on the right of the title
mIconPlay = ResourceImage::New( PLAY_ICON );
mParent.SetPositionInheritanceMode( USE_PARENT_POSITION );
mContent.Add( mParent );
- mSizeConstraint= Constraint::New<Vector3>( Actor::SCALE, LocalSource( Actor::SIZE ), ParentSource( Actor::SIZE ), ScaleToFitKeepAspectRatioConstraint() );
+ mSizeConstraint= Constraint::New<Vector3>( Actor::Property::SCALE, LocalSource( Actor::Property::SIZE ), ParentSource( Actor::Property::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 );
mParent.Add( 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 );
mCurrentImageEffect = Toolkit::DissolveEffect::New(mUseHighPrecision);
if(mUseHighPrecision)
{
- mTitleActor.SetText( APPLICATION_TITLE_HIGHP );
mEffectChangeButton.SetBackgroundImage(mIconHighP);
}
else
{
- mTitleActor.SetText( APPLICATION_TITLE_MEDIUMP );
mEffectChangeButton.SetBackgroundImage(mIconMediumP);
}
- mTitleActor.SetStyleToCurrentText(DemoHelper::GetDefaultTextStyle());
return true;
}
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 );
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 );