[Title] trim a emulator window when HW key is pressed
authorgiwoong.kim <giwoong.kim@samsung.com>
Thu, 17 May 2012 13:00:52 +0000 (22:00 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Thu, 17 May 2012 13:00:52 +0000 (22:00 +0900)
[Type] enhancement
[Module]
[Priority]
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution] re-masking
[TestCase]

tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java
tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java

index ce8b3c01849e6721722137c66c0ef0f03079d36d..886d1587c874f76cb48e8bd3340b5ed0d1c142ab 100755 (executable)
@@ -595,6 +595,8 @@ public class EmulatorSkin {
                                                        }
                                                }
                                                
+                                               SkinUtil.trimShell( shell, currentImage );
+
                                                KeyEventData keyEventData = new KeyEventData( KeyEventType.RELEASED.value(), keyCode, 0 );
                                                communicator.sendToQEMU( SendCommand.SEND_HARD_KEY_EVENT, keyEventData );
                                        }
@@ -623,6 +625,8 @@ public class EmulatorSkin {
                                                                        region.height - 1, // src
                                                                        region.x + 1, region.y + 1, region.width - 1, region.height - 1 ); // dst
                                                        gc.dispose();
+
+                                                       SkinUtil.trimShell( shell, currentKeyPressedImage, region.x, region.y, region.width, region.height );
                                                }
 
                                                KeyEventData keyEventData = new KeyEventData( KeyEventType.PRESSED.value(), keyCode, 0 );
index 047226deaa323cfa3d9d1ba01790503ddb11b652..48ea756b8b22720f7e8aefc72eb4003cb8b11989 100644 (file)
@@ -265,6 +265,35 @@ public class SkinUtil {
 
        }
 
+       public static void trimShell( Shell shell, Image image, int left, int top, int width, int height ) {
+
+               if ( null == image ) {
+                       return;
+               }
+
+               ImageData imageData = image.getImageData();
+
+               int right = left + width;
+               int bottom = top + height;
+
+               Region region = shell.getRegion();
+               if (region == null) {
+                       return;
+               }
+
+               for ( int i = left; i < right; i++ ) {
+                       for ( int j = top; j < bottom; j++ ) {
+                               int alpha = imageData.getAlpha( i, j );
+                               if ( 0 == alpha ) {
+                                       region.subtract( i, j, 1, 1 );
+                               }
+                       }
+               }
+
+               shell.setRegion( region );
+
+       }
+
        public static int[] convertMouseGeometry( int originalX, int originalY, int lcdWidth, int lcdHeight, int scale,
                        int angle ) {