Skip to content

Latest commit

 

History

History

RenderEffectSample

Render effects

Android sample app to learn about the RenderEffect API, which was recently introduced in Android 12.

A RenderEffect corresponds to a visual effect that can be applied to render a part of the UI, a RenderNode. It's a structure used to record draw operations, and can store and apply render properties when drawn. RenderNodes are useful to divide up the rendering of a scene into multiple smaller pieces. This allows updating them individually, which is more optimal/cheaper.

Views in Android internally use RenderNodes, this allows for hardware accelerated rendering, meaning that UI hierarchies are rendered using the GPU, instead ofthe CPU. A RenderEffect can be applied to a View by calling View.setRenderEffect(RenderEffect).

blur-effect color-filter-effect offset-effect

The app mainly showcases:

  • Appliying blur effects on a View.
  • Applying color filter effects on a View.
  • Applying offset effects on a View.

The sample should be run on a device/an emulator running Android 12, since the RenderEffect API was only introduced in Android S.