[dali_1.3.25] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / visual-factory / visual-factory.h
index 636147d..454919a 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_VISUAL_FACTORY_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -51,7 +51,7 @@ class VisualFactory;
  * | visualType               | INTEGER or STRING |
  * | shader                   | MAP               |
  */
-class DALI_IMPORT_API VisualFactory : public BaseHandle
+class DALI_TOOLKIT_API VisualFactory : public BaseHandle
 {
 public:
 
@@ -117,55 +117,31 @@ public:
    */
   Visual::Base CreateVisual( const std::string& url, ImageDimensions size );
 
+  /**
+   * @brief Enable or disable premultiplying alpha in images and image visuals.
+   *
+   * The default is to enable pre-multiplication on load.
+   *
+   * Applications that have assets with pre-multiplied alpha already applied should turn this option off.
+   *
+   * @param[in] preMultiply True if loaded images for image visuals should have alpha multiplied into the color
+   * channels.
+   */
+  void SetPreMultiplyOnLoad( bool preMultiply );
+
+  /**
+   * @brief Get the setting for automatically pre-multiplying image visual images on load.
+   *
+   * @return True if loaded images have pre-multiplied alpha applied on load, false otherwise.
+   */
+  bool GetPreMultiplyOnLoad() const;
+
 private:
 
   explicit DALI_INTERNAL VisualFactory(Internal::VisualFactory *impl);
 
 };
 
-
-/**
- * @brief Template to allow discard old visual, get new one and set it on stage if possible
- *
- * @tparam ParameterType0 The type of first argument passed to the CreateVisual()
- * @tparam ParameterType1 The type of second argument passed to the CreateVisual()
- * @SINCE_1_0.39
- * @param[in] actor Actor for which the visual will be replaced
- * @param[in,out] visual The visual to be replaced
- * @param[in] param0 First template based argument passed to the visual factory
- * @param[in] param1 Second template based argument passed to the visual factory
- */
-template< class ParameterType0, class ParameterType1 >
-void InitializeVisual( Actor& actor, Visual::Base& visual, ParameterType0& param0, ParameterType1& param1 )
-{
-  visual.RemoveAndReset( actor );
-  visual = Toolkit::VisualFactory::Get().CreateVisual( param0, param1 );
-  if( visual && actor && actor.OnStage() )
-  {
-    visual.SetOnStage( actor );
-  }
-}
-
-/**
- * @brief Template to allow discard old visual, get new one and set it on stage if possible
- *
- * @tparam ParameterType The type of argument passed to the CreateVisual()
- * @SINCE_1_0.39
- * @param[in] actor Actor for which the visual will be replaced
- * @param[in,out] visual The visual to be replaced
- * @param[in] param Template based argument passed to the visual factory
- */
-template< class ParameterType >
-void InitializeVisual( Actor& actor, Visual::Base& visual, ParameterType& param )
-{
-  visual.RemoveAndReset( actor );
-  visual =  Toolkit::VisualFactory::Get().CreateVisual( param );
-  if( visual && actor && actor.OnStage() )
-  {
-    visual.SetOnStage( actor );
-  }
-}
-
 } // namespace Toolkit
 
 } // namespace Dali