import org.eclipse.swt.widgets.Display;
import org.tizen.emulator.skin.comm.ICommunicator.MouseButtonType;
import org.tizen.emulator.skin.comm.ICommunicator.MouseEventType;
-import org.tizen.emulator.skin.comm.ICommunicator.RotationInfo;
import org.tizen.emulator.skin.comm.ICommunicator.SendCommand;
import org.tizen.emulator.skin.comm.sock.SocketCommunicator;
import org.tizen.emulator.skin.comm.sock.data.MouseEventData;
import org.tizen.emulator.skin.info.EmulatorSkinState;
import org.tizen.emulator.skin.log.SkinLogger;
+import org.tizen.emulator.skin.util.SkinRotation;
public class EmulatorFingers {
private static final int MAX_FINGER_CNT = 10;
private Boolean calculateOriginCoordinates(
int scaledDisplayWitdh, int scaledDisplayHeight,
- double scaleFactor, int rotationType, FingerPoint finger) {
+ double scaleFactor, short rotationId, FingerPoint finger) {
int pointX = 0, pointY = 0;
int rotatedPointX = 0, rotatedPointY = 0;
int flag = 0;
/* logger.info("rotatedPointX:" + rotatedPointX +
" rotatedPointY:" + rotatedPointY); */
- if (rotationType == RotationInfo.LANDSCAPE.id()) {
+ if (rotationId == SkinRotation.LANDSCAPE_ID) {
rotatedPointX = pointY;
rotatedPointY = scaledDisplayWitdh - pointX;
- } else if (rotationType == RotationInfo.REVERSE_PORTRAIT.id()) {
+ } else if (rotationId == SkinRotation.REVERSE_PORTRAIT_ID) {
rotatedPointX = scaledDisplayWitdh - pointX;
rotatedPointY = scaledDisplayHeight - pointY;
- } else if (rotationType == RotationInfo.REVERSE_LANDSCAPE.id()) {
+ } else if (rotationId == SkinRotation.REVERSE_LANDSCAPE_ID) {
rotatedPointX = scaledDisplayHeight - pointY;
rotatedPointY = pointX;
} else {
return false;
}
- public int rearrangeFingerPoints(
- int displayWidth, int displayHeight, double scaleFactor, int rotationType) {
+ public int rearrangeFingerPoints(int displayWidth, int displayHeight,
+ double scaleFactor, short rotationId) {
if (multiTouchEnable == 0) {
return 0;
}
for (int i = 0; i < fingerCnt; i++) {
finger = getFingerPointFromSlot(i);
if (finger != null && finger.id != 0) {
- if (calculateOriginCoordinates(
- displayWidth, displayHeight, scaleFactor, rotationType, finger) == true) {
+ if (calculateOriginCoordinates(displayWidth, displayHeight,
+ scaleFactor, rotationId, finger) == true) {
count++;
}
}
import org.tizen.emulator.skin.info.SkinInformation;
import org.tizen.emulator.skin.log.SkinLogger;
import org.tizen.emulator.skin.screenshot.ShmScreenShotWindow;
+import org.tizen.emulator.skin.util.SkinRotation;
import org.tizen.emulator.skin.util.SkinUtil;
import org.tizen.emulator.skin.util.SwtUtil;
e.gc.setInterpolation(SWT.HIGH);
}
- switch(currentState.getCurrentAngle()) {
- case -90: /* landscape */
+ switch(currentState.getCurrentRotationId()) {
+ case SkinRotation.LANDSCAPE_ID:
+ /* landscape */
e.gc.setTransform(displayTransform);
e.gc.drawImage(bufferPainter.imageFramebuffer,
0, 0, bufferPainter.widthFB, bufferPainter.heightFB,
0, 0, screen_height, screen_width);
e.gc.setTransform(null); /* set to the identity transform */
break;
- case 180: /* reverse-portrait */
+ case SkinRotation.REVERSE_PORTRAIT_ID:
+ /* reverse-portrait */
e.gc.setTransform(displayTransform);
e.gc.drawImage(bufferPainter.imageFramebuffer,
0, 0, bufferPainter.widthFB, bufferPainter.heightFB,
0, 0, screen_width, screen_height);
e.gc.setTransform(null);
break;
- case 90: /* reverse-landscape */
+ case SkinRotation.REVERSE_LANDSCAPE_ID:
+ /* reverse-landscape */
e.gc.setTransform(displayTransform);
e.gc.drawImage(bufferPainter.imageFramebuffer,
0, 0, bufferPainter.widthFB, bufferPainter.heightFB,
0, 0, screen_height, screen_width);
e.gc.setTransform(null);
break;
- default: /* portrait */
+ default:
+ /* portrait */
e.gc.drawImage(bufferPainter.imageFramebuffer,
0, 0, bufferPainter.widthFB, bufferPainter.heightFB,
0, 0, screen_width, screen_height);
int[] geometry = SkinUtil.convertMouseGeometry(e.x, e.y,
currentState.getCurrentResolutionWidth(),
currentState.getCurrentResolutionHeight(),
- currentState.getCurrentScale(), currentState.getCurrentAngle());
+ currentState.getCurrentScale(),
+ currentState.getCurrentRotationId());
//eventType = MouseEventType.DRAG.value();
if (finger.getMultiTouchEnable() == 1) {
int[] geometry = SkinUtil.convertMouseGeometry(e.x, e.y,
currentState.getCurrentResolutionWidth(),
currentState.getCurrentResolutionHeight(),
- currentState.getCurrentScale(), currentState.getCurrentAngle());
+ currentState.getCurrentScale(),
+ currentState.getCurrentRotationId());
logger.info("mouseUp in display" +
" x:" + geometry[0] + " y:" + geometry[1]);
int[] geometry = SkinUtil.convertMouseGeometry(e.x, e.y,
currentState.getCurrentResolutionWidth(),
currentState.getCurrentResolutionHeight(),
- currentState.getCurrentScale(), currentState.getCurrentAngle());
+ currentState.getCurrentScale(),
+ currentState.getCurrentRotationId());
logger.info("mouseDown in display" +
" x:" + geometry[0] + " y:" + geometry[1]);
import org.tizen.emulator.skin.comm.ICommunicator.KeyEventType;
import org.tizen.emulator.skin.comm.ICommunicator.MouseButtonType;
import org.tizen.emulator.skin.comm.ICommunicator.MouseEventType;
-import org.tizen.emulator.skin.comm.ICommunicator.RotationInfo;
import org.tizen.emulator.skin.comm.ICommunicator.SendCommand;
import org.tizen.emulator.skin.comm.sock.SocketCommunicator;
import org.tizen.emulator.skin.comm.sock.data.BooleanData;
import org.tizen.emulator.skin.layout.GeneralPurposeSkinComposer;
import org.tizen.emulator.skin.layout.ISkinComposer;
import org.tizen.emulator.skin.layout.ProfileSpecificSkinComposer;
+import org.tizen.emulator.skin.layout.rotation.Rotation;
import org.tizen.emulator.skin.log.SkinLogger;
import org.tizen.emulator.skin.menu.KeyWindowKeeper;
import org.tizen.emulator.skin.menu.PopupMenu;
currentState.setCurrentResolutionHeight(config.getValidResolutionHeight());
currentState.setCurrentScale(config.getValidScale());
-
- short rotationId = EmulatorConfig.DEFAULT_WINDOW_ROTATION;
- currentState.setCurrentRotationId(rotationId);
+ currentState.setCurrentRotationId();
/* create and attach a popup menu */
popupMenu = new PopupMenu(config, this);
currentState.getCurrentResolutionWidth(),
currentState.getCurrentResolutionHeight(),
currentState.getCurrentScale(),
- currentState.getCurrentAngle());
+ currentState.getCurrentRotationId());
logger.info("mouseWheel in display" + " x:" + geometry[0]
+ " y:" + geometry[1] + " value:" + e.count);
int[] geometry = SkinUtil.convertMouseGeometry(e.x, e.y,
currentState.getCurrentResolutionWidth(),
currentState.getCurrentResolutionHeight(),
- currentState.getCurrentScale(), currentState.getCurrentAngle());
+ currentState.getCurrentScale(),
+ currentState.getCurrentRotationId());
MouseEventData mouseEventData = new MouseEventData(
MouseButtonType.LEFT.value(), eventType,
int[] geometry = SkinUtil.convertMouseGeometry(e.x, e.y,
currentState.getCurrentResolutionWidth(),
currentState.getCurrentResolutionHeight(),
- currentState.getCurrentScale(), currentState.getCurrentAngle());
+ currentState.getCurrentScale(),
+ currentState.getCurrentRotationId());
logger.info("mouseUp in display" +
" x:" + geometry[0] + " y:" + geometry[1]);
int[] geometry = SkinUtil.convertMouseGeometry(e.x, e.y,
currentState.getCurrentResolutionWidth(),
currentState.getCurrentResolutionHeight(),
- currentState.getCurrentScale(), currentState.getCurrentAngle());
+ currentState.getCurrentScale(),
+ currentState.getCurrentRotationId());
logger.info("mouseDown in display" +
" x:" + geometry[0] + " y:" + geometry[1]);
}
displayTransform = new Transform(lcdCanvas.getDisplay());
- displayTransform.rotate(currentState.getCurrentAngle());
- if (currentState.getCurrentAngle() == -90) { /* landscape */
+ short rotationId = currentState.getCurrentRotationId();
+ displayTransform.rotate(SkinRotation.getAngle(rotationId));
+
+ if (rotationId == SkinRotation.LANDSCAPE_ID) {
+ /* landscape */
displayTransform.translate(
lcdCanvas.getSize().y * -1, 0);
- } else if (currentState.getCurrentAngle() == 180) { /* reverse-portrait */
+ } else if (rotationId == SkinRotation.REVERSE_PORTRAIT_ID) {
+ /* reverse-portrait */
displayTransform.translate(
lcdCanvas.getSize().x * -1,
lcdCanvas.getSize().y * -1);
- } else if (currentState.getCurrentAngle() == 90) { /* reverse-landscape */
+ } else if (rotationId == SkinRotation.REVERSE_LANDSCAPE_ID) {
+ /* reverse-landscape */
displayTransform.translate(
0, lcdCanvas.getSize().x * -1);
}
final List<MenuItem> rotationList = new ArrayList<MenuItem>();
- Iterator<Entry<Short, RotationType>> iterator =
+ Iterator<Entry<Short, Rotation>> iterator =
SkinRotation.getRotationIterator();
while (iterator.hasNext()) {
- Entry<Short, RotationType> entry = iterator.next();
+ Entry<Short, Rotation> entry = iterator.next();
Short rotationId = entry.getKey();
RotationType section = entry.getValue();
for (MenuItem m : rotationList) {
short rotationId = (Short) m.getData();
- if (rotationId == RotationInfo.PORTRAIT.id()) {
+ if (rotationId == SkinRotation.PORTRAIT_ID) {
String landscape = SkinRotation.getRotation(
- RotationInfo.LANDSCAPE.id()).getName().value();
+ SkinRotation.LANDSCAPE_ID).getName().value();
m.setText(landscape);
- } else if (rotationId == RotationInfo.LANDSCAPE.id()) {
+ } else if (rotationId == SkinRotation.LANDSCAPE_ID) {
String portrait = SkinRotation.getRotation(
- RotationInfo.PORTRAIT.id()).getName().value();
+ SkinRotation.PORTRAIT_ID).getName().value();
m.setText(portrait);
- } else if (rotationId == RotationInfo.REVERSE_PORTRAIT.id()) {
+ } else if (rotationId == SkinRotation.REVERSE_PORTRAIT_ID) {
String landscapeReverse = SkinRotation.getRotation(
- RotationInfo.REVERSE_LANDSCAPE.id()).getName().value();
+ SkinRotation.REVERSE_LANDSCAPE_ID).getName().value();
m.setText(landscapeReverse);
- } else if (rotationId == RotationInfo.REVERSE_LANDSCAPE.id()) {
+ } else if (rotationId == SkinRotation.REVERSE_LANDSCAPE_ID) {
String portraitReverse = SkinRotation.getRotation(
- RotationInfo.REVERSE_PORTRAIT.id()).getName().value();
+ SkinRotation.REVERSE_PORTRAIT_ID).getName().value();
m.setText(portraitReverse);
}
}
package org.tizen.emulator.skin.comm;
import org.tizen.emulator.skin.comm.sock.data.ISendData;
-import org.tizen.emulator.skin.dbi.RotationNameType;
/**
*
}
- public enum RotationInfo {
- PORTRAIT( RotationNameType.PORTRAIT.value(), (short)0, 0 ),
- LANDSCAPE( RotationNameType.LANDSCAPE.value(), (short)1, -90 ),
- REVERSE_PORTRAIT( RotationNameType.REVERSE_PORTRAIT.value(), (short)2, 180 ),
- REVERSE_LANDSCAPE( RotationNameType.REVERSE_LANDSCAPE.value(), (short)3, 90 );
-
- private String value;
- private short id;
- private int angle;
-
- RotationInfo( String value, short id, int ratio ) {
- this.value = value;
- this.id = id;
- this.angle = ratio;
- }
-
- public String value() {
- return this.value;
- }
-
- public int angle() {
- return this.angle;
- }
-
- public short id() {
- return this.id;
- }
-
- public static RotationInfo getValue(short id) {
- RotationInfo[] values = RotationInfo.values();
- for (int i = 0; i < values.length; i++) {
- if (values[i].id == id) {
- return values[i];
- }
- }
-
- throw new IllegalArgumentException(Integer.toString(id));
- }
- }
-
public enum SendCommand {
/* This values must match the QEMU definitions */
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
-import org.tizen.emulator.skin.comm.ICommunicator.RotationInfo;
import org.tizen.emulator.skin.dbi.EmulatorUI;
import org.tizen.emulator.skin.exception.ConfigException;
import org.tizen.emulator.skin.log.SkinLogger;
public static final int DEFAULT_WINDOW_SCALE = 50;
public static final int MIN_SCALE_FACTOR = 25;
public static final int MAX_SCALE_FACTOR = 200;
- public static final short DEFAULT_WINDOW_ROTATION = RotationInfo.PORTRAIT.id();
public static final int DEFAULT_WINDOW_X = 50;
public static final int DEFAULT_WINDOW_Y = 50;
public static final SkinLogLevel DEFAULT_LOG_LEVEL = SkinLogLevel.DEBUG;
logger.info("get skin image from " + skinPath);
RotationType targetRotation = SkinRotation.getRotation(id);
+ if (targetRotation == null) {
+ return null;
+ }
+
List<RotationType> rotationList = rotations.getRotation();
for (RotationType rotation : rotationList) {
public EmulatorSkinState() {
this.currentResolution = new Point(720, 1280);
this.currentScale = EmulatorConfig.DEFAULT_WINDOW_SCALE;
- this.currentRotationId = EmulatorConfig.DEFAULT_WINDOW_ROTATION;
+ this.currentRotationId = SkinRotation.PORTRAIT_ID;
this.displayBounds = null;
this.updateDisplayBounds = false;
return currentRotationId;
}
- public synchronized int getCurrentAngle() {
- return SkinRotation.getAngle(currentRotationId);
+ public synchronized void setCurrentRotationId() {
+ this.currentRotationId = SkinRotation.PORTRAIT_ID;
}
public synchronized void setCurrentRotationId(short rotationId) {
import org.eclipse.swt.widgets.Shell;
import org.tizen.emulator.skin.EmulatorSkin;
import org.tizen.emulator.skin.EmulatorSkinMain;
-import org.tizen.emulator.skin.comm.ICommunicator.RotationInfo;
import org.tizen.emulator.skin.config.EmulatorConfig;
import org.tizen.emulator.skin.config.EmulatorConfig.SkinPropertiesConstants;
import org.tizen.emulator.skin.custom.ColorTag;
import org.tizen.emulator.skin.log.SkinLogger;
import org.tizen.emulator.skin.menu.KeyWindowKeeper;
import org.tizen.emulator.skin.menu.PopupMenu;
+import org.tizen.emulator.skin.util.SkinRotation;
import org.tizen.emulator.skin.util.SkinUtil;
import org.tizen.emulator.skin.util.SwtUtil;
}
/* arrange the pair tag */
- if (rotationId == RotationInfo.PORTRAIT.id()) {
+ if (rotationId == SkinRotation.PORTRAIT_ID) {
pairTag.setBounds(
PAIR_TAG_POSITION_X, PAIR_TAG_POSITION_Y,
pairTag.getWidth(), pairTag.getHeight());
- } else if (rotationId == RotationInfo.LANDSCAPE.id()) {
+ } else if (rotationId == SkinRotation.LANDSCAPE_ID) {
pairTag.setBounds(
PAIR_TAG_POSITION_Y,
shell.getSize().y - PAIR_TAG_POSITION_X - pairTag.getHeight(),
pairTag.getWidth(), pairTag.getHeight());
- } else if (rotationId == RotationInfo.REVERSE_PORTRAIT.id()) {
+ } else if (rotationId == SkinRotation.REVERSE_PORTRAIT_ID) {
pairTag.setBounds(
shell.getSize().x - PAIR_TAG_POSITION_X - pairTag.getWidth(),
shell.getSize().y - PAIR_TAG_POSITION_Y - pairTag.getHeight(),
pairTag.getWidth(), pairTag.getHeight());
- } else if (rotationId == RotationInfo.REVERSE_LANDSCAPE.id()) {
+ } else if (rotationId == SkinRotation.REVERSE_LANDSCAPE_ID) {
pairTag.setBounds(
shell.getSize().x - PAIR_TAG_POSITION_Y - pairTag.getWidth(),
PAIR_TAG_POSITION_X,
frameMaker.getPatchWidth(), frameMaker.getPatchHeight(), 0, 0);
float convertedScale = SkinUtil.convertScale(scale);
- RotationInfo rotation = RotationInfo.getValue(rotationId);
/* resoultion, that is display size in general skin mode */
- if (RotationInfo.LANDSCAPE == rotation ||
- RotationInfo.REVERSE_LANDSCAPE == rotation) {
+ if (SkinRotation.LANDSCAPE_ID == rotationId ||
+ SkinRotation.REVERSE_LANDSCAPE_ID == rotationId) {
displayBounds.width = (int)(resolutionH * convertedScale);
displayBounds.height = (int)(resolutionW * convertedScale);
} else {
float convertedScale = SkinUtil.convertScale(scale);
RotationType rotation = SkinRotation.getRotation(rotationId);
+ if (rotation == null) {
+ return null;
+ }
DisplayType display = rotation.getDisplay(); /* from dbi */
if (display == null) {
--- /dev/null
+/**
+ * Rotation Information
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.skin.layout.rotation;
+
+import org.tizen.emulator.skin.dbi.RotationType;
+
+
+public class Rotation extends RotationType {
+ private int angle;
+
+ public void setAngle(int degree) {
+ this.angle = degree;
+ }
+
+ public int getAngle() {
+ return angle;
+ }
+}
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.tizen.emulator.skin.EmulatorSkin;
-import org.tizen.emulator.skin.comm.ICommunicator.RotationInfo;
import org.tizen.emulator.skin.config.EmulatorConfig;
import org.tizen.emulator.skin.dbi.MenuItemType;
import org.tizen.emulator.skin.dbi.PopupMenuType;
ROTATE_MENUITEM_NAME : rotationMenuType.getItemName());
} else {
/* do not rotate */
- skin.getEmulatorSkinState().setCurrentRotationId(
- RotationInfo.PORTRAIT.id());
+ skin.getEmulatorSkinState().setCurrentRotationId();
}
}
import org.tizen.emulator.skin.comm.sock.SocketCommunicator;
import org.tizen.emulator.skin.comm.sock.data.KeyEventData;
import org.tizen.emulator.skin.comm.sock.data.MouseEventData;
-import org.tizen.emulator.skin.config.EmulatorConfig;
import org.tizen.emulator.skin.custom.SkinWindow;
import org.tizen.emulator.skin.exception.JaxbException;
import org.tizen.emulator.skin.image.SpecialKeyWindowImageRegistry;
import org.tizen.emulator.skin.keywindow.dbi.KeyWindowUI;
import org.tizen.emulator.skin.keywindow.dbi.RegionType;
import org.tizen.emulator.skin.layout.HWKey;
+import org.tizen.emulator.skin.util.HWKeyRegion;
import org.tizen.emulator.skin.util.IOUtil;
import org.tizen.emulator.skin.util.JaxbUtil;
-import org.tizen.emulator.skin.util.HWKeyRegion;
import org.tizen.emulator.skin.util.SkinUtil;
import org.tizen.emulator.skin.util.SwtUtil;
/* get keywindow image */
//TODO: null
this.keyWindowImage = imageRegistry.getKeyWindowImage(
- EmulatorConfig.DEFAULT_WINDOW_ROTATION,
- SpecailKeyWindowImageType.SPECIAL_IMAGE_TYPE_NORMAL);
+ (short)0, SpecailKeyWindowImageType.SPECIAL_IMAGE_TYPE_NORMAL);
this.keyWindowPressedImage = imageRegistry.getKeyWindowImage(
- EmulatorConfig.DEFAULT_WINDOW_ROTATION,
- SpecailKeyWindowImageType.SPECIAL_IMAGE_TYPE_PRESSED);
+ (short)0, SpecailKeyWindowImageType.SPECIAL_IMAGE_TYPE_PRESSED);
/* set window size */
if (keyWindowImage != null) {
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.tizen.emulator.skin.EmulatorSkin;
-import org.tizen.emulator.skin.comm.ICommunicator.RotationInfo;
import org.tizen.emulator.skin.config.EmulatorConfig;
import org.tizen.emulator.skin.exception.ScreenShotException;
import org.tizen.emulator.skin.image.ImageRegistry;
import org.tizen.emulator.skin.image.ImageRegistry.IconName;
import org.tizen.emulator.skin.log.SkinLogger;
import org.tizen.emulator.skin.util.IOUtil;
+import org.tizen.emulator.skin.util.SkinRotation;
import org.tizen.emulator.skin.util.SkinUtil;
import org.tizen.emulator.skin.util.StringUtil;
import org.tizen.emulator.skin.util.SwtUtil;
}
}
- protected ImageData rotateImageData(ImageData srcData, RotationInfo rotation) {
+ protected ImageData getRotateImageData(ImageData srcData) {
int direction = SWT.NONE;
- switch (rotation) {
- case PORTRAIT:
+ switch (skin.getEmulatorSkinState().getCurrentRotationId()) {
+ case SkinRotation.PORTRAIT_ID:
return srcData;
- case LANDSCAPE:
+ case SkinRotation.LANDSCAPE_ID:
direction = SWT.LEFT;
break;
- case REVERSE_PORTRAIT:
+ case SkinRotation.REVERSE_PORTRAIT_ID:
direction = SWT.DOWN;
break;
- case REVERSE_LANDSCAPE:
+ case SkinRotation.REVERSE_LANDSCAPE_ID:
direction = SWT.RIGHT;
break;
default:
srcData.depth, srcData.palette, destBytesPerLine, newData);
}
- protected RotationInfo getCurrentRotation() {
- short currentRotationId =
- skin.getEmulatorSkinState().getCurrentRotationId();
- RotationInfo rotationInfo = RotationInfo.getValue(currentRotationId);
-
- return rotationInfo;
- }
-
private void createToolBar(final Shell parent) {
ImageRegistry imageRegistry = skin.getImageRegistry();
import org.eclipse.swt.graphics.PaletteData;
import org.eclipse.swt.widgets.Display;
import org.tizen.emulator.skin.EmulatorSdlSkin;
-import org.tizen.emulator.skin.comm.ICommunicator.RotationInfo;
import org.tizen.emulator.skin.comm.ICommunicator.SendCommand;
import org.tizen.emulator.skin.comm.sock.SocketCommunicator.DataTranfer;
import org.tizen.emulator.skin.config.EmulatorConfig;
ImageData imageData = new ImageData(width, height,
EmulatorSdlSkin.DISPLAY_COLOR_DEPTH, palette, 1, receivedData);
- RotationInfo rotation = getCurrentRotation();
- imageData = rotateImageData(imageData, rotation);
+ imageData = getRotateImageData(imageData);
Image tempImage = imageShot;
imageShot = new Image(Display.getDefault(), imageData);
import org.eclipse.swt.graphics.PaletteData;
import org.eclipse.swt.widgets.Display;
import org.tizen.emulator.skin.EmulatorShmSkin;
-import org.tizen.emulator.skin.comm.ICommunicator.RotationInfo;
import org.tizen.emulator.skin.config.EmulatorConfig;
import org.tizen.emulator.skin.exception.ScreenShotException;
import org.tizen.emulator.skin.log.SkinLogger;
imageData.setPixels(0, 0,
width * height, arrayFramebuffer, 0);
- RotationInfo rotation = getCurrentRotation();
- imageData = rotateImageData(imageData, rotation);
+ imageData = getRotateImageData(imageData);
Image tempImage = imageShot;
imageShot = new Image(Display.getDefault(), imageData);
/**
- * Rotation Utilities
+ * Rotation Informations
*
* Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
package org.tizen.emulator.skin.util;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
-import org.tizen.emulator.skin.comm.ICommunicator.RotationInfo;
+import org.tizen.emulator.skin.dbi.RotationNameType;
import org.tizen.emulator.skin.dbi.RotationType;
-
+import org.tizen.emulator.skin.layout.rotation.Rotation;
/**
*
*
*/
public class SkinRotation {
- private static Map<Short, RotationType> rotationMap;
- private static Map<Short, RotationInfo> angleMap;
+ public static final short PORTRAIT_ID = 0;
+ public static final short LANDSCAPE_ID = 1;
+ public static final short REVERSE_PORTRAIT_ID = 2;
+ public static final short REVERSE_LANDSCAPE_ID = 3;
+
+ private static Map<Short, Rotation> rotationMap =
+ new LinkedHashMap<Short, Rotation>();
private SkinRotation() {
/* do nothing */
}
- static {
- rotationMap = new LinkedHashMap<Short, RotationType>();
- angleMap = new HashMap<Short, RotationInfo>();
- }
+ public static void put(RotationType rotationType) {
+ Rotation rotation = new Rotation();
+ rotation.setName(rotationType.getName());
+ rotation.setDisplay(rotationType.getDisplay());
+ rotation.setImageList(rotationType.getImageList());
+ rotation.setKeyMapList(rotationType.getKeyMapList());
- public static void put(RotationType rotation) {
- if (RotationInfo.PORTRAIT.value()
- .equalsIgnoreCase(rotation.getName().value()))
+ if (RotationNameType.PORTRAIT.value()
+ .equalsIgnoreCase(rotationType.getName().value()))
{
- rotationMap.put(RotationInfo.PORTRAIT.id(), rotation);
- angleMap.put(RotationInfo.PORTRAIT.id(), RotationInfo.PORTRAIT);
+ rotation.setAngle(0);
+ rotationMap.put(PORTRAIT_ID, rotation);
}
- else if (RotationInfo.LANDSCAPE.value()
- .equalsIgnoreCase(rotation.getName().value()))
+ else if (RotationNameType.LANDSCAPE.value()
+ .equalsIgnoreCase(rotationType.getName().value()))
{
- rotationMap.put(RotationInfo.LANDSCAPE.id(), rotation);
- angleMap.put(RotationInfo.LANDSCAPE.id(), RotationInfo.LANDSCAPE);
+ rotation.setAngle(-90);
+ rotationMap.put(LANDSCAPE_ID, rotation);
}
- else if (RotationInfo.REVERSE_PORTRAIT.value()
- .equalsIgnoreCase(rotation.getName().value()))
+ else if (RotationNameType.REVERSE_PORTRAIT.value()
+ .equalsIgnoreCase(rotationType.getName().value()))
{
- rotationMap.put(RotationInfo.REVERSE_PORTRAIT.id(), rotation);
- angleMap.put(RotationInfo.REVERSE_PORTRAIT.id(), RotationInfo.REVERSE_PORTRAIT);
+ rotation.setAngle(180);
+ rotationMap.put(REVERSE_PORTRAIT_ID, rotation);
}
- else if (RotationInfo.REVERSE_LANDSCAPE.value()
- .equalsIgnoreCase(rotation.getName().value()))
+ else if (RotationNameType.REVERSE_LANDSCAPE.value()
+ .equalsIgnoreCase(rotationType.getName().value()))
{
- rotationMap.put(RotationInfo.REVERSE_LANDSCAPE.id(), rotation);
- angleMap.put(RotationInfo.REVERSE_LANDSCAPE.id(), RotationInfo.REVERSE_LANDSCAPE);
+ rotation.setAngle(90);
+ rotationMap.put(REVERSE_LANDSCAPE_ID, rotation);
}
}
+ public static Rotation getRotation(Short rotationId) {
+ return rotationMap.get(rotationId);
+ }
+
public static int getAngle(Short rotationId) {
- RotationInfo rotationInfo = angleMap.get(rotationId);
- if (null != rotationInfo) {
- return rotationInfo.angle();
- } else {
+ Rotation rotation = rotationMap.get(rotationId);
+ if (rotation == null) {
return 0;
}
- }
- public static RotationType getRotation(Short rotationId) {
- return rotationMap.get(rotationId);
+ return rotation.getAngle();
}
- public static Iterator<Entry<Short, RotationType>> getRotationIterator() {
+ public static Iterator<Entry<Short, Rotation>> getRotationIterator() {
return rotationMap.entrySet().iterator();
}
}
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
-import org.tizen.emulator.skin.comm.ICommunicator.RotationInfo;
import org.tizen.emulator.skin.config.EmulatorConfig;
import org.tizen.emulator.skin.config.EmulatorConfig.ArgsConstants;
import org.tizen.emulator.skin.dbi.EventInfoType;
KeyMapListType list = rotation.getKeyMapList();
if (list == null) {
/* try to using a KeyMapList of portrait */
- rotation = SkinRotation.getRotation(RotationInfo.PORTRAIT.id());
+ rotation = SkinRotation.getRotation(SkinRotation.PORTRAIT_ID);
if (rotation == null) {
return null;
}
public static int[] convertMouseGeometry(
int originalX, int originalY, int displayWidth, int displayHeight,
- int scale, int angle) {
+ int scale, short rotationId) {
float convertedScale = convertScale(scale);
int x = (int) (originalX * (1 / convertedScale));
int rotatedX = x;
int rotatedY = y;
- if (RotationInfo.LANDSCAPE.angle() == angle) {
+ if (rotationId == SkinRotation.LANDSCAPE_ID) {
rotatedX = displayWidth - y;
rotatedY = x;
- } else if (RotationInfo.REVERSE_PORTRAIT.angle() == angle) {
+ } else if (rotationId == SkinRotation.REVERSE_PORTRAIT_ID) {
rotatedX = displayWidth - x;
rotatedY = displayHeight - y;
- } else if (RotationInfo.REVERSE_LANDSCAPE.angle() == angle) {
+ } else if (rotationId == SkinRotation.REVERSE_LANDSCAPE_ID) {
rotatedX = y;
rotatedY = displayHeight - x;
}