X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fsvg%2Fsvg-visual.h;h=2ccd337556feee032957c5d088861123cd3e2f55;hp=66de43ce3b88057509c8f24a720786c6ea85c688;hb=HEAD;hpb=5e7b7d7fb3a8c320a9371cf31043a0b3fddb8f3d diff --git a/dali-toolkit/internal/visuals/svg/svg-visual.h b/dali-toolkit/internal/visuals/svg/svg-visual.h index 66de43c..faf8a22 100644 --- a/dali-toolkit/internal/visuals/svg/svg-visual.h +++ b/dali-toolkit/internal/visuals/svg/svg-visual.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_SVG_VISUAL_H /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ // INTERNAL INCLUDES #include #include +#include namespace Dali { @@ -72,9 +73,10 @@ public: * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object * @param[in] shaderFactory The ImageVisualShaderFactory object * @param[in] imageUrl The URL to svg resource to use + * @param[in] size The width and height of the rasterized buffer. The visual size will be used if these are 0. * @return A smart-pointer to the newly allocated visual. */ - static SvgVisualPtr New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl); + static SvgVisualPtr New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, ImageDimensions size = ImageDimensions()); public: // from Visual /** @@ -92,6 +94,11 @@ public: // from Visual */ void DoCreateInstancePropertyMap(Property::Map& map) const override; + /** + * @copydoc Visual::Base::EnablePreMultipliedAlpha + */ + void EnablePreMultipliedAlpha(bool preMultiplied) override; + protected: /** * @brief Constructor. @@ -99,8 +106,9 @@ protected: * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object * @param[in] shaderFactory The ImageVisualShaderFactory object * @param[in] imageUrl The URL to svg resource to use + * @param[in] size The width and height of the rasterized buffer. The visual size will be used if these are 0. */ - SvgVisual(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl); + SvgVisual(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, ImageDimensions size); /** * @brief A reference counted object may only be deleted by calling Unreference(). @@ -133,11 +141,6 @@ protected: void OnSetTransform() override; /** - * @copydoc Visual::Base::IsResourceReady - */ - bool IsResourceReady() const override; - - /** * @copydoc Visual::Base::UpdateShader */ void UpdateShader() override; @@ -151,19 +154,12 @@ public: /** * @bried Apply the rasterized image to the visual. * - * @param[in] vectorImage The data of vector image. - * @param[in] rasterizedPixelData The pixel buffer with the rasterized pixels - * @param[in] bool Whether the resource is loaded + * @param[in] task SvgTaskPtr */ - void ApplyRasterizedImage(VectorImageRenderer vectorImage, PixelData rasterizedPixelData, bool isLoaded); + void ApplyRasterizedImage(SvgTaskPtr task); private: /** - * @brief Load the SVG Image from the set URL. - */ - void Load(); - - /** * @bried Rasterize the svg with the given size, and add it to the visual. * * @param[in] size The target size of the SVG rasterization. @@ -191,7 +187,10 @@ private: uint32_t mDefaultWidth; uint32_t mDefaultHeight; WeakHandle mPlacementActor; - Vector2 mVisualSize; + Vector2 mRasterizedSize; + Dali::ImageDimensions mDesiredSize{}; + SvgTaskPtr mLoadingTask; + SvgTaskPtr mRasterizingTask; bool mLoadFailed; bool mAttemptAtlasing; ///< If true will attempt atlasing, otherwise create unique texture };