+void Visual::Base::RegisterMixColor()
+{
+ // Only register if not already registered.
+ // (Color and Primitive visuals will register their own and save to this index)
+ if( mImpl->mMixColorIndex == Property::INVALID_INDEX )
+ {
+ mImpl->mMixColorIndex = DevelHandle::RegisterProperty(
+ mImpl->mRenderer,
+ Toolkit::DevelVisual::Property::MIX_COLOR,
+ MIX_COLOR,
+ Vector3(mImpl->mMixColor) );
+ }
+
+ if( mImpl->mMixColor.a < 1.f )
+ {
+ mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
+ }
+
+ if( mImpl->mOpacityIndex == Property::INVALID_INDEX )
+ {
+ mImpl->mOpacityIndex = DevelHandle::RegisterProperty(
+ mImpl->mRenderer,
+ Toolkit::DevelVisual::Property::OPACITY,
+ OPACITY,
+ mImpl->mMixColor.a );
+ }
+
+ float preMultipliedAlpha = 0.0f;
+ if( IsPreMultipliedAlphaEnabled() )
+ {
+ preMultipliedAlpha = 1.0f;
+ }
+ mImpl->mRenderer.RegisterProperty( "preMultipliedAlpha", preMultipliedAlpha );
+}
+
+void Visual::Base::SetMixColor( const Vector4& color )
+{
+ mImpl->mMixColor = color;
+
+ if( mImpl->mRenderer )
+ {
+ mImpl->mRenderer.SetProperty( mImpl->mMixColorIndex, Vector3(color) );
+ mImpl->mRenderer.SetProperty( mImpl->mOpacityIndex, color.a );
+ if( color.a < 1.f )
+ {
+ mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
+ }
+ }
+}
+
+void Visual::Base::SetMixColor( const Vector3& color )
+{
+ mImpl->mMixColor.r = color.r;
+ mImpl->mMixColor.g = color.g;
+ mImpl->mMixColor.b = color.b;
+
+ if( mImpl->mRenderer )
+ {
+ mImpl->mRenderer.SetProperty( mImpl->mMixColorIndex, color );
+ }
+}
+
+const Vector4& Visual::Base::GetMixColor() const
+{
+ return mImpl->mMixColor;
+}
+
+void Visual::Base::AddResourceObserver( Visual::ResourceObserver& observer)
+{
+ mImpl->mResourceObserver = &observer;
+}
+
+void Visual::Base::RemoveResourceObserver( Visual::ResourceObserver& observer )
+{
+ mImpl->mResourceObserver = NULL;
+}
+
+void Visual::Base::ResourceReady()
+{
+ if( mImpl->mResourceReady )
+ {
+ // only inform the observer the first time the resource is ready
+ return;
+ }
+ mImpl->mResourceReady = true;
+
+ if( mImpl->mResourceObserver )
+ {
+ // observer is currently a control impl
+ mImpl->mResourceObserver->ResourceReady( *this );
+ }
+}
+
+bool Visual::Base::IsResourceReady() const