EffectColor.java revision fdacc8be92cd36f712cfdb0fcf9b0e847f8eeb58
1/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.media.videoeditor;
18
19/**
20 * This class allows to apply color on a media item.
21 * {@hide}
22 */
23public class EffectColor extends Effect {
24
25    /**
26     * Change the video frame color to the RGB color value provided
27     */
28    public static final int TYPE_COLOR = 1; // color as 888 RGB
29    /**
30     * Change the video frame color to a gradation from RGB color (at the top of
31     * the frame) to black (at the bottom of the frame).
32     */
33    public static final int TYPE_GRADIENT = 2;
34    /**
35     * Change the video frame color to sepia
36     */
37    public static final int TYPE_SEPIA = 3;
38    /**
39     * Invert the video frame color
40     */
41    public static final int TYPE_NEGATIVE = 4;
42    /**
43     * Make the video look like as if it was recorded in 50's
44     */
45    public static final int TYPE_FIFTIES = 5;
46
47    // Colors for the color effect
48    public static final int GREEN = 0x0000ff00;
49    public static final int PINK = 0x00ff66cc;
50    public static final int GRAY = 0x007f7f7f;
51
52    // The effect type
53    private final int mType;
54
55    // The effect parameter
56    private final int mParam;
57
58    /**
59     * An object of this type cannot be instantiated by using the default
60     * constructor
61     */
62    @SuppressWarnings("unused")
63    private EffectColor() {
64        this(null, 0, 0, 0, 0);
65    }
66
67    /**
68     * Constructor
69     *
70     * @param effectId The effect id
71     * @param startTimeMs The start time relative to the media item to which it
72     *            is applied
73     * @param durationMs The duration of this effect in milliseconds
74     * @param type type of the effect. type is one of: TYPE_COLOR,
75     *            TYPE_GRADIENT, TYPE_SEPIA, TYPE_NEGATIVE, TYPE_FIFTIES. If
76     *            type is not supported, the argument is ignored
77     * @param param if type is TYPE_COLOR, param is the RGB color as 888.
78     *            Otherwise, param is ignored
79     */
80    public EffectColor(String effectId, long startTimeMs, long durationMs,
81            int type, int param) {
82        super(effectId, startTimeMs, durationMs);
83        mType = type;
84        mParam = param;
85    }
86
87    /**
88     * @return The type of this effect
89     */
90    public int getType() {
91        return mType;
92    }
93
94    /**
95     * @return the color as RGB 888 if type is TYPE_COLOR. Otherwise, ignore.
96     */
97    public int getParam() {
98        return mParam;
99    }
100}
101