blob: 3e4fad206e0e10e3b4d032b37fa2c5f6e26f3ee0 [file] [log] [blame]
Ruei-sung Lind37ff2e2011-09-19 14:33:17 +08001/*
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 Lind37ff2e2011-09-19 14:33:17 +080021
22import com.android.gallery3d.photoeditor.Photo;
23
24/**
25 * Facelift filter applied to the image.
26 */
Yuli Huang738e82e2011-11-04 16:39:50 +080027public class FaceliftFilter extends AbstractScaleFilter {
Ruei-sung Lind37ff2e2011-09-19 14:33:17 +080028
Yuli Huang738e82e2011-11-04 16:39:50 +080029 public static final Creator<FaceliftFilter> CREATOR = creatorOf(FaceliftFilter.class);
Ruei-sung Lind37ff2e2011-09-19 14:33:17 +080030
Jorge Ruesgaa901f882012-06-12 23:28:58 +020031 private static final String EFFECT_FACELIFT = "com.google.android.media.effect.effects.FaceliftEffect";
32
Ruei-sung Lind37ff2e2011-09-19 14:33:17 +080033 @Override
Yuli Huangc7e39d12011-10-05 16:22:10 +080034 public void process(Photo src, Photo dst) {
Jorge Ruesgaa901f882012-06-12 23:28:58 +020035 Effect effect = getEffect(EFFECT_FACELIFT);
Ruei-sung Lind37ff2e2011-09-19 14:33:17 +080036 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_FACELIFT);
47 }
Ruei-sung Lind37ff2e2011-09-19 14:33:17 +080048}