summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGil Dobjanschi <virgild@google.com>2010-10-11 07:18:00 -0700
committerGil Dobjanschi <virgild@google.com>2010-10-11 11:24:14 -0700
commit0ce122e38b46ce3dc5d37c7b0719c0b9325e9cc0 (patch)
tree7faa73c5a5fac843eeb60e4914bab6862460b05b
parent84e8827a477cdf3d8c2b67e370395b22ec1963ad (diff)
downloadframeworks_base-0ce122e38b46ce3dc5d37c7b0719c0b9325e9cc0.zip
frameworks_base-0ce122e38b46ce3dc5d37c7b0719c0b9325e9cc0.tar.gz
frameworks_base-0ce122e38b46ce3dc5d37c7b0719c0b9325e9cc0.tar.bz2
Color effect comments and method name changes.
Change-Id: I58a9535e2bc4f61532f980f31bba4140797bf483
-rwxr-xr-xmedia/java/android/media/videoeditor/EffectColor.java46
-rw-r--r--media/java/android/media/videoeditor/VideoEditorTestImpl.java5
2 files changed, 35 insertions, 16 deletions
diff --git a/media/java/android/media/videoeditor/EffectColor.java b/media/java/android/media/videoeditor/EffectColor.java
index f38cf75..ac48e37 100755
--- a/media/java/android/media/videoeditor/EffectColor.java
+++ b/media/java/android/media/videoeditor/EffectColor.java
@@ -25,7 +25,7 @@ public class EffectColor extends Effect {
/**
* Change the video frame color to the RGB color value provided
*/
- public static final int TYPE_COLOR = 1; // color as 888 RGB
+ public static final int TYPE_COLOR = 1;
/**
* Change the video frame color to a gradation from RGB color (at the top of
* the frame) to black (at the bottom of the frame).
@@ -44,7 +44,7 @@ public class EffectColor extends Effect {
*/
public static final int TYPE_FIFTIES = 5;
- // Colors for the color effect
+ // Predefined colors
public static final int GREEN = 0x0000ff00;
public static final int PINK = 0x00ff66cc;
public static final int GRAY = 0x007f7f7f;
@@ -52,8 +52,8 @@ public class EffectColor extends Effect {
// The effect type
private final int mType;
- // The effect parameter
- private final int mParam;
+ // The effect color
+ private final int mColor;
/**
* An object of this type cannot be instantiated by using the default
@@ -73,29 +73,47 @@ public class EffectColor extends Effect {
* is applied
* @param durationMs The duration of this effect in milliseconds
* @param type type of the effect. type is one of: TYPE_COLOR,
- * TYPE_GRADIENT, TYPE_SEPIA, TYPE_NEGATIVE, TYPE_FIFTIES. If
- * type is not supported, the argument is ignored
- * @param param if type is TYPE_COLOR, param is the RGB color as 888.
- * Otherwise, param is ignored
+ * TYPE_GRADIENT, TYPE_SEPIA, TYPE_NEGATIVE, TYPE_FIFTIES.
+ * @param color If type is TYPE_COLOR, color is the RGB color as 888.
+ * If type is TYPE_GRADIENT, color is the RGB color at the
+ * top of the frame. Otherwise, color is ignored
*/
public EffectColor(MediaItem mediaItem, String effectId, long startTimeMs, long durationMs,
- int type, int param) {
+ int type, int color) {
super(mediaItem, effectId, startTimeMs, durationMs);
+ switch (type) {
+ case TYPE_COLOR:
+ case TYPE_GRADIENT: {
+ mColor = color;
+ break;
+ }
+
+ case TYPE_SEPIA:
+ case TYPE_NEGATIVE:
+ case TYPE_FIFTIES: {
+ mColor = -1;
+ break;
+ }
+
+ default: {
+ throw new IllegalArgumentException("Invalid type: " + type);
+ }
+ }
+
mType = type;
- mParam = param;
}
/**
- * @return The type of this effect
+ * @return The effect type
*/
public int getType() {
return mType;
}
/**
- * @return the color as RGB 888 if type is TYPE_COLOR. Otherwise, ignore.
+ * @return the color as RGB 888 if type is TYPE_COLOR or TYPE_GRADIENT.
*/
- public int getParam() {
- return mParam;
+ public int getColor() {
+ return mColor;
}
}
diff --git a/media/java/android/media/videoeditor/VideoEditorTestImpl.java b/media/java/android/media/videoeditor/VideoEditorTestImpl.java
index c3cb82a..cf0e3ba 100644
--- a/media/java/android/media/videoeditor/VideoEditorTestImpl.java
+++ b/media/java/android/media/videoeditor/VideoEditorTestImpl.java
@@ -643,7 +643,7 @@ public class VideoEditorTestImpl implements VideoEditor {
Integer.toString(colorEffect.getType()));
if (colorEffect.getType() == EffectColor.TYPE_COLOR) {
serializer.attribute("", ATTR_COLOR_EFFECT_VALUE,
- Integer.toString(colorEffect.getParam()));
+ Integer.toString(colorEffect.getColor()));
}
} else if (effect instanceof EffectKenBurns) {
final Rect startRect = ((EffectKenBurns)effect).getStartRect();
@@ -972,7 +972,8 @@ public class VideoEditorTestImpl implements VideoEditor {
final int colorEffectType =
Integer.parseInt(parser.getAttributeValue("", ATTR_COLOR_EFFECT_TYPE));
final int color;
- if (colorEffectType == EffectColor.TYPE_COLOR) {
+ if (colorEffectType == EffectColor.TYPE_COLOR
+ || colorEffectType == EffectColor.TYPE_GRADIENT) {
color = Integer.parseInt(parser.getAttributeValue("", ATTR_COLOR_EFFECT_VALUE));
} else {
color = 0;