From 6b4ce6f79e1735f825281a73d6d8530fd7bac7a6 Mon Sep 17 00:00:00 2001 From: GiWoong Kim Date: Thu, 18 Dec 2014 19:48:03 +0900 Subject: [PATCH] display: added display masking Change-Id: Ice619c0988b7528d381a745f5ee1709b833f9a07 Signed-off-by: GiWoong Kim --- .../org/tizen/emulator/skin/dbi/DisplayType.java | 30 ++++++++++++++++-- .../skin/image/ProfileSkinImageRegistry.java | 36 +++++++++++++++------- .../skin/layout/ProfileSpecificSkinComposer.java | 13 ++++++++ .../skin/client/xsd/ProfileSpecificSkin-layout.xsd | 1 + 4 files changed, 67 insertions(+), 13 deletions(-) diff --git a/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/DisplayType.java b/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/DisplayType.java index 01e5208..8a37e76 100644 --- a/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/DisplayType.java +++ b/tizen/src/skin/client/jaxb_src/org/tizen/emulator/skin/dbi/DisplayType.java @@ -5,7 +5,7 @@ * * Contact: * GiWoong Kim - * YeongKyoon Lee + * SangHo Park * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -30,7 +30,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2013.07.11 at 12:12:25 PM KST +// Generated on: 2014.12.18 at 11:23:37 AM KST // @@ -54,6 +54,7 @@ import javax.xml.bind.annotation.XmlType; * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <all> * <element name="region" type="{http://www.tizen.org/emulator/skin/dbi}regionType"/> + * <element name="maskImage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * </all> * <attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}int" /> * </restriction> @@ -71,6 +72,7 @@ public class DisplayType { @XmlElement(required = true) protected RegionType region; + protected String maskImage; @XmlAttribute(name = "id", required = true) protected int id; @@ -99,6 +101,30 @@ public class DisplayType { } /** + * Gets the value of the maskImage property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMaskImage() { + return maskImage; + } + + /** + * Sets the value of the maskImage property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMaskImage(String value) { + this.maskImage = value; + } + + /** * Gets the value of the id property. * */ diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/image/ProfileSkinImageRegistry.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/image/ProfileSkinImageRegistry.java index b83bfa7..c435c42 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/image/ProfileSkinImageRegistry.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/image/ProfileSkinImageRegistry.java @@ -45,6 +45,7 @@ import org.tizen.emulator.skin.dbi.RotationsType; import org.tizen.emulator.skin.layout.rotation.Rotation; import org.tizen.emulator.skin.layout.rotation.SkinRotations; import org.tizen.emulator.skin.log.SkinLogger; +import org.tizen.emulator.skin.util.StringUtil; public class ProfileSkinImageRegistry { private static Logger logger = SkinLogger.getSkinLogger( @@ -52,7 +53,8 @@ public class ProfileSkinImageRegistry { public enum SkinImageType { PROFILE_IMAGE_TYPE_NORMAL, - PROFILE_IMAGE_TYPE_PRESSED + PROFILE_IMAGE_TYPE_PRESSED, + DISPLAY_MASK_IMAGE } private Display display; @@ -101,17 +103,29 @@ public class ProfileSkinImageRegistry { continue; } - String mainImage = imageList.getMainImage(); - String keyPressedImage = imageList.getKeyPressedImage(); - if (targetRotation.getName().value().equals(rotation.getName().value())) { - String mainKey = makeKey(id, SkinImageType.PROFILE_IMAGE_TYPE_NORMAL); - skinImageMap.put(mainKey, - new Image(display, skinPath + File.separator + mainImage)); - - String pressedKey = makeKey(id, SkinImageType.PROFILE_IMAGE_TYPE_PRESSED); - skinImageMap.put(pressedKey, - new Image(display, skinPath + File.separator + keyPressedImage)); + if (SkinImageType.PROFILE_IMAGE_TYPE_NORMAL == imageType) { + String mainImage = imageList.getMainImage(); + + String mainKey = makeKey(id, imageType); + skinImageMap.put(mainKey, + new Image(display, skinPath + File.separator + mainImage)); + } else if (SkinImageType.PROFILE_IMAGE_TYPE_PRESSED == imageType) { + String keyPressedImage = imageList.getKeyPressedImage(); + + String pressedKey = makeKey(id, imageType); + skinImageMap.put(pressedKey, + new Image(display, skinPath + File.separator + keyPressedImage)); + } else if (SkinImageType.DISPLAY_MASK_IMAGE == imageType) { + String displayMaskImage = rotation.getDisplay().getMaskImage(); + if (StringUtil.isEmpty(StringUtil.nvl(displayMaskImage))) { + return null; + } + + String displayMaskKey = makeKey(id, imageType); + skinImageMap.put(displayMaskKey, + new Image(display, skinPath + File.separator + displayMaskImage)); + } break; } diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/ProfileSpecificSkinComposer.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/ProfileSpecificSkinComposer.java index c44ac49..226e5b7 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/ProfileSpecificSkinComposer.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/ProfileSpecificSkinComposer.java @@ -196,6 +196,19 @@ public class ProfileSpecificSkinComposer implements ISkinComposer { } logger.info("display bounds : " + displayBounds); + Image mask = imageRegistry.getSkinImage(rotationId, SkinImageType.DISPLAY_MASK_IMAGE); + if (mask != null) { + logger.info("display masking"); + + mask = SkinUtil.createScaledImage( + shell.getDisplay(), mask, rotationId, scale); + lcdCanvas.setRegion(SkinUtil.getTrimmedRegion(mask)); + + mask.dispose(); + } else { + lcdCanvas.setRegion(null); + } + /* make profile skin */ Image originSkin = imageRegistry.getSkinImage( rotationId, SkinImageType.PROFILE_IMAGE_TYPE_NORMAL); diff --git a/tizen/src/skin/client/xsd/ProfileSpecificSkin-layout.xsd b/tizen/src/skin/client/xsd/ProfileSpecificSkin-layout.xsd index 8c966cf..6f80b33 100644 --- a/tizen/src/skin/client/xsd/ProfileSpecificSkin-layout.xsd +++ b/tizen/src/skin/client/xsd/ProfileSpecificSkin-layout.xsd @@ -48,6 +48,7 @@ xmlns:dbi="http://www.tizen.org/emulator/skin/dbi" elementFormDefault="qualified + -- 2.7.4