#include <dali/public-api/images/native-image.h>
#include <dali/integration-api/debug.h>
#include <dali/devel-api/adaptor-framework/bitmap-loader.h>
+#include <dali/devel-api/rendering/renderer-devel.h>
#include <dali/public-api/images/pixel-data.h>
#include <dali/public-api/rendering/texture.h>
#include <dali/public-api/rendering/texture-set.h>
// INTERNAL HEADER
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.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::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 );
- }
+ desiredWidthValue->Get( desiredWidth );
+ }
- mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
+ int desiredHeight = 0;
+ Property::Value* desiredHeightValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT, DESIRED_HEIGHT );
+ if( desiredHeightValue )
+ {
+ desiredHeightValue->Get( desiredHeight );
}
-}
-void BatchImageVisual::SetSize( const Vector2& size )
-{
- Visual::Base::SetSize( size );
+ mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
}
-void BatchImageVisual::GetNaturalSize( Vector2& naturalSize ) const
+void BatchImageVisual::GetNaturalSize( Vector2& naturalSize )
{
if( mDesiredSize.GetWidth() > 0 && mDesiredSize.GetHeight() > 0 )
{
mImpl->mRenderer.SetTextures( textureSet );
// Turn batching on, to send message it must be on stage.
- mImpl->mRenderer.SetProperty( Dali::Renderer::Property::BATCHING_ENABLED, true );
+ mImpl->mRenderer.SetProperty( Dali::DevelRenderer::Property::BATCHING_ENABLED, true );
}
mImpl->mFlags |= Impl::IS_FROM_CACHE;
}
InitializeRenderer( mImageUrl );
}
// Turn batching on, to send message it must be on stage
- mImpl->mRenderer.SetProperty( Dali::Renderer::Property::BATCHING_ENABLED, true );
+ mImpl->mRenderer.SetProperty( Dali::DevelRenderer::Property::BATCHING_ENABLED, true );
actor.AddRenderer( mImpl->mRenderer );
}
void BatchImageVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE );
+ map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::IMAGE );
if( !mImageUrl.empty() )
{
}
}
-void BatchImageVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
-{
- // TODO
-}
-
-Dali::Property::Value BatchImageVisual::DoGetProperty( Dali::Property::Index index )
-{
- // TODO
- return Dali::Property::Value();
-}
-
Shader BatchImageVisual::GetBatchShader( VisualFactoryCache& factoryCache )
{
Shader shader = factoryCache.GetShader( VisualFactoryCache::BATCH_IMAGE_SHADER );
}
}
+void BatchImageVisual::OnSetTransform()
+{
+ if( mImpl->mRenderer )
+ {
+ //Register transform properties
+ mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
+ }
+}
} // namespace Internal