skin: add some skin uitility functions & etc 78/34478/1
authorGiWoong Kim <giwoong.kim@samsung.com>
Fri, 23 Jan 2015 05:40:28 +0000 (14:40 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Wed, 28 Jan 2015 05:23:47 +0000 (14:23 +0900)
Change-Id: I2fae05887785aec7bc8dfaaabd3331938e59d35e
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/display/maru_sdl.c
tizen/src/ecs/ecs_msg_device.c
tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java
tizen/src/skin/maruskin_operation.c

index 831b311..cef5890 100644 (file)
@@ -465,9 +465,9 @@ static void maru_sdl_resize_bh(void *opaque)
         surface_qemu->format->Amask);
 
     /* rearrange multi-touch finger points */
-    if (get_emul_multi_touch_state()->multitouch_enable == 1 ||
-            get_emul_multi_touch_state()->multitouch_enable == 2) {
-        rearrange_finger_points(get_emul_resolution_width(), get_emul_resolution_height(),
+    if (get_emul_multi_touch_state()->multitouch_enable != 0) {
+        rearrange_finger_points(
+            get_emul_resolution_width(), get_emul_resolution_height(),
             current_scale_factor, rotaton_type);
     }
 
index b14464b..338560a 100644 (file)
@@ -205,13 +205,7 @@ static void msgproc_device_req_tgesture(ECS_Client* ccli, ECS__DeviceReq* msg)
     }
 
     /* release multi-touch */
-#ifndef CONFIG_USE_SHM
-    if (get_multi_touch_enable() != 0) {
-        clear_finger_slot(false);
-    }
-#else
     // TODO:
-#endif
 
     if (data == NULL) {
         LOG_SEVERE("touch gesture data is NULL\n");
index 8cce8a6..d2a97ec 100644 (file)
@@ -44,9 +44,12 @@ import java.util.logging.Logger;
 
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.PaletteData;
 import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.RGB;
 import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.graphics.Region;
+import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.MessageBox;
 import org.eclipse.swt.widgets.Shell;
@@ -244,6 +247,50 @@ public class SkinUtil {
                return false;
        }
 
+       public static void setColorKeyFromMask(Display display,
+                       int colorKey, int fakeKey, ImageData srcData, ImageData dstData) {
+               if (srcData == null || dstData == null) {
+                       return;
+               }
+
+               int j = 0;
+               for (int i = 0; i < dstData.width; i++) {
+                       for (j = 0; j < dstData.height; j++) {
+                               if (srcData.getAlpha(i, j) == 0) {
+                                       dstData.setPixel(i, j, colorKey);
+                               } else if (srcData.getPixel(i, j) == colorKey) {
+                                       dstData.setPixel(i, j, fakeKey);
+                               }
+                       }
+               }
+       }
+
+       public static ImageData getMaskDataForImage(Display display, Image srcImage) {
+               if (srcImage == null || srcImage.isDisposed() == true) {
+                       return null;
+               }
+
+               ImageData srcImageData = srcImage.getImageData();
+               int[] maskArray = new int[srcImageData.width * srcImageData.height];
+
+               int j = 0;
+               for (int i = 0; i < srcImageData.width; i++) {
+                       for (j = 0; j < srcImageData.height; j++) {
+                               if (srcImageData.getAlpha(i, j) != 0) {
+                                       maskArray[i * srcImageData.width + j] = 1;
+                               } else {
+                                       maskArray[i * srcImageData.width + j] = 0;
+                               }
+                       }
+               }
+
+               ImageData maskData = new ImageData(srcImageData.width, srcImageData.height, 1,
+                               new PaletteData(new RGB[] { new RGB(0, 0, 0), new RGB(255, 255, 255) }));
+               maskData.setPixels(0, 0, srcImageData.width * srcImageData.height, maskArray, 0);
+
+               return maskData;
+       }
+
        public static Region getTrimmedRegion(Image image) {
                if (null == image) {
                        return null;
@@ -1071,4 +1118,9 @@ public class SkinUtil {
                logger.info("32bit architecture : " + System.getProperty("os.arch"));
                return setTopMost32(shell, isOnTop); /* 32bit */
        }
+
+       public static int getAngleFromVector(Control con, int x, int y) {
+               return (int)Math.toDegrees(
+                               Math.atan2(y - (con.getSize().y / 2), x - (con.getSize().x / 2)));
+       }
 }
index 6d255c8..e1bb974 100644 (file)
@@ -610,6 +610,8 @@ void request_close(void)
 #endif
 
     do_hw_key_event(KEY_RELEASED, HARD_KEY_POWER);
+
+    maru_display_update();
 }
 
 void shutdown_qemu_gracefully(void)