// INTERNAL HEADER
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
} // unnamed namespace
-BatchImageVisualPtr BatchImageVisual::New( VisualFactoryCache& factoryCache )
+BatchImageVisualPtr BatchImageVisual::New( VisualFactoryCache& factoryCache, const std::string& url )
{
- return new BatchImageVisual( factoryCache );
+ BatchImageVisualPtr visual = new BatchImageVisual( factoryCache );
+ visual->mImageUrl = url;
+ return visual;
}
BatchImageVisual::BatchImageVisual( VisualFactoryCache& factoryCache )
: Visual::Base( factoryCache ),
+ mImageUrl(""),
mDesiredSize()
{
}
{
}
-void BatchImageVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
+void BatchImageVisual::DoSetProperties( const Property::Map& propertyMap )
{
- std::string oldImageUrl = mImageUrl;
- Property::Value* imageURLValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::URL, Dali::Toolkit::Internal::IMAGE_URL_NAME );
+ // url already passed in constructor
- if( imageURLValue )
+ int desiredWidth = 0;
+ Property::Value* desiredWidthValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::DESIRED_WIDTH, DESIRED_WIDTH );
+ if( desiredWidthValue )
{
- imageURLValue->Get( mImageUrl );
-
- int desiredWidth = 0;
- Property::Value* desiredWidthValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::DESIRED_WIDTH, DESIRED_WIDTH );
- if( desiredWidthValue )
- {
- desiredWidthValue->Get( desiredWidth );
- }
-
- int desiredHeight = 0;
- Property::Value* desiredHeightValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT, DESIRED_HEIGHT );
- if( desiredHeightValue )
- {
- desiredHeightValue->Get( desiredHeight );
- }
-
- mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
+ desiredWidthValue->Get( desiredWidth );
}
- // Remove old renderer if exit.
- if( mImpl->mRenderer )
+ int desiredHeight = 0;
+ Property::Value* desiredHeightValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT, DESIRED_HEIGHT );
+ if( desiredHeightValue )
{
- if( actor ) // Remove old renderer from actor.
- {
- actor.RemoveRenderer( mImpl->mRenderer );
- }
- if( !oldImageUrl.empty() ) // Clean old renderer from cache.
- {
- CleanCache( oldImageUrl );
- }
+ desiredHeightValue->Get( desiredHeight );
}
- // If actor is on stage, create new renderer and apply to actor.
- if( actor && actor.OnStage() )
- {
- SetOnStage( actor );
- }
+ mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
}
void BatchImageVisual::SetSize( const Vector2& size )
void BatchImageVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE );
+ map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::IMAGE );
if( !mImageUrl.empty() )
{