virtual void StartRender() {}
- virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ) { return false; }
+ virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface ) { return false; }
- virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface ) {}
+ virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface ) {}
virtual void StopRender() {}
namespace DevelTextLabel
{
+/**
+ * @brief Enumeration for the start and end property ranges for this control.
+ * @SINCE_1_0.0
+ */
+enum PropertyRange
+{
+ ANIMATABLE_PROPERTY_START_INDEX = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX,
+ ANIMATABLE_PROPERTY_END_INDEX = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1000 ///< Reserve animatable property indices
+};
+
namespace Property
{
enum Type
* @brief line wrap mode when the text lines over layout width.
* @details name "lineWrapMode", type string.
*/
- LINE_WRAP_MODE = OUTLINE + 6
+ LINE_WRAP_MODE = OUTLINE + 6,
+
+ /*
+ * @brief Animatable text color
+ * @details text color property to use if required to animate the text color
+ */
+ TEXT_COLOR_ANIMATABLE = ANIMATABLE_PROPERTY_START_INDEX
+
};
} // namespace Property
{
if( mRenderer )
{
+ Dali::Toolkit::TextEditor handle = Dali::Toolkit::TextEditor( GetOwner() );
+
renderableActor = mRenderer->Render( mController->GetView(),
+ handle,
+ Property::INVALID_INDEX, // Animatable property not supported
mAlignmentOffset,
DepthIndex::CONTENT );
}
{
if( mRenderer )
{
+ Dali::Toolkit::TextField handle = Dali::Toolkit::TextField( GetOwner() );
+
renderableActor = mRenderer->Render( mController->GetView(),
+ handle,
+ Property::INVALID_INDEX, // Animatable property not supported
mAlignmentOffset,
DepthIndex::CONTENT );
}
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollStopMode", STRING, AUTO_SCROLL_STOP_MODE )
DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY( Toolkit, TextLabel, "lineCount", INTEGER, LINE_COUNT )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "lineWrapMode", STRING, LINE_WRAP_MODE )
-
+DALI_DEVEL_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT( Toolkit, TextLabel, "textColorAnimatable", Color::WHITE, TEXT_COLOR_ANIMATABLE )
DALI_TYPE_REGISTRATION_END()
} // namespace
case Toolkit::TextLabel::Property::TEXT_COLOR:
{
- if( impl.mController )
- {
- const Vector4& textColor = value.Get< Vector4 >();
- if( impl.mController->GetDefaultColor() != textColor )
- {
- impl.mController->SetDefaultColor( textColor );
- impl.mRenderer.Reset();
- }
- }
+ SetProperty( object, DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE, value );
break;
}
break;
}
case Toolkit::TextLabel::Property::TEXT_COLOR:
+ case Toolkit::DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE:
{
if ( impl.mController )
{
return mController->GetHeightForWidth( width ) + padding.top + padding.bottom;
}
+void TextLabel::OnPropertySet( Property::Index index, Property::Value propertyValue )
+{
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextLabel::OnPropertySet index[%d]\n", index );
+
+ switch ( index )
+ {
+ case Toolkit::TextLabel::Property::TEXT_COLOR:
+ case Toolkit::DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE:
+ {
+ const Vector4& textColor = propertyValue.Get< Vector4 >();
+ if( mController->GetDefaultColor() != textColor )
+ {
+ mController->SetDefaultColor( textColor );
+ mRenderer.Reset();
+ }
+ break;
+ }
+ default:
+ {
+ Control::OnPropertySet( index, propertyValue ); // up call to control for non-handled properties
+ break;
+ }
+ }
+}
+
void TextLabel::OnRelayout( const Vector2& size, RelayoutContainer& container )
{
DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::OnRelayout\n" );
float alignmentOffset = 0.f;
if( mRenderer )
{
+
+ Dali::Toolkit::TextLabel handle = Dali::Toolkit::TextLabel( GetOwner() );
+
renderableActor = mRenderer->Render( mController->GetView(),
+ handle,
+ Toolkit::DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE,
alignmentOffset,
DepthIndex::CONTENT );
}
/**
* @copydoc Control::OnInitialize()
*/
- virtual void OnInitialize();
+ virtual void OnInitialize() override ;
/**
* @copydoc Control::OnStyleChange()
*/
- virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change );
+ virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change ) override ;
/**
* @copydoc Control::OnRelayout()
*/
- virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
+ virtual void OnRelayout( const Vector2& size, RelayoutContainer& container ) override ;
/**
* @copydoc Control::GetNaturalSize()
*/
- virtual Vector3 GetNaturalSize();
+ virtual Vector3 GetNaturalSize() override ;
/**
* @copydoc Control::GetHeightForWidth()
*/
- virtual float GetHeightForWidth( float width );
+ virtual float GetHeightForWidth( float width ) override ;
-// From ControlInterface
+ /**
+ * @copydoc Control::OnPropertySet()
+ */
+ virtual void OnPropertySet( Property::Index index, Property::Value propertyValue ) override ;
+
+ // From ControlInterface
/**
* @copydoc Text::ControlInterface::RequestTextRelayout()
*/
- virtual void RequestTextRelayout();
+ virtual void RequestTextRelayout() override ;
private: // from TextScroller
#include <dali/public-api/images/frame-buffer-image.h>
#include <dali/devel-api/text-abstraction/font-client.h>
#include <dali/integration-api/debug.h>
+#include <dali/public-api/animation/constraints.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
const char* FRAGMENT_SHADER_L8 = MAKE_SHADER(
uniform lowp vec4 uColor;
+uniform lowp vec4 textColorAnimatable;
uniform sampler2D sTexture;
varying mediump vec2 vTexCoord;
varying mediump vec4 vColor;
void main()
{
mediump vec4 color = texture2D( sTexture, vTexCoord );
- gl_FragColor = vec4( vColor.rgb * uColor.rgb, vColor.a * uColor.a * color.r );
+ gl_FragColor = vec4( vColor.rgb * uColor.rgb * textColorAnimatable.rgb, uColor.a * vColor.a * textColorAnimatable.a * color.r );
}
);
const char* FRAGMENT_SHADER_RGBA = MAKE_SHADER(
uniform lowp vec4 uColor;
+uniform lowp vec4 textColorAnimatable;
uniform sampler2D sTexture;
varying mediump vec2 vTexCoord;
void main()
{
- gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;
+ gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor * textColorAnimatable;
}
);
}
void AddGlyphs( Text::ViewInterface& view,
+ Actor textControl,
+ Property::Index animatablePropertyIndex,
const Vector<Vector2>& positions,
const Vector<GlyphInfo>& glyphs,
const Vector4& defaultColor,
{
MeshRecord& meshRecord = *it;
- Actor actor = CreateMeshActor( meshRecord, textSize, STYLE_NORMAL );
+ Actor actor = CreateMeshActor( textControl, animatablePropertyIndex, defaultColor, meshRecord, textSize, STYLE_NORMAL );
// Whether the actor has renderers.
const bool hasRenderer = actor.GetRendererCount() > 0u;
vertex.mColor = shadowColor;
}
- Actor shadowActor = CreateMeshActor( meshRecord, textSize, STYLE_DROP_SHADOW );
+ Actor shadowActor = CreateMeshActor(textControl, animatablePropertyIndex, defaultColor, meshRecord, textSize, STYLE_DROP_SHADOW );
#if defined(DEBUG_ENABLED)
shadowActor.SetName( "Text Shadow renderable actor" );
#endif
mTextCache.Resize( 0 );
}
- Actor CreateMeshActor( const MeshRecord& meshRecord, const Vector2& actorSize, Style style )
+ Actor CreateMeshActor( Actor textControl, Property::Index animatablePropertyIndex, const Vector4& defaultColor, const MeshRecord& meshRecord,
+ const Vector2& actorSize, Style style )
{
PropertyBuffer quadVertices = PropertyBuffer::New( mQuadVertexFormat );
quadVertices.SetData( const_cast< AtlasManager::Vertex2D* >( &meshRecord.mMesh.mVertices[ 0 ] ), meshRecord.mMesh.mVertices.Size() );
shader = mShaderL8;
}
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "defaultColor[%f, %f, %f, %f ]\n", defaultColor.r, defaultColor.g, defaultColor.b, defaultColor.a );
+
+ Dali::Property::Index shaderTextColorIndex = shader.RegisterProperty( "textColorAnimatable", defaultColor );
+
+ if ( animatablePropertyIndex != Property::INVALID_INDEX )
+ {
+ // create constraint for the animatable text's color Property with textColorAnimatable in the shader.
+ if( shaderTextColorIndex )
+ {
+ Constraint constraint = Constraint::New<Vector4>( shader, shaderTextColorIndex, EqualToConstraint() );
+ constraint.AddSource( Source( textControl, animatablePropertyIndex ) );
+ constraint.Apply();
+ }
+ }
+ else
+ {
+ // If not animating the text colour then set to 1's so shader uses the current vertex color
+ shader.RegisterProperty( "textColorAnimatable", Vector4(1.0, 1.0, 1.0, 1.0 ) );
+ }
+
Dali::Renderer renderer = Dali::Renderer::New( quadGeometry, shader );
renderer.SetTextures( textureSet );
renderer.SetProperty( Dali::Renderer::Property::BLEND_MODE, BlendMode::ON );
}
Actor AtlasRenderer::Render( Text::ViewInterface& view,
+ Actor textControl,
+ Property::Index animatablePropertyIndex,
float& alignmentOffset,
int depth )
{
const Vector4& defaultColor = view.GetTextColor();
mImpl->AddGlyphs( view,
+ textControl,
+ animatablePropertyIndex,
positions,
glyphs,
defaultColor,
* @copydoc Renderer::Render()
*/
virtual Actor Render( ViewInterface& view,
+ Actor textControl,
+ Property::Index animatablePropertyIndex,
float& alignmentOffset,
int depth );
* @brief Render the glyphs from a ViewInterface.
*
* @param[in] view The interface to a view.
+ * @param[in] textControl handle to the text control
+ * @param[in] animatablePropertyIndex textControl specific animatable property
* @param[out] alignmentOffset Offset used to internally align the placement actor.
* @param[in] depth The depth in the tree of the parent.
* @return The Renderable actor used to position the text.
*/
virtual Actor Render( ViewInterface& view,
+ Actor textContol,
+ Property::Index animatablePropertyIndex,
float& alignmentOffset,
int depth ) = 0;
}
Actor VectorBasedRenderer::Render( Text::ViewInterface& view,
+ Actor textControl,
+ Property::Index animatablePropertyIndex,
float& alignmentOffset,
int /*depth*/ )
{
* @copydoc Renderer::Render()
*/
virtual Actor Render( ViewInterface& view,
+ Actor textControl, // Functionality not supported but defined in interface
+ Property::Index animatablePropertyIndex, // Functionality not supported but defined in interface
float& alignmentOffset,
int depth );
naturalSize.y = mDesiredSize.GetHeight();
return;
}
+ else if( mImpl->mRenderer ) // Check if we have a loaded image
+ {
+ auto textureSet = mImpl->mRenderer.GetTextures();
+
+ if( textureSet )
+ {
+ auto texture = textureSet.GetTexture(0);
+ naturalSize.x = texture.GetWidth();
+ naturalSize.y = texture.GetHeight();
+ return;
+ }
+ }
- else if( mMaskingData != NULL && mMaskingData->mAlphaMaskUrl.IsValid() &&
+ if( mMaskingData != NULL && mMaskingData->mAlphaMaskUrl.IsValid() &&
mMaskingData->mCropToMask )
{
ImageDimensions dimensions = Dali::GetClosestImageSize( mMaskingData->mAlphaMaskUrl.GetUrl() );
}
return;
}
- else if( mImageUrl.IsValid() && mImageUrl.GetLocation() == VisualUrl::LOCAL )
+ else if( mImageUrl.IsValid() )
{
- ImageDimensions dimensions = Dali::GetClosestImageSize( mImageUrl.GetUrl() );
-
- if( dimensions != ImageDimensions( 0, 0 ) )
- {
- naturalSize.x = dimensions.GetWidth();
- naturalSize.y = dimensions.GetHeight();
- }
- else
+ if( mImageUrl.GetLocation() == VisualUrl::LOCAL )
{
- Image brokenImage = VisualFactoryCache::GetBrokenVisualImage();
+ ImageDimensions dimensions = Dali::GetClosestImageSize( mImageUrl.GetUrl() );
+
+ if( dimensions != ImageDimensions( 0, 0 ) )
+ {
+ naturalSize.x = dimensions.GetWidth();
+ naturalSize.y = dimensions.GetHeight();
+ }
+ else
+ {
+ Image brokenImage = VisualFactoryCache::GetBrokenVisualImage();
- naturalSize.x = brokenImage.GetWidth();
- naturalSize.y = brokenImage.GetWidth();
+ naturalSize.x = brokenImage.GetWidth();
+ naturalSize.y = brokenImage.GetWidth();
+ }
+ return;
}
- return;
}
naturalSize = Vector2::ZERO;
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 50;
+const unsigned int TOOLKIT_MICRO_VERSION = 51;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.2.50
+Version: 1.2.51
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT