Android Effect - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Effect class.

This code example shows how to use the following methods:apply, setParameter
                EffectFactory.EFFECT_AUTOFIX);
        mAutoFixEffect.setParameter("scale", 0.4f);
 
        mMinMaxEffect = effectFactory.createEffect(
                EffectFactory.EFFECT_BLACKWHITE);
        mMinMaxEffect.setParameter("black", .1f);
        mMinMaxEffect.setParameter("white", .8f);
    } 
 
    private void applyEffects() { 
        mMinMaxEffect.apply(mTextures[0], mImageWidth, mImageHeight, mTextures[0]);
        mAutoFixEffect.apply(mTextures[0], mImageWidth, mImageHeight, mTextures[0]);
    } 
 
    private void renderResult() { 
        mTexRenderer.renderTexture(mTextures[0]);
    } 
 
    @Override 
    public void onDrawFrame(GL10 gl) {
8
CodeRank
This code example shows how to use the following methods:apply, setParameter
    public void process(Photo src, Photo dst) {
        dst.changeDimension(Math.round(bounds.width() * src.width()),
                Math.round(bounds.height() * src.height()));
 
        Effect effect = getEffect(EffectFactory.EFFECT_CROP);
        effect.setParameter("xorigin", Math.round(bounds.left * src.width()));
        effect.setParameter("yorigin", Math.round(bounds.top * src.height()));
        effect.setParameter("width", dst.width());
        effect.setParameter("height", dst.height());
        effect.apply(src.texture(), src.width(), src.height(), dst.texture());
    } 
 
    @Override 
    protected void writeToParcel(Parcel out) {
        out.writeParcelable(bounds, 0);
    } 
 
    @Override 
    protected void readFromParcel(Parcel in) {
        bounds = in.readParcelable(null);
7
CodeRank
This code example shows how to use the following methods:apply, setParameter
    } 
 
    @Override 
    public void process(Photo src, Photo dst) {
        Effect effect = getEffect(EffectFactory.EFFECT_FLIP);
        effect.setParameter("horizontal", flips[0]);
        effect.setParameter("vertical", flips[1]);
        effect.apply(src.texture(), src.width(), src.height(), dst.texture());
    } 
 
    @Override 
    protected void writeToParcel(Parcel out) {
        out.writeBooleanArray(flips);
    } 
 
    @Override 
    protected void readFromParcel(Parcel in) {
        in.readBooleanArray(flips);
    } 
} 
6
CodeRank
This code example shows how to use the following methods:apply, setParameter
    } 
 
    @Override 
    public void process(Photo src, Photo dst) {
        Effect effect = getEffect(EffectFactory.EFFECT_STRAIGHTEN);
        effect.setParameter("maxAngle", MAX_DEGREES);
        effect.setParameter("angle", -degrees);
        effect.apply(src.texture(), src.width(), src.height(), dst.texture());
    } 
 
    @Override 
    protected void writeToParcel(Parcel out) {
        out.writeFloat(degrees);
    } 
 
    @Override 
    protected void readFromParcel(Parcel in) {
        degrees = in.readFloat();
    } 
} 
6
CodeRank
This code example shows how to use the following methods:apply, setParameter
    } 
 
    @Override 
    public void process(Photo src, Photo dst) {
        Effect effect = getEffect(EffectFactory.EFFECT_DUOTONE);
        effect.setParameter("first_color", firstColor);
        effect.setParameter("second_color", secondColor);
        effect.apply(src.texture(), src.width(), src.height(), dst.texture());
    } 
 
    @Override 
    protected void writeToParcel(Parcel out) {
        out.writeInt(firstColor);
        out.writeInt(secondColor);
    } 
 
    @Override 
    protected void readFromParcel(Parcel in) {
        firstColor = in.readInt();
        secondColor = in.readInt();
6
CodeRank
This code example shows how to use the following methods:apply, setParameter
    public void process(Photo src, Photo dst) {
        dst.changeDimension(Math.round(bounds.width() * src.width()),
                Math.round(bounds.height() * src.height()));
 
        Effect effect = getEffect(EffectFactory.EFFECT_CROP);
        effect.setParameter("xorigin", Math.round(bounds.left * src.width()));
        effect.setParameter("yorigin", Math.round(bounds.top * src.height()));
        effect.setParameter("width", dst.width());
        effect.setParameter("height", dst.height());
        effect.apply(src.texture(), src.width(), src.height(), dst.texture());
    } 
} 
6
CodeRank
This code example shows how to use the following methods:apply, setParameter
    } 
 
    @Override 
    public void process(Photo src, Photo dst) {
        Effect effect = getEffect(EffectFactory.EFFECT_TINT);
        effect.setParameter("tint", color);
        effect.apply(src.texture(), src.width(), src.height(), dst.texture());
    } 
 
    @Override 
    protected void writeToParcel(Parcel out) {
        out.writeInt(color);
   } 
 
    @Override 
    protected void readFromParcel(Parcel in) {
        color = in.readInt();
    } 
} 
5
CodeRank
This code example shows how to use the following methods:apply, setParameter
    public void process(Photo src, Photo dst) {
        if (degrees % 180 != 0) {
            dst.changeDimension(src.height(), src.width());
        } 
        Effect effect = getEffect(EffectFactory.EFFECT_ROTATE);
        effect.setParameter("angle", (int) degrees);
        effect.apply(src.texture(), src.width(), src.height(), dst.texture());
    } 
 
    @Override 
    protected void writeToParcel(Parcel out) {
        out.writeFloat(degrees);
    } 
 
    @Override 
    protected void readFromParcel(Parcel in) {
        degrees = in.readFloat();
    } 
} 
6
CodeRank
This code example shows how to use the following methods:apply, setParameter
 
    @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
    @Override 
    public void process(Photo src, Photo dst) {
        Effect effect = getEffect("com.google.android.media.effect.effects.FaceliftEffect");
        effect.setParameter("blend", scale);
        effect.apply(src.texture(), src.width(), src.height(), dst.texture());
    } 
} 

5
CodeRank
This code example shows how to use the following methods:apply, setParameter
 
    @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
    @Override 
    public void process(Photo src, Photo dst) {
        Effect effect = getEffect(EffectFactory.EFFECT_BLACKWHITE);
        effect.setParameter("black", black);
        effect.setParameter("white", 1f);
        effect.apply(src.texture(), src.width(), src.height(), dst.texture());
    } 
} 
5
CodeRank
See Code Examples for Android Effect Methods: