BufferImage img = BufferImage::New( 10, 10 );
ImageActor actor = ImageActor::New( img );
- DALI_TEST_CHECK( actor.IsPixelAreaSet() == false );
-
ImageActor::PixelArea area( 1, 2, 3, 4 );
actor.SetPixelArea( area );
- DALI_TEST_CHECK( actor.IsPixelAreaSet() == true );
-
DALI_TEST_EQUALS( 1, actor.GetPixelArea().x, TEST_LOCATION );
DALI_TEST_EQUALS( 2, actor.GetPixelArea().y, TEST_LOCATION );
DALI_TEST_EQUALS( 3, actor.GetPixelArea().width, TEST_LOCATION );
DALI_TEST_EQUALS( 4, actor.GetPixelArea().height, TEST_LOCATION );
ImageActor actor2 = ImageActor::New( img, ImageActor::PixelArea( 5, 6, 7, 8 ) );
- DALI_TEST_CHECK( actor2.IsPixelAreaSet() == true );
DALI_TEST_EQUALS( 5, actor2.GetPixelArea().x, TEST_LOCATION );
DALI_TEST_EQUALS( 6, actor2.GetPixelArea().y, TEST_LOCATION );
DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), Vector2(100, 100), TEST_LOCATION );
// Clear the pixel area. Expect the whole image to be shown, filling the set size.
- actor.ClearPixelArea();
+ actor.SetPixelArea( ImageActor::PixelArea( 0, 0, image.GetWidth(), image.GetHeight()) );
application.SendNotification(); // Process event messages
application.Render(); // Process LoadComplete
DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), Vector2(100, 100), TEST_LOCATION );
DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), Vector2(30, 30), TEST_LOCATION );
// Clear the pixel area. Expect the whole image to be shown, changing actor size
- actor.ClearPixelArea();
+ actor.SetPixelArea( ImageActor::PixelArea( 0, 0, image.GetWidth(), image.GetHeight()) );
application.SendNotification(); // Process event messages
application.Render(); // Process LoadComplete
DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
// Clearing pixel area should change actor size to image size
actor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
- actor.ClearPixelArea();
+ actor.SetPixelArea( ImageActor::PixelArea( 0, 0, image.GetWidth(), image.GetHeight()) );
application.SendNotification(); // Process event messages
application.Render(); // Process LoadComplete
DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
END_TEST;
}
-int UtcDaliImageActorClearPixelArea(void)
-{
- TestApplication application;
-
- BufferImage img = BufferImage::New( 10, 10 );
- ImageActor actor = ImageActor::New( img );
-
- DALI_TEST_CHECK( actor.IsPixelAreaSet() == false );
-
- ImageActor::PixelArea area( 1, 2, 3, 4 );
- actor.SetPixelArea( area );
-
- DALI_TEST_CHECK( actor.IsPixelAreaSet() == true );
-
- actor.ClearPixelArea();
-
- DALI_TEST_CHECK( actor.IsPixelAreaSet() == false );
- END_TEST;
-}
-
int UtcDaliImageGetStyle(void)
{
TestApplication application;
}
// Set to non-default values
- actor.SetBlendFunc( BlendingFactor::ONE_MINUS_SRC_COLOR, BlendingFactor::SRC_ALPHA_SATURATE );
+ actor.SetBlendFunc( BlendingFactor::ONE_MINUS_SRC_COLOR, BlendingFactor::SRC_ALPHA_SATURATE, BlendingFactor::ONE_MINUS_SRC_COLOR, BlendingFactor::SRC_ALPHA_SATURATE );
// Test that Set was successful
{
END_TEST;
}
-int UtcDaliRenderableActorSetGetBlendEquation(void)
-{
- TestApplication application;
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-
- tet_infoline("Testing Dali::RenderableActor::SetBlendEquation()");
-
- BufferImage img = BufferImage::New( 1,1 );
- ImageActor actor = ImageActor::New( img );
- Stage::GetCurrent().Add( actor );
- application.SendNotification();
- application.Render();
-
- // Test the defaults as documented int blending.h
- {
- BlendingEquation::Type equationRgb( BlendingEquation::SUBTRACT );
- BlendingEquation::Type equationAlpha( BlendingEquation::SUBTRACT );
- actor.GetBlendEquation( equationRgb, equationAlpha );
- DALI_TEST_EQUALS( BlendingEquation::ADD, equationRgb, TEST_LOCATION );
- DALI_TEST_EQUALS( BlendingEquation::ADD, equationAlpha, TEST_LOCATION );
- }
-
- // Test the single blending equation setting
- {
- actor.SetBlendEquation( BlendingEquation::REVERSE_SUBTRACT );
- BlendingEquation::Type equationRgba( BlendingEquation::SUBTRACT );
- actor.GetBlendEquation( equationRgba, equationRgba );
- DALI_TEST_EQUALS( BlendingEquation::REVERSE_SUBTRACT, equationRgba, TEST_LOCATION );
- }
-
- actor.SetBlendEquation( BlendingEquation::REVERSE_SUBTRACT, BlendingEquation::REVERSE_SUBTRACT );
-
- // Test that Set was successful
- {
- BlendingEquation::Type equationRgb( BlendingEquation::SUBTRACT );
- BlendingEquation::Type equationAlpha( BlendingEquation::SUBTRACT );
- actor.GetBlendEquation( equationRgb, equationAlpha );
- DALI_TEST_EQUALS( BlendingEquation::REVERSE_SUBTRACT, equationRgb, TEST_LOCATION );
- DALI_TEST_EQUALS( BlendingEquation::REVERSE_SUBTRACT, equationAlpha, TEST_LOCATION );
- }
-
- // Render & check GL commands
- application.SendNotification();
- application.Render();
- DALI_TEST_EQUALS( (GLenum)GL_FUNC_REVERSE_SUBTRACT, glAbstraction.GetLastBlendEquationRgb(), TEST_LOCATION );
- DALI_TEST_EQUALS( (GLenum)GL_FUNC_REVERSE_SUBTRACT, glAbstraction.GetLastBlendEquationAlpha(), TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliRenderableActorSetGetBlendColor(void)
-{
- TestApplication application;
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-
- tet_infoline("Testing Dali::RenderableActor::SetBlendColor()");
-
- BufferImage img = BufferImage::New( 1,1 );
- ImageActor actor = ImageActor::New( img );
- Stage::GetCurrent().Add( actor );
- application.SendNotification();
- application.Render();
-
- // Test the defaults as documented int blending.h
- DALI_TEST_EQUALS( Vector4::ZERO, actor.GetBlendColor(), TEST_LOCATION );
-
- actor.SetBlendColor( Color::RED );
-
- // Test that Set was successful
- DALI_TEST_EQUALS( Color::RED, actor.GetBlendColor(), TEST_LOCATION );
-
- // Render & check GL commands
- application.SendNotification();
- application.Render();
- DALI_TEST_EQUALS( Color::RED, glAbstraction.GetLastBlendColor(), TEST_LOCATION );
- END_TEST;
-}
-
int UtcDaliRenderableActorSetGetAlpha(void)
{
TestApplication application;
return GetImplementation(*this).GetPixelArea();
}
-bool ImageActor::IsPixelAreaSet() const
-{
- return GetImplementation(*this).IsPixelAreaSet();
-}
-
-void ImageActor::ClearPixelArea()
-{
- GetImplementation(*this).ClearPixelArea();
-}
-
void ImageActor::SetStyle(Style style)
{
GetImplementation(*this).SetStyle(style);
PixelArea GetPixelArea() const;
/**
- * @brief Query whether a pixel area has been set.
- *
- * @pre image must be initialized.
- * @return True if a pixel area has been set.
- */
- bool IsPixelAreaSet() const;
-
- /**
- * @brief Remove any pixel areas specified with SetPixelArea; the entire image will be displayed.
- *
- * The actor size will change to that of the Image unless a custom size was set, e.g. via
- * Actor::SetSize().
- * @pre image must be initialized.
- */
- void ClearPixelArea();
-
- /**
* @brief Set how the image is rendered; the default is STYLE_QUAD.
*
* @pre image must be initialized.
return GetImplementation(*this).GetBlendMode();
}
-void RenderableActor::SetBlendFunc( BlendingFactor::Type srcFactorRgba, BlendingFactor::Type destFactorRgba )
-{
- GetImplementation(*this).SetBlendFunc( srcFactorRgba, destFactorRgba );
-}
-
void RenderableActor::SetBlendFunc( BlendingFactor::Type srcFactorRgb, BlendingFactor::Type destFactorRgb,
BlendingFactor::Type srcFactorAlpha, BlendingFactor::Type destFactorAlpha )
{
GetImplementation(*this).GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
}
-void RenderableActor::SetBlendEquation( BlendingEquation::Type equationRgba )
-{
- GetImplementation(*this).SetBlendEquation( equationRgba );
-}
-
-void RenderableActor::SetBlendEquation( BlendingEquation::Type equationRgb, BlendingEquation::Type equationAlpha )
-{
- GetImplementation(*this).SetBlendEquation( equationRgb, equationAlpha );
-}
-
-void RenderableActor::GetBlendEquation( BlendingEquation::Type& equationRgb, BlendingEquation::Type& equationAlpha ) const
-{
- GetImplementation(*this).GetBlendEquation( equationRgb, equationAlpha );
-}
-
-void RenderableActor::SetBlendColor( const Vector4& color )
-{
- GetImplementation(*this).SetBlendColor( color );
-}
-
-const Vector4& RenderableActor::GetBlendColor() const
-{
- return GetImplementation(*this).GetBlendColor();
-}
-
void RenderableActor::SetFilterMode( FilterMode::Type minFilter, FilterMode::Type magFilter )
{
GetImplementation(*this).SetFilterMode( minFilter, magFilter );
/**
* @brief Specify the pixel arithmetic used when the actor is blended.
*
- * @param[in] srcFactorRgba Specifies how the red, green, blue, and alpha source blending factors are computed.
- * The options are BlendingFactor::ZERO, ONE, SRC_COLOR, ONE_MINUS_SRC_COLOR, DST_COLOR, ONE_MINUS_DST_COLOR,
- * SRC_ALPHA, ONE_MINUS_SRC_ALPHA, DST_ALPHA, ONE_MINUS_DST_ALPHA, CONSTANT_COLOR, ONE_MINUS_CONSTANT_COLOR,
- * GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA, and GL_SRC_ALPHA_SATURATE.
- *
- * @param[in] destFactorRgba Specifies how the red, green, blue, and alpha destination blending factors are computed.
- * The options are BlendingFactor::ZERO, ONE, SRC_COLOR, ONE_MINUS_SRC_COLOR, DST_COLOR, ONE_MINUS_DST_COLOR,
- * SRC_ALPHA, ONE_MINUS_SRC_ALPHA, DST_ALPHA, ONE_MINUS_DST_ALPHA, CONSTANT_COLOR, ONE_MINUS_CONSTANT_COLOR,
- * GL_CONSTANT_ALPHA, and GL_ONE_MINUS_CONSTANT_ALPHA.
- */
- void SetBlendFunc( BlendingFactor::Type srcFactorRgba, BlendingFactor::Type destFactorRgba );
-
- /**
- * @brief Specify the pixel arithmetic used when the actor is blended.
- *
* @param[in] srcFactorRgb Specifies how the red, green, and blue source blending factors are computed.
* The options are BlendingFactor::ZERO, ONE, SRC_COLOR, ONE_MINUS_SRC_COLOR, DST_COLOR, ONE_MINUS_DST_COLOR,
* SRC_ALPHA, ONE_MINUS_SRC_ALPHA, DST_ALPHA, ONE_MINUS_DST_ALPHA, CONSTANT_COLOR, ONE_MINUS_CONSTANT_COLOR,
BlendingFactor::Type& srcFactorAlpha, BlendingFactor::Type& destFactorAlpha ) const;
/**
- * @brief Specify the equation used when the actor is blended.
- *
- * The options are BlendingEquation::ADD, SUBTRACT, or REVERSE_SUBTRACT.
- * @param[in] equationRgba The equation used for combining red, green, blue, and alpha components.
- */
- void SetBlendEquation( BlendingEquation::Type equationRgba );
-
- /**
- * @brief Specify the equation used when the actor is blended.
- *
- * @param[in] equationRgb The equation used for combining red, green, and blue components.
- * @param[in] equationAlpha The equation used for combining the alpha component.
- * The options are BlendingEquation::ADD, SUBTRACT, or REVERSE_SUBTRACT.
- */
- void SetBlendEquation( BlendingEquation::Type equationRgb, BlendingEquation::Type equationAlpha );
-
- /**
- * @brief Query the equation used when the actor is blended.
- *
- * @param[out] equationRgb The equation used for combining red, green, and blue components.
- * @param[out] equationAlpha The equation used for combining the alpha component.
- */
- void GetBlendEquation( BlendingEquation::Type& equationRgb, BlendingEquation::Type& equationAlpha ) const;
-
- /**
- * @brief Specify the color used when the actor is blended; the default is Vector4::ZERO.
- *
- * @param[in] color The blend color.
- */
- void SetBlendColor( const Vector4& color );
-
- /**
- * @brief Query the color used when the actor is blended.
- *
- * @return The blend color.
- */
- const Vector4& GetBlendColor() const;
-
- /**
* @brief Sets the filtering mode.
*
* Possible values are: FilterMode::NEAREST and FilterMode::LINEAR. Default is FilterMode::LINEAR.