--- /dev/null
+#ifndef DALI_COLOR_CONTROLLER_PLUGIN_H
+#define DALI_COLOR_CONTROLLER_PLUGIN_H
+
+/*
+ * Copyright (c) 2019 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <cstdlib>
+
+namespace Dali
+{
+
+/**
+ * @brief ColorControllerPlugin is an abstract interface, used by dali-adaptor to access Color Controller plugin.
+ * A concrete implementation must be created for each platform and provided as dynamic library.
+ */
+class ColorControllerPlugin
+{
+public:
+
+ /**
+ * @brief Constructor.
+ */
+ ColorControllerPlugin(){}
+
+ /**
+ * @brief Destructor.
+ */
+ virtual ~ColorControllerPlugin(){}
+
+ /**
+ * @brief Retrieve the RGBA value by given the color code.
+ *
+ * @param[in] colorCode The color code string.
+ * @param[out] colorValue The RGBA color
+ * @return true if the color code exists, otherwise false
+ */
+ virtual bool RetrieveColor( const std::string& colorCode, Vector4& colorValue ) const = 0;
+
+ /**
+ * @brief Retrieve the RGBA value by given the color code.
+ *
+ * @param[in] colorCode The color code string.
+ * @param[out] textColor The text color.
+ * @param[out] textOutlineColor The text outline color.
+ * @param[out] textShadowColor The text shadow color.
+ * @return true if the color code exists, otherwise false
+ */
+ virtual bool RetrieveColor( const std::string& colorCode , Vector4& textColor, Vector4& textOutlineColor, Vector4& textShadowColor ) const = 0;
+};
+
+} // namespace Dali;
+
+#endif // DALI_COLOR_CONTROLLER_PLUGIN_H
-#ifndef __DALI_COLOR_CONTROLLER_H__
-#define __DALI_COLOR_CONTROLLER_H__
+#ifndef DALI_COLOR_CONTROLLER_H
+#define DALI_COLOR_CONTROLLER_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
{
class ColorController;
}
+
}
/**
~ColorController();
/**
- * @brief Retrieve the RGB value by given the color code.
+ * @brief Retrieve the RGBA value by given the color code.
*
* @param[in] colorCode The color code string.
* @param[out] colorValue The RGBA color
bool RetrieveColor( const std::string& colorCode, Vector4& colorValue );
/**
- * @brief Retrieve the RGB values by given the color code.
+ * @brief Retrieve the RGBA values by given the color code.
*
* @param[in] colorCode The color code string.
* @param[out] textColor The text color.
} //namespace Dali
-#endif /* __DALI_COLOR_CONTROLLER_H__ */
+#endif // DALI_COLOR_CONTROLLER_H
$(adaptor_devel_api_dir)/adaptor-framework/bitmap-saver.h \
$(adaptor_devel_api_dir)/adaptor-framework/clipboard-event-notifier.h \
$(adaptor_devel_api_dir)/adaptor-framework/clipboard.h \
+ $(adaptor_devel_api_dir)/adaptor-framework/color-controller-plugin.h \
$(adaptor_devel_api_dir)/adaptor-framework/color-controller.h \
$(adaptor_devel_api_dir)/adaptor-framework/drag-and-drop-detector.h \
$(adaptor_devel_api_dir)/adaptor-framework/environment-variable.h \
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
#include <dali/internal/system/common/color-controller-impl.h>
// EXTERNAL INCLUDES
+#include <dlfcn.h>
#include <dali/integration-api/debug.h>
#include <dali/public-api/object/type-registry.h>
namespace Adaptor
{
+namespace // unnamed namespace
+{
+const char* COLOR_CONTROLLER_PLUGIN_SO( "libdali-color-controller-plugin.so" );
+}
+
Dali::ColorController ColorController::Get()
{
Dali::ColorController colorController;
}
return colorController;
-
}
ColorController::ColorController()
+: mLibHandle( NULL ),
+ mPlugin( NULL ),
+ mCreateColorControllerPtr( NULL )
{
+ Initialize();
}
ColorController::~ColorController()
{
}
+void ColorController::Initialize()
+{
+ mLibHandle = dlopen( COLOR_CONTROLLER_PLUGIN_SO, RTLD_LAZY );
+
+ char* error = dlerror();
+ if( mLibHandle == NULL || error != NULL )
+ {
+ DALI_LOG_ERROR( "ColorController::Initialize: dlopen error [%s]\n", error );
+ return;
+ }
+
+ // load plugin
+ mCreateColorControllerPtr = reinterpret_cast< CreateColorControllerFunction >( dlsym( mLibHandle, "CreateColorControllerPlugin" ) );
+
+ error = dlerror();
+ if( mCreateColorControllerPtr == NULL || error != NULL )
+ {
+ DALI_LOG_ERROR( "ColorController::Initialize: Cannot load symbol CreateColorControllerPlugin(): %s\n", error );
+ return;
+ }
+
+ mPlugin = mCreateColorControllerPtr();
+ if( !mPlugin )
+ {
+ DALI_LOG_ERROR("ColorController::Initialize: Plugin creation failed\n");
+ return;
+ }
+}
+
bool ColorController::RetrieveColor( const std::string& colorCode, Vector4& colorValue )
{
+ if( mPlugin )
+ {
+ return mPlugin->RetrieveColor( colorCode, colorValue );
+ }
return false;
}
bool ColorController::RetrieveColor( const std::string& colorCode , Vector4& textColor, Vector4& textOutlineColor, Vector4& textShadowColor)
{
+ if( mPlugin )
+ {
+ return mPlugin->RetrieveColor( colorCode, textColor, textOutlineColor, textShadowColor );
+ }
return false;
}
-#ifndef __DALI_INTERNAL_COLOR_CONTROLLER_H__
-#define __DALI_INTERNAL_COLOR_CONTROLLER_H__
+#ifndef DALI_INTERNAL_COLOR_CONTROLLER_H
+#define DALI_INTERNAL_COLOR_CONTROLLER_H
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
// INTERNAL INCLUDES
#include <dali/devel-api/adaptor-framework/color-controller.h>
+#include <dali/devel-api/adaptor-framework/color-controller-plugin.h>
namespace Dali
{
bool RetrieveColor( const std::string& colorCode, Vector4& colorValue );
/**
- *copydoc Dali::ColorController::RetrieveColor(const std::string&, Vector4&, Vector4&, Vector4&)
+ * @copydoc Dali::ColorController::RetrieveColor(const std::string&, Vector4&, Vector4&, Vector4&)
*/
bool RetrieveColor( const std::string& colorCode , Vector4& textColor, Vector4& textOutlineColor, Vector4& textShadowColor);
+private:
+
+ /**
+ * @brief Initialize
+ */
+ void Initialize();
+
protected:
/**
- * Destructor.
+ * @brief Destructor.
*/
virtual ~ColorController();
+private:
+
+ using CreateColorControllerFunction = Dali::ColorControllerPlugin* (*)();
+
+ void* mLibHandle; ///< Handle for the loaded library
+ Dali::ColorControllerPlugin* mPlugin; ///< Plugin handle
+
+ CreateColorControllerFunction mCreateColorControllerPtr; ///< Function pointer called in adaptor to create a plugin instance
+
};
} // namespace Adaptor
} // namespace Dali
-#endif // __DALI_INTERNAL_COLOR_CONTROLLER_H__
+#endif // DALI_INTERNAL_COLOR_CONTROLLER_H
# module: system, backend: common
adaptor_system_common_src_files=\
${adaptor_system_dir}/common/abort-handler.cpp \
+ ${adaptor_system_dir}/common/color-controller-impl.cpp \
${adaptor_system_dir}/common/command-line-options.cpp \
${adaptor_system_dir}/common/environment-options.cpp \
${adaptor_system_dir}/common/fps-tracker.cpp \
# module: system, backend: tizen-wayland
adaptor_system_tizen_wayland_src_files=\
- ${adaptor_system_dir}/tizen-wayland/color-controller-impl-tizen.cpp \
${adaptor_system_dir}/tizen-wayland/system-settings-tizen.cpp \
${adaptor_system_dir}/tizen-wayland/widget-application-impl-tizen.cpp \
${adaptor_system_dir}/tizen-wayland/widget-controller-tizen.cpp
${adaptor_system_dir}/tizen-wayland/tizen-wearable/capture.cpp \
${adaptor_system_dir}/tizen-wayland/tizen-wearable/capture-impl-tizen.cpp \
${adaptor_system_dir}/tizen-wayland/tizen-wearable/watch-time.cpp \
- ${adaptor_system_dir}/tizen-wayland/color-controller-impl-tizen.cpp \
${adaptor_system_dir}/tizen-wayland/system-settings-tizen.cpp \
${adaptor_system_dir}/tizen-wayland/widget-application-impl-tizen.cpp \
${adaptor_system_dir}/tizen-wayland/widget-controller-tizen.cpp
# module: system, backend: ubuntu-x11
adaptor_system_ubuntu_x11_src_files=\
- ${adaptor_system_dir}/ubuntu-x11/color-controller-impl-x.cpp \
${adaptor_system_dir}/ubuntu-x11/system-settings-x.cpp \
${adaptor_system_dir}/ubuntu-x11/widget-application-impl-x.cpp \
${adaptor_system_dir}/ubuntu-x11/widget-controller-x.cpp
+++ /dev/null
-/*
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/internal/system/common/color-controller-impl.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-Dali::ColorController ColorController::Get()
-{
- return Dali::ColorController( new ColorController() );
-}
-
-ColorController::ColorController()
-{
-}
-
-ColorController::~ColorController()
-{
-}
-
-bool ColorController::RetrieveColor( const std::string& colorCode, Vector4& colorValue )
-{
- return false;
-}
-
-bool ColorController::RetrieveColor( const std::string& colorCode , Vector4& textColor, Vector4& textOutlineColor, Vector4& textShadowColor)
-{
- return false;
-}
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali