summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/controller
diff options
context:
space:
mode:
authorJohn Hoford <hoford@google.com>2013-08-22 14:38:19 -0700
committerJohn Hoford <hoford@google.com>2013-08-22 15:22:18 -0700
commit49798939f1bc58eaf5842bbc8bc5424284ab7930 (patch)
tree1c46853c45ce2ad7f5a930b29c779f4365ec4028 /src/com/android/gallery3d/filtershow/controller
parent73d0f42972c7c49a2589f2184f67e5a887007e7e (diff)
downloadandroid_packages_apps_Gallery2-49798939f1bc58eaf5842bbc8bc5424284ab7930.tar.gz
android_packages_apps_Gallery2-49798939f1bc58eaf5842bbc8bc5424284ab7930.tar.bz2
android_packages_apps_Gallery2-49798939f1bc58eaf5842bbc8bc5424284ab7930.zip
border UI editor
bug:9470514 Change-Id: I4d5cd91775c9b8742f847fd9a955f6f28e66cd38
Diffstat (limited to 'src/com/android/gallery3d/filtershow/controller')
-rw-r--r--src/com/android/gallery3d/filtershow/controller/ParameterColor.java21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/com/android/gallery3d/filtershow/controller/ParameterColor.java b/src/com/android/gallery3d/filtershow/controller/ParameterColor.java
index 2608df6ce..4f8248fb0 100644
--- a/src/com/android/gallery3d/filtershow/controller/ParameterColor.java
+++ b/src/com/android/gallery3d/filtershow/controller/ParameterColor.java
@@ -16,6 +16,8 @@
package com.android.gallery3d.filtershow.controller;
+import android.graphics.Color;
+
public class ParameterColor implements Parameter {
public static String sParameterType = "ParameterColor";
protected Control mControl;
@@ -23,10 +25,12 @@ public class ParameterColor implements Parameter {
float[] mHSVO = new float[4];
String mParameterName;
int mValue;
- public final int ID;
+ public final int ID;
- public ParameterColor(int id) {
+ public ParameterColor(int id, int defaultColor) {
ID = id;
+ Color.colorToHSV(defaultColor, mHSVO);
+ mHSVO[3] = ((defaultColor >> 24) & 0xFF) / (float) 255;
}
@Override
@@ -36,24 +40,23 @@ public class ParameterColor implements Parameter {
public void setColor(float[] hsvo) {
mHSVO = hsvo;
+ mValue = Color.HSVToColor((int) (hsvo[3] * 255), mHSVO);
}
public float[] getColor() {
- mHSVO[3] = getValue() ;
return mHSVO;
}
-
public void copyFrom(Parameter src) {
- if (!(src instanceof BasicParameterInt)) {
+ if (!(src instanceof ParameterColor)) {
throw new IllegalArgumentException(src.getClass().getName());
}
- BasicParameterInt p = (BasicParameterInt) src;
+ ParameterColor p = (ParameterColor) src;
mValue = p.mValue;
+ System.arraycopy(p.mHSVO, 0, mHSVO, 0, 4);
}
-
@Override
public String getParameterName() {
return mParameterName;
@@ -61,7 +64,7 @@ public class ParameterColor implements Parameter {
@Override
public String getValueString() {
- return "("+Integer.toHexString(mValue)+")";
+ return "(" + Integer.toHexString(mValue) + ")";
}
@Override
@@ -75,6 +78,8 @@ public class ParameterColor implements Parameter {
public void setValue(int value) {
mValue = value;
+ Color.colorToHSV(mValue, mHSVO);
+ mHSVO[3] = ((mValue >> 24) & 0xFF) / (float) 255;
}
@Override