• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 package com.android.videoeditor;
18 
19 import android.content.Context;
20 
21 /**
22  * Represents an effect that consists of name and type.
23  */
24 public class EffectType {
25     // Effect categories
26     public static final int CATEGORY_IMAGE = 0;
27     public static final int CATEGORY_VIDEO = 1;
28 
29     // Effect types
30     public static final int EFFECT_KEN_BURNS = 0;
31     public static final int EFFECT_COLOR_GRADIENT = 1;
32     public static final int EFFECT_COLOR_SEPIA = 2;
33     public static final int EFFECT_COLOR_NEGATIVE = 3;
34 
35     /**
36      * Gets effects for the specified category, either image or video.
37      *
38      * @param context The context
39      * @param category The category
40      *
41      * @return The array of effects of the specified category
42      */
getEffects(Context context, int category)43     public static EffectType[] getEffects(Context context, int category) {
44         final EffectType[] effects;
45 
46         switch (category) {
47             case CATEGORY_IMAGE: {
48                 effects = new EffectType[4];
49                 effects[0] = new EffectType(
50                         context.getString(R.string.effect_pan_zoom), EFFECT_KEN_BURNS);
51                 effects[1] = new EffectType(
52                         context.getString(R.string.effect_gradient), EFFECT_COLOR_GRADIENT);
53                 effects[2] = new EffectType(
54                         context.getString(R.string.effect_sepia), EFFECT_COLOR_SEPIA);
55                 effects[3] = new EffectType(
56                         context.getString(R.string.effect_negative), EFFECT_COLOR_NEGATIVE);
57                 break;
58             }
59 
60             case CATEGORY_VIDEO: {
61                 effects = new EffectType[3];
62                 effects[0] = new EffectType(
63                         context.getString(R.string.effect_gradient), EFFECT_COLOR_GRADIENT);
64                 effects[1] = new EffectType(
65                         context.getString(R.string.effect_sepia), EFFECT_COLOR_SEPIA);
66                 effects[2] = new EffectType(
67                         context.getString(R.string.effect_negative), EFFECT_COLOR_NEGATIVE);
68                 break;
69             }
70 
71             default: {
72                 effects = new EffectType[0];
73                 break;
74             }
75         }
76 
77         return effects;
78     }
79 
80     // Instance variables
81     private final String mName;
82     private final int mType;
83 
EffectType(String name, int type)84     public EffectType(String name, int type) {
85         mName = name;
86         mType = type;
87     }
88 
getName()89     public String getName() {
90         return mName;
91     }
92 
getType()93     public int getType() {
94         return mType;
95     }
96 }
97