本文整理汇总了Java中android.media.effect.Effect.setParameter方法的典型用法代码示例。如果您正苦于以下问题:Java Effect.setParameter方法的具体用法?Java Effect.setParameter怎么用?Java Effect.setParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.media.effect.Effect
的用法示例。
在下文中一共展示了Effect.setParameter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEffect
import android.media.effect.Effect; //导入方法依赖的package包/类
protected Effect getEffect(String name) {
Effect effect = null;
if (context == null) {
context = EffectContext.createWithCurrentGlContext();
}
effect = context.getFactory().createEffect(name);
effect.setParameter("tile_size", DEFAULT_TILE_SIZE);
effects.put(this, effect);
return effect;
}
示例2: process
import android.media.effect.Effect; //导入方法依赖的package包/类
@Override
public void process(Photo src, Photo dst) {
Effect effect = getEffect(EffectFactory.EFFECT_REDEYE);
float[] centers = new float[redeyes.size() * 2];
int i = 0;
for (PointF eye : redeyes) {
centers[i++] = eye.x;
centers[i++] = eye.y;
}
effect.setParameter("centers", centers);
effect.apply(src.texture(), src.width(), src.height(), dst.texture());
}
示例3: updateParameters
import android.media.effect.Effect; //导入方法依赖的package包/类
private void updateParameters(EFFECTS type, Effect effect) {
Settings settings = type.mSettings;
if (settings == null) {
return;
}
int val = Preferences.General.Effects.getEffectSettings(mContext, type.mId, settings.mDef);
// Update the parameters
if (type.compareTo(EFFECTS.AUTOFIX) == 0) {
effect.setParameter("scale", (val * 0.05f));
} else if (type.compareTo(EFFECTS.BLUR) == 0) {
effect.setParameter(BlurEffect.STRENGTH_PARAMETER, (val * 0.2f) + 1.0f);
} else if (type.compareTo(EFFECTS.FROSTED) == 0) {
effect.setParameter(FrostedEffect.STRENGTH_PARAMETER, (val * 0.005f) + 0.005f);
} else if (type.compareTo(EFFECTS.GRAIN) == 0) {
effect.setParameter("strength", (val * 0.075f) + 0.075f);
} else if (type.compareTo(EFFECTS.DOF) == 0) {
effect.setParameter(DoFEffect.STRENGTH_PARAMETER, (val * 0.05f));
} else if (type.compareTo(EFFECTS.SCANLINES) == 0) {
effect.setParameter(ScanlinesEffect.STRENGTH_PARAMETER, (val * 0.3f) + 3f);
} else if (type.compareTo(EFFECTS.HALFTONE) == 0) {
effect.setParameter(HalftoneEffect.STRENGTH_PARAMETER, (val * 4f) + 40f);
} else if (type.compareTo(EFFECTS.NOISE) == 0) {
effect.setParameter(NoiseEffect.STRENGTH_PARAMETER, (val * 0.00175) + 0.00175);
} else if (type.compareTo(EFFECTS.PIXELATE) == 0) {
effect.setParameter(PixelateEffect.STRENGTH_PARAMETER, (val * 0.075) + 0.5);
} else if (type.compareTo(EFFECTS.SATURATE) == 0) {
effect.setParameter("scale", (val * 0.04f) + 0.1f);
} else if (type.compareTo(EFFECTS.TEMPERATURE) == 0) {
effect.setParameter("scale", (val * 0.04f) + 0.1f);
} else if (type.compareTo(EFFECTS.VIGNETTE) == 0) {
effect.setParameter("scale", (val * 0.04f) + 0.1f);
} else if (type.compareTo(EFFECTS.SWIRL) == 0) {
effect.setParameter(SwirlEffect.STRENGTH_PARAMETER, (val * 0.15f) + 1.0f);
} else if (type.compareTo(EFFECTS.DUOTONE) == 0) {
final String[] firstColors = {"#ff4a61c6", "#ffc64a50", "#ff4ac65b"};
final int[] secondColors = {Color.WHITE, Color.BLACK, Color.LTGRAY};
effect.setParameter("first_color", Color.parseColor(firstColors[val % firstColors.length]));
effect.setParameter("second_color", secondColors[(val / secondColors.length)]);
} else if (type.compareTo(EFFECTS.TINT) == 0) {
final int[] colors = {
Color.WHITE, Color.BLACK, Color.LTGRAY, Color.LTGRAY, Color.DKGRAY,
Color.parseColor("#ff4a61c6"), Color.parseColor("#ffc64a50"),
Color.parseColor("#ff4ac65b"), Color.parseColor("#ffc64ab6"),
Color.parseColor("#ffc6c54a"), Color.parseColor("#ffc69f4a"),
Color.parseColor("#ff934ac6"), Color.parseColor("#ffffa500")};
effect.setParameter("tint", colors[val]);
}
}