android.media.effect.EffectContext Java Examples

The following examples show how to use android.media.effect.EffectContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MediaEffectsFragment.java    From graphics-samples with Apache License 2.0 6 votes vote down vote up
@Override
public void onDrawFrame(GL10 gl) {
    if (!mInitialized) {
        //Only need to do this once
        mEffectContext = EffectContext.createWithCurrentGlContext();
        mTexRenderer.init();
        loadTextures();
        mInitialized = true;
    }
    if (mCurrentEffect != R.id.none) {
        //if an effect is chosen initialize it and apply it to the texture
        initEffect();
        applyEffect();
    }
    renderResult();
}
 
Example #2
Source File: MediaEffectsFragment.java    From android-MediaEffects with Apache License 2.0 6 votes vote down vote up
@Override
public void onDrawFrame(GL10 gl) {
    if (!mInitialized) {
        //Only need to do this once
        mEffectContext = EffectContext.createWithCurrentGlContext();
        mTexRenderer.init();
        loadTextures();
        mInitialized = true;
    }
    if (mCurrentEffect != R.id.none) {
        //if an effect is chosen initialize it and apply it to the texture
        initEffect();
        applyEffect();
    }
    renderResult();
}
 
Example #3
Source File: EffectsFilterActivity.java    From ImageEffects with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void onDrawFrame(GL10 gl) {
	if (!mInitialized) {
		// Only need to do this once
		mEffectContext = EffectContext.createWithCurrentGlContext();
		mTexRenderer.init();
		loadTextures();
		mInitialized = true;
	}
	if (mCurrentEffect != R.id.none) {
		// if an effect is chosen initialize it and apply it to the texture
		initEffect();
		applyEffect();
	}
	renderResult();
	if (saveFrame) {
		saveBitmap(takeScreenshot(gl));
	}
}
 
Example #4
Source File: MainActivity.java    From Rocko-Android-Demos with Apache License 2.0 6 votes vote down vote up
@Override
public void onDrawFrame(GL10 gl) {
    if (!mInitialized) {
        //Only need to do this once
        mEffectContext = EffectContext.createWithCurrentGlContext();
        mTexRenderer.init();
        loadTextures();
        mInitialized = true;
    }
    if (mCurrentEffect != R.id.none) {
        //if an effect is chosen initialize it and apply it to the texture
        initEffect();
        applyEffect();
    }
    renderResult();
}
 
Example #5
Source File: ImageFilterView.java    From PhotoEditor with MIT License 5 votes vote down vote up
@Override
public void onDrawFrame(GL10 gl) {

    if (!mInitialized) {
        //Only need to do this once
        mEffectContext = EffectContext.createWithCurrentGlContext();
        mTexRenderer.init();
        loadTextures();
        mInitialized = true;
    }
    if (mCurrentEffect != NONE || mCustomEffect != null) {
        //if an effect is chosen initialize it and apply it to the texture
        initEffect();
        applyEffect();
    }
    renderResult();
    if (isSaveImage) {
        final Bitmap mFilterBitmap = BitmapUtil.createBitmapFromGLSurface(this, gl);
        Log.e(TAG, "onDrawFrame: " + mFilterBitmap);
        isSaveImage = false;
        if (mOnSaveBitmap != null) {
            new Handler(Looper.getMainLooper()).post(new Runnable() {
                @Override
                public void run() {
                    mOnSaveBitmap.onBitmapReady(mFilterBitmap);
                }
            });
        }
    }
}
 
Example #6
Source File: MediaEffect.java    From libcommon with Apache License 2.0 5 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 * @param effect_context
 */
public MediaEffect(final EffectContext effect_context, final String effectName) {
	mEffectContext = effect_context;
	final EffectFactory factory = effect_context.getFactory();
	if (TextUtils.isEmpty(effectName)) {
		mEffect = null;
	} else {
		mEffect = factory.createEffect(effectName);
	}
}
 
Example #7
Source File: MediaEffectFlip.java    From libcommon with Apache License 2.0 3 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 * @param flip_vertical
 * @param flip_horizontal
 */
public MediaEffectFlip(final EffectContext effect_context,
	final boolean flip_vertical, final boolean flip_horizontal) {

	super(effect_context, EffectFactory.EFFECT_FLIP);
	setParameter(flip_vertical, flip_horizontal);
}
 
Example #8
Source File: MediaEffectCrop.java    From libcommon with Apache License 2.0 3 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 * @param x The origin's x-value. between 0 and width of the image.
 * @param y The origin's y-value. between 0 and height of the image.
 * @param width The width of the cropped image.
 * 			between 1 and the width of the image minus xorigin.
 * @param height The height of the cropped image.
 * 			between 1 and the height of the image minus yorigin.
 */
public MediaEffectCrop(final EffectContext effect_context,
	final int x, final int y, final int width, final int height) {

	super(effect_context, EffectFactory.EFFECT_CROP);
	setParameter(x, y, width, height);
}
 
Example #9
Source File: MediaEffectBitmapOverlay.java    From libcommon with Apache License 2.0 3 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 * @param bitmap The overlay bitmap.
 */
public MediaEffectBitmapOverlay(final EffectContext effect_context,
	final Bitmap bitmap) {

	super(effect_context, EffectFactory.EFFECT_BITMAPOVERLAY);
	setParameter(bitmap);
}
 
Example #10
Source File: MediaEffectDuoTone.java    From libcommon with Apache License 2.0 3 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 * @param first_color The first color tone.
 * 			representing an ARGB color with 8 bits per channel.
 * 			May be created using Color class.
 * @param second_color The second color tone. Integer,
 * 			representing an ARGB color with 8 bits per channel.
 * 			May be created using Color class.
 */
public MediaEffectDuoTone(final EffectContext effect_context,
	final int first_color, final int second_color) {

	super(effect_context, EffectFactory.EFFECT_DUOTONE);
	setParameter(first_color, second_color);
}
 
Example #11
Source File: MediaEffectBlackWhite.java    From libcommon with Apache License 2.0 2 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 */
public MediaEffectBlackWhite(final EffectContext effect_context) {
	this(effect_context, 0.0f, 1.0f);
}
 
Example #12
Source File: MediaEffectDocumentary.java    From libcommon with Apache License 2.0 2 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 */
public MediaEffectDocumentary(final EffectContext effect_context) {
	super(effect_context, EffectFactory.EFFECT_DOCUMENTARY);
}
 
Example #13
Source File: MediaEffectCrossProcess.java    From libcommon with Apache License 2.0 2 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 */
public MediaEffectCrossProcess(final EffectContext effect_context) {
	super(effect_context, EffectFactory.EFFECT_CROSSPROCESS);
}
 
Example #14
Source File: MediaEffectAutoFix.java    From libcommon with Apache License 2.0 2 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 * @param scale The scale of the adjustment. between 0 and 1.
 * Zero means no adjustment, while 1 indicates the maximum amount of adjustment.
 */
public MediaEffectAutoFix(final EffectContext effect_context, final float scale) {
	super(effect_context, EffectFactory.EFFECT_AUTOFIX);
	setParameter(scale);
}
 
Example #15
Source File: MediaEffectNull.java    From libcommon with Apache License 2.0 2 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 * 入力テクスチャを無変換で出力テクスチャにコピーする
 * @param effect_context
 */
public MediaEffectNull(final EffectContext effect_context) {
	super(effect_context, EffectFactory.EFFECT_AUTOFIX);
	setParameter("scale", 0.0f);	// scale=0.0fならコピー
}
 
Example #16
Source File: MediaEffectNegative.java    From libcommon with Apache License 2.0 2 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 */
public MediaEffectNegative(final EffectContext effect_context) {
	super(effect_context, EffectFactory.EFFECT_NEGATIVE);
}
 
Example #17
Source File: MediaEffectSharpen.java    From libcommon with Apache License 2.0 2 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 * @param scale The degree of sharpening. Float, between 0 and 1. 0 means no change.
 */
public MediaEffectSharpen(final EffectContext effect_context, final float scale) {
	super(effect_context, EffectFactory.EFFECT_SHARPEN);
	setParameter(scale);
}
 
Example #18
Source File: MediaEffectSepia.java    From libcommon with Apache License 2.0 2 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 */
public MediaEffectSepia(final EffectContext effect_context) {
	super(effect_context, EffectFactory.EFFECT_SEPIA);
}
 
Example #19
Source File: MediaEffectFillLight.java    From libcommon with Apache License 2.0 2 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 * @param strength between 0 and 1. between 0 and 1. Zero means no change.
 */
public MediaEffectFillLight(final EffectContext effect_context, final float strength) {
	super(effect_context, EffectFactory.EFFECT_FILLLIGHT);
	setParameter(strength);
}
 
Example #20
Source File: MediaEffectRotate.java    From libcommon with Apache License 2.0 2 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 * @param angle The angle of rotation in degrees.
 * 			This will be rounded to the nearest multiple of 90.
 */
public MediaEffectRotate(final EffectContext effect_context, final int angle) {
	super(effect_context, EffectFactory.EFFECT_ROTATE);
	setParameter(angle);
}
 
Example #21
Source File: MediaEffectBlackWhite.java    From libcommon with Apache License 2.0 2 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 * @param black The value of the minimal pixel. 0-1
 * @param white The value of the maximal pixel. 0-1
 */
public MediaEffectBlackWhite(final EffectContext effect_context, final float black, final float white) {
	super(effect_context, EffectFactory.EFFECT_BLACKWHITE);
	setParameter(black, white);
}
 
Example #22
Source File: MediaEffectSaturate.java    From libcommon with Apache License 2.0 2 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 * @param scale The scale of color saturation.
 * 			between -1 and 1. 0 means no change,
 * 			while -1 indicates full desaturation, i.e. grayscale.
 */
public MediaEffectSaturate(final EffectContext effect_context, final float scale) {
	super(effect_context, EffectFactory.EFFECT_SATURATE);
	setParameter(scale);
}
 
Example #23
Source File: MediaEffectRedEye.java    From libcommon with Apache License 2.0 2 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 * @param centers Multiple center points (x, y) of the red eye regions.
 * 			An array of floats, where (f[2*i], f[2*i+1])
 * 			specifies the center of the i'th eye.
 * 			Coordinate values are expected to be normalized between 0 and 1.
 */
public MediaEffectRedEye(final EffectContext effect_context, final float[] centers) {
	super(effect_context, EffectFactory.EFFECT_REDEYE);
	setParameter(centers);
}
 
Example #24
Source File: MediaEffectLomoish.java    From libcommon with Apache License 2.0 2 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 */
public MediaEffectLomoish(final EffectContext effect_context) {
	super(effect_context, EffectFactory.EFFECT_LOMOISH);
}
 
Example #25
Source File: MediaEffectGrayScale.java    From libcommon with Apache License 2.0 2 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 */
public MediaEffectGrayScale(final EffectContext effect_context) {
	super(effect_context, EffectFactory.EFFECT_GRAYSCALE);
}
 
Example #26
Source File: MediaEffectFlipHorizontal.java    From libcommon with Apache License 2.0 2 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 */
public MediaEffectFlipHorizontal(final EffectContext effect_context) {
	super(effect_context, false, true);
}
 
Example #27
Source File: MediaEffectFishEye.java    From libcommon with Apache License 2.0 2 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 * @param scale The scale of the distortion. between 0 and 1. Zero means no distortion.
 */
public MediaEffectFishEye(final EffectContext effect_context, final float scale) {
	super(effect_context, EffectFactory.EFFECT_FISHEYE);
	setParameter(scale);
}
 
Example #28
Source File: MediaEffectGrain.java    From libcommon with Apache License 2.0 2 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 * @param strength The strength of the grain effect. between 0 and 1. Zero means no change.
 */
public MediaEffectGrain(final EffectContext effect_context, final float strength) {
	super(effect_context, EffectFactory.EFFECT_GRAIN);
	setParameter(strength);
}
 
Example #29
Source File: MediaEffectTemperature.java    From libcommon with Apache License 2.0 2 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 * @param scale The value of color temperature. between 0 and 1,
 * with 0 indicating cool, and 1 indicating warm.
 * A value of of 0.5 indicates no change.
 */
public MediaEffectTemperature(final EffectContext effect_context, final float scale) {
	super(effect_context, EffectFactory.EFFECT_TEMPERATURE);
	setParameter(scale);
}
 
Example #30
Source File: MediaEffectTint.java    From libcommon with Apache License 2.0 2 votes vote down vote up
/**
 * コンストラクタ
 * GLコンテキスト内で生成すること
 *
 * @param effect_context
 * @param tint The color of the tint.
 * 			representing an ARGB color with 8 bits per channel.
 * 			May be created using Color class.
 */
public MediaEffectTint(final EffectContext effect_context, final int tint) {
	super(effect_context, EffectFactory.EFFECT_TINT);
	setParameter(tint);
}