Skip to content

Most visited

Recently visited

navigation

Shader

public class Shader
extends Object

java.lang.Object
   ↳ android.graphics.Shader
Known Direct Subclasses


Shader is the based class for objects that return horizontal spans of colors during drawing. A subclass of Shader is installed in a Paint calling paint.setShader(shader). After that any object (other than a bitmap) that is drawn with that paint will get its color(s) from the shader.

Summary

Nested classes

enum Shader.TileMode

 

Public constructors

Shader()

This constructor was deprecated in API level 26. Use subclass constructors directly instead.

Public methods

boolean getLocalMatrix(Matrix localM)

Return true if the shader has a non-identity local matrix.

void setLocalMatrix(Matrix localM)

Set the shader's local matrix.

Inherited methods

From class java.lang.Object

Public constructors

Shader

added in API level 1
Shader ()

This constructor was deprecated in API level 26.
Use subclass constructors directly instead.

Public methods

getLocalMatrix

added in API level 1
boolean getLocalMatrix (Matrix localM)

Return true if the shader has a non-identity local matrix.

Parameters
localM Matrix: Set to the local matrix of the shader, if the shader's matrix is non-null.

Returns
boolean true if the shader has a non-identity local matrix

setLocalMatrix

added in API level 1
void setLocalMatrix (Matrix localM)

Set the shader's local matrix. Passing null will reset the shader's matrix to identity. If the matrix has scale value as 0, the drawing result is undefined.

Parameters
localM Matrix: The shader's new local matrix, or null to specify identity

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)