// CLASS HEADER
#include <dali/internal/event/actors/image-actor-impl.h>
+// EXTERNAL INCLUDES
+#include <cstring> // for strcmp
+
// INTERNAL INCLUDES
-#include <dali/internal/event/images/nine-patch-image-impl.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/internal/event/common/property-index-ranges.h>
+#include <dali/devel-api/scripting/scripting.h>
+#include <dali/internal/event/common/property-helper.h>
+#include <dali/internal/event/effects/shader-effect-impl.h>
#include <dali/internal/event/images/image-connector.h>
-#include <dali/public-api/scripting/scripting.h>
+#include <dali/internal/event/images/nine-patch-image-impl.h>
namespace Dali
{
-const Property::Index ImageActor::PIXEL_AREA = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
-const Property::Index ImageActor::FADE_IN = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 1;
-const Property::Index ImageActor::FADE_IN_DURATION = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 2;
-const Property::Index ImageActor::STYLE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 3;
-const Property::Index ImageActor::BORDER = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 4;
-const Property::Index ImageActor::IMAGE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 5;
-
namespace Internal
{
-bool ImageActor::mFirstInstance = true;
-Actor::DefaultPropertyLookup* ImageActor::mDefaultImageActorPropertyLookup = NULL;
namespace
{
+// Properties
+
+// Name Type writable animatable constraint-input enum for index-checking
+DALI_PROPERTY_TABLE_BEGIN
+DALI_PROPERTY( "pixel-area", RECTANGLE, true, false, true, Dali::ImageActor::Property::PIXEL_AREA )
+DALI_PROPERTY( "style", STRING, true, false, true, Dali::ImageActor::Property::STYLE )
+DALI_PROPERTY( "border", VECTOR4, true, false, true, Dali::ImageActor::Property::BORDER )
+DALI_PROPERTY( "image", MAP, true, false, false, Dali::ImageActor::Property::IMAGE )
+DALI_PROPERTY_TABLE_END( DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX )
+
BaseHandle Create()
{
return Dali::ImageActor::New();
}
-TypeRegistration mType( typeid(Dali::ImageActor), typeid(Dali::RenderableActor), Create );
-
-const std::string DEFAULT_IMAGE_ACTOR_PROPERTY_NAMES[] =
-{
- "pixel-area",
- "fade-in",
- "fade-in-duration",
- "style",
- "border",
- "image"
-};
-const int DEFAULT_IMAGE_ACTOR_PROPERTY_COUNT = sizeof( DEFAULT_IMAGE_ACTOR_PROPERTY_NAMES ) / sizeof( std::string );
-
-const Property::Type DEFAULT_IMAGE_ACTOR_PROPERTY_TYPES[DEFAULT_IMAGE_ACTOR_PROPERTY_COUNT] =
-{
- Property::RECTANGLE, // "pixel-area",
- Property::BOOLEAN, // "fade-in",
- Property::FLOAT, // "fade-in-duration",
- Property::STRING, // "style",
- Property::VECTOR4, // "border",
- Property::MAP, // "image",
-};
+TypeRegistration mType( typeid( Dali::ImageActor ), typeid( Dali::Actor ), Create );
ImageActor::Style StyleEnum(const std::string &s)
{
{
return Dali::ImageActor::STYLE_NINE_PATCH;
}
+ else if(s == "STYLE_NINE_PATCH_NO_CENTER")
+ {
+ return Dali::ImageActor::STYLE_NINE_PATCH_NO_CENTER;
+ }
else // if(s == "QUAD")
{
return Dali::ImageActor::STYLE_QUAD;
{
return "STYLE_NINE_PATCH";
}
+ else if(style == Dali::ImageActor::STYLE_NINE_PATCH_NO_CENTER)
+ {
+ return "STYLE_NINE_PATCH_NO_CENTER";
+ }
else // if(s == "QUAD")
{
return "STYLE_QUAD";
}
}
-ImageActorPtr ImageActor::New( Image* anImage )
+ImageActorPtr ImageActor::New()
{
- ImageActorPtr actor( new ImageActor() );
- ImagePtr theImage( anImage );
+ ImageActorPtr actor( new ImageActor );
- // Second-phase construction
+ // Second-phase construction of base class
actor->Initialize();
- NinePatchImage* ninePatchImage = NULL;
-
- // Automatically convert upcasted nine-patch images to cropped bitmap
- ninePatchImage = NinePatchImage::GetNinePatchImage( anImage );
-
- if( ninePatchImage != NULL )
- {
- theImage = ninePatchImage->CreateCroppedBitmapImage();
- }
// Create the attachment
- actor->mImageAttachment = ImageAttachment::New( *actor->mNode, theImage.Get() );
+ actor->mImageAttachment = ImageAttachment::New( actor->GetEventThreadServices(), *actor->mNode );
actor->Attach( *actor->mImageAttachment );
- // Adjust the actor's size
- if( theImage )
- {
- actor->mImageNext.Set( theImage.Get(), false );
- actor->OnImageSet( *theImage );
- actor->SetNaturalSize( *theImage );
- }
-
- if( ninePatchImage != NULL )
- {
- actor->SetStyle( Dali::ImageActor::STYLE_NINE_PATCH );
- Vector4 border = ninePatchImage->GetStretchBorders();
- actor->SetNinePatchBorder( border, true );
- }
-
- return actor;
-}
-
-
-ImageActorPtr ImageActor::New( Image* image, const PixelArea& pixelArea )
-{
- // re-use basic New
- ImageActorPtr actor = New( image );
- // then set the pixel area
- actor->mImageAttachment->SetPixelArea( pixelArea );
return actor;
}
void ImageActor::OnInitialize()
{
- if(ImageActor::mFirstInstance)
- {
- mDefaultImageActorPropertyLookup = new DefaultPropertyLookup();
- const int start = DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
- for ( int i = 0; i < DEFAULT_IMAGE_ACTOR_PROPERTY_COUNT; ++i )
- {
- (*mDefaultImageActorPropertyLookup)[DEFAULT_IMAGE_ACTOR_PROPERTY_NAMES[i]] = i + start;
- }
- ImageActor::mFirstInstance = false;
- }
+ SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
}
-void ImageActor::SetImage( Image* image )
+void ImageActor::SetImage( ImagePtr& image )
{
- Image* currentImage = static_cast<Image*>(mImageAttachment->GetImage().GetObjectPtr());
- // early exit if it's the same image
- if ( currentImage == image || mImageNext.Get() == image )
+ ImagePtr currentImage = mImageAttachment->GetImage();
+ // early exit if it's the same image as we already have
+ if ( currentImage == image )
{
return;
}
- mLoadedConnection.DisconnectAll();
-
- ImagePtr imagePtr( image );
-
- // Automatically convert nine-patch images to cropped bitmap
- NinePatchImage* ninePatchImage = NinePatchImage::GetNinePatchImage( image );
- if( ninePatchImage )
+ // NOTE! image might be pointing to NULL, which is fine as in that case app wants to just remove the image
+ ImagePtr newImage( image );
+ // if image is not NULL, check for 9 patch
+ if( newImage )
{
- imagePtr = ninePatchImage->CreateCroppedBitmapImage();
- }
-
- mImageNext.Set( imagePtr.Get(), OnStage() );
-
- if( ninePatchImage )
- {
- SetStyle( Dali::ImageActor::STYLE_NINE_PATCH );
- SetNinePatchBorder( ninePatchImage->GetStretchBorders(), true );
+ // Automatically convert nine-patch images to cropped bitmap
+ NinePatchImage* ninePatchImage = NinePatchImage::DownCast( image.Get() );
+ if( ninePatchImage )
+ {
+ newImage = ninePatchImage->CreateCroppedBufferImage();
+ SetStyle( Dali::ImageActor::STYLE_NINE_PATCH );
+ SetNinePatchBorder( ninePatchImage->GetStretchBorders(), true );
+ }
}
+ // set the actual image (normal or 9 patch) and natural size based on that
+ mImageAttachment->SetImage( newImage );
- if ( !imagePtr )
- {
- mImageAttachment->SetImage( NULL );
- }
- else
- {
- // don't disconnect currently shown image until we made sure that the new one is loaded
- OnImageSet( *imagePtr.Get() );
- }
+ RelayoutRequest();
}
-Dali::Image ImageActor::GetImage()
+ImagePtr ImageActor::GetImage()
{
return mImageAttachment->GetImage();
}
-void ImageActor::SetToNaturalSize()
-{
- mUsingNaturalSize = true;
- Dali::Image image = mImageAttachment->GetImage();
-
- if( image )
- {
- SetNaturalSize( GetImplementation(image) );
- }
-}
-
void ImageActor::SetPixelArea( const PixelArea& pixelArea )
{
mImageAttachment->SetPixelArea( pixelArea );
- if( mUsingNaturalSize )
- {
- mInternalSetSize = true;
- SetSize(pixelArea.width, pixelArea.height);
- mInternalSetSize = false;
- }
+ RelayoutRequest();
}
const ImageActor::PixelArea& ImageActor::GetPixelArea() const
{
mImageAttachment->ClearPixelArea();
- if( mUsingNaturalSize )
- {
- Dali::Image image = mImageAttachment->GetImage();
- if( image )
- {
- mInternalSetSize = true;
- SetSize(GetImplementation(image).GetNaturalSize());
- mInternalSetSize = false;
- }
- }
+ RelayoutRequest();
}
void ImageActor::SetStyle( Style style )
return mImageAttachment->GetNinePatchBorder();
}
-void ImageActor::SetFadeIn( bool enableFade )
-{
- mFadeIn = enableFade;
-}
-
-bool ImageActor::GetFadeIn() const
-{
- return mFadeIn;
-}
-
-void ImageActor::SetFadeInDuration( float durationSeconds )
-{
- mFadeInDuration = durationSeconds;
-}
-
-float ImageActor::GetFadeInDuration() const
-{
- return mFadeInDuration;
-}
-
ImageAttachment& ImageActor::GetImageAttachment()
{
return *mImageAttachment;
}
-Vector2 ImageActor::GetCurrentImageSize() const
-{
- Vector3 size;
- Vector3 currentSize;
-
- // get the texture size / pixel area if only a subset of it is displayed
- if( IsPixelAreaSet() )
- {
- PixelArea area(GetPixelArea());
- return Vector2(area.width, area.height );
- }
- else
- {
- return Vector2( GetCurrentSize() );
- }
-}
-
RenderableAttachment& ImageActor::GetRenderableAttachment() const
{
DALI_ASSERT_DEBUG( mImageAttachment && "ImageAttachment missing from ImageActor" );
}
ImageActor::ImageActor()
-: RenderableActor(),
- mUsingNaturalSize(true),
- mInternalSetSize(false),
- mFadeIn( false ),
- mFadeInitial( true ),
- mLoadedConnection( this ),
- mFadeInDuration( 1.0f )
+: Actor( Actor::RENDERABLE )
{
}
ImageActor::~ImageActor()
{
- // ScopedConnection disconnects automatically
}
-void ImageActor::OnImageSet( Image& image )
+Vector3 ImageActor::GetNaturalSize() const
{
- // observe image loaded
- if( Dali::ResourceLoading == image.GetLoadingState() && ! image.GetFilename().empty() )
- {
- image.LoadingFinishedSignal().Connect( mLoadedConnection, &ImageActor::ImageLoaded );
- }
- else
- {
- // image already loaded, or generated
- ImageLoaded( Dali::Image(&image) );
- }
+ Vector2 naturalSize( CalculateNaturalSize() );
+ return Vector3( naturalSize.width, naturalSize.height, CalculateSizeZ( naturalSize ) );
}
-void ImageActor::SetNaturalSize( Image& image )
+Vector2 ImageActor::CalculateNaturalSize() const
{
- if( mUsingNaturalSize )
+ // if no image then natural size is 0
+ Vector2 size( 0.0f, 0.0f );
+
+ ImagePtr image = mImageAttachment->GetImage();
+ if( image )
{
- Vector2 size;
if( IsPixelAreaSet() )
{
PixelArea area(GetPixelArea());
}
else
{
- size = image.GetNaturalSize();
+ size = image->GetNaturalSize();
}
-
- mInternalSetSize = true;
- SetSize( size );
- mInternalSetSize = false;
}
-}
-
-void ImageActor::OnSizeSet( const Vector3& targetSize )
-{
- if( !mInternalSetSize )
- {
- mUsingNaturalSize = false;
- }
-}
-void ImageActor::OnSizeAnimation(Animation& animation, const Vector3& targetSize)
-{
- mUsingNaturalSize = false;
+ return size;
}
void ImageActor::OnStageConnectionInternal()
{
- FadeIn();
-
- mImageNext.OnStageConnect();
}
void ImageActor::OnStageDisconnectionInternal()
{
- mImageNext.OnStageDisconnect();
-}
-
-void ImageActor::ImageLoaded( Dali::Image image )
-{
- DALI_ASSERT_DEBUG (image && "Image handle empty!");
-
- // TODO: Handle case where image loading failed
-
- // Need to keep mUploadedConnection connected as image may change later through Reload
- // Note: Reloaded images may have changed size.
-
- // Set the attachment's image once we know the image has loaded to prevent
- // blank frames during load / reload.
- mImageAttachment->SetImage( &GetImplementation( image ) );
-
- // If size has never been set by application
- if( mUsingNaturalSize )
- {
- // If a pixel area has been set, use this size
- if( IsPixelAreaSet() )
- {
- const PixelArea& area = GetPixelArea();
- mInternalSetSize = true;
- SetSize(area.width, area.height);
- mInternalSetSize = false;
- }
- else
- {
- mInternalSetSize = true;
- SetSize( GetImplementation(image).GetNaturalSize() );
- mInternalSetSize = false;
- }
- }
-
- // fade in if required
- FadeIn();
-}
-
-void ImageActor::FadeIn()
-{
- // only fade in if enabled and newly displayed on screen
- if( mFadeIn && mFadeInitial && ( mFadeInDuration > 0.0f ) )
- {
- // need to set opacity immediately to 0 otherwise child actors might get rendered
- SetOpacity( 0.0f );
-
- Dali::Image image = mImageAttachment->GetImage();
-
- // Fade-in when on-stage & the image is loaded
- if (OnStage() &&
- image &&
- image.GetLoadingState() == Dali::ResourceLoadingSucceeded)
- {
- // fire and forget animation; will clean up after it's finished
- Dali::Animation animation = Dali::Animation::New( mFadeInDuration );
- animation.OpacityTo( Dali::Actor( this ), 1.0f, AlphaFunctions::EaseOut );
- animation.Play();
- mFadeInitial = false;
- }
- }
}
unsigned int ImageActor::GetDefaultPropertyCount() const
{
- return RenderableActor::GetDefaultPropertyCount() + DEFAULT_IMAGE_ACTOR_PROPERTY_COUNT;
+ return Actor::GetDefaultPropertyCount() + DEFAULT_PROPERTY_COUNT;
}
void ImageActor::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
{
- RenderableActor::GetDefaultPropertyIndices( indices ); // RenderableActor class properties
+ Actor::GetDefaultPropertyIndices( indices ); // Actor class properties
- indices.reserve( indices.size() + DEFAULT_IMAGE_ACTOR_PROPERTY_COUNT );
+ indices.Reserve( indices.Size() + DEFAULT_PROPERTY_COUNT );
- int index = DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
- for ( int i = 0; i < DEFAULT_IMAGE_ACTOR_PROPERTY_COUNT; ++i, ++index )
+ int index = DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX;
+ for ( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i, ++index )
{
- indices.push_back( index );
+ indices.PushBack( index );
}
}
bool ImageActor::IsDefaultPropertyWritable( Property::Index index ) const
{
- if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
+ if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT )
{
- return RenderableActor::IsDefaultPropertyWritable(index);
+ return Actor::IsDefaultPropertyWritable(index);
}
- else
+
+ index -= DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX;
+ if ( ( index >= 0 ) && ( index < DEFAULT_PROPERTY_COUNT ) )
{
- return true;
+ return DEFAULT_PROPERTY_DETAILS[ index ].writable;
}
+
+ return false;
}
bool ImageActor::IsDefaultPropertyAnimatable( Property::Index index ) const
{
- if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
+ if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT )
{
- return RenderableActor::IsDefaultPropertyAnimatable(index);
+ return Actor::IsDefaultPropertyAnimatable( index );
}
- else
+
+ index -= DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX;
+ if ( ( index >= 0 ) && ( index < DEFAULT_PROPERTY_COUNT ) )
{
- return false;
+ return DEFAULT_PROPERTY_DETAILS[ index ].animatable;
}
+
+ return false;
}
bool ImageActor::IsDefaultPropertyAConstraintInput( Property::Index index ) const
{
- if( index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT )
+ if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT )
{
- return RenderableActor::IsDefaultPropertyAConstraintInput(index);
+ return Actor::IsDefaultPropertyAConstraintInput( index );
}
- return true; // Our properties can be used as input to constraints.
+
+ index -= DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX;
+ if ( ( index >= 0 ) && ( index < DEFAULT_PROPERTY_COUNT ) )
+ {
+ return DEFAULT_PROPERTY_DETAILS[ index ].constraintInput;
+ }
+
+ return false;
}
Property::Type ImageActor::GetDefaultPropertyType( Property::Index index ) const
{
- if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
+ if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT )
{
- return RenderableActor::GetDefaultPropertyType(index);
+ return Actor::GetDefaultPropertyType( index );
}
- else
- {
- index -= DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
- if ( ( index >= 0 ) && ( index < DEFAULT_IMAGE_ACTOR_PROPERTY_COUNT ) )
- {
- return DEFAULT_IMAGE_ACTOR_PROPERTY_TYPES[index];
- }
- else
- {
- // index out-of-bounds
- return Property::NONE;
- }
+ index -= DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX;
+ if ( ( index >= 0 ) && ( index < DEFAULT_PROPERTY_COUNT ) )
+ {
+ return DEFAULT_PROPERTY_DETAILS[index].type;
}
+
+ // index out-of-bounds
+ return Property::NONE;
}
-const std::string& ImageActor::GetDefaultPropertyName( Property::Index index ) const
+const char* ImageActor::GetDefaultPropertyName( Property::Index index ) const
{
- if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
+ if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT)
{
- return RenderableActor::GetDefaultPropertyName(index);
+ return Actor::GetDefaultPropertyName(index);
}
- else
- {
- index -= DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
- if ( ( index >= 0 ) && ( index < DEFAULT_IMAGE_ACTOR_PROPERTY_COUNT ) )
- {
- return DEFAULT_IMAGE_ACTOR_PROPERTY_NAMES[index];
- }
- else
- {
- // index out-of-bounds
- static const std::string INVALID_PROPERTY_NAME;
- return INVALID_PROPERTY_NAME;
- }
+ index -= DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX;
+ if ( ( index >= 0 ) && ( index < DEFAULT_PROPERTY_COUNT ) )
+ {
+ return DEFAULT_PROPERTY_DETAILS[index].name;
}
+
+ // index out-of-bounds
+ return NULL;
}
Property::Index ImageActor::GetDefaultPropertyIndex(const std::string& name) const
{
Property::Index index = Property::INVALID_INDEX;
- DALI_ASSERT_DEBUG( NULL != mDefaultImageActorPropertyLookup );
-
- // Look for name in current class' default properties
- DefaultPropertyLookup::const_iterator result = mDefaultImageActorPropertyLookup->find( name );
- if ( mDefaultImageActorPropertyLookup->end() != result )
+ // Look for name in default properties
+ for( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
{
- index = result->second;
+ const Internal::PropertyDetails* property = &DEFAULT_PROPERTY_DETAILS[ i ];
+ if( 0 == strcmp( name.c_str(), property->name ) ) // Don't want to convert rhs to string
+ {
+ index = i + DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX;
+ break;
+ }
}
- else
+
+ // If not found, check in base class
+ if( Property::INVALID_INDEX == index )
{
- // If not found, check in base class
- index = RenderableActor::GetDefaultPropertyIndex( name );
+ index = Actor::GetDefaultPropertyIndex( name );
}
-
return index;
}
void ImageActor::SetDefaultProperty( Property::Index index, const Property::Value& propertyValue )
{
- if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
+ if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT )
{
- RenderableActor::SetDefaultProperty(index, propertyValue);
+ Actor::SetDefaultProperty( index, propertyValue );
}
else
{
switch(index)
{
- case Dali::ImageActor::PIXEL_AREA:
+ case Dali::ImageActor::Property::PIXEL_AREA:
{
SetPixelArea(propertyValue.Get<Rect<int> >());
break;
}
- case Dali::ImageActor::FADE_IN:
- {
- SetFadeIn(propertyValue.Get<bool>());
- break;
- }
- case Dali::ImageActor::FADE_IN_DURATION:
- {
- SetFadeInDuration(propertyValue.Get<float>());
- break;
- }
- case Dali::ImageActor::STYLE:
+ case Dali::ImageActor::Property::STYLE:
{
- SetStyle(StyleEnum(propertyValue.Get<std::string>()));
+ SetStyle( StyleEnum( propertyValue.Get<std::string>() ) );
break;
}
- case Dali::ImageActor::BORDER:
+ case Dali::ImageActor::Property::BORDER:
{
SetNinePatchBorder( propertyValue.Get<Vector4>(), true /*in pixels*/ );
break;
}
- case Dali::ImageActor::IMAGE:
+ case Dali::ImageActor::Property::IMAGE:
{
Dali::Image img = Scripting::NewImage( propertyValue );
if(img)
{
- SetImage( &GetImplementation(img) );
+ ImagePtr image( &GetImplementation(img) );
+ SetImage( image );
}
else
{
Property::Value ImageActor::GetDefaultProperty( Property::Index index ) const
{
Property::Value ret;
- if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
+ if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT )
{
- ret = RenderableActor::GetDefaultProperty(index);
+ ret = Actor::GetDefaultProperty( index );
}
else
{
- switch(index)
+ switch( index )
{
- case Dali::ImageActor::PIXEL_AREA:
+ case Dali::ImageActor::Property::PIXEL_AREA:
{
Rect<int> r = GetPixelArea();
ret = r;
break;
}
- case Dali::ImageActor::FADE_IN:
- {
- ret = GetFadeIn();
- break;
- }
- case Dali::ImageActor::FADE_IN_DURATION:
- {
- ret = GetFadeInDuration();
- break;
- }
- case Dali::ImageActor::STYLE:
+ case Dali::ImageActor::Property::STYLE:
{
- ret = StyleString(GetStyle());
+ ret = StyleString( GetStyle() );
break;
}
- case Dali::ImageActor::BORDER:
+ case Dali::ImageActor::Property::BORDER:
{
ret = GetNinePatchBorder();
break;
}
- case Dali::ImageActor::IMAGE:
+ case Dali::ImageActor::Property::IMAGE:
{
Property::Map map;
- Scripting::CreatePropertyMap( mImageAttachment->GetImage(), map );
+ Scripting::CreatePropertyMap( Dali::Image( mImageAttachment->GetImage().Get() ), map );
ret = Property::Value( map );
break;
}
default:
{
- DALI_LOG_WARNING("Unknown property (%d)\n", index);
+ DALI_LOG_WARNING( "Unknown property (%d)\n", index );
break;
}
} // switch(index)
}
+void ImageActor::SetSortModifier(float modifier)
+{
+ mImageAttachment->SetSortModifier( modifier );
+}
+
+float ImageActor::GetSortModifier() const
+{
+ return mImageAttachment->GetSortModifier();
+}
+
+void ImageActor::SetDepthIndex( int depthIndex )
+{
+ mImageAttachment->SetSortModifier( depthIndex );
+}
+
+int ImageActor::GetDepthIndex() const
+{
+ return static_cast< int >( mImageAttachment->GetSortModifier() );
+}
+
+void ImageActor::SetCullFace(CullFaceMode mode)
+{
+ mImageAttachment->SetCullFace( mode );
+}
+
+CullFaceMode ImageActor::GetCullFace() const
+{
+ return mImageAttachment->GetCullFace();
+}
+
+void ImageActor::SetBlendMode( BlendingMode::Type mode )
+{
+ mImageAttachment->SetBlendMode( mode );
+}
+
+BlendingMode::Type ImageActor::GetBlendMode() const
+{
+ return mImageAttachment->GetBlendMode();
+}
+
+void ImageActor::SetBlendFunc( BlendingFactor::Type srcFactorRgba, BlendingFactor::Type destFactorRgba )
+{
+ mImageAttachment->SetBlendFunc( srcFactorRgba, destFactorRgba, srcFactorRgba, destFactorRgba );
+}
+
+void ImageActor::SetBlendFunc( BlendingFactor::Type srcFactorRgb, BlendingFactor::Type destFactorRgb,
+ BlendingFactor::Type srcFactorAlpha, BlendingFactor::Type destFactorAlpha )
+{
+ mImageAttachment->SetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
+}
+
+void ImageActor::GetBlendFunc( BlendingFactor::Type& srcFactorRgb, BlendingFactor::Type& destFactorRgb,
+ BlendingFactor::Type& srcFactorAlpha, BlendingFactor::Type& destFactorAlpha ) const
+{
+ mImageAttachment->GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
+}
+
+void ImageActor::SetBlendEquation( BlendingEquation::Type equationRgba )
+{
+ mImageAttachment->SetBlendEquation( equationRgba, equationRgba );
+}
+
+void ImageActor::SetBlendEquation( BlendingEquation::Type equationRgb, BlendingEquation::Type equationAlpha )
+{
+ mImageAttachment->SetBlendEquation( equationRgb, equationAlpha );
+}
+
+void ImageActor::GetBlendEquation( BlendingEquation::Type& equationRgb, BlendingEquation::Type& equationAlpha ) const
+{
+ mImageAttachment->GetBlendEquation( equationRgb, equationAlpha );
+}
+
+void ImageActor::SetBlendColor( const Vector4& color )
+{
+ mImageAttachment->SetBlendColor( color );
+}
+
+const Vector4& ImageActor::GetBlendColor() const
+{
+ return mImageAttachment->GetBlendColor();
+}
+
+void ImageActor::SetFilterMode( FilterMode::Type minFilter, FilterMode::Type magFilter )
+{
+ mImageAttachment->SetFilterMode( minFilter, magFilter );
+}
+
+void ImageActor::GetFilterMode( FilterMode::Type& minFilter, FilterMode::Type& magFilter ) const
+{
+ return mImageAttachment->GetFilterMode( minFilter, magFilter );
+}
+
+void ImageActor::SetShaderEffect(ShaderEffect& effect)
+{
+ mImageAttachment->SetShaderEffect( effect );
+}
+
+ShaderEffectPtr ImageActor::GetShaderEffect() const
+{
+ return mImageAttachment->GetShaderEffect();
+}
+
+void ImageActor::RemoveShaderEffect()
+{
+ return mImageAttachment->RemoveShaderEffect();
+}
+
+
} // namespace Internal
} // namespace Dali