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=26f1d3151cb7da10740080501708f005fabb17ec;hp=c11c6b0d413fd5c962d29bb9e7deb8e6f096b312;hb=23ceb4d9eef323cddf0c0f6d13f3a02226926911;hpb=f3c7e52f300fc2f6d07bcbd75ad3b992e19083f5 diff --git a/dali-toolkit/internal/controls/renderers/image/image-renderer.h b/dali-toolkit/internal/controls/renderers/image/image-renderer.h index c11c6b0..26f1d31 100644 --- a/dali-toolkit/internal/controls/renderers/image/image-renderer.h +++ b/dali-toolkit/internal/controls/renderers/image/image-renderer.h @@ -30,6 +30,8 @@ namespace Dali { +class NativeImage; + namespace Toolkit { @@ -44,30 +46,31 @@ typedef IntrusivePtr< ImageRenderer > ImageRendererPtr; * * The following properties are optional * - * | %Property Name | Type | - * |-------------------------|------------------| - * | imageUrl | STRING | - * | imageFittingMode | STRING | - * | imageSamplingMode | STRING | - * | imageDesiredWidth | INT | - * | imageDesiredHeight | INT | + * | %Property Name | Type | + * |--------------------|------------------| + * | url | STRING | + * | fittingMode | STRING | + * | samplingMode | STRING | + * | desiredWidth | INT | + * | desiredHeight | INT | + * | synchronousLoading | BOOLEAN | * * where imageFittingMode should be one of the following fitting modes: - * "shrinkToFit" - * "scaleToFill" - * "fitWidth" - * "fitHeight" - * "default" + * "SHRINK_TO_FIT" + * "SCALE_TO_FIT" + * "FIT_WIDTH" + * "FIT_HEIGHT" + * "DEFAULT" * * where imageSamplingMode should be one of the following sampling modes: - * "box" - * "nearest" - * "linear" - * "boxThenNearest" - * "boxThenLinear" - * "noFilter" - * "dontCare" - * "default" + * "BOX" + * "NEAREST" + * "LINEAR" + * "BOX_THEN_NEAREST" + * "BOX_THEN_LINEAR" + * "NO_FILTER" + * "DONT_CARE" + * "DEFAULT" * */ class ImageRenderer: public ControlRenderer, public ConnectionTracker @@ -143,7 +146,7 @@ public: * 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] imageUrl The URL of the image resource to use * @param[in] size The width and height to fit the loaded image to. * @param[in] fittingMode The FittingMode of the resource to load * @param[in] samplingMode The SamplingMode of the resource to load @@ -165,9 +168,9 @@ public: private: /** - * @brief Applies the image to the material used for this renderer + * @brief Applies the image to the texture set used for this renderer * - * @param[in] image The Image to apply to the material used for this renderer + * @param[in] image The Image to apply to the texture set used for this renderer */ void ApplyImageToSampler( const Image& image ); @@ -193,6 +196,39 @@ private: Renderer CreateRenderer() const; /** + * @brief Creates the Dali::Renderer for NativeImage with custom sampler type and prefix, initializing it + * + * @return Returns the created Dali::Renderer + */ + Renderer CreateNativeImageRenderer() const; + + /** + * @brief Query whether resources requires to be loaded synchronously. + * @return Returns true if synchronoud resource loading is required, false otherwise. + */ + bool IsSynchronousResourceLoading() const; + + /** + * @brief Do the synchronous resource loading + */ + void DoSynchronousResourceLoading(); + + /** + * Load the image. + * @param[in] url The URL of the image resource to use. + * @param[in] synchronousLoading If true, the resource is loaded synchronously, otherwise asynchronously. + */ + Image LoadImage( const std::string& url, bool synchronousLoading ); + + /** + * Load the image and create a texture set to hold the texture, with automatic atlasing applied. + * @param [out] textureRect The texture area of the resource image in the atlas. + * @param[in] url The URL of the image resource to use. + * @param[in] synchronousLoading If true, the resource is loaded synchronously, otherwise asynchronously. + */ + TextureSet CreateTextureSet( Vector4& textureRect, const std::string& url, bool synchronousLoading ); + + /** * Callback function of image resource loading succeed * @param[in] image The Image content that we attempted to load from mImageUrl */ @@ -209,16 +245,23 @@ private: */ void CleanCache(const std::string& url); + /** + * Set shader code for nativeimage if it exists + */ + void SetNativeFragmentShaderCode( Dali::NativeImage& nativeImage ); + private: Image mImage; ImageAtlasManager& mAtlasManager; - Vector4 mTextureRect; + PixelData mPixels; std::string mImageUrl; Dali::ImageDimensions mDesiredSize; Dali::FittingMode::Type mFittingMode; Dali::SamplingMode::Type mSamplingMode; + std::string mNativeFragmentShaderCode; + bool mNativeImageFlag; }; } // namespace Internal