summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorchaviw <chaviw@google.com>2017-08-25 12:15:26 -0700
committerchaviw <chaviw@google.com>2017-08-25 12:15:26 -0700
commit0dd03f55e306c566d0c9180e5a437231106b3073 (patch)
treeae6aad548f6e10c073adae8731aa1f3a57e977ea /core/java/android
parent1f3f7a858c4bb079d52cb6628335ee12c950a46c (diff)
Added jni and SurfaceControl methods for native setColor
Added the java method to invoke the setColor method that will set a color for a layer. Test: Builds and runs Change-Id: Ica846fb977d937b48fe890ca70a3879b17cc71f6
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/view/SurfaceControl.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index 91932dd40dd8..c7a82f397f36 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -18,6 +18,7 @@ package android.view;
import static android.view.WindowManager.LayoutParams.INVALID_WINDOW_TYPE;
+import android.annotation.Size;
import android.graphics.Bitmap;
import android.graphics.GraphicBuffer;
import android.graphics.Rect;
@@ -65,6 +66,7 @@ public class SurfaceControl {
private static native void nativeSetSize(long nativeObject, int w, int h);
private static native void nativeSetTransparentRegionHint(long nativeObject, Region region);
private static native void nativeSetAlpha(long nativeObject, float alpha);
+ private static native void nativeSetColor(long nativeObject, float[] color);
private static native void nativeSetMatrix(long nativeObject, float dsdx, float dtdx,
float dtdy, float dsdy);
private static native void nativeSetFlags(long nativeObject, int flags, int mask);
@@ -552,6 +554,15 @@ public class SurfaceControl {
nativeSetAlpha(mNativeObject, alpha);
}
+ /**
+ * Sets a color for the Surface.
+ * @param color A float array with three values to represent r, g, b in range [0..1]
+ */
+ public void setColor(@Size(3) float[] color) {
+ checkNotReleased();
+ nativeSetColor(mNativeObject, color);
+ }
+
public void setMatrix(float dsdx, float dtdx, float dtdy, float dsdy) {
checkNotReleased();
nativeSetMatrix(mNativeObject, dsdx, dtdx, dtdy, dsdy);