[Title] support rotated image in saved image file and pasted image
authorSon Hyunjun <hj79.son@samsung.com>
Mon, 26 Mar 2012 10:57:41 +0000 (19:57 +0900)
committerSon Hyunjun <hj79.son@samsung.com>
Mon, 26 Mar 2012 10:57:41 +0000 (19:57 +0900)
[Type] Feature
[Module] Skin
[Priority] Minor
[CQ#]
[Redmine#]
[Problem]
[Cause]
[Solution]

Change-Id: Id5c186f0649194074913e5045f672b92863d3b20

tizen/src/skin/client/src/org/tizen/emulator/skin/screenshot/ScreenShotDialog.java

index 575cfed11217e50120ef0e51d15e8ca2f4e01d8a..88ca052b8e9922d122de364ae9b994362b8b0536 100644 (file)
@@ -165,18 +165,31 @@ public class ScreenShotDialog extends Dialog {
                                                e.gc.drawImage( image, CANVAS_MARGIN, CANVAS_MARGIN );
 
                                        } else {
-
+                                               
                                                Transform transform = new Transform( shell.getDisplay() );
 
                                                float angle = rotation.angle();
                                                transform.rotate( angle );
 
+                                               int w = 0;
+                                               int h = 0;
+                                               ImageData imageData = image.getImageData();
+
                                                if ( RotationInfo.LANDSCAPE.equals( rotation ) ) {
                                                        transform.translate( -width - ( 2 * CANVAS_MARGIN ), 0 );
+                                                       w = imageData.height;
+                                                       h = imageData.width;
                                                } else if ( RotationInfo.REVERSE_PORTRAIT.equals( rotation ) ) {
                                                        transform.translate( -width - ( 2 * CANVAS_MARGIN ), -height - ( 2 * CANVAS_MARGIN ) );
+                                                       w = imageData.width;
+                                                       h = imageData.height;
                                                } else if ( RotationInfo.REVERSE_LANDSCAPE.equals( rotation ) ) {
                                                        transform.translate( 0, -height - ( 2 * CANVAS_MARGIN ) );
+                                                       w = imageData.height;
+                                                       h = imageData.width;
+                                               } else {
+                                                       w = imageData.width;
+                                                       h = imageData.height;
                                                }
 
                                                e.gc.setTransform( transform );
@@ -184,6 +197,13 @@ public class ScreenShotDialog extends Dialog {
 
                                                transform.dispose();
 
+                                               // 'gc.drawImage' is only for the showing without changing image data,
+                                               // so change image data fully to support the roated image in a saved file and a pasted image.
+                                               Image rotatedImage = new Image( shell.getDisplay(), w, h );
+                                               e.gc.copyArea( rotatedImage, CANVAS_MARGIN, CANVAS_MARGIN );
+                                               image.dispose();
+                                               image = rotatedImage;
+
                                        }
 
                                }
@@ -481,7 +501,7 @@ public class ScreenShotDialog extends Dialog {
                }
 
        }
-
+       
        public void open() {
 
                if ( shell.isDisposed() ) {