Allow to use premultiplied external texture 55/290455/7
authorEunki Hong <eunkiki.hong@samsung.com>
Sat, 25 Mar 2023 12:26:04 +0000 (21:26 +0900)
committerEunki Hong <eunkiki.hong@samsung.com>
Mon, 27 Mar 2023 17:13:15 +0000 (02:13 +0900)
FrameBuffer result colortexture is premultiplied always.
So make we always use premultiplied texture.

And make a way to user determine native image source is premultiplied or not.

+

Since FBO texture always premultiplied, revert scene view's trick
https://review.tizen.org/gerrit/c/platform/core/uifw/dali-toolkit/+/285486

Change-Id: I72bfe4a04a69c259d983e9dc74086cefcdd4cc7d
Signed-off-by: Eunki Hong <eunkiki.hong@samsung.com>
18 files changed:
automated-tests/src/dali-toolkit/utc-Dali-Image.cpp
automated-tests/src/dali-toolkit/utc-Dali-ImageUrl.cpp
automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextureManager.cpp
dali-scene3d/internal/controls/scene-view/scene-view-impl.cpp
dali-toolkit/devel-api/image-loader/texture-manager.cpp
dali-toolkit/devel-api/image-loader/texture-manager.h
dali-toolkit/internal/image-loader/image-url-impl.cpp
dali-toolkit/internal/image-loader/image-url-impl.h
dali-toolkit/internal/texture-manager/texture-cache-manager.cpp
dali-toolkit/internal/texture-manager/texture-cache-manager.h
dali-toolkit/internal/texture-manager/texture-manager-impl.cpp
dali-toolkit/internal/texture-manager/texture-manager-impl.h
dali-toolkit/internal/texture-manager/texture-manager-type.h
dali-toolkit/public-api/image-loader/image-url.cpp
dali-toolkit/public-api/image-loader/image-url.h
dali-toolkit/public-api/image-loader/image.cpp
dali-toolkit/public-api/image-loader/image.h

index 6dff87b..4767977 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -77,10 +77,10 @@ int UtcDaliImageConvertFrameBufferToUrl2(void)
   END_TEST;
 }
 
-int UtcDaliImageConvertPixelDataToUrl(void)
+int UtcDaliImageConvertPixelDataToUrl01(void)
 {
   ToolkitTestApplication application;
-  tet_infoline("UtcDaliImageConvertPixelDataToUrl");
+  tet_infoline("UtcDaliImageConvertPixelDataToUrl01");
 
   unsigned int width(64);
   unsigned int height(64);
@@ -94,10 +94,27 @@ int UtcDaliImageConvertPixelDataToUrl(void)
   END_TEST;
 }
 
-int UtcDaliImageConvertNativeImageSourceToUrl(void)
+int UtcDaliImageConvertPixelDataToUrl02(void)
 {
   ToolkitTestApplication application;
-  tet_infoline("UtcDaliImageConvertNativeImageSourceToUrl");
+  tet_infoline("UtcDaliImageConvertPixelDataToUrl02");
+
+  unsigned int width(64);
+  unsigned int height(64);
+  unsigned int bufferSize = width * height * Pixel::GetBytesPerPixel(Pixel::RGBA8888);
+
+  unsigned char* buffer    = reinterpret_cast<unsigned char*>(malloc(bufferSize));
+  PixelData      pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE);
+
+  DALI_TEST_CHECK(Dali::Toolkit::Image::GenerateUrl(pixelData, true).GetUrl().size() > 0u);
+
+  END_TEST;
+}
+
+int UtcDaliImageConvertNativeImageSourceToUrl01(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("UtcDaliImageConvertNativeImageSourceToUrl01");
 
   unsigned int width(64);
   unsigned int height(64);
@@ -121,6 +138,33 @@ int UtcDaliImageConvertNativeImageSourceToUrl(void)
   END_TEST;
 }
 
+int UtcDaliImageConvertNativeImageSourceToUrl02(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("UtcDaliImageConvertNativeImageSourceToUrl02");
+
+  unsigned int width(64);
+  unsigned int height(64);
+  try
+  {
+    NativeImageSourcePtr nativeImageSource = NativeImageSource::New(width, height, NativeImageSource::COLOR_DEPTH_DEFAULT);
+
+    DALI_TEST_CHECK(Dali::Toolkit::Image::GenerateUrl(nativeImageSource, true).GetUrl().size() > 0u);
+  }
+  catch(Dali::DaliException& e)
+  {
+    DALI_TEST_PRINT_ASSERT(e);
+    DALI_TEST_ASSERT(e, "Adaptor::IsAvailable()", TEST_LOCATION);
+  }
+  catch(...)
+  {
+    tet_printf("Assertion test failed - wrong Exception\n");
+    tet_result(TET_FAIL);
+  }
+
+  END_TEST;
+}
+
 int UtcDaliImageConvertEncodedImageBufferToUrl(void)
 {
   ToolkitTestApplication application;
index 658d585..d137c5d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -24,7 +24,7 @@
 using namespace Dali;
 using namespace Dali::Toolkit;
 
-int UtcImageUrlConstructor(void)
+int UtcImageUrlConstructor01(void)
 {
   ToolkitTestApplication application;
 
@@ -50,3 +50,30 @@ int UtcImageUrlConstructor(void)
   DALI_TEST_CHECK(downcastUrl);
   END_TEST;
 }
+
+int UtcImageUrlConstructor02(void)
+{
+  ToolkitTestApplication application;
+
+  tet_infoline(" UtcImageUrlValid ");
+
+  // Test default constructor.
+  ImageUrl imageUrl;
+  DALI_TEST_CHECK(!imageUrl);
+
+  // Test object creation
+  Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 4u, 4u); // test texture
+  imageUrl      = ImageUrl::New(image, true);
+  DALI_TEST_CHECK(imageUrl);
+
+  // Test copy constructor
+  ImageUrl ImageUrlCopy(imageUrl);
+  DALI_TEST_CHECK(ImageUrlCopy);
+
+  // Test down cast
+  BaseHandle baseUrl;
+  baseUrl              = imageUrl;
+  ImageUrl downcastUrl = ImageUrl::DownCast(baseUrl);
+  DALI_TEST_CHECK(downcastUrl);
+  END_TEST;
+}
index 1fcd10d..43c7530 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -424,6 +424,198 @@ int UtcDaliImageVisualRemoteImageLoad(void)
   END_TEST;
 }
 
+int UtcDaliImageVisualWithFrameBufferPreMultipliedAlpha01(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("Use FrameBuffer as url");
+
+  uint32_t width(64);
+  uint32_t height(64);
+  FrameBuffer frameBuffer = Dali::FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE);
+
+  DALI_TEST_CHECK(frameBuffer);
+  ImageUrl    imageUrl = Dali::Toolkit::Image::GenerateUrl(frameBuffer, Pixel::Format::RGBA8888, width, height);
+  std::string url      = imageUrl.GetUrl();
+
+  VisualFactory factory = VisualFactory::Get();
+  DALI_TEST_CHECK(factory);
+
+  Property::Map propertyMap;
+  propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::IMAGE);
+  propertyMap.Insert(ImageVisual::Property::URL, url);
+
+  Visual::Base visual = factory.CreateVisual(propertyMap);
+  DALI_TEST_CHECK(visual);
+
+  DummyControl      actor     = DummyControl::New();
+  DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+  dummyImpl.RegisterVisual(Control::CONTROL_PROPERTY_END_INDEX + 1, visual);
+
+  DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
+
+  application.GetScene().Add(actor);
+
+  DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
+
+  application.SendNotification();
+  application.Render(16);
+
+  Renderer renderer = actor.GetRendererAt(0);
+
+  // Check whether preMultipliedAlpha is true.
+  auto preMultipliedAlpha = renderer.GetProperty<bool>(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA);
+  DALI_TEST_EQUALS(preMultipliedAlpha, true, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliImageVisualWithFrameBufferPreMultipliedAlpha02(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("Use FrameBuffer as url");
+
+  uint32_t width(64);
+  uint32_t height(64);
+  FrameBuffer frameBuffer = Dali::FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE);
+
+  DALI_TEST_CHECK(frameBuffer);
+
+  Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+  frameBuffer.AttachColorTexture(texture);
+
+  ImageUrl    imageUrl = Dali::Toolkit::Image::GenerateUrl(frameBuffer, 0u);
+  std::string url      = imageUrl.GetUrl();
+
+  VisualFactory factory = VisualFactory::Get();
+  DALI_TEST_CHECK(factory);
+
+  Property::Map propertyMap;
+  propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::IMAGE);
+  propertyMap.Insert(ImageVisual::Property::URL, url);
+
+  Visual::Base visual = factory.CreateVisual(propertyMap);
+  DALI_TEST_CHECK(visual);
+
+  DummyControl      actor     = DummyControl::New();
+  DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+  dummyImpl.RegisterVisual(Control::CONTROL_PROPERTY_END_INDEX + 1, visual);
+
+  DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
+
+  application.GetScene().Add(actor);
+
+  DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
+
+  application.SendNotification();
+  application.Render(16);
+
+  Renderer renderer = actor.GetRendererAt(0);
+
+  // Check whether preMultipliedAlpha is true.
+  auto preMultipliedAlpha = renderer.GetProperty<bool>(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA);
+  DALI_TEST_EQUALS(preMultipliedAlpha, true, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliImageVisualWithPixelData(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("Use PixelData as url");
+
+  uint32_t width(64);
+  uint32_t height(64);
+  uint32_t bufferSize = width * height * Pixel::GetBytesPerPixel(Pixel::RGBA8888);
+
+  uint8_t*  buffer    = reinterpret_cast<uint8_t*>(malloc(bufferSize));
+  PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE);
+
+  DALI_TEST_CHECK(pixelData);
+
+  ImageUrl    imageUrl = Dali::Toolkit::Image::GenerateUrl(pixelData);
+  std::string url      = imageUrl.GetUrl();
+
+  VisualFactory factory = VisualFactory::Get();
+  DALI_TEST_CHECK(factory);
+
+  Property::Map propertyMap;
+  propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::IMAGE);
+  propertyMap.Insert(ImageVisual::Property::URL, url);
+
+  Visual::Base visual = factory.CreateVisual(propertyMap);
+  DALI_TEST_CHECK(visual);
+
+  DummyControl      actor     = DummyControl::New();
+  DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+  dummyImpl.RegisterVisual(Control::CONTROL_PROPERTY_END_INDEX + 1, visual);
+
+  DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
+
+  application.GetScene().Add(actor);
+
+  DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
+
+  application.SendNotification();
+  application.Render(16);
+
+  Renderer renderer = actor.GetRendererAt(0);
+
+  // Check whether preMultipliedAlpha is false.
+  auto preMultipliedAlpha = renderer.GetProperty<bool>(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA);
+  DALI_TEST_EQUALS(preMultipliedAlpha, false, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliImageVisualWithPixelDataPreMultipliedAlpha(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("Use PixelData as url");
+
+  uint32_t width(64);
+  uint32_t height(64);
+  uint32_t bufferSize = width * height * Pixel::GetBytesPerPixel(Pixel::RGBA8888);
+
+  uint8_t*  buffer    = reinterpret_cast<uint8_t*>(malloc(bufferSize));
+  PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE);
+
+  DALI_TEST_CHECK(pixelData);
+
+  ImageUrl    imageUrl = Dali::Toolkit::Image::GenerateUrl(pixelData, true);
+  std::string url      = imageUrl.GetUrl();
+
+  VisualFactory factory = VisualFactory::Get();
+  DALI_TEST_CHECK(factory);
+
+  Property::Map propertyMap;
+  propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::IMAGE);
+  propertyMap.Insert(ImageVisual::Property::URL, url);
+
+  Visual::Base visual = factory.CreateVisual(propertyMap);
+  DALI_TEST_CHECK(visual);
+
+  DummyControl      actor     = DummyControl::New();
+  DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+  dummyImpl.RegisterVisual(Control::CONTROL_PROPERTY_END_INDEX + 1, visual);
+
+  DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
+
+  application.GetScene().Add(actor);
+
+  DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
+
+  application.SendNotification();
+  application.Render(16);
+
+  Renderer renderer = actor.GetRendererAt(0);
+
+  // Check whether preMultipliedAlpha is true.
+  auto preMultipliedAlpha = renderer.GetProperty<bool>(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA);
+  DALI_TEST_EQUALS(preMultipliedAlpha, true, TEST_LOCATION);
+
+  END_TEST;
+}
+
 int UtcDaliImageVisualWithNativeImage(void)
 {
   ToolkitTestApplication application;
@@ -453,6 +645,9 @@ int UtcDaliImageVisualWithNativeImage(void)
 
   DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
 
+  application.SendNotification();
+  application.Render(16);
+
   Renderer renderer = actor.GetRendererAt(0);
   Shader   shader   = renderer.GetShader();
 
@@ -466,6 +661,62 @@ int UtcDaliImageVisualWithNativeImage(void)
 
   DALI_TEST_EQUALS(pos != std::string::npos, true, TEST_LOCATION);
 
+  // Check whether preMultipliedAlpha is false.
+  auto preMultipliedAlpha = renderer.GetProperty<bool>(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA);
+  DALI_TEST_EQUALS(preMultipliedAlpha, false, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliImageVisualWithNativeImagePreMultipliedAlpha(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("Use Native Image as url");
+
+  NativeImageSourcePtr nativeImageSource = NativeImageSource::New(500, 500, NativeImageSource::COLOR_DEPTH_DEFAULT);
+  ImageUrl             imageUrl          = Dali::Toolkit::Image::GenerateUrl(nativeImageSource, true);
+  std::string          url               = imageUrl.GetUrl();
+
+  VisualFactory factory = VisualFactory::Get();
+  DALI_TEST_CHECK(factory);
+
+  Property::Map propertyMap;
+  propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::IMAGE);
+  propertyMap.Insert(ImageVisual::Property::URL, url);
+
+  Visual::Base visual = factory.CreateVisual(propertyMap);
+  DALI_TEST_CHECK(visual);
+
+  DummyControl      actor     = DummyControl::New();
+  DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+  dummyImpl.RegisterVisual(Control::CONTROL_PROPERTY_END_INDEX + 1, visual);
+
+  DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
+
+  application.GetScene().Add(actor);
+
+  DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
+
+  application.SendNotification();
+  application.Render(16);
+
+  Renderer renderer = actor.GetRendererAt(0);
+  Shader   shader   = renderer.GetShader();
+
+  Property::Value value = shader.GetProperty(Shader::Property::PROGRAM);
+  DALI_TEST_CHECK(value.GetType() == Property::MAP);
+  const Property::Map* outMap         = value.GetMap();
+  std::string          fragmentShader = (*outMap)["fragment"].Get<std::string>();
+
+  const char* fragmentPrefix = Dali::NativeImageSourceTest::GetCustomFragmentPrefix();
+  size_t      pos            = fragmentShader.find(fragmentPrefix);
+
+  DALI_TEST_EQUALS(pos != std::string::npos, true, TEST_LOCATION);
+
+  // Check whether preMultipliedAlpha is true.
+  auto preMultipliedAlpha = renderer.GetProperty<bool>(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA);
+  DALI_TEST_EQUALS(preMultipliedAlpha, true, TEST_LOCATION);
+
   END_TEST;
 }
 
@@ -475,7 +726,7 @@ int UtcDaliImageVisualWithNativeImageCustomShader(void)
   tet_infoline("Use Native Image as url and Use custom shader");
 
   NativeImageSourcePtr nativeImageSource = NativeImageSource::New(500, 500, NativeImageSource::COLOR_DEPTH_DEFAULT);
-  ImageUrl             imageUrl          = Dali::Toolkit::Image::GenerateUrl(nativeImageSource);
+  ImageUrl             imageUrl          = Dali::Toolkit::Image::GenerateUrl(nativeImageSource, true);
   std::string          url               = imageUrl.GetUrl();
 
   VisualFactory factory = VisualFactory::Get();
@@ -531,6 +782,11 @@ int UtcDaliImageVisualWithNativeImageCustomShader(void)
 
   DALI_TEST_EQUALS(std::string(fragmentPrefix) + customFragmentShaderSource, fragmentShaderSource, TEST_LOCATION);
 
+  // Check whether preMultipliedAlpha is false.
+  // Note : We dont use preMultiplied alpha when app developer using custom shader.
+  auto preMultipliedAlpha = renderer.GetProperty<bool>(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA);
+  DALI_TEST_EQUALS(preMultipliedAlpha, false, TEST_LOCATION);
+
   END_TEST;
 }
 
index 116b489..beba867 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -47,6 +47,8 @@ int UtcDaliTextureManagerAddRemoveP(void)
   std::string url2;
   std::string url3;
   std::string url4;
+  std::string url5;
+  std::string url6;
   // scope to ensure texturesets are kept alive by texture manager
   {
     auto texture = Texture::New(Dali::TextureType::TEXTURE_2D, Pixel::RGBA8888, 88, 99);
@@ -71,6 +73,23 @@ int UtcDaliTextureManagerAddRemoveP(void)
     DALI_TEST_CHECK(url4 != url);
     DALI_TEST_CHECK(url4 != url2);
     DALI_TEST_CHECK(url4 != url3);
+
+    // add same texture again with preMultiplied, should give new Url
+    url5 = TextureManager::AddTexture(texture, true);
+    DALI_TEST_CHECK(url5.size() > 0u);
+    DALI_TEST_CHECK(url5 != url);
+    DALI_TEST_CHECK(url5 != url2);
+    DALI_TEST_CHECK(url5 != url3);
+    DALI_TEST_CHECK(url5 != url4);
+
+    textureSet = TextureSet::New();
+    url6       = TextureManager::AddTexture(textureSet, true);
+    DALI_TEST_CHECK(url6.size() > 0u);
+    DALI_TEST_CHECK(url6 != url);
+    DALI_TEST_CHECK(url6 != url2);
+    DALI_TEST_CHECK(url6 != url3);
+    DALI_TEST_CHECK(url6 != url4);
+    DALI_TEST_CHECK(url6 != url5);
   }
 
   auto textureSet = TextureManager::RemoveTexture(url);
@@ -102,6 +121,16 @@ int UtcDaliTextureManagerAddRemoveP(void)
   textureSet = TextureManager::RemoveTexture(url4);
   DALI_TEST_CHECK(!textureSet && "Texture needs to be removed from texture manager");
 
+  textureSet = TextureManager::RemoveTexture(url5);
+  DALI_TEST_CHECK(textureSet && "Texture needs to be non empty handle");
+  textureSet = TextureManager::RemoveTexture(url5);
+  DALI_TEST_CHECK(!textureSet && "Texture needs to be removed from texture manager");
+
+  textureSet = TextureManager::RemoveTexture(url6);
+  DALI_TEST_CHECK(textureSet && "Texture needs to be non empty handle");
+  textureSet = TextureManager::RemoveTexture(url6);
+  DALI_TEST_CHECK(!textureSet && "Texture needs to be removed from texture manager");
+
   END_TEST;
 }
 
index 946eb98..e2e6912 100644 (file)
@@ -668,19 +668,10 @@ void SceneView::UpdateRenderTask()
         Property::Map imagePropertyMap;
         imagePropertyMap.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE);
         imagePropertyMap.Insert(Toolkit::ImageVisual::Property::URL, imageUrl.GetUrl());
-        // To make sure this visual call LoadTexture API immediate.
-        imagePropertyMap.Insert(Toolkit::ImageVisual::Property::LOAD_POLICY, Toolkit::ImageVisual::LoadPolicy::IMMEDIATE);
-        imagePropertyMap.Insert(Toolkit::ImageVisual::Property::RELEASE_POLICY, Toolkit::ImageVisual::ReleasePolicy::DESTROYED);
         // To flip rendered scene without CameraActor::SetInvertYAxis() to avoid backface culling.
         imagePropertyMap.Insert(Toolkit::ImageVisual::Property::PIXEL_AREA, Vector4(0.0f, 1.0f, 1.0f, -1.0f));
         mVisual = Toolkit::VisualFactory::Get().CreateVisual(imagePropertyMap);
 
-        // Use premultiplied alpha when we use FBO
-        if(mVisual)
-        {
-          Toolkit::GetImplementation(mVisual).EnablePreMultipliedAlpha(true);
-        }
-
         Toolkit::DevelControl::RegisterVisual(*this, RENDERING_BUFFER, mVisual);
 
         mRenderTask.SetFrameBuffer(mFrameBuffer);
index cff4718..ace107e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -26,18 +26,18 @@ namespace Toolkit
 {
 namespace TextureManager
 {
-std::string AddTexture(Texture& texture)
+std::string AddTexture(Texture& texture, bool preMultiplied)
 {
   TextureSet set = TextureSet::New();
   set.SetTexture(0u, texture);
-  return AddTexture(set);
+  return AddTexture(set, preMultiplied);
 }
 
-std::string AddTexture(TextureSet& textureSet)
+std::string AddTexture(TextureSet& textureSet, bool preMultiplied)
 {
   auto  visualFactory = Toolkit::VisualFactory::Get();
   auto& textureMgr    = GetImplementation(visualFactory).GetTextureManager();
-  return textureMgr.AddExternalTexture(textureSet);
+  return textureMgr.AddExternalTexture(textureSet, preMultiplied);
 }
 
 TextureSet RemoveTexture(const std::string& textureUrl)
index f18ed14..ff61916 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_DEVEL_API_TEXTURE_MANAGER_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -39,9 +39,10 @@ namespace TextureManager
  * @note this method does not check for duplicates,
  *       if same Texture is added multiple times, a different URL is returned each time
  * @param[in] texture the Texture to add
+ * @param[in] preMultiplied Whether this external texture preMultiplied or not. Default as false.
  * @return the Url string representing this texture
  */
-DALI_TOOLKIT_API std::string AddTexture(Texture& texture);
+DALI_TOOLKIT_API std::string AddTexture(Texture& texture, bool preMultiplied = false);
 
 /**
  * @brief Add a TextureSet to texture manager
@@ -49,9 +50,10 @@ DALI_TOOLKIT_API std::string AddTexture(Texture& texture);
  * @note this method does not check for duplicates,
  *       if same TextureSet is added multiple times, a different URL is returned each time
  * @param[in] textureSet the TextureSet to add
+ * @param[in] preMultiplied Whether this external texture preMultiplied or not. Default as false.
  * @return the Url string representing this texture
  */
-DALI_TOOLKIT_API std::string AddTexture(TextureSet& textureSet);
+DALI_TOOLKIT_API std::string AddTexture(TextureSet& textureSet, bool preMultiplied = false);
 
 /**
  * @brief Removes a TextureSet from toolkit
index fae9fc1..31dc6fc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -30,9 +30,9 @@ namespace Toolkit
 {
 namespace Internal
 {
-ImageUrl::ImageUrl(Texture& texture)
+ImageUrl::ImageUrl(Texture& texture, bool preMultiplied)
 {
-  mUrl = Dali::Toolkit::TextureManager::AddTexture(texture);
+  mUrl = Dali::Toolkit::TextureManager::AddTexture(texture, preMultiplied);
 }
 
 ImageUrl::ImageUrl(const EncodedImageBuffer& encodedImageBuffer)
@@ -66,9 +66,9 @@ ImageUrl::~ImageUrl()
   }
 }
 
-ImageUrlPtr ImageUrl::New(Texture& texture)
+ImageUrlPtr ImageUrl::New(Texture& texture, bool preMultiplied)
 {
-  ImageUrlPtr imageUrlPtr = new ImageUrl(texture);
+  ImageUrlPtr imageUrlPtr = new ImageUrl(texture, preMultiplied);
   return imageUrlPtr;
 }
 
index 99616bf..f7ae8ef 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_INTERNAL_IMAGE_URL_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -41,7 +41,7 @@ public:
   /**
    * @brief Constructor.
    */
-  ImageUrl(Texture& texture);
+  ImageUrl(Texture& texture, bool preMultiplied);
 
   /**
    * @brief Constructor.
@@ -51,7 +51,7 @@ public:
   /**
    * @copydoc Dali::Toolkit::ImageUrl::New
    */
-  static ImageUrlPtr New(Texture& texture);
+  static ImageUrlPtr New(Texture& texture, bool preMultiplied);
 
   /**
    * @copydoc Dali::Toolkit::ImageUrl::New
index fc3ffde..fc77c6f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include "texture-cache-manager.h"
+#include <dali-toolkit/internal/texture-manager/texture-cache-manager.h>
 
 // EXTERNAL HEADERS
 #include <dali/devel-api/common/hash.h>
@@ -193,15 +193,12 @@ Texture TextureCacheManager::GetTexture(const TextureCacheManager::TextureId& te
   return texture;
 }
 
-TextureSet TextureCacheManager::GetExternalTextureSet(const TextureCacheManager::TextureId& textureId)
+TextureCacheManager::ExternalTextureInfo& TextureCacheManager::GetExternalTextureInfo(const TextureCacheManager::TextureId& textureId)
 {
-  TextureSet        textureSet; // empty handle
   TextureCacheIndex cacheIndex = GetCacheIndexFromExternalTextureId(textureId);
-  if(cacheIndex != INVALID_CACHE_INDEX)
-  {
-    textureSet = mExternalTextures[cacheIndex.GetIndex()].textureSet;
-  }
-  return textureSet;
+  DALI_ASSERT_ALWAYS(cacheIndex != INVALID_CACHE_INDEX);
+
+  return mExternalTextures[cacheIndex.GetIndex()];
 }
 
 EncodedImageBuffer TextureCacheManager::GetEncodedImageBuffer(const TextureCacheManager::TextureId& bufferId)
@@ -230,14 +227,14 @@ EncodedImageBuffer TextureCacheManager::GetEncodedImageBuffer(const VisualUrl& u
   return encodedImageBuffer;
 }
 
-std::string TextureCacheManager::AddExternalTexture(const TextureSet& textureSet)
+std::string TextureCacheManager::AddExternalTexture(const TextureSet& textureSet, bool preMultiplied)
 {
   TextureId textureId = GenerateTextureId(TextureCacheIndex(TextureCacheIndexType::TEXTURE_CACHE_INDEX_TYPE_TEXTURE, mExternalTextures.size()));
 
-  TextureCacheManager::ExternalTextureInfo textureInfo(textureId, textureSet);
+  TextureCacheManager::ExternalTextureInfo textureInfo(textureId, textureSet, preMultiplied);
   mExternalTextures.emplace_back(textureInfo);
 
-  DALI_LOG_INFO(gTextureManagerLogFilter, Debug::Concise, "TextureCacheManager::AddExternalTexture() : New texture registered. textureId:%d\n", textureInfo.textureId);
+  DALI_LOG_INFO(gTextureManagerLogFilter, Debug::Concise, "TextureCacheManager::AddExternalTexture() : New texture registered. textureId:%d, preMultiplied:%d\n", textureInfo.textureId, preMultiplied);
 
   return VisualUrl::CreateTextureUrl(std::to_string(textureInfo.textureId));
 }
index c1f1355..75686a1 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_TEXTURE_CACHE_MANAGER_H
 
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -70,13 +70,14 @@ public:
   static constexpr TextureId         INVALID_TEXTURE_ID  = TextureManagerType::INVALID_TEXTURE_ID;
   static constexpr TextureCacheIndex INVALID_CACHE_INDEX = TextureManagerType::INVALID_CACHE_INDEX;
 
-  using UseAtlas       = TextureManagerType::UseAtlas;
-  using StorageType    = TextureManagerType::StorageType;
-  using LoadType       = TextureManagerType::LoadType;
-  using LoadState      = TextureManagerType::LoadState;
-  using ReloadPolicy   = TextureManagerType::ReloadPolicy;
-  using MultiplyOnLoad = TextureManagerType::MultiplyOnLoad;
-  using TextureInfo    = TextureManagerType::TextureInfo;
+  using UseAtlas            = TextureManagerType::UseAtlas;
+  using StorageType         = TextureManagerType::StorageType;
+  using LoadType            = TextureManagerType::LoadType;
+  using LoadState           = TextureManagerType::LoadState;
+  using ReloadPolicy        = TextureManagerType::ReloadPolicy;
+  using MultiplyOnLoad      = TextureManagerType::MultiplyOnLoad;
+  using TextureInfo         = TextureManagerType::TextureInfo;
+  using ExternalTextureInfo = TextureManagerType::ExternalTextureInfo;
 
 public:
   /**
@@ -126,11 +127,11 @@ public:
   Texture GetTexture(const TextureCacheManager::TextureId& textureId, uint32_t textureIndex = 0);
 
   /**
-   * @brief Get the external texture set if the texture id is valid
+   * @brief Get the external texture set information if the texture id is valid
    * @param[in] textureId The texture Id to look up
-   * @return the external texture set, or an empty handle if textureId is not valid
+   * @return the external texture information. Assert if textureId is not valid
    */
-  TextureSet GetExternalTextureSet(const TextureCacheManager::TextureId& textureId);
+  TextureCacheManager::ExternalTextureInfo& GetExternalTextureInfo(const TextureCacheManager::TextureId& textureId);
 
   /**
    * @brief Get the encoded image buffer
@@ -149,9 +150,10 @@ public:
   /**
    * Adds an external texture to the texture manager
    * @param[in] texture The texture to add
+   * @param[in] preMultiplied Whether this external texture preMultiplied or not. Default as false.
    * @return string containing the URL for the texture
    */
-  std::string AddExternalTexture(const TextureSet& texture);
+  std::string AddExternalTexture(const TextureSet& texture, bool preMultiplied);
 
   /**
    * Adds an encoded image buffer to the texture manager
@@ -300,23 +302,6 @@ private:
   // Private defined structs.
 
   /**
-   * @brief This struct is used to manage the life-cycle of ExternalTexture url.
-   */
-  struct ExternalTextureInfo
-  {
-    ExternalTextureInfo(const TextureCacheManager::TextureId& textureId,
-                        const TextureSet&                     textureSet)
-    : textureId(textureId),
-      textureSet(textureSet),
-      referenceCount(1u)
-    {
-    }
-    TextureCacheManager::TextureId textureId;
-    TextureSet                     textureSet;
-    std::int16_t                   referenceCount;
-  };
-
-  /**
    * @brief This struct is used to manage the life-cycle of EncodedImageBuffer url.
    */
   struct EncodedImageBufferInfo
index 0984e2f..9e8cec5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include "texture-manager-impl.h"
+#include <dali-toolkit/internal/texture-manager/texture-manager-impl.h>
 
 // EXTERNAL HEADERS
 #include <dali/devel-api/adaptor-framework/environment-variable.h>
@@ -299,12 +299,18 @@ TextureSet TextureManager::LoadTexture(
     if(location.size() > 0u)
     {
       TextureId id = std::stoi(location);
-      textureSet   = mTextureCacheManager.GetExternalTextureSet(id);
-      if(textureSet)
+      auto externalTextureInfo   = mTextureCacheManager.GetExternalTextureInfo(id);
+      if(externalTextureInfo.textureSet)
       {
-        preMultiplyOnLoad = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
-        textureId         = id;
-        return textureSet;
+        textureId = id;
+
+        if(preMultiplyOnLoad == TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD)
+        {
+          // Change preMultiplyOnLoad value so make caller determine to preMultiplyAlpha or not.
+          // TODO : Should we seperate input and output value?
+          preMultiplyOnLoad = externalTextureInfo.preMultiplied ? TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD : TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
+        }
+        return externalTextureInfo.textureSet;
       }
     }
   }
index 54db840..d3aabb5 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_TEXTURE_MANAGER_IMPL_H
 
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -326,9 +326,9 @@ public:
   /**
    * @copydoc TextureCacheManager::AddExternalTexture
    */
-  inline std::string AddExternalTexture(const TextureSet& texture)
+  inline std::string AddExternalTexture(const TextureSet& texture, bool preMultiplied = false)
   {
-    return mTextureCacheManager.AddExternalTexture(texture);
+    return mTextureCacheManager.AddExternalTexture(texture, preMultiplied);
   }
 
   /**
index 74057fc..2d95210 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_TEXTURE_MANAGER_TYPE_H
 
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -234,18 +234,18 @@ struct TextureInfo
               const TextureId&                  maskTextureId,
               const VisualUrl&                  url,
               const Dali::ImageDimensions&      desiredSize,
-              const float&                      scaleFactor,
+              float                             scaleFactor,
               const Dali::FittingMode::Type&    fittingMode,
               const Dali::SamplingMode::Type&   samplingMode,
-              const bool&                       loadSynchronously,
-              const bool&                       cropToMask,
+              bool                              loadSynchronously,
+              bool                              cropToMask,
               const UseAtlas&                   useAtlas,
               const TextureHash&                hash,
-              const bool&                       orientationCorrection,
-              const bool&                       preMultiplyOnLoad,
+              bool                              orientationCorrection,
+              bool                              preMultiplyOnLoad,
               const Dali::AnimatedImageLoading& animatedImageLoading,
-              const std::uint32_t&              frameIndex,
-              const bool&                       loadYuvPlanes)
+              std::uint32_t                     frameIndex,
+              bool                              loadYuvPlanes)
   : url(url),
     desiredSize(desiredSize),
     useSize(desiredSize),
@@ -311,6 +311,27 @@ struct TextureInfo
   bool loadYuvPlanes : 1;         ///< true if the image should be loaded as yuv planes
 };
 
+/**
+ * @brief This struct is used to manage the life-cycle of ExternalTexture url.
+ */
+struct ExternalTextureInfo
+{
+  ExternalTextureInfo(const TextureId&  textureId,
+                      const TextureSet& textureSet,
+                      bool              preMultiplied)
+  : textureId(textureId),
+    textureSet(textureSet),
+    referenceCount(1u),
+    preMultiplied(preMultiplied)
+  {
+  }
+
+  TextureId    textureId;         ///< The TextureId associated with this ExternalTexture
+  TextureSet   textureSet;        ///< The external texture
+  std::int16_t referenceCount;    ///< The reference count of clients using this ExternalTexture
+  bool         preMultiplied : 1; ///< True if the image's color was multiplied by it's alpha
+};
+
 } // namespace TextureManagerType
 
 } // namespace Internal
index 67f2401..35d4c77 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -32,9 +32,9 @@ ImageUrl::~ImageUrl()
 {
 }
 
-ImageUrl ImageUrl::New(Texture& texture)
+ImageUrl ImageUrl::New(Texture& texture, bool preMultiplied)
 {
-  Toolkit::Internal::ImageUrlPtr internal = Toolkit::Internal::ImageUrl::New(texture);
+  Toolkit::Internal::ImageUrlPtr internal = Toolkit::Internal::ImageUrl::New(texture, preMultiplied);
   return ImageUrl(internal.Get());
 }
 
index 872d872..7e5b700 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_IMAGE_URL_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -60,9 +60,10 @@ public:
    * @brief Create an initialized ImageUrl.
    *
    * @param[in] texture The texture url is got from external buffer.
+   * @param[in] preMultiplied Whether this external texture preMultiplied or not. Default as false.
    * @return A handle to a newly allocated Dali resource.
    */
-  static ImageUrl New(Texture& texture);
+  static ImageUrl New(Texture& texture, bool preMultiplied = false);
 
   /**
    * @brief Create an initialized ImageUrl.
index 7b91059..8ca77d2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -15,7 +15,7 @@
  */
 
 // CLASS HEADER
-#include "image.h"
+#include <dali-toolkit/public-api/image-loader/image.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/image-loader/texture-manager.h>
@@ -34,29 +34,31 @@ Dali::Toolkit::ImageUrl GenerateUrl(Dali::FrameBuffer frameBuffer, Pixel::Format
 {
   Texture texture = Texture::New(Dali::TextureType::TEXTURE_2D, pixelFormat, width, height);
   frameBuffer.AttachColorTexture(texture, 0u, 0u);
-  Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::ImageUrl::New(texture);
+  // TODO : Need to check frameBuffer result use preMultiplied color or not. By default, we use premultiplied
+  Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::ImageUrl::New(texture, true);
   return imageUrl;
 }
 
 Dali::Toolkit::ImageUrl GenerateUrl(const Dali::FrameBuffer frameBuffer, uint8_t index)
 {
   Texture texture = Dali::DevelFrameBuffer::GetColorTexture(frameBuffer, index);
-  Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::ImageUrl::New(texture);
+  // TODO : Need to check frameBuffer result use preMultiplied color or not. By default, we use premultiplied
+  Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::ImageUrl::New(texture, true);
   return imageUrl;
 }
 
-Dali::Toolkit::ImageUrl GenerateUrl(const Dali::PixelData pixelData)
+Dali::Toolkit::ImageUrl GenerateUrl(const Dali::PixelData pixelData, bool preMultiplied)
 {
   Texture texture = Texture::New(TextureType::TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight());
   texture.Upload(pixelData);
-  Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::ImageUrl::New(texture);
+  Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::ImageUrl::New(texture, preMultiplied);
   return imageUrl;
 }
 
-Dali::Toolkit::ImageUrl GenerateUrl(const Dali::NativeImageSourcePtr nativeImageSource)
+Dali::Toolkit::ImageUrl GenerateUrl(const Dali::NativeImageSourcePtr nativeImageSource, bool preMultiplied)
 {
   Texture texture = Dali::Texture::New(*nativeImageSource);
-  Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::ImageUrl::New(texture);
+  Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::ImageUrl::New(texture, preMultiplied);
   return imageUrl;
 }
 
index 6db6e7e..f3675ef 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_IMAGE_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -66,18 +66,20 @@ DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::FrameBuffer fra
  * This Url can be used in visuals to render the pixel data.
  * @note This method does not check for duplicates, If same pixel data is entered multiple times, a different URL is returned each time.
  * @param[in] pixelData the pixel data to converted to Url
+ * @param[in] preMultiplied Whether this pixel data preMultiplied or not. Default as false.
  * @return the ImageUrl representing this pixel data
  */
-DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::PixelData pixelData);
+DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::PixelData pixelData, bool preMultiplied = false);
 
 /**
  * @brief Generate a Url from native image source.
  * This Url can be used in visuals to render the native image source.
  * @note This method does not check for duplicates, If same native image source is entered multiple times, a different URL is returned each time.
  * @param[in] nativeImageSource the native image source to converted to Url
+ * @param[in] preMultiplied Whether this native image source preMultiplied or not. Default as false.
  * @return the ImageUrl representing this native image source
  */
-DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::NativeImageSourcePtr nativeImageSource);
+DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::NativeImageSourcePtr nativeImageSource, bool preMultiplied = false);
 
 /**
  * @brief Generate a Url from encoded image buffer.