Stay organized with collections
Save and categorize content based on your preferences.
ComposeShader
open class ComposeShader : Shader
A subclass of shader that returns the composition of two other shaders, combined by an android.graphics.Xfermode
subclass.
Summary
Public constructors |
Create a new compose shader, given shaders A, B, and a combining PorterDuff mode.
|
Create a new compose shader, given shaders A, B, and a combining PorterDuff mode.
|
Create a new compose shader, given shaders A, B, and a combining mode.
|
Inherited functions |
From class Shader
Boolean |
getLocalMatrix(localM: Matrix)
Return true if the shader has a non-identity local matrix.
|
Unit |
setLocalMatrix(localM: Matrix?)
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.
|
|
Public constructors
ComposeShader
ComposeShader(
shaderA: Shader,
shaderB: Shader,
blendMode: BlendMode)
Create a new compose shader, given shaders A, B, and a combining PorterDuff mode. When the mode is applied, it will be given the result from shader A as its "dst", and the result from shader B as its "src".
Parameters |
shaderA |
Shader: The colors from this shader are seen as the "dst" by the mode This value cannot be null . |
shaderB |
Shader: The colors from this shader are seen as the "src" by the mode This value cannot be null . |
blendMode |
BlendMode: The blend mode that combines the colors from the two shaders. This value cannot be null . |
ComposeShader
ComposeShader(
shaderA: Shader,
shaderB: Shader,
mode: PorterDuff.Mode)
Create a new compose shader, given shaders A, B, and a combining PorterDuff mode. When the mode is applied, it will be given the result from shader A as its "dst", and the result from shader B as its "src".
Parameters |
shaderA |
Shader: The colors from this shader are seen as the "dst" by the mode This value cannot be null . |
shaderB |
Shader: The colors from this shader are seen as the "src" by the mode This value cannot be null . |
mode |
PorterDuff.Mode: The PorterDuff mode that combines the colors from the two shaders. This value cannot be null . |
ComposeShader
ComposeShader(
shaderA: Shader,
shaderB: Shader,
mode: Xfermode)
Create a new compose shader, given shaders A, B, and a combining mode. When the mode is applied, it will be given the result from shader A as its "dst", and the result from shader B as its "src".
Parameters |
shaderA |
Shader: The colors from this shader are seen as the "dst" by the mode This value cannot be null . |
shaderB |
Shader: The colors from this shader are seen as the "src" by the mode This value cannot be null . |
mode |
Xfermode: The mode that combines the colors from the two shaders. If mode is null, then SRC_OVER is assumed. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# ComposeShader\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nComposeShader\n=============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/graphics/ComposeShader \"View this page in Java\") \n\n```\nopen class ComposeShader : Shader\n```\n\n|---|---|-------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) |||\n| ↳ | [android.graphics.Shader](/reference/kotlin/android/graphics/Shader) ||\n| | ↳ | [android.graphics.ComposeShader](#) |\n\nA subclass of shader that returns the composition of two other shaders, combined by an [android.graphics.Xfermode](/reference/kotlin/android/graphics/Xfermode) subclass.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [ComposeShader](#ComposeShader(android.graphics.Shader,%20android.graphics.Shader,%20android.graphics.BlendMode))`(`shaderA:` `[Shader](/reference/kotlin/android/graphics/Shader)`, `shaderB:` `[Shader](/reference/kotlin/android/graphics/Shader)`, `blendMode:` `[BlendMode](/reference/kotlin/android/graphics/BlendMode)`)` Create a new compose shader, given shaders A, B, and a combining PorterDuff mode. |\n| [ComposeShader](#ComposeShader(android.graphics.Shader,%20android.graphics.Shader,%20android.graphics.PorterDuff.Mode))`(`shaderA:` `[Shader](/reference/kotlin/android/graphics/Shader)`, `shaderB:` `[Shader](/reference/kotlin/android/graphics/Shader)`, `mode:` `[PorterDuff.Mode](/reference/kotlin/android/graphics/PorterDuff.Mode)`)` Create a new compose shader, given shaders A, B, and a combining PorterDuff mode. |\n| [ComposeShader](#ComposeShader(android.graphics.Shader,%20android.graphics.Shader,%20android.graphics.Xfermode))`(`shaderA:` `[Shader](/reference/kotlin/android/graphics/Shader)`, `shaderB:` `[Shader](/reference/kotlin/android/graphics/Shader)`, `mode:` `[Xfermode](/reference/kotlin/android/graphics/Xfermode)`)` Create a new compose shader, given shaders A, B, and a combining mode. |\n\n| Inherited functions ||\n|---|---|\n| From class [Shader](/reference/kotlin/android/graphics/Shader) |------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [getLocalMatrix](/reference/kotlin/android/graphics/Shader#getLocalMatrix(android.graphics.Matrix))`(`localM:` `[Matrix](/reference/kotlin/android/graphics/Matrix)`)` Return true if the shader has a non-identity local matrix. \u003cbr /\u003e | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setLocalMatrix](/reference/kotlin/android/graphics/Shader#setLocalMatrix(android.graphics.Matrix))`(`localM:` `[Matrix](/reference/kotlin/android/graphics/Matrix)?`)` 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. \u003cbr /\u003e | ||\n\nPublic constructors\n-------------------\n\n### ComposeShader\n\nAdded in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nComposeShader(\n shaderA: Shader, \n shaderB: Shader, \n blendMode: BlendMode)\n```\n\nCreate a new compose shader, given shaders A, B, and a combining PorterDuff mode. When the mode is applied, it will be given the result from shader A as its \"dst\", and the result from shader B as its \"src\".\n\n| Parameters ||\n|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `shaderA` | [Shader](/reference/kotlin/android/graphics/Shader): The colors from this shader are seen as the \"dst\" by the mode This value cannot be `null`. |\n| `shaderB` | [Shader](/reference/kotlin/android/graphics/Shader): The colors from this shader are seen as the \"src\" by the mode This value cannot be `null`. |\n| `blendMode` | [BlendMode](/reference/kotlin/android/graphics/BlendMode): The blend mode that combines the colors from the two shaders. This value cannot be `null`. |\n\n### ComposeShader\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nComposeShader(\n shaderA: Shader, \n shaderB: Shader, \n mode: PorterDuff.Mode)\n```\n\nCreate a new compose shader, given shaders A, B, and a combining PorterDuff mode. When the mode is applied, it will be given the result from shader A as its \"dst\", and the result from shader B as its \"src\".\n\n| Parameters ||\n|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `shaderA` | [Shader](/reference/kotlin/android/graphics/Shader): The colors from this shader are seen as the \"dst\" by the mode This value cannot be `null`. |\n| `shaderB` | [Shader](/reference/kotlin/android/graphics/Shader): The colors from this shader are seen as the \"src\" by the mode This value cannot be `null`. |\n| `mode` | [PorterDuff.Mode](/reference/kotlin/android/graphics/PorterDuff.Mode): The PorterDuff mode that combines the colors from the two shaders. This value cannot be `null`. |\n\n### ComposeShader\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nComposeShader(\n shaderA: Shader, \n shaderB: Shader, \n mode: Xfermode)\n```\n\nCreate a new compose shader, given shaders A, B, and a combining mode. When the mode is applied, it will be given the result from shader A as its \"dst\", and the result from shader B as its \"src\".\n\n| Parameters ||\n|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `shaderA` | [Shader](/reference/kotlin/android/graphics/Shader): The colors from this shader are seen as the \"dst\" by the mode This value cannot be `null`. |\n| `shaderB` | [Shader](/reference/kotlin/android/graphics/Shader): The colors from this shader are seen as the \"src\" by the mode This value cannot be `null`. |\n| `mode` | [Xfermode](/reference/kotlin/android/graphics/Xfermode): The mode that combines the colors from the two shaders. If mode is null, then SRC_OVER is assumed. |"]]