X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Frenderers%2Fimage%2Fimage-renderer.h;h=8498e54812cf5f78065e0f3b5219c9db11c1a27e;hp=f408fb25bbe0c9983ab26b4e71a4faf6b411940c;hb=f3da11c2818c6d17706fbb2417f21b602b3190f5;hpb=3a21dc6b7c0c8e199c075d367ffd9574fde752f3 diff --git a/dali-toolkit/internal/controls/renderers/image/image-renderer.h b/dali-toolkit/internal/controls/renderers/image/image-renderer.h index f408fb2..8498e54 100644 --- a/dali-toolkit/internal/controls/renderers/image/image-renderer.h +++ b/dali-toolkit/internal/controls/renderers/image/image-renderer.h @@ -24,6 +24,7 @@ // EXTERNAL INCLUDES #include #include +#include namespace Dali { @@ -42,33 +43,33 @@ typedef IntrusivePtr< ImageRenderer > ImageRendererPtr; * * The following properties are optional * - * | %Property Name | Type | - * |---------------------------|------------------| - * | image-url | STRING | - * | image-fitting-mode | STRING | - * | image-sampling-mode | STRING | - * | image-desired-width | INT | - * | image-desired-height | INT | + * | %Property Name | Type | + * |-------------------------|------------------| + * | imageUrl | STRING | + * | imageFittingMode | STRING | + * | imageSamplingMode | STRING | + * | imageDesiredWidth | INT | + * | imageDesiredHeight | INT | * - * where image-fitting-mode should be one of the following fitting modes: - * "shrink-to-fit" - * "scale-to-fill" - * "fit-width" - * "fit-height" + * where imageFittingMode should be one of the following fitting modes: + * "shrinkToFit" + * "scaleToFill" + * "fitWidth" + * "fitHeight" * "default" * - * where image-sampling-mode should be one of the following sampling modes: + * where imageSamplingMode should be one of the following sampling modes: * "box" * "nearest" * "linear" - * "box-then-nearest" - * "box-then-linear" - * "no-filter" - * "dont-care" + * "boxThenNearest" + * "boxThenLinear" + * "noFilter" + * "dontCare" * "default" * */ -class ImageRenderer: public ControlRenderer +class ImageRenderer: public ControlRenderer, public ConnectionTracker { public: @@ -115,7 +116,7 @@ protected: /** * @copydoc ControlRenderer::DoInitialize */ - virtual void DoInitialize( const Property::Map& propertyMap ); + virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap ); /** * @copydoc ControlRenderer::DoSetOnStage @@ -127,53 +128,73 @@ protected: */ virtual void DoSetOffStage( Actor& actor ); - /** - * @copydoc ControlRenderer::InitializeRenderer - */ - virtual void InitializeRenderer( Renderer& renderer ); - public: /** * @brief Sets the image of this renderer to the resource at imageUrl * The renderer will load the Image asynchronously when the associated actor is put on stage, and destroy the image when it is off stage * + * @param[in] actor The Actor the renderer is applied to if, empty if the renderer has not been applied to any Actor * @param[in] imageUrl The URL to to image resource to use */ - void SetImage( const std::string& imageUrl ); + void SetImage( Actor& actor, const std::string& imageUrl ); /** * @brief Sets the image of this renderer to the resource at imageUrl * The renderer will load the Image asynchronously when the associated actor is put on stage, and destroy the image when it is off stage * + * @param[in] actor The Actor the renderer is applied to if, empty if the renderer has not been applied to any Actor * @param[in] imageUrl The URL to to image resource to use * @param[in] desiredWidth The desired width of the resource to load * @param[in] desiredHeight The desired height of the resource to load * @param[in] fittingMode The FittingMode of the resource to load * @param[in] samplingMode The SamplingMode of the resource to load */ - void SetImage( const std::string& imageUrl, int desiredWidth, int desiredHeight, Dali::FittingMode::Type fittingMode, Dali::SamplingMode::Type samplingMode ); + void SetImage( Actor& actor, const std::string& imageUrl, int desiredWidth, int desiredHeight, Dali::FittingMode::Type fittingMode, Dali::SamplingMode::Type samplingMode ); /** * @brief Sets the image of this renderer to use * + * @param[in] actor The Actor the renderer is applied to if, empty if the renderer has not been applied to any Actor * @param[in] image The image to use */ - void SetImage( Image image ); + void SetImage( Actor& actor, const Image& image ); + +private: /** - * @brief Gets the image this renderer uses + * @brief Applies the image to the material used for this renderer * - * @return The image this renderer uses, which may be null if the image is set from a URL string and the renderer is not set as onstage + * @param[in] image The Image to apply to the material used for this renderer */ - Image GetImage() const; + void ApplyImageToSampler( const Image& image ); -private: + /** + * @brief Initializes the Dali::Renderer from an image url string + * + * @param[in] imageUrl The image url string to intialize this ImageRenderer from + */ + void InitializeRenderer( const std::string& imageUrl ); + + /** + * @brief Initializes the Dali::Renderer from an image handle + * + * @param[in] image The image handle to intialize this ImageRenderer from + */ + void InitializeRenderer( const Image& image ); + + /** + * @brief Creates the Dali::Renderer (potentially from the renderer cache), initializing it + * + * @return Returns the created Dali::Renderer + */ + Renderer CreateRenderer() const; /** - * @brief Applies this renderer's image to the sampler to the material used for this renderer + * Callback function of image resource loading succeed + * @param[in] image The Image content that we attempted to load from mImageUrl */ - void ApplyImageToSampler(); + void OnImageLoaded( ResourceImage image ); private: Image mImage;