Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ce122e3 authored by Gil Dobjanschi's avatar Gil Dobjanschi
Browse files

Color effect comments and method name changes.

Change-Id: I58a9535e2bc4f61532f980f31bba4140797bf483
parent 84e8827a
Loading
Loading
Loading
Loading
+32 −14
Original line number Diff line number Diff line
@@ -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;
    }
}
+3 −2
Original line number Diff line number Diff line
@@ -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;