当前位置: 首页>>代码示例>>Java>>正文


Java Effect类代码示例

本文整理汇总了Java中android.media.effect.Effect的典型用法代码示例。如果您正苦于以下问题:Java Effect类的具体用法?Java Effect怎么用?Java Effect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Effect类属于android.media.effect包,在下文中一共展示了Effect类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: applyEffect

import android.media.effect.Effect; //导入依赖的package包/类
private static int applyEffect(int[] textureHandles, int n, Effect effect, Rect dimen) {
    // Apply the border (we need a thread-safe call here)
    synchronized (SYNC) {
        // No more than 1024 (the minimum supported by all the gles20 devices)
        effect.apply(textureHandles[n], dimen.width(), dimen.height(), textureHandles[n + 1]);
    }

    // Delete the unused texture
    if (GLESUtil.DEBUG_GL_MEMOBJS) {
        Log.d(GLESUtil.DEBUG_GL_MEMOBJS_DEL_TAG, "glDeleteTextures: ["
                + textureHandles[n] + "]");
    }
    GLES20.glDeleteTextures(1, textureHandles, n);
    GLESUtil.glesCheckError("glDeleteTextures");
    return textureHandles[n + 1];
}
 
开发者ID:jruesga,项目名称:PhotoPhase,代码行数:17,代码来源:GLESUtil.java

示例2: releaseContext

import android.media.effect.Effect; //导入依赖的package包/类
/**
 * Filter context should be released before the current GL context is lost.
 */
public static void releaseContext() {
    if (context != null) {
        // Release all effects created with the releasing context.
        for (Effect effect : effects.values()) {
            effect.release();
        }
        effects.clear();
        context.release();
        context = null;
    }
}
 
开发者ID:hubert1002,项目名称:WiCamera3D,代码行数:15,代码来源:Filter.java

示例3: 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;
}
 
开发者ID:hubert1002,项目名称:WiCamera3D,代码行数:11,代码来源:Filter.java

示例4: 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());
}
 
开发者ID:hubert1002,项目名称:WiCamera3D,代码行数:13,代码来源:RedEyeFilter.java

示例5: SimpleTextureManager

import android.media.effect.Effect; //导入依赖的package包/类
public SimpleTextureManager(Context context, Effect effect, Border border, boolean singleTexture) {
    // Pre-calculate the window size for the PhotoPhaseTextureManager. In onSurfaceChanged
    // the best fixed size will be set. The disposition size is simple for a better
    // performance of the internal arrays
    final Configuration conf = context.getResources().getConfiguration();
    int w = (int) AndroidHelper.convertDpToPixel(context, conf.screenWidthDp);
    int h = (int) AndroidHelper.convertDpToPixel(context, conf.screenHeightDp);
    mDimensions = new Rect(0, 0, w, h);
    mEffect = effect;
    mBorder = border;
    mContext = context;
    mSingleTexture = singleTexture;
}
 
开发者ID:jruesga,项目名称:PhotoPhase,代码行数:14,代码来源:SimpleTextureManager.java

示例6: release

import android.media.effect.Effect; //导入依赖的package包/类
/**
 * Method that that release the cached data
 */
public void release() {
    for (Effect effect : mCachedEffects.values()) {
        try {
            effect.release();
        } catch (NoSuchElementException ex) {
            // Catching a runtime exception is not ideally, but releasing
            // the effect causes a fc it the effect is not a valid state.
            // Since we are releasing the effect we can ignore it to avoid
            // crash the app
        }
    }
    mCachedEffects.clear();
}
 
开发者ID:jruesga,项目名称:PhotoPhase,代码行数:17,代码来源:Effects.java

示例7: getNextEffect

import android.media.effect.Effect; //导入依赖的package包/类
/**
 * Method that return the next effect to use with the picture.
 *
 * @return Effect The next effect to use or null if no need to apply any effect
 */
@SuppressWarnings("boxing")
public Effect getNextEffect() {
    // Get an effect based on the user preference
    EFFECTS[] effects = Preferences.General.Effects.toEFFECTS(
            Preferences.General.Effects.getSelectedEffects(mContext));
    EFFECTS nextEffect = null;
    if (effects.length > 0) {
        int low = 0;
        int high = effects.length - 1;
        int pos = Utils.getNextRandom(low, high);
        nextEffect = effects[pos];
    }
    return getEffect(nextEffect);
}
 
开发者ID:jruesga,项目名称:PhotoPhase,代码行数:20,代码来源:Effects.java

示例8: release

import android.media.effect.Effect; //导入依赖的package包/类
public void release() {
    Effect effect = effects.remove(this);
    if (effect != null) {
        effect.release();
    }
}
 
开发者ID:hubert1002,项目名称:WiCamera3D,代码行数:7,代码来源:Filter.java

示例9: 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]);
    }
}
 
开发者ID:jruesga,项目名称:PhotoPhase,代码行数:50,代码来源:Effects.java


注:本文中的android.media.effect.Effect类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。