想了解沙盒效应的新动态吗?本文将为您提供详细的信息,我们还将为您解答关于sandboxeffect的相关问题,此外,我们还将为您介绍关于android.media.effect.EffectConte
想了解沙盒效应的新动态吗?本文将为您提供详细的信息,我们还将为您解答关于sandboxeffect的相关问题,此外,我们还将为您介绍关于android.media.effect.EffectContext的实例源码、android.media.effect.EffectFactory的实例源码、android.media.effect.Effect的实例源码、CodeSandbox —— 基于 React 的在线代码沙盒平台的新知识。
本文目录一览:- 沙盒效应(sandboxeffect)(沙盒效应名词解释)
- android.media.effect.EffectContext的实例源码
- android.media.effect.EffectFactory的实例源码
- android.media.effect.Effect的实例源码
- CodeSandbox —— 基于 React 的在线代码沙盒平台
沙盒效应(sandboxeffect)(沙盒效应名词解释)
查找营销专家所运用的非正式姓名,用来描绘Google和其他查找引擎处理新站点的办法,它们会对那些链接盛行度敏捷攀升的网站进行冷处理,网页可以展现它要的内容,但会被放在“沙箱”里边,而对任何查找恳求都不会得到最高排名其后来的盛行度经过一段时刻还坚持不变,或许逐渐上升,那么查找引擎就开端撤销冷处理而且给链接盛行度更高的权重,使得查找排名上升。
android.media.effect.EffectContext的实例源码
@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(); }
@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(); }
@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(); }
@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(); }
@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)); } }
/** * 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); }
/** * 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); }
/** * 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"); }
/** * Constructor of <code>DoubleJoinedBorder</code>. * * @param ctx The effect context * @param name The effect name */ public DoubleJoinedBorder(EffectContext ctx,DoubleJoinedBorder.class.getName()); init(VERTEX_SHADER,COLOR_ParaMETER); GLESUtil.glesCheckerror("glGetUniformlocation"); }
/** * Constructor of <code>RoundedBorder</code>. * * @param ctx The effect context * @param name The effect name */ public ElegantBorder(EffectContext ctx,ElegantBorder.class.getName()); init(VERTEX_SHADER,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"); }
/** * コンストラクタ * 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); } }
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; }
@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]); }
@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; }
/** * 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; }
/** * Constructor of <code>BlurEffect</code>. * * @param ctx The effect context * @param name The effect name */ public BlurEffect(EffectContext 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"); }
/** * Constructor of <code>CrossHatchingEffect</code>. * * @param ctx The effect context * @param name The effect name */ public FrostedEffect(EffectContext ctx,FrostedEffect.class.getName()); init(VERTEX_SHADER,FRAGMENT_SHADER); // Parameters mStrengthHandle = GLES20.glGetUniformlocation(mProgram[0],"strength"); GLESUtil.glesCheckerror("glGetUniformlocation"); }
/** * Constructor of <code>ToonEffect</code>. * * @param ctx The effect context * @param name The effect name */ public ToonEffect(EffectContext ctx,ToonEffect.class.getName()); init(VERTEX_SHADER,"h"); GLESUtil.glesCheckerror("glGetUniformlocation"); }
/** * Constructor of <code>PixelateEffect</code>. * * @param ctx The effect context * @param name The effect name */ public SwirlEffect(EffectContext ctx,SwirlEffect.class.getName()); init(VERTEX_SHADER,"strength"); GLESUtil.glesCheckerror("glGetUniformlocation"); mWidthHandle = GLES20.glGetUniformlocation(mProgram[0],"h"); GLESUtil.glesCheckerror("glGetUniformlocation"); }
/** * 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); }
/** * Constructor of <code>NoiseEffect</code>. * * @param ctx The effect context * @param name The effect name */ public NoiseEffect(EffectContext ctx,NoiseEffect.class.getName()); init(VERTEX_SHADER,"strength"); GLESUtil.glesCheckerror("glGetUniformlocation"); }
/** * Constructor of <code>ToonEffect</code>. * * @param ctx The effect context * @param name The effect name */ public SobelEffect(EffectContext ctx,SobelEffect.class.getName()); init(VERTEX_SHADER,"h"); GLESUtil.glesCheckerror("glGetUniformlocation"); }
/** * Constructor of <code>ScanlinesEffect</code>. * * @param ctx The effect context * @param name The effect name */ public ScanlinesEffect(EffectContext 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"); }
/** * Constructor of <code>BlurEffect</code>. * * @param ctx The effect context * @param name The effect name */ public DoFEffect(EffectContext ctx,DoFEffect.class.getName()); init(new String[]{H_VERTEX_SHADER,"strength"); GLESUtil.glesCheckerror("glGetUniformlocation"); }
/** * Constructor of <code>HorizontalFilmBorder</code>. * * @param ctx The effect context * @param name The effect name */ public HorizontalFilmBorder(EffectContext ctx,HorizontalFilmBorder.class.getName()); init(VERTEX_SHADER,COLOR_ParaMETER); GLESUtil.glesCheckerror("glGetUniformlocation"); }
/** * Constructor of <code>DoubleJoinedBorder</code>. * * @param ctx The effect context * @param name The effect name */ public InsetBorder(EffectContext ctx,InsetBorder.class.getName()); init(VERTEX_SHADER,COLOR_ParaMETER); GLESUtil.glesCheckerror("glGetUniformlocation"); }
/** * Constructor of <code>VerticalFilmBorder</code>. * * @param ctx The effect context * @param name The effect name */ public VerticalFilmBorder(EffectContext ctx,VerticalFilmBorder.class.getName()); init(VERTEX_SHADER,COLOR_ParaMETER); GLESUtil.glesCheckerror("glGetUniformlocation"); }
/** * 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; }
/** * Constructor of <code>SimpleBorder</code>. * * @param ctx The effect context * @param name The effect name */ public SimpleBorder(EffectContext ctx,SimpleBorder.class.getName()); init(VERTEX_SHADER,COLOR_ParaMETER); GLESUtil.glesCheckerror("glGetUniformlocation"); }
/** * Constructor of <code>RoundedBorder</code>. * * @param ctx The effect context * @param name The effect name */ public RoundedBorder(EffectContext ctx,RoundedBorder.class.getName()); init(VERTEX_SHADER,COLOR_ParaMETER); GLESUtil.glesCheckerror("glGetUniformlocation"); }
/** * Constructor of <code>SimpleBorder</code>. * * @param ctx The effect context * @param name The effect name */ public SquaresBorder(EffectContext ctx,SquaresBorder.class.getName()); init(VERTEX_SHADER,COLOR_ParaMETER); GLESUtil.glesCheckerror("glGetUniformlocation"); }
/** * 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); mBgColor = new GLESUtil.GLColor(1,0); // Stand on MCA identity effect for the initialization work EffectFactory effectFactory = ctx.getFactory(); mIdentityEffect = effectFactory.createEffect(MCA_IDENTITY_EFFECT); }
/** * Constructor of <code>RoundedSquaresBorder</code>. * * @param ctx The effect context * @param name The effect name */ public RoundedSquaresBorder(EffectContext ctx,RoundedSquaresBorder.class.getName()); init(VERTEX_SHADER,COLOR_ParaMETER); GLESUtil.glesCheckerror("glGetUniformlocation"); }
/** * Constructor of <code>DoubleJoinedBorder</code>. * * @param ctx The effect context * @param name The effect name */ public InsetSquaresBorder(EffectContext ctx,InsetSquaresBorder.class.getName()); init(VERTEX_SHADER,COLOR_ParaMETER); GLESUtil.glesCheckerror("glGetUniformlocation"); }
/** * {@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,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(); }
/** * コンストラクタ * 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); }
/** * コンストラクタ * 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); }
/** * コンストラクタ * 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); }
/** * コンストラクタ * 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); }
/** * コンストラクタ * GLコンテキスト内で生成すること * * @param effect_context */ public MediaEffectDocumentary(final EffectContext effect_context) { super(effect_context,EffectFactory.EFFECT_DOCUMENTARY); }
android.media.effect.EffectFactory的实例源码
/** * コンストラクタ * 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); } }
@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()); }
@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]); }
/** * 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); }
/** * 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); mBgColor = new GLESUtil.GLColor(1,0); // Stand on MCA identity effect for the initialization work EffectFactory effectFactory = ctx.getFactory(); mIdentityEffect = effectFactory.createEffect(MCA_IDENTITY_EFFECT); }
private void grayScaleEffect(String effectType){ EffectFactory factory = effectContext.getFactory(); effect = factory.createEffect(effectType); effect.apply(textures[0],photoWidth,photoHeight,textures[1]); }
/** * コンストラクタ * 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); }
/** * コンストラクタ * 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); }
/** * コンストラクタ * 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); }
/** * コンストラクタ * 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); }
/** * コンストラクタ * GLコンテキスト内で生成すること * * @param effect_context */ public MediaEffectDocumentary(final EffectContext effect_context) { super(effect_context,EffectFactory.EFFECT_DOCUMENTARY); }
/** * コンストラクタ * GLコンテキスト内で生成すること * * @param effect_context */ public MediaEffectCrossprocess(final EffectContext effect_context) { super(effect_context,EffectFactory.EFFECT_CROsspROCESS); }
/** * コンストラクタ * 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); }
/** * コンストラクタ * GLコンテキスト内で生成すること * * @param effect_context * @param scale The scale of vignetting. between 0 and 1. 0 means no change. */ public MediaEffectVignette(final EffectContext effect_context,EffectFactory.EFFECT_SHARPEN); setParameter(scale); }
/** * コンストラクタ * GLコンテキスト内で生成すること * * @param effect_context * @param angle The angle of rotation. between -45 and +45. */ public MediaEffectStraighten(final EffectContext effect_context,final float angle) { super(effect_context,EffectFactory.EFFECT_STRAIGHTEN); setParameter(angle); }
/** * コンストラクタ * GLコンテキスト内で生成すること * * @param effect_context * @param contrast The contrast multiplier. Float. 1.0 means no change; larger values will increase contrast. */ public MediaEffectContrast(final EffectContext effect_context,final float contrast) { super(effect_context,EffectFactory.EFFECT_CONTRAST); setParameter(contrast); }
/** * コンストラクタ * 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); }
/** * コンストラクタ * 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,EffectFactory.EFFECT_TEMPERATURE); setParameter(scale); }
/** * コンストラクタ * 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); }
/** * コンストラクタ * 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,EffectFactory.EFFECT_FISheyE); setParameter(scale); }
/** * コンストラクタ * GLコンテキスト内で生成すること * * @param effect_context */ public MediaEffectGrayScale(final EffectContext effect_context) { super(effect_context,EffectFactory.EFFECT_GRAYSCALE); }
/** * コンストラクタ * GLコンテキスト内で生成すること * * @param effect_context */ public MediaEffectLomoish(final EffectContext effect_context) { super(effect_context,EffectFactory.EFFECT_LOMOISH); }
/** * コンストラクタ * 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); }
/** * コンストラクタ * 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); }
/** * コンストラクタ * 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); }
/** * コンストラクタ * GLコンテキスト内で生成すること * * @param effect_context * @param strength between 0 and 1. between 0 and 1. Zero means no change. */ public MediaEffectFillLight(final EffectContext effect_context,EffectFactory.EFFECT_FILLLIGHT); setParameter(strength); }
/** * コンストラクタ * GLコンテキスト内で生成すること * * @param effect_context */ public MediaEffectSepia(final EffectContext effect_context) { super(effect_context,EffectFactory.EFFECT_SEPIA); }
/** * コンストラクタ * GLコンテキスト内で生成すること * * @param effect_context * @param source A URI for the background video to use. * This parameter must be supplied before calling apply() for the first time. */ public MediaEffectBackDropper(final EffectContext effect_context,final String source) { super(effect_context,EffectFactory.EFFECT_BACKDROPPER); setParameter(source); }
/** * コンストラクタ * 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,EffectFactory.EFFECT_SHARPEN); setParameter(scale); }
/** * コンストラクタ * GLコンテキスト内で生成すること * * @param effect_context */ public MediaEffectNegative(final EffectContext effect_context) { super(effect_context,EffectFactory.EFFECT_NEGATIVE); }
/** * コンストラクタ * GLコンテキスト内で生成すること * 入力テクスチャを無変換で出力テクスチャにコピーする * @param effect_context */ public MediaEffectNull(final EffectContext effect_context) { super(effect_context,EffectFactory.EFFECT_AUTOFIX); setParameter("scale",0.0f); // scale=0.0fならコピー }
/** * コンストラクタ * 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,EffectFactory.EFFECT_AUTOFIX); setParameter(scale); }
@Subscribe public void sampleMethodPreventEventbusCrash(EffectFactory event) { }
android.media.effect.Effect的实例源码
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]; }
/** * 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; } }
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; }
@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()); }
public SimpleTextureManager(Context context,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,w,h); mEffect = effect; mBorder = border; mContext = context; mSingleTexture = singleTexture; }
/** * 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(); }
/** * 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); }
public void release() { Effect effect = effects.remove(this); if (effect != null) { effect.release(); } }
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.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]); } }
CodeSandbox —— 基于 React 的在线代码沙盒平台
CodeSandbox 是一个在线的代码编辑器,主要聚焦于创建 Web 应用项目,支持主流的前端相关文件的编辑。
今天关于沙盒效应和sandboxeffect的讲解已经结束,谢谢您的阅读,如果想了解更多关于android.media.effect.EffectContext的实例源码、android.media.effect.EffectFactory的实例源码、android.media.effect.Effect的实例源码、CodeSandbox —— 基于 React 的在线代码沙盒平台的相关知识,请在本站搜索。
本文标签: