X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fpublic-api%2Factors%2Fimage-actor.h;h=136cb8a8e7cd968a0bd294b0f225fd310c762276;hb=1c92aff3ef39de0b3f2699b432deeb3937172f1c;hp=764fe3e4392dd55c5d0088713939f9ed23fda036;hpb=199d46a42f943543a9d43cc3166a0d8b7cf63fd4;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/public-api/actors/image-actor.h b/dali/public-api/actors/image-actor.h index 764fe3e..136cb8a 100644 --- a/dali/public-api/actors/image-actor.h +++ b/dali/public-api/actors/image-actor.h @@ -22,9 +22,12 @@ #include // INTERNAL INCLUDES -#include +#include #include #include +#include +#include +#include namespace Dali { @@ -39,7 +42,7 @@ class ImageActor; * * Allows the developer to add an actor to stage which displays the content of an Image object. * - * By default CullFaceMode is set to CullNone to enable the ImageActor to be viewed from all angles. + * By default ImageActor can be viewed from all angles. * * If an ImageActor is created without setting size, then the actor takes the size of the image - * this is the natural size. @@ -56,7 +59,7 @@ class ImageActor; * Clearing the pixel area on an Image actor with a set size will cause the actor to show the * whole image again, but will not change the image size. */ -class DALI_IMPORT_API ImageActor : public RenderableActor +class DALI_IMPORT_API ImageActor : public Actor { public: @@ -150,6 +153,8 @@ public: */ typedef Rect PixelArea; + static const BlendingMode::Type DEFAULT_BLENDING_MODE; ///< default value is BlendingMode::AUTO + /** * @brief Create an uninitialized ImageActor handle. * @@ -267,23 +272,6 @@ public: 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. @@ -315,11 +303,212 @@ public: */ Vector4 GetNinePatchBorder() const; + + /** + * @brief Allows modification of an actors position in the depth sort algorithm. + * + * The offset can be altered for each coplanar actor hence allowing an order of painting. + * @pre The Actor has been initialized. + * @param [in] depthOffset the offset to be given to the actor. Positive values pushing it further back. + */ + void SetSortModifier(float depthOffset); + + /** + * @brief Retrieves the offset used to modify an actors position in the depth sort algorithm. + * + * The offset can be altered for each coplanar actor hence allowing an order of painting. + * @pre The Actor has been initialized. + * @return the offset that has been given to the actor. Positive values pushing it further back. + */ + float GetSortModifier() const; + + /** + * @brief Sets the blending mode. + * + * Possible values are: BlendingMode::OFF, BlendingMode::AUTO and BlendingMode::ON. Default is BlendingMode::AUTO. + * + * If blending is disabled (BlendingMode::OFF) fade in and fade out animations do not work. + * + *
    + *
  • \e OFF Blending is disabled. + *
  • \e AUTO Blending is enabled only if the renderable actor has alpha channel. + *
  • \e ON Blending is enabled. + *
+ * + * @param[in] mode The blending mode. + */ + void SetBlendMode( BlendingMode::Type mode ); + + /** + * @brief Retrieves the blending mode. + * + * @return The blending mode, one of BlendingMode::OFF, BlendingMode::AUTO or BlendingMode::ON. + */ + BlendingMode::Type GetBlendMode() const; + + /** + * @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, + * GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA, and GL_SRC_ALPHA_SATURATE. + * + * @param[in] destFactorRgb 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. + * + * @param[in] srcFactorAlpha Specifies how the alpha source blending factor is computed. + * The options are the same as for srcFactorRgb. + * + * @param[in] destFactorAlpha Specifies how the alpha source blending factor is computed. + * The options are the same as for destFactorRgb. + */ + void SetBlendFunc( BlendingFactor::Type srcFactorRgb, BlendingFactor::Type destFactorRgb, + BlendingFactor::Type srcFactorAlpha, BlendingFactor::Type destFactorAlpha ); + + /** + * @brief Query the pixel arithmetic used when the actor is blended. + * + * @param[out] srcFactorRgb Specifies how the red, green, blue, and alpha source blending factors are computed. + * @param[out] destFactorRgb Specifies how the red, green, blue, and alpha destination blending factors are computed. + * @param[out] srcFactorAlpha Specifies how the red, green, blue, and alpha source blending factors are computed. + * @param[out] destFactorAlpha Specifies how the red, green, blue, and alpha destination blending factors are computed. + */ + void GetBlendFunc( BlendingFactor::Type& srcFactorRgb, BlendingFactor::Type& destFactorRgb, + 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. + * + *
    + *
  • \e NEAREST Use nearest filtering + *
  • \e LINEAR Use linear filtering + *
+ * + * @param[in] minFilter The minification filtering mode. + * @param[in] magFilter The magnification filtering mode. + */ + void SetFilterMode( FilterMode::Type minFilter, FilterMode::Type magFilter ); + + /** + * @brief Retrieves the filtering mode. + * + * @param[out] minFilter The return minification value + * @param[out] magFilter The return magnification value + */ + void GetFilterMode( FilterMode::Type& minFilter, FilterMode::Type& magFilter) const; + + /** + * @brief Sets the shader effect for the RenderableActor. + * + * Shader effects provide special effects like ripple and bend. + * Setting a shader effect removes any shader effect previously set by SetShaderEffect. + * @pre The actor has been initialized. + * @pre effect has been initialized. + * @param [in] effect The shader effect. + */ + void SetShaderEffect( ShaderEffect effect ); + + /** + * @brief Retrieve the custom shader effect for the RenderableActor. + * If default shader is used an empty handle is returned. + * + * @pre The Actor has been initialized. + * @return The shader effect + */ + ShaderEffect GetShaderEffect() const; + + /** + * @brief Removes the current shader effect. + * + * @pre The Actor has been initialized. + */ + void RemoveShaderEffect(); + + public: // Not intended for application developers explicit DALI_INTERNAL ImageActor(Internal::ImageActor*); }; + +/** + * @brief Sets the shader effect for all ImageActors in a tree of Actors. + * + * @see ImageActor::SetShaderEffect + * + * @param [in] actor root of a tree of actors. + * @param [in] effect The shader effect. + */ +DALI_IMPORT_API void SetShaderEffectRecursively( Actor actor, ShaderEffect effect ); + +/** + * @brief Removes the shader effect from all ImageActors in a tree of Actors. + * + * @see ImageActor::RemoveShaderEffect + * + * @param [in] actor root of a tree of actors. + */ +DALI_IMPORT_API void RemoveShaderEffectRecursively( Actor actor ); + } // namespace Dali #endif // __DALI_IMAGE_ACTOR_H__