--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+#ifndef __TIZEN_UI_EFL_UTIL_SCREENSHOT_EXTENSION_H__
+#define __TIZEN_UI_EFL_UTIL_SCREENSHOT_EXTENSION_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __GNUC__
+# if __GNUC__ >= 4
+# ifndef API
+# define API __attribute__ ((visibility("default")))
+# endif
+# endif
+#endif
+
+/**
+ * @file efl_util_screenshot_extension.h
+ */
+
+/**
+ * @addtogroup CAPI_EFL_UTIL_MODULE
+ * @{
+ */
+
+/**
+ * @platform
+ * @brief Set auto rotation value for screenshot.
+ * @since_tizen $TZ_CFG_VER_40$
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/screenshot
+ * @param[in] screenshot efl_util_screenshot_h handle
+ * @param[in] set auto rotation value (1:use auto rotation, 0:don't use auto rotation)
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #EFL_UTIL_ERROR_NONE Successful
+ * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see efl_util_screenshot_get_auto_rotation()
+ */
+API int efl_util_screenshot_set_auto_rotation(efl_util_screenshot_h screenshot, int set);
+
+/**
+ * @platform
+ * @brief Get current auto rotation value of screenshot.
+ * @since_tizen $TZ_CFG_VER_40$
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/screenshot
+ * @param[in] screenshot efl_util_screenshot_h handle
+ * @param[out] set The current auto rotation value of screenshot
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #EFL_UTIL_ERROR_NONE Successful
+ * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see efl_util_screenshot_set_auto_rotation()
+ */
+API int efl_util_screenshot_get_auto_rotation(efl_util_screenshot_h screenshot, int *set);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __TIZEN_UI_EFL_UTIL_SCREENSHOT_EXTENSION_H__ */
#include <tizen-extension-client-protocol.h>
#include <screenshooter-client-protocol.h>
+#include <efl_util_screenshot_extension.h>
+
#include <dlog.h>
#ifdef LOG_TAG
#undef LOG_TAG
/* tbm bufmgr */
tbm_bufmgr bufmgr;
+
+ Eina_Bool auto_rotation;
};
/* scrrenshot handle */
screenshot->width = width;
screenshot->height = height;
+ screenshot->auto_rotation = EINA_TRUE;
screenshot->bufmgr = wayland_tbm_client_get_bufmgr(_eflutil.wl.shot.tbm_client);
EINA_SAFETY_ON_NULL_GOTO(screenshot->bufmgr, fail_init);
/* reset shot_done for next screenshot */
screenshot->shot_done = EINA_FALSE;
+ set_last_result(EFL_UTIL_ERROR_NONE);
+
_screenshot_mutex_unlock();
return t_surface;
return NULL;
}
+
+API int
+efl_util_screenshot_set_auto_rotation(efl_util_screenshot_h screenshot, int set)
+{
+ if (!screenshot || (screenshot != g_screenshot))
+ return EFL_UTIL_ERROR_INVALID_PARAMETER;
+
+ if (!(set == 0 || set == 1))
+ return EFL_UTIL_ERROR_INVALID_PARAMETER;
+
+ if (set)
+ g_screenshot->auto_rotation = EINA_TRUE;
+ else
+ g_screenshot->auto_rotation = EINA_FALSE;
+
+ tizen_screenshooter_set_oneshot_auto_rotation(_eflutil.wl.shot.tz_screenshooter, g_screenshot->auto_rotation);
+
+ return EFL_UTIL_ERROR_NONE;
+}
+
+API int
+efl_util_screenshot_get_auto_rotation(efl_util_screenshot_h screenshot, int *set)
+{
+ if (!screenshot || (screenshot != g_screenshot) || !set)
+ return EFL_UTIL_ERROR_INVALID_PARAMETER;
+
+ *set = g_screenshot->auto_rotation;
+
+ return EFL_UTIL_ERROR_NONE;
+}