Java 类android.media.effect.EffectContext 实例源码
项目:buildAPKsSamples
文件:HelloEffects.java
@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();
}
项目:camp_exam_HelloEffects
文件:HelloEffects.java
@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();
}
项目:Rocko-Android-Demos
文件:MainActivity.java
@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();
}
项目:android-demos
文件:TextureRenderer.java
@Override
public void onDrawFrame(GL10 gl) {
if (!mInitialized) {
//Only need to do this once
mEffectContext = EffectContext.createWithCurrentGlContext();
init();
loadTextures();
mInitialized = true;
}
if (mEffectChanged) {
initEffect();
applyEffect();
mEffectChanged = false;
}
renderResult();
}
项目:ImageEffects
文件:EffectsFilterActivity.java
@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));
}
}
项目:PhotoPhase
文件:PhotoPhaseTextureManager.java
/**
* Constructor of <code>PhotoPhaseTextureManager</code>
*
* @param ctx The current context
* @param effectCtx The current effect context
* @param dispatcher The GLES dispatcher
* @param requestors The number of requestors
* @param screenDimensions The screen dimensions
*/
public PhotoPhaseTextureManager(final Context ctx, final Handler handler,
final EffectContext effectCtx, GLESSurfaceDispatcher dispatcher,
int requestors, Rect screenDimensions) {
super();
mContext = ctx;
mHandler = handler;
mEffects = new Effects(ctx, effectCtx);
mBorders = new Borders(ctx, effectCtx);
mDispatcher = dispatcher;
mScreenDimensions = screenDimensions;
mDimensions = screenDimensions; // For now, use the screen dimensions as the preferred dimensions for bitmaps
mSync = new Object();
mPendingRequests = new ArrayList<>(requestors);
mPictureDiscoverer = new MediaPictureDiscoverer(mContext);
// Run the media discovery thread
mBackgroundTask = new BackgroundPictureLoaderThread();
mBackgroundTask.mTaskPaused = false;
reloadMedia(false);
}
项目:PhotoPhase
文件:PhotoPhaseTextureManager.java
/**
* Method that update the effect context if the EGL context change
*
* @param effectCtx The new effect context
*/
public void updateEffectContext(final EffectContext effectCtx) {
synchronized (mEffectsSync) {
if (mEffects != null) {
mEffects.release();
mEffects = null;
}
mEffects = new Effects(mContext, effectCtx);
if (mBorders != null) {
mBorders.release();
mBorders = null;
}
mBorders = new Borders(mContext, effectCtx);
}
emptyTextureQueue(true);
}
项目:PhotoPhase
文件:DoubleBorder.java
/**
* Constructor of <code>DoubleBorder</code>.
*
* @param ctx The effect context
* @param name The effect name
*/
public DoubleBorder(EffectContext ctx, String name) {
super(ctx, DoubleBorder.class.getName());
init(VERTEX_SHADER, FRAGMENT_SHADER);
// Parameters
mWidthHandle = GLES20.glGetUniformLocation(mProgram[0], "w");
GLESUtil.glesCheckError("glGetUniformLocation");
mHeightHandle = GLES20.glGetUniformLocation(mProgram[0], "h");
GLESUtil.glesCheckError("glGetUniformLocation");
mStrengthHandle = GLES20.glGetUniformLocation(mProgram[0], STRENGTH_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
mStrengthHandle2 = GLES20.glGetUniformLocation(mProgram[0], STRENGTH_PARAMETER2);
GLESUtil.glesCheckError("glGetUniformLocation");
mColorHandle = GLES20.glGetUniformLocation(mProgram[0], COLOR_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
}
项目:PhotoPhase
文件:DoubleJoinedBorder.java
/**
* Constructor of <code>DoubleJoinedBorder</code>.
*
* @param ctx The effect context
* @param name The effect name
*/
public DoubleJoinedBorder(EffectContext ctx, String name) {
super(ctx, DoubleJoinedBorder.class.getName());
init(VERTEX_SHADER, FRAGMENT_SHADER);
// Parameters
mWidthHandle = GLES20.glGetUniformLocation(mProgram[0], "w");
GLESUtil.glesCheckError("glGetUniformLocation");
mHeightHandle = GLES20.glGetUniformLocation(mProgram[0], "h");
GLESUtil.glesCheckError("glGetUniformLocation");
mStrengthHandle = GLES20.glGetUniformLocation(mProgram[0], STRENGTH_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
mStrengthHandle2 = GLES20.glGetUniformLocation(mProgram[0], STRENGTH_PARAMETER2);
GLESUtil.glesCheckError("glGetUniformLocation");
mColorHandle = GLES20.glGetUniformLocation(mProgram[0], COLOR_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
}
项目:PhotoPhase
文件:ElegantBorder.java
/**
* Constructor of <code>RoundedBorder</code>.
*
* @param ctx The effect context
* @param name The effect name
*/
public ElegantBorder(EffectContext ctx, String name) {
super(ctx, ElegantBorder.class.getName());
init(VERTEX_SHADER, FRAGMENT_SHADER);
// Parameters
mWidthHandle = GLES20.glGetUniformLocation(mProgram[0], "w");
GLESUtil.glesCheckError("glGetUniformLocation");
mHeightHandle = GLES20.glGetUniformLocation(mProgram[0], "h");
GLESUtil.glesCheckError("glGetUniformLocation");
mStrengthHandle = GLES20.glGetUniformLocation(mProgram[0], STRENGTH_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
mColorHandle = GLES20.glGetUniformLocation(mProgram[0], COLOR_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
mBgColorHandle = GLES20.glGetUniformLocation(mProgram[0], BGCOLOR_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
}
项目:libcommon
文件:MediaEffect.java
/**
* コンストラクタ
* 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);
}
}
项目:WiCamera3D
文件:Filter.java
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;
}
项目:binea_project_for_android
文件:MainActivity.java
@Override
public void onDrawFrame(GL10 gl10) {
if(effectContext==null) {
effectContext = EffectContext.createWithCurrentGlContext();
}
if(effect!=null){
effect.release();
}
if(null == effectType){
effectType = EffectFactory.EFFECT_DOCUMENTARY;
}
grayScaleEffect(effectType);
square.draw(textures[1]);
}
项目:PhotoPhase
文件:LivePreviewView.java
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
TypedValue a = new TypedValue();
getContext().getTheme().resolveAttribute(android.R.attr.colorBackground, a, true);
if (a.type >= TypedValue.TYPE_FIRST_COLOR_INT
&& a.type <= TypedValue.TYPE_LAST_COLOR_INT) {
mBackgroundColor = new GLColor(a.data);
} else {
mBackgroundColor = new GLColor(Color.WHITE);
}
// We have a 2d (fake) scenario, disable all unnecessary tests. Deep are
// necessary for some 3d effects
GLES20.glDisable(GL10.GL_DITHER);
GLESUtil.glesCheckError("glDisable");
GLES20.glDisable(GL10.GL_CULL_FACE);
GLESUtil.glesCheckError("glDisable");
GLES20.glEnable(GL10.GL_DEPTH_TEST);
GLESUtil.glesCheckError("glEnable");
GLES20.glDepthMask(false);
GLESUtil.glesCheckError("glDepthMask");
GLES20.glDepthFunc(GLES20.GL_LEQUAL);
GLESUtil.glesCheckError("glDepthFunc");
// Recreate the effect contexts
recycle();
synchronized (mLock) {
mEffectContext = EffectContext.createWithCurrentGlContext();
mEffectsFactory = new Effects(mContext, mEffectContext);
mBordersFactory = new Borders(mContext, mEffectContext);
recreateContext();
boolean singleTexture = mTransitionType.equals(Transitions.TRANSITIONS.NO_TRANSITION);
mTextureManager = new SimpleTextureManager(mContext, mEffect, mBorder, singleTexture);
mTransition = Transitions.createTransition(mContext, mTextureManager, mTransitionType);
}
mRecycled = false;
}
项目:PhotoPhase
文件:Effects.java
/**
* Constructor of <code>Effects</code>
*
* @param effectContext The current effect context
*/
public Effects(Context context, EffectContext effectContext) {
super();
mCachedEffects = new HashMap<>();
mEffectContext = effectContext;
mContext = context;
}
项目:PhotoPhase
文件:BlurEffect.java
/**
* Constructor of <code>BlurEffect</code>.
*
* @param ctx The effect context
* @param name The effect name
*/
public BlurEffect(EffectContext ctx, String name) {
super(ctx, BlurEffect.class.getName());
init(new String[]{H_VERTEX_SHADER, V_VERTEX_SHADER},
new String[]{FRAGMENT_SHADER, FRAGMENT_SHADER});
// Parameters
mStrengthHandle = GLES20.glGetUniformLocation(mProgram[0], "strength");
GLESUtil.glesCheckError("glGetUniformLocation");
}
项目:PhotoPhase
文件:FrostedEffect.java
/**
* Constructor of <code>CrossHatchingEffect</code>.
*
* @param ctx The effect context
* @param name The effect name
*/
public FrostedEffect(EffectContext ctx, String name) {
super(ctx, FrostedEffect.class.getName());
init(VERTEX_SHADER, FRAGMENT_SHADER);
// Parameters
mStrengthHandle = GLES20.glGetUniformLocation(mProgram[0], "strength");
GLESUtil.glesCheckError("glGetUniformLocation");
}
项目:PhotoPhase
文件:ToonEffect.java
/**
* Constructor of <code>ToonEffect</code>.
*
* @param ctx The effect context
* @param name The effect name
*/
public ToonEffect(EffectContext ctx, String name) {
super(ctx, ToonEffect.class.getName());
init(VERTEX_SHADER, FRAGMENT_SHADER);
// Parameters
mWidthHandle = GLES20.glGetUniformLocation(mProgram[0], "w");
GLESUtil.glesCheckError("glGetUniformLocation");
mHeightHandle = GLES20.glGetUniformLocation(mProgram[0], "h");
GLESUtil.glesCheckError("glGetUniformLocation");
}
项目:PhotoPhase
文件:SwirlEffect.java
/**
* Constructor of <code>PixelateEffect</code>.
*
* @param ctx The effect context
* @param name The effect name
*/
public SwirlEffect(EffectContext ctx, String name) {
super(ctx, SwirlEffect.class.getName());
init(VERTEX_SHADER, FRAGMENT_SHADER);
// Parameters
mStrengthHandle = GLES20.glGetUniformLocation(mProgram[0], "strength");
GLESUtil.glesCheckError("glGetUniformLocation");
mWidthHandle = GLES20.glGetUniformLocation(mProgram[0], "w");
GLESUtil.glesCheckError("glGetUniformLocation");
mHeightHandle = GLES20.glGetUniformLocation(mProgram[0], "h");
GLESUtil.glesCheckError("glGetUniformLocation");
}
项目:PhotoPhase
文件:PhotoPhaseEffect.java
/**
* An abstract constructor of <code>Effect</code> to follow the rules
* defined by {@link EffectFactory}.
*
* @param ctx The effect context
* @param name The effect name
*/
public PhotoPhaseEffect(EffectContext ctx, String name) {
super();
mName = name;
// Stand on MCA identity effect for the initialization work
EffectFactory effectFactory = ctx.getFactory();
mIdentityEffect = effectFactory.createEffect(MCA_IDENTITY_EFFECT);
}
项目:PhotoPhase
文件:NoiseEffect.java
/**
* Constructor of <code>NoiseEffect</code>.
*
* @param ctx The effect context
* @param name The effect name
*/
public NoiseEffect(EffectContext ctx, String name) {
super(ctx, NoiseEffect.class.getName());
init(VERTEX_SHADER, FRAGMENT_SHADER);
// Parameters
mStrengthHandle = GLES20.glGetUniformLocation(mProgram[0], "strength");
GLESUtil.glesCheckError("glGetUniformLocation");
}
项目:PhotoPhase
文件:SobelEffect.java
/**
* Constructor of <code>ToonEffect</code>.
*
* @param ctx The effect context
* @param name The effect name
*/
public SobelEffect(EffectContext ctx, String name) {
super(ctx, SobelEffect.class.getName());
init(VERTEX_SHADER, FRAGMENT_SHADER);
// Parameters
mWidthHandle = GLES20.glGetUniformLocation(mProgram[0], "w");
GLESUtil.glesCheckError("glGetUniformLocation");
mHeightHandle = GLES20.glGetUniformLocation(mProgram[0], "h");
GLESUtil.glesCheckError("glGetUniformLocation");
}
项目:PhotoPhase
文件:ScanlinesEffect.java
/**
* Constructor of <code>ScanlinesEffect</code>.
*
* @param ctx The effect context
* @param name The effect name
*/
public ScanlinesEffect(EffectContext ctx, String name) {
super(ctx, ScanlinesEffect.class.getName());
init(VERTEX_SHADER, FRAGMENT_SHADER);
// Parameters
mFrequencyHandle = GLES20.glGetUniformLocation(mProgram[0], "frequency");
GLESUtil.glesCheckError("glGetUniformLocation");
mOffsetHandle = GLES20.glGetUniformLocation(mProgram[0], "offset");
GLESUtil.glesCheckError("glGetUniformLocation");
}
项目:PhotoPhase
文件:DoFEffect.java
/**
* Constructor of <code>BlurEffect</code>.
*
* @param ctx The effect context
* @param name The effect name
*/
public DoFEffect(EffectContext ctx, String name) {
super(ctx, DoFEffect.class.getName());
init(new String[]{H_VERTEX_SHADER, V_VERTEX_SHADER},
new String[]{FRAGMENT_SHADER, FRAGMENT_SHADER});
// Parameters
mStrengthHandle = GLES20.glGetUniformLocation(mProgram[0], "strength");
GLESUtil.glesCheckError("glGetUniformLocation");
}
项目:PhotoPhase
文件:HorizontalFilmBorder.java
/**
* Constructor of <code>HorizontalFilmBorder</code>.
*
* @param ctx The effect context
* @param name The effect name
*/
public HorizontalFilmBorder(EffectContext ctx, String name) {
super(ctx, HorizontalFilmBorder.class.getName());
init(VERTEX_SHADER, FRAGMENT_SHADER);
// Parameters
mWidthHandle = GLES20.glGetUniformLocation(mProgram[0], "w");
GLESUtil.glesCheckError("glGetUniformLocation");
mHeightHandle = GLES20.glGetUniformLocation(mProgram[0], "h");
GLESUtil.glesCheckError("glGetUniformLocation");
mStrengthHandle = GLES20.glGetUniformLocation(mProgram[0], STRENGTH_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
mColorHandle = GLES20.glGetUniformLocation(mProgram[0], COLOR_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
}
项目:PhotoPhase
文件:InsetBorder.java
/**
* Constructor of <code>DoubleJoinedBorder</code>.
*
* @param ctx The effect context
* @param name The effect name
*/
public InsetBorder(EffectContext ctx, String name) {
super(ctx, InsetBorder.class.getName());
init(VERTEX_SHADER, FRAGMENT_SHADER);
// Parameters
mWidthHandle = GLES20.glGetUniformLocation(mProgram[0], "w");
GLESUtil.glesCheckError("glGetUniformLocation");
mHeightHandle = GLES20.glGetUniformLocation(mProgram[0], "h");
GLESUtil.glesCheckError("glGetUniformLocation");
mStrengthHandle = GLES20.glGetUniformLocation(mProgram[0], STRENGTH_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
mColorHandle = GLES20.glGetUniformLocation(mProgram[0], COLOR_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
}
项目:PhotoPhase
文件:VerticalFilmBorder.java
/**
* Constructor of <code>VerticalFilmBorder</code>.
*
* @param ctx The effect context
* @param name The effect name
*/
public VerticalFilmBorder(EffectContext ctx, String name) {
super(ctx, VerticalFilmBorder.class.getName());
init(VERTEX_SHADER, FRAGMENT_SHADER);
// Parameters
mWidthHandle = GLES20.glGetUniformLocation(mProgram[0], "w");
GLESUtil.glesCheckError("glGetUniformLocation");
mHeightHandle = GLES20.glGetUniformLocation(mProgram[0], "h");
GLESUtil.glesCheckError("glGetUniformLocation");
mStrengthHandle = GLES20.glGetUniformLocation(mProgram[0], STRENGTH_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
mColorHandle = GLES20.glGetUniformLocation(mProgram[0], COLOR_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
}
项目:PhotoPhase
文件:Borders.java
/**
* Constructor of <code>Borders</code>
*
* @param effectContext The current effect context
*/
public Borders(Context context, EffectContext effectContext) {
super();
mCachedBorders = new HashMap<>();
mEffectContext = effectContext;
mContext = context;
}
项目:PhotoPhase
文件:SimpleBorder.java
/**
* Constructor of <code>SimpleBorder</code>.
*
* @param ctx The effect context
* @param name The effect name
*/
public SimpleBorder(EffectContext ctx, String name) {
super(ctx, SimpleBorder.class.getName());
init(VERTEX_SHADER, FRAGMENT_SHADER);
// Parameters
mWidthHandle = GLES20.glGetUniformLocation(mProgram[0], "w");
GLESUtil.glesCheckError("glGetUniformLocation");
mHeightHandle = GLES20.glGetUniformLocation(mProgram[0], "h");
GLESUtil.glesCheckError("glGetUniformLocation");
mStrengthHandle = GLES20.glGetUniformLocation(mProgram[0], STRENGTH_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
mColorHandle = GLES20.glGetUniformLocation(mProgram[0], COLOR_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
}
项目:PhotoPhase
文件:RoundedBorder.java
/**
* Constructor of <code>RoundedBorder</code>.
*
* @param ctx The effect context
* @param name The effect name
*/
public RoundedBorder(EffectContext ctx, String name) {
super(ctx, RoundedBorder.class.getName());
init(VERTEX_SHADER, FRAGMENT_SHADER);
// Parameters
mWidthHandle = GLES20.glGetUniformLocation(mProgram[0], "w");
GLESUtil.glesCheckError("glGetUniformLocation");
mHeightHandle = GLES20.glGetUniformLocation(mProgram[0], "h");
GLESUtil.glesCheckError("glGetUniformLocation");
mStrengthHandle = GLES20.glGetUniformLocation(mProgram[0], STRENGTH_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
mColorHandle = GLES20.glGetUniformLocation(mProgram[0], COLOR_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
}
项目:PhotoPhase
文件:SquaresBorder.java
/**
* Constructor of <code>SimpleBorder</code>.
*
* @param ctx The effect context
* @param name The effect name
*/
public SquaresBorder(EffectContext ctx, String name) {
super(ctx, SquaresBorder.class.getName());
init(VERTEX_SHADER, FRAGMENT_SHADER);
// Parameters
mWidthHandle = GLES20.glGetUniformLocation(mProgram[0], "w");
GLESUtil.glesCheckError("glGetUniformLocation");
mHeightHandle = GLES20.glGetUniformLocation(mProgram[0], "h");
GLESUtil.glesCheckError("glGetUniformLocation");
mStrengthHandle = GLES20.glGetUniformLocation(mProgram[0], STRENGTH_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
mColorHandle = GLES20.glGetUniformLocation(mProgram[0], COLOR_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
}
项目:PhotoPhase
文件:Border.java
/**
* An abstract constructor of <code>Border</code> to follow the rules
* defined by {@link EffectFactory}.
*
* @param ctx The effect context
* @param name The effect name
*/
public Border(EffectContext ctx, String name) {
super();
mName = name;
mColor = new GLESUtil.GLColor(1, 0, 0, 0);
mBgColor = new GLESUtil.GLColor(1, 0, 0, 0);
// Stand on MCA identity effect for the initialization work
EffectFactory effectFactory = ctx.getFactory();
mIdentityEffect = effectFactory.createEffect(MCA_IDENTITY_EFFECT);
}
项目:PhotoPhase
文件:RoundedSquaresBorder.java
/**
* Constructor of <code>RoundedSquaresBorder</code>.
*
* @param ctx The effect context
* @param name The effect name
*/
public RoundedSquaresBorder(EffectContext ctx, String name) {
super(ctx, RoundedSquaresBorder.class.getName());
init(VERTEX_SHADER, FRAGMENT_SHADER);
// Parameters
mWidthHandle = GLES20.glGetUniformLocation(mProgram[0], "w");
GLESUtil.glesCheckError("glGetUniformLocation");
mHeightHandle = GLES20.glGetUniformLocation(mProgram[0], "h");
GLESUtil.glesCheckError("glGetUniformLocation");
mStrengthHandle = GLES20.glGetUniformLocation(mProgram[0], STRENGTH_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
mColorHandle = GLES20.glGetUniformLocation(mProgram[0], COLOR_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
}
项目:PhotoPhase
文件:InsetSquaresBorder.java
/**
* Constructor of <code>DoubleJoinedBorder</code>.
*
* @param ctx The effect context
* @param name The effect name
*/
public InsetSquaresBorder(EffectContext ctx, String name) {
super(ctx, InsetSquaresBorder.class.getName());
init(VERTEX_SHADER, FRAGMENT_SHADER);
// Parameters
mWidthHandle = GLES20.glGetUniformLocation(mProgram[0], "w");
GLESUtil.glesCheckError("glGetUniformLocation");
mHeightHandle = GLES20.glGetUniformLocation(mProgram[0], "h");
GLESUtil.glesCheckError("glGetUniformLocation");
mStrengthHandle = GLES20.glGetUniformLocation(mProgram[0], STRENGTH_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
mColorHandle = GLES20.glGetUniformLocation(mProgram[0], COLOR_PARAMETER);
GLESUtil.glesCheckError("glGetUniformLocation");
}
项目:PhotoPhase
文件:PhotoPhaseRenderer.java
/**
* {@inheritDoc}
*/
@Override
public void onSurfaceCreated(GL10 glUnused, EGLConfig config) {
if (DEBUG) Log.d(TAG, "onSurfaceCreated [" + mInstance + "]");
mWidth = -1;
mHeight = -1;
mMeasuredHeight = -1;
mStatusBarHeight = 0;
mLastTransition = System.currentTimeMillis();
// We have a 2d (fake) scenario, disable all unnecessary tests. Deep are
// necessary for some 3d effects
GLES20.glDisable(GL10.GL_DITHER);
GLESUtil.glesCheckError("glDisable");
GLES20.glDisable(GL10.GL_CULL_FACE);
GLESUtil.glesCheckError("glDisable");
GLES20.glEnable(GL10.GL_DEPTH_TEST);
GLESUtil.glesCheckError("glEnable");
GLES20.glDepthMask(false);
GLESUtil.glesCheckError("glDepthMask");
GLES20.glDepthFunc(GLES20.GL_LEQUAL);
GLESUtil.glesCheckError("glDepthFunc");
// Create an effect context
if (mEffectContext != null) {
mEffectContext.release();
}
mEffectContext = EffectContext.createWithCurrentGlContext();
// Create the texture manager and recycle the old one
if (mTextureManager == null) {
// Precalculate 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 = mContext.getResources().getConfiguration();
int orientation = mContext.getResources().getConfiguration().orientation;
int w = (int) AndroidHelper.convertDpToPixel(mContext, conf.screenWidthDp);
int h = (int) AndroidHelper.convertDpToPixel(mContext, conf.screenHeightDp);
Rect dimensions = new Rect(0, 0, w, h);
int cc = (orientation == Configuration.ORIENTATION_PORTRAIT)
? Preferences.Layout.getPortraitDisposition(mContext).size()
: Preferences.Layout.getLandscapeDisposition(mContext).size();
// Recycle the current texture manager and create a new one
recycle();
mTextureManager = new PhotoPhaseTextureManager(
mContext, mHandler, mEffectContext, mDispatcher, cc, dimensions);
} else {
mTextureManager.updateEffectContext(mEffectContext);
}
// Schedule dispositions random recreation (if need it)
scheduleDispositionRecreation();
}
项目:libcommon
文件:MediaEffectFlip.java
/**
* コンストラクタ
* 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);
}
项目:libcommon
文件:MediaEffectCrop.java
/**
* コンストラクタ
* 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);
}
项目:libcommon
文件:MediaEffectDuoTone.java
/**
* コンストラクタ
* 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);
}
项目:libcommon
文件:MediaEffectBitmapOverlay.java
/**
* コンストラクタ
* 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);
}
项目:libcommon
文件:MediaEffectDocumentary.java
/**
* コンストラクタ
* GLコンテキスト内で生成すること
*
* @param effect_context
*/
public MediaEffectDocumentary(final EffectContext effect_context) {
super(effect_context, EffectFactory.EFFECT_DOCUMENTARY);
}