EffectKenBurns.java revision a573b563b3c6a3edc60393543dc9adb7ade4f188
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 17 18package android.media.videoeditor; 19 20import android.graphics.Rect; 21 22/** 23 * This class represents a Ken Burns effect. 24 * {@hide} 25 */ 26public class EffectKenBurns extends Effect { 27 /** 28 * Instance variables 29 */ 30 private Rect mStartRect; 31 private Rect mEndRect; 32 33 /** 34 * Objects of this type cannot be instantiated by using the default 35 * constructor 36 */ 37 @SuppressWarnings("unused") 38 private EffectKenBurns() { 39 this(null, null, null, null, 0, 0); 40 } 41 42 /** 43 * Constructor 44 * 45 * @param mediaItem The media item owner 46 * @param effectId The effect id 47 * @param startRect The start rectangle 48 * @param endRect The end rectangle 49 * @param startTimeMs The start time 50 * @param durationMs The duration of the Ken Burns effect in milliseconds 51 */ 52 public EffectKenBurns(MediaItem mediaItem, String effectId, Rect startRect, 53 Rect endRect, long startTimeMs, long durationMs) { 54 super(mediaItem, effectId, startTimeMs, durationMs); 55 56 mStartRect = startRect; 57 mEndRect = endRect; 58 } 59 60 61 /** 62 * Get the start rectangle. 63 * 64 * @return The start rectangle 65 */ 66 public Rect getStartRect() { 67 return mStartRect; 68 } 69 70 71 /** 72 * Get the end rectangle. 73 * 74 * @return The end rectangle 75 */ 76 public Rect getEndRect() { 77 return mEndRect; 78 } 79 80 /** 81 * Get the KenBurn effect start and end rectangle coordinates 82 * @param start The rect object to be populated with start 83 * rectangle coordinates 84 * 85 * @param end The rect object to be populated with end 86 * rectangle coordinates 87 */ 88 void getKenBurnsSettings(Rect start, Rect end) { 89 start.left = getStartRect().left; 90 start.top = getStartRect().top; 91 start.right = getStartRect().right; 92 start.bottom = getStartRect().bottom; 93 end.left = getEndRect().left; 94 end.top = getEndRect().top; 95 end.right = getEndRect().right; 96 end.bottom = getEndRect().bottom; 97 } 98} 99