blob: b7a1cf1c728f7aed4ba30c9255c95574011152f6 [file] [log] [blame]
Ruei-sung Lin08e2b472011-10-13 18:20:07 -07001/*
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 com.android.gallery3d.photoeditor.filters;
18
19import android.media.effect.Effect;
Jorge Ruesgaa901f882012-06-12 23:28:58 +020020import android.media.effect.EffectFactory;
Ruei-sung Lin08e2b472011-10-13 18:20:07 -070021
22import com.android.gallery3d.photoeditor.Photo;
23
24/**
25 * Face tanning filter applied to the image.
26 */
Yuli Huang738e82e2011-11-04 16:39:50 +080027public class FaceTanFilter extends AbstractScaleFilter {
Ruei-sung Lin08e2b472011-10-13 18:20:07 -070028
Yuli Huang738e82e2011-11-04 16:39:50 +080029 public static final Creator<FaceTanFilter> CREATOR = creatorOf(FaceTanFilter.class);
Ruei-sung Lin08e2b472011-10-13 18:20:07 -070030
Jorge Ruesgaa901f882012-06-12 23:28:58 +020031 private static final String EFFECT_FACE_TANNING = "com.google.android.media.effect.effects.FaceTanningEffect";
32
Ruei-sung Lin08e2b472011-10-13 18:20:07 -070033 @Override
34 public void process(Photo src, Photo dst) {
Jorge Ruesgaa901f882012-06-12 23:28:58 +020035 Effect effect = getEffect(EFFECT_FACE_TANNING);
Ruei-sung Lin08e2b472011-10-13 18:20:07 -070036 effect.setParameter("blend", scale);
37 effect.apply(src.texture(), src.width(), src.height(), dst.texture());
38 }
Jorge Ruesgaa901f882012-06-12 23:28:58 +020039
40 /**
41 * Checks if the effect is present in the system.
42 *
43 * @return boolean true if an effect is present in the system and can be loaded
44 */
45 public static boolean isPresent() {
46 return EffectFactory.isEffectSupported(EFFECT_FACE_TANNING);
47 }
48
Ruei-sung Lin08e2b472011-10-13 18:20:07 -070049}