Add new API to set rotation degree 14/262114/1
authorInHong Han <inhong1.han@samsung.com>
Thu, 10 Jun 2021 05:45:12 +0000 (14:45 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 3 Aug 2021 02:56:59 +0000 (11:56 +0900)
Change-Id: I8ea4dc19678403d88d342bdbfda7b153a2e43ed7

capi/include/cscl-ui-nui.h
capi/src/cscl-ui-nui.cpp

index dc792b1..4f73a71 100644 (file)
 #include <cscl-ui-controller.h>
 
 #define MAX_FONT_NAME_LEN 32
+#define DEGREE_TO_SCLROTATION(degree) \
+    (degree == 90 ? ROTATION_90_CW : \
+    (degree == 180 ? ROTATION_180 : \
+    (degree == 270 ? ROTATION_90_CCW : \
+    ROTATION_0)))
 
 #ifdef __cplusplus
 extern "C" {
@@ -66,6 +71,7 @@ int scl_nui_fini();
 int scl_nui_get_input_mode(const char **input_mode);
 int scl_nui_set_input_mode(const char *input_mode);
 int scl_nui_set_update_pending(bool pend);
+int scl_nui_set_rotation(int degree);
 
 int scl_nui_set_draw_text_cb(scl_nui_draw_text_cb callback, void *user_data);
 int scl_nui_set_draw_image_cb(scl_nui_draw_image_cb callback, void *user_data);
index 1b9601e..603222a 100644 (file)
@@ -245,6 +245,15 @@ EXPORT_API int scl_nui_set_update_pending(bool pend)
     return 0;
 }
 
+EXPORT_API int scl_nui_set_rotation(int degree)
+{
+    if (!g_ui)
+        return 1;
+
+    g_ui->set_rotation(DEGREE_TO_SCLROTATION(degree));
+    return 0;
+}
+
 EXPORT_API int scl_nui_set_draw_text_cb(scl_nui_draw_text_cb callback, void *user_data)
 {
     g_draw_text_cb = callback;