summaryrefslogtreecommitdiffstats
path: root/media/java
diff options
context:
space:
mode:
authorGil Dobjanschi <virgild@google.com>2010-10-11 12:11:25 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-10-11 12:11:25 -0700
commitc5d322998325aa03c9716413295b8da3efbc165a (patch)
treeedaa8f19a79299b228a1afe31a10273f75327901 /media/java
parent4cda1e3e8bb983cf838007acb25f98c78256aea4 (diff)
parent0ce122e38b46ce3dc5d37c7b0719c0b9325e9cc0 (diff)
downloadframeworks_base-c5d322998325aa03c9716413295b8da3efbc165a.zip
frameworks_base-c5d322998325aa03c9716413295b8da3efbc165a.tar.gz
frameworks_base-c5d322998325aa03c9716413295b8da3efbc165a.tar.bz2
Merge "Color effect comments and method name changes."
Diffstat (limited to 'media/java')
-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;