Remove RenderableActor
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / image-actor-impl.h
index cf3d0c4..785216e 100644 (file)
@@ -21,8 +21,9 @@
 // INTERNAL INCLUDES
 #include <dali/public-api/object/ref-object.h>
 #include <dali/public-api/actors/image-actor.h>
+#include <dali/devel-api/rendering/cull-face.h>
 #include <dali/internal/event/actors/actor-declarations.h>
-#include <dali/internal/event/actors/renderable-actor-impl.h>
+#include <dali/internal/event/actors/actor-impl.h>
 #include <dali/internal/event/actor-attachments/image-attachment-impl.h>
 #include <dali/internal/event/animation/animation-impl.h>
 #include <dali/internal/event/images/nine-patch-image-impl.h>
@@ -48,7 +49,7 @@ class Image;
  * mImageAttachment's member object. The first one points to the Image object that is going to
  * be displayed next, the second one to the Image that is currently being displayed.
  */
-class ImageActor : public RenderableActor
+class ImageActor : public Actor
 {
 public:
 
@@ -56,24 +57,10 @@ public:
   typedef Dali::ImageActor::PixelArea PixelArea;
 
   /**
-   * @brief Create an initialised image actor.
-   * When the image is loaded the actors size will reset to the image size,
-   * unless a custom size chosen via Actor:SetSize().
-   * @param[in] image A pointer to the image object to display or NULL not to display anything.
+   * @brief Create an image actor instance.
    * @return A smart-pointer to a newly allocated image actor.
    */
-  static ImageActorPtr New( Image* image );
-
-  /**
-   * @brief Create an initialised image actor.
-   * When the image is loaded the actors size will reset to the image size,
-   * unless a custom size chosen via Actor:SetSize().
-   * @param [in] image A pointer to the image object to display or NULL not to display anything.
-   * @param [in] pixelArea The area of the image to display.
-   * This in pixels, relative to the top-left (0,0) of the image.
-   * @return A smart-pointer to a newly allocated image actor.
-   */
-  static ImageActorPtr New( Image* image, const PixelArea& pixelArea );
+  static ImageActorPtr New();
 
   /**
    * @copydoc Dali::Internal::Actor::OnInitialize
@@ -81,58 +68,44 @@ public:
   void OnInitialize() ;
 
   /**
-   * Set the image rendered by the actor's attachment.
-   * When the image is loaded the actors size will be reset to the image size,
-   * unless a custom size is chosen via Actor:SetSize().
-   * The old image will continue to be displayed until the new image has loaded
-   * @param [in] image A pointer to the image to display or NULL not to display anything.
+   * @see Dali::ImageActor::SetImage()
+   * @param[in] ImagePtr reference to the image object to display. Reference to avoid unnecessary increment/decrement reference.
    */
-  void SetImage( Image* image );
+  void SetImage( ImagePtr& image );
 
   /**
    * Retrieve the image rendered by the actor's attachment.
-   * @return The image (uninitialized Image object in case the ImageActor does not display anything).
+   * @return smart pointer to the image or an empty one if no image is assigned
    */
-  Dali::Image GetImage();
+  ImagePtr GetImage();
 
   /**
-   * @copydoc Dali::ImageActor::SetToNaturalSize()
-   */
-  void SetToNaturalSize();
-
-  /**
-   * Set a region of the image to display, in pixels.
-   * @param [in] pixelArea The area of the image to display.
-   * This in pixels, relative to the top-left (0,0) of the image.
+   * @copydoc Dali::ImageActor::SetPixelArea()
    */
   void SetPixelArea( const PixelArea& pixelArea );
 
   /**
-   * Retrieve the region of the image to display, in pixels.
-   * @return The pixel area, or a default-constructed area if none was set.
+   * @copydoc Dali::ImageActor::GetPixelArea()
    */
   const PixelArea& GetPixelArea() const;
 
   /**
-   * Query whether a pixel area has been set.
-   * @return True if a pixel area has been set.
+   * @copydoc Dali::ImageActor::IsPixelAreaSet()
    */
   bool IsPixelAreaSet() const;
 
   /**
-   * Remove any pixel areas specified with SetPixelArea; the entire image will be displayed.
+   * @copydoc Dali::ImageActor::ClearPixelArea()
    */
   void ClearPixelArea();
 
   /**
-   * Set how the image is rendered; the default is STYLE_QUAD.
-   * @param [in] style The new style.
+   * @copydoc Dali::ImageActor::SetStyle()
    */
   void SetStyle( Style style );
 
   /**
-   * Query how the image is rendered.
-   * @return The rendering style.
+   * @copydoc Dali::ImageActor::GetStyle()
    */
   Style GetStyle() const;
 
@@ -147,92 +120,179 @@ public:
   Vector4 GetNinePatchBorder() const;
 
   /**
-   * Set whether the image should gradually fade in when first rendered.
-   * @param [in] enableFade True if the image should fade in.
+   * Retrieve the attachment which renders the image.
+   * @return The attachment.
    */
-  void SetFadeIn(bool enableFade);
+  ImageAttachment& GetImageAttachment();
+
 
   /**
-   * Query whether the image will gradually fade in when first rendered.
-   * @return True if the image will fade in.
+   * @copydoc Dali::RenderableActor::SetSortModifier()
    */
-  bool GetFadeIn() const;
+  void SetSortModifier(float modifier);
 
   /**
-   * Set the duration of the fade-in effect; the default is 1 second.
-   * @param [in] durationSeconds The duration in seconds.
+   * @copydoc Dali::RenderableActor::GetSortModifier()
    */
-  void SetFadeInDuration( float durationSeconds );
+  float GetSortModifier() const;
 
   /**
-   * Retrieve the duration of the fade-in effect.
-   * @return The duration in seconds.
+   * @copydoc Dali::RenderableActor::SetDepthIndex()
    */
-  float GetFadeInDuration() const;
+  void SetDepthIndex( int depthIndex );
 
   /**
-   * Retrieve the attachment which renders the image.
-   * @return The attachment.
+   * @copydoc Dali::RenderableActor::GetDepthIndex()
    */
-  ImageAttachment& GetImageAttachment();
+  int GetDepthIndex() const;
+
+  /**
+   * @copydoc Dali::RenderableActor::SetCullFace()
+   */
+  void SetCullFace(CullFaceMode mode);
+
+  /**
+   * @copydoc Dali::RenderableActor::GetCullFace()
+   */
+  CullFaceMode GetCullFace() const;
+
+  /**
+   * @copydoc Dali::RenderableActor::SetBlendMode()
+   */
+  void SetBlendMode( BlendingMode::Type mode );
 
   /**
-   * @copydoc Dali::ImageActor::GetCurrentImageSize
+   * @copydoc Dali::RenderableActor::GetBlendMode()
    */
-  Vector2 GetCurrentImageSize() const;
+  BlendingMode::Type GetBlendMode() const;
 
-public: // Default property extensions from ProxyObject
+  /**
+   * @copydoc Dali::RenderableActor::SetBlendFunc()
+   */
+  void SetBlendFunc( BlendingFactor::Type srcFactorRgba,   BlendingFactor::Type destFactorRgba );
 
   /**
-   * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyCount()
+   * @copydoc Dali::RenderableActor::SetBlendFunc()
+   */
+  void SetBlendFunc( BlendingFactor::Type srcFactorRgb,   BlendingFactor::Type destFactorRgb,
+                     BlendingFactor::Type srcFactorAlpha, BlendingFactor::Type destFactorAlpha );
+
+  /**
+   * @copydoc Dali::RenderableActor::GetBlendFunc()
+   */
+  void GetBlendFunc( BlendingFactor::Type& srcFactorRgb,   BlendingFactor::Type& destFactorRgb,
+                     BlendingFactor::Type& srcFactorAlpha, BlendingFactor::Type& destFactorAlpha ) const;
+
+  /**
+   * @copydoc Dali::RenderableActor::SetBlendEquation()
+   */
+  void SetBlendEquation( BlendingEquation::Type equationRgba );
+
+  /**
+   * @copydoc Dali::RenderableActor::SetBlendEquation()
+   */
+  void SetBlendEquation( BlendingEquation::Type equationRgb, BlendingEquation::Type equationAlpha );
+
+  /**
+   * @copydoc Dali::RenderableActor::GetBlendEquation()
+   */
+  void GetBlendEquation( BlendingEquation::Type& equationRgb, BlendingEquation::Type& equationAlpha ) const;
+
+  /**
+   * @copydoc Dali::RenderableActor::SetBlendColor()
+   */
+  void SetBlendColor( const Vector4& color );
+
+  /**
+   * @copydoc Dali::RenderableActor::GetBlendColor()
+   */
+  const Vector4& GetBlendColor() const;
+
+  /**
+   * @copydoc Dali::RenderableActor::SetFilterMode()
+   */
+  void SetFilterMode( FilterMode::Type minFilter, FilterMode::Type magFilter );
+
+  /**
+   * @copydoc Dali::RenderableActor::GetFilterMode()
+   */
+  void GetFilterMode( FilterMode::Type& minFilter, FilterMode::Type& magFilter ) const;
+
+public:
+  /**
+   * @copydoc Actor::SetShaderEffect
+   */
+  virtual void SetShaderEffect(ShaderEffect& effect);
+
+  /**
+   * @copydoc Actor::GetShaderEffect
+   */
+  virtual ShaderEffectPtr GetShaderEffect() const;
+
+  /**
+   * @copydoc Actor::RemoveShaderEffect
+   */
+  virtual void RemoveShaderEffect();
+
+public: // Default property extensions from Object
+
+  /**
+   * @copydoc Dali::Internal::Object::GetDefaultPropertyCount()
    */
   virtual unsigned int GetDefaultPropertyCount() const;
 
   /**
-   * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyIndices()
+   * @copydoc Dali::Internal::Object::GetDefaultPropertyIndices()
    */
   virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
 
   /**
-   * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyName()
+   * @copydoc Dali::Internal::Object::GetDefaultPropertyName()
    */
-  virtual const std::string& GetDefaultPropertyName(Property::Index index) const;
+  virtual const char* GetDefaultPropertyName(Property::Index index) const;
 
   /**
-   * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyIndex()
+   * @copydoc Dali::Internal::Object::GetDefaultPropertyIndex()
    */
   virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
 
   /**
-   * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyWritable()
+   * @copydoc Dali::Internal::Object::IsDefaultPropertyWritable()
    */
   virtual bool IsDefaultPropertyWritable(Property::Index index) const;
 
   /**
-   * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyAnimatable()
+   * @copydoc Dali::Internal::Object::IsDefaultPropertyAnimatable()
    */
   virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
 
   /**
-   * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyAConstraintInput()
+   * @copydoc Dali::Internal::Object::IsDefaultPropertyAConstraintInput()
    */
   virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
 
   /**
-   * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyType()
+   * @copydoc Dali::Internal::Object::GetDefaultPropertyType()
    */
   virtual Property::Type GetDefaultPropertyType(Property::Index index) const;
 
   /**
-   * @copydoc Dali::Internal::ProxyObject::SetDefaultProperty()
+   * @copydoc Dali::Internal::Object::SetDefaultProperty()
    */
   virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
 
   /**
-   * @copydoc Dali::Internal::ProxyObject::GetDefaultProperty()
+   * @copydoc Dali::Internal::Object::GetDefaultProperty()
    */
   virtual Property::Value GetDefaultProperty( Property::Index index ) const;
 
+public: // From Actor
+
+  /**
+   * @copydoc Dali::Actor::GetNaturalSize()
+   */
+  virtual Vector3 GetNaturalSize() const;
+
 private: // From RenderableActor
 
   /**
@@ -254,23 +314,12 @@ protected:
 
 private:
 
-  // Helper for overloads of SetImage().
-  void OnImageSet( Image& image );
-
-  // Helper to set the actor to the image's natural size
-  void SetNaturalSize( Image& image );
-
-
-  /**
-   * From Actor.
-   * This is called after SizeSet() has been called.
-   */
-  virtual void OnSizeSet( const Vector3& targetSize );
-
   /**
-   * @copydoc Actor::OnSizeAnimation( Animation& animation, const Vector3& targetSize )
+   * Calculate the natural size of this image actor
+   *
+   * @return Return the natural size as a Vector2
    */
-  virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
+  Vector2 CalculateNaturalSize() const;
 
   /**
    * From Actor; used to trigger fade-in animations.
@@ -282,35 +331,9 @@ private:
    */
   virtual void OnStageDisconnectionInternal();
 
-  /**
-   * Helper for when the image loads.
-   * @param[in] image The newly (re)loaded image.
-   */
-  void ImageLoaded( Dali::Image image );
-
-  /**
-   * Helper to start fade-in animations.
-   */
-  void FadeIn();
-
 private:
 
   ImageAttachmentPtr mImageAttachment; ///< Used to display the image (holds a pointer to currently showed Image)
-  ImageConnector     mImageNext;       ///< Manages the Image this ImageActor will show (used when changing displayed image)
-
-  // flags, compressed to bitfield (uses only 4 bytes)
-  bool mUsingNaturalSize:1; ///< True only when the actor is using
-  bool mInternalSetSize:1;  ///< True whilst setting size internally, false at all other times
-  bool mFadeIn:1;           ///< True if fade in animation is enabled
-  bool mFadeInitial:1;      ///< True if fading in for the first time
-
-  SlotDelegate<ImageActor> mLoadedConnection; ///< Tracks the connection to the "loading finished" signal
-
-  // For fade-in animations
-  float        mFadeInDuration;  ///< Length of animation
-
-  static bool mFirstInstance ;
-  static DefaultPropertyLookup* mDefaultImageActorPropertyLookup; ///< Default properties
 
 };