RenderEffect
public
final
class
RenderEffect
extends Object
Intermediate rendering step used to render drawing commands with a corresponding
visual effect. A RenderEffect
can be configured on a RenderNode
through
RenderNode#setRenderEffect(RenderEffect)
and will be applied when drawn through
Canvas#drawRenderNode(RenderNode)
.
Additionally a RenderEffect
can be applied to a View's backing RenderNode through
View.setRenderEffect(RenderEffect)
Summary
Public methods |
static
RenderEffect
|
createBitmapEffect(Bitmap bitmap)
Create a RenderEffect that renders the contents of the input Bitmap .
|
static
RenderEffect
|
createBitmapEffect(Bitmap bitmap, Rect src, Rect dst)
Create a RenderEffect that renders the contents of the input Bitmap .
|
static
RenderEffect
|
createBlendModeEffect(RenderEffect dst, RenderEffect src, BlendMode blendMode)
Create a RenderEffect that is a composition of 2 other RenderEffect instances
combined by the specified BlendMode
|
static
RenderEffect
|
createBlurEffect(float radiusX, float radiusY, Shader.TileMode edgeTreatment)
Create a RenderEffect that blurs the contents of the
RenderNode that this RenderEffect is installed on with the
specified radius along the x and y axis.
|
static
RenderEffect
|
createBlurEffect(float radiusX, float radiusY, RenderEffect inputEffect, Shader.TileMode edgeTreatment)
Create a RenderEffect that blurs the contents of the optional input RenderEffect
with the specified radius along the x and y axis.
|
static
RenderEffect
|
createChainEffect(RenderEffect outer, RenderEffect inner)
Create a RenderEffect that composes 'inner' with 'outer', such that the results of
'inner' are treated as the source bitmap passed to 'outer', i.e.
|
static
RenderEffect
|
createColorFilterEffect(ColorFilter colorFilter, RenderEffect renderEffect)
Create a RenderEffect that applies the color filter to the provided RenderEffect
|
static
RenderEffect
|
createColorFilterEffect(ColorFilter colorFilter)
Create a RenderEffect that applies the color filter to the contents of the
RenderNode that this RenderEffect is installed on
|
static
RenderEffect
|
createOffsetEffect(float offsetX, float offsetY, RenderEffect input)
Create a RenderEffect instance with the provided x and y offset
|
static
RenderEffect
|
createOffsetEffect(float offsetX, float offsetY)
Create a RenderEffect instance that will offset the drawing content
by the provided x and y offset.
|
static
RenderEffect
|
createRuntimeShaderEffect(RuntimeShader shader, String uniformShaderName)
Create a RenderEffect that executes the provided RuntimeShader and passes
the contents of the RenderNode that this RenderEffect is installed
on as an input to the shader.
|
static
RenderEffect
|
createShaderEffect(Shader shader)
Create a RenderEffect that renders the contents of the input Shader .
|
Inherited methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait(long timeoutMillis, int nanos)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait(long timeoutMillis)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait()
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted.
|
|
Public methods
createBlendModeEffect
public static RenderEffect createBlendModeEffect (RenderEffect dst,
RenderEffect src,
BlendMode blendMode)
Create a RenderEffect
that is a composition of 2 other RenderEffect
instances
combined by the specified BlendMode
Parameters |
dst |
RenderEffect : The Dst pixels used in blending
This value cannot be null . |
src |
RenderEffect : The Src pixels used in blending
This value cannot be null . |
blendMode |
BlendMode : The BlendMode to be used to combine colors from the two
RenderEffect s
This value cannot be null . |
createBlurEffect
public static RenderEffect createBlurEffect (float radiusX,
float radiusY,
Shader.TileMode edgeTreatment)
Create a RenderEffect
that blurs the contents of the
RenderNode
that this RenderEffect is installed on with the
specified radius along the x and y axis.
Parameters |
radiusX |
float : Radius of blur along the X axis |
radiusY |
float : Radius of blur along the Y axis |
edgeTreatment |
Shader.TileMode : Policy for how to blur content near edges of the blur kernel
This value cannot be null . |
createBlurEffect
public static RenderEffect createBlurEffect (float radiusX,
float radiusY,
RenderEffect inputEffect,
Shader.TileMode edgeTreatment)
Create a RenderEffect
that blurs the contents of the optional input RenderEffect
with the specified radius along the x and y axis. If no input RenderEffect is provided
then all drawing commands issued with a RenderNode
that this
RenderEffect is installed in will be blurred
Parameters |
radiusX |
float : Radius of blur along the X axis |
radiusY |
float : Radius of blur along the Y axis |
inputEffect |
RenderEffect : Input RenderEffect that provides the content to be blurred, can be null
to indicate that the drawing commands on the RenderNode are to be
blurred instead of the input RenderEffect |
edgeTreatment |
Shader.TileMode : Policy for how to blur content near edges of the blur kernel
This value cannot be null . |
createChainEffect
public static RenderEffect createChainEffect (RenderEffect outer,
RenderEffect inner)
Create a RenderEffect
that composes 'inner' with 'outer', such that the results of
'inner' are treated as the source bitmap passed to 'outer', i.e.
result = outer(inner(source))
Consumers should favor explicit chaining of
RenderEffect
instances at creation time
rather than using chain effect. Chain effects are useful for situations where the input or
output are provided from elsewhere and the input or output
RenderEffect
need to be
changed.
Parameters |
outer |
RenderEffect : RenderEffect that consumes the output of as its input
This value cannot be null . |
inner |
RenderEffect : RenderEffect that is consumed as input by
This value cannot be null . |
createColorFilterEffect
public static RenderEffect createColorFilterEffect (ColorFilter colorFilter,
RenderEffect renderEffect)
Create a RenderEffect
that applies the color filter to the provided RenderEffect
Parameters |
colorFilter |
ColorFilter : ColorFilter applied to the content in the input RenderEffect
This value cannot be null . |
renderEffect |
RenderEffect : Source to be transformed by the specified ColorFilter
This value cannot be null . |
createColorFilterEffect
public static RenderEffect createColorFilterEffect (ColorFilter colorFilter)
Create a RenderEffect
that applies the color filter to the contents of the
RenderNode
that this RenderEffect is installed on
Parameters |
colorFilter |
ColorFilter : ColorFilter applied to the content in the input RenderEffect
This value cannot be null . |
createOffsetEffect
public static RenderEffect createOffsetEffect (float offsetX,
float offsetY,
RenderEffect input)
Create a RenderEffect
instance with the provided x and y offset
Parameters |
offsetX |
float : offset along the x axis in pixels |
offsetY |
float : offset along the y axis in pixels |
input |
RenderEffect : target RenderEffect used to render in the offset coordinates.
This value cannot be null . |
createOffsetEffect
public static RenderEffect createOffsetEffect (float offsetX,
float offsetY)
Create a RenderEffect
instance that will offset the drawing content
by the provided x and y offset.
Parameters |
offsetX |
float : offset along the x axis in pixels |
offsetY |
float : offset along the y axis in pixels |
createRuntimeShaderEffect
public static RenderEffect createRuntimeShaderEffect (RuntimeShader shader,
String uniformShaderName)
Create a RenderEffect
that executes the provided RuntimeShader
and passes
the contents of the RenderNode
that this RenderEffect is installed
on as an input to the shader.
Parameters |
shader |
RuntimeShader : the runtime shader that will bind the inputShaderName to the RenderEffect input
This value cannot be null . |
uniformShaderName |
String : the uniform name defined in the RuntimeShader's program to which
the contents of the RenderNode will be bound
This value cannot be null . |