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);
}
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;
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;
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)));
+ }
}