Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

# android.media.effect

*** ** * ** ***

Provides classes that allow you to apply a variety of visual effects to images and
videos. For example, you can easily fix red-eye, convert an image to grayscale,
adjust brightness, adjust saturation, rotate an image, apply a fisheye effect, and much more. The
system performs all effects processing on the GPU to obtain maximum performance.

For maximum performance, effects are applied directly to OpenGL textures, so your application
must have a valid OpenGL context before it can use the effects APIs. The textures to which you apply
effects may be from bitmaps, videos or even the camera. However, there are certain restrictions that
textures must meet:

1. They must be bound to a `https://developer.android.com/reference/android/opengl/GLES20#GL_TEXTURE_2D` texture image
2. They must contain at least one mipmap level

An `https://developer.android.com/reference/android/media/effect/Effect` object defines a single media effect that you can apply to
an image frame. The basic workflow to create an `https://developer.android.com/reference/android/media/effect/Effect` is:

1. Call `https://developer.android.com/reference/android/media/effect/EffectContext#createWithCurrentGlContext()` from your OpenGL ES 2.0 context.
2. Use the returned `https://developer.android.com/reference/android/media/effect/EffectContext` to call `https://developer.android.com/reference/android/media/effect/EffectContext#getFactory()`, which returns an instance of `https://developer.android.com/reference/android/media/effect/EffectFactory`.
3. Call `https://developer.android.com/reference/android/media/effect/EffectFactory#createEffect(java.lang.String)`, passing it an effect name from `https://developer.android.com/reference/android/media/effect/EffectFactory`, such as `https://developer.android.com/reference/android/media/effect/EffectFactory#EFFECT_FISHEYE` or `https://developer.android.com/reference/android/media/effect/EffectFactory#EFFECT_VIGNETTE`.

You can adjust an effect\\u2019s parameters by calling `https://developer.android.com/reference/android/media/effect/Effect#setParameter(java.lang.String,%20java.lang.Object)` and passing a parameter name and parameter value. Each type of effect accepts
different parameters, which are documented with the effect name. For example, `https://developer.android.com/reference/android/media/effect/EffectFactory#EFFECT_FISHEYE` has one parameter for the `scale` of the
distortion.

To apply an effect on a texture, call `https://developer.android.com/reference/android/media/effect/Effect#apply(int,%20int,%20int,%20int)` on the
`https://developer.android.com/reference/android/media/effect/Effect` and pass in the input texture, its width and height, and the output
texture. The input texture must be bound to a `https://developer.android.com/reference/android/opengl/GLES20#GL_TEXTURE_2D` texture
image (usually done by calling the `https://developer.android.com/reference/android/opengl/GLES20#glTexImage2D(int,%20int,%20int,%20int,%20int,%20int,%20int,%20int,%20java.nio.Buffer)`
function). You may provide multiple mipmap levels. If the output texture has not been bound to a
texture image, it will be automatically bound by the effect as a `https://developer.android.com/reference/android/opengl/GLES20#GL_TEXTURE_2D` and with one mipmap level (0), which will have the same
size as the input.

**Note:** All effects listed in `https://developer.android.com/reference/android/media/effect/EffectFactory` are guaranteed to be supported. However, some additional effects
available from external libraries are not supported by all devices, so you must first check if the
desired effect from the external library is supported by calling `https://developer.android.com/reference/android/media/effect/EffectFactory#isEffectSupported(java.lang.String)`.

## Interfaces

|---|---|
| [EffectUpdateListener](https://developer.android.com/reference/android/media/effect/EffectUpdateListener) | Some effects may issue callbacks to inform the host of changes to the effect state. |

## Classes

|---|---|
| [Effect](https://developer.android.com/reference/android/media/effect/Effect) | Effects are high-performance transformations that can be applied to image frames. |
| [EffectContext](https://developer.android.com/reference/android/media/effect/EffectContext) | An EffectContext keeps all necessary state information to run Effects within a Open GL ES 2.0 context. |
| [EffectFactory](https://developer.android.com/reference/android/media/effect/EffectFactory) | The EffectFactory class defines the list of available Effects, and provides functionality to inspect and instantiate them. |

-

  ## Interfaces

  - [EffectUpdateListener](https://developer.android.com/reference/android/media/effect/EffectUpdateListener)
-

  ## Classes

  - [Effect](https://developer.android.com/reference/android/media/effect/Effect)
  - [EffectContext](https://developer.android.com/reference/android/media/effect/EffectContext)
  - [EffectFactory](https://developer.android.com/reference/android/media/effect/EffectFactory)