EffectKenBurns.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
19import java.io.IOException;
20
21import android.graphics.Rect;
22
23/**
24 * This class represents a Ken Burns effect.
25 * {@hide}
26 */
27public class EffectKenBurns extends Effect {
28    // Instance variables
29    private Rect mStartRect;
30    private Rect mEndRect;
31
32    /**
33     * Objects of this type cannot be instantiated by using the default
34     * constructor
35     */
36    @SuppressWarnings("unused")
37    private EffectKenBurns() throws IOException {
38        this(null, null, null, 0, 0);
39    }
40
41    /**
42     * Constructor
43     *
44     * @param effectId The effect id
45     * @param startRect The start rectangle
46     * @param endRect The end rectangle
47     * @param startTimeMs The start time
48     * @param durationMs The duration of the Ken Burns effect in milliseconds
49     */
50    public EffectKenBurns(String effectId, Rect startRect, Rect endRect, long startTime,
51            long durationMs)
52            throws IOException {
53        super(effectId, startTime, durationMs);
54
55        mStartRect = startRect;
56        mEndRect = endRect;
57    }
58
59    /**
60     * @param startRect The start rectangle
61     *
62     * @throws IllegalArgumentException if start rectangle is incorrectly set.
63     */
64    public void setStartRect(Rect startRect) {
65        mStartRect = startRect;
66    }
67
68    /**
69     * @return The start rectangle
70     */
71    public Rect getStartRect() {
72        return mStartRect;
73    }
74
75    /**
76     * @param endRect The end rectangle
77     *
78     * @throws IllegalArgumentException if end rectangle is incorrectly set.
79     */
80    public void setEndRect(Rect endRect) {
81        mEndRect = endRect;
82    }
83
84    /**
85     * @return The end rectangle
86     */
87    public Rect getEndRect() {
88        return mEndRect;
89    }
90}
91