diff options
author | Romain Guy <romainguy@google.com> | 2010-07-30 19:18:16 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2010-07-30 19:18:16 -0700 |
commit | 06f96e2652e4855b6520ad9dd70583677605b79a (patch) | |
tree | 7d0e3709c8a400e264f37206eb27a286ee50d64b /graphics/java/android/graphics/ComposeShader.java | |
parent | 42272759e4c3c406977187fd2b4df8739edccde8 (diff) | |
download | frameworks_base-06f96e2652e4855b6520ad9dd70583677605b79a.zip frameworks_base-06f96e2652e4855b6520ad9dd70583677605b79a.tar.gz frameworks_base-06f96e2652e4855b6520ad9dd70583677605b79a.tar.bz2 |
Refactor Skia shaders handling.
With this change, Skia shaders can easily be applied to any mesh. This change also
supports ComposeShader. For instance, this can be used to blend a gradient and a
bitmap togehter and paint a string of text with the result.
Change-Id: I701c2f9cf7f89b2ff58005e8a1d0d80ccf4a4aea
Diffstat (limited to 'graphics/java/android/graphics/ComposeShader.java')
-rw-r--r-- | graphics/java/android/graphics/ComposeShader.java | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/graphics/java/android/graphics/ComposeShader.java b/graphics/java/android/graphics/ComposeShader.java index a06d30b..9b57ea4 100644 --- a/graphics/java/android/graphics/ComposeShader.java +++ b/graphics/java/android/graphics/ComposeShader.java @@ -30,7 +30,9 @@ public class ComposeShader extends Shader { */ public ComposeShader(Shader shaderA, Shader shaderB, Xfermode mode) { native_instance = nativeCreate1(shaderA.native_instance, shaderB.native_instance, - (mode != null) ? mode.native_instance : 0); + (mode != null) ? mode.native_instance : 0); + native_shader = nativePostCreate1(native_instance, shaderA.native_shader, + shaderB.native_shader, (mode != null) ? mode.native_instance : 0); } /** Create a new compose shader, given shaders A, B, and a combining PorterDuff mode. @@ -42,10 +44,17 @@ public class ComposeShader extends Shader { */ public ComposeShader(Shader shaderA, Shader shaderB, PorterDuff.Mode mode) { native_instance = nativeCreate2(shaderA.native_instance, shaderB.native_instance, - mode.nativeInt); + mode.nativeInt); + native_shader = nativePostCreate2(native_instance, shaderA.native_shader, + shaderB.native_shader, mode.nativeInt); } - private static native int nativeCreate1(int native_shaderA, int native_shaderB, int native_mode); - private static native int nativeCreate2(int native_shaderA, int native_shaderB, int porterDuffMode); + private static native int nativeCreate1(int native_shaderA, int native_shaderB, + int native_mode); + private static native int nativeCreate2(int native_shaderA, int native_shaderB, + int porterDuffMode); + private static native int nativePostCreate1(int native_shader, int native_skiaShaderA, + int native_skiaShaderB, int native_mode); + private static native int nativePostCreate2(int native_shader, int native_skiaShaderA, + int native_skiaShaderB, int porterDuffMode); } - |