private static native void nativeSetMatrix(long transactionObj, long nativeObject,
float dsdx, float dtdx,
float dtdy, float dsdy);
+ private static native void nativeSetColorTransform(long transactionObj, long nativeObject,
+ float[] matrix, float[] translation);
private static native void nativeSetColor(long transactionObj, long nativeObject, float[] color);
private static native void nativeSetFlags(long transactionObj, long nativeObject,
int flags, int mask);
}
}
+ /**
+ * Sets the color transform for the Surface.
+ * @param matrix A float array with 9 values represents a 3x3 transform matrix
+ * @param translation A float array with 3 values represents a translation vector
+ */
+ public void setColorTransform(@Size(9) float[] matrix, @Size(3) float[] translation) {
+ checkNotReleased();
+ synchronized (SurfaceControl.class) {
+ sGlobalTransaction.setColorTransform(this, matrix, translation);
+ }
+ }
+
public void setWindowCrop(Rect crop) {
checkNotReleased();
synchronized (SurfaceControl.class) {
return this;
}
+ /**
+ * Sets the color transform for the Surface.
+ * @param matrix A float array with 9 values represents a 3x3 transform matrix
+ * @param translation A float array with 3 values represents a translation vector
+ */
+ public Transaction setColorTransform(SurfaceControl sc, @Size(9) float[] matrix,
+ @Size(3) float[] translation) {
+ sc.checkNotReleased();
+ nativeSetColorTransform(mNativeObject, sc.mNativeObject, matrix, translation);
+ return this;
+ }
+
@UnsupportedAppUsage
public Transaction setWindowCrop(SurfaceControl sc, Rect crop) {
sc.checkNotReleased();
transaction->setMatrix(ctrl, dsdx, dtdx, dtdy, dsdy);
}
+static void nativeSetColorTransform(JNIEnv* env, jclass clazz, jlong transactionObj,
+ jlong nativeObject, jfloatArray fMatrix, jfloatArray fTranslation) {
+ auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
+ SurfaceControl* const surfaceControl = reinterpret_cast<SurfaceControl*>(nativeObject);
+ float* floatMatrix = env->GetFloatArrayElements(fMatrix, 0);
+ mat3 matrix(static_cast<float const*>(floatMatrix));
+ float* floatTranslation = env->GetFloatArrayElements(fTranslation, 0);
+ vec3 translation(floatTranslation[0], floatTranslation[1], floatTranslation[2]);
+ transaction->setColorTransform(surfaceControl, matrix, translation);
+}
+
static void nativeSetWindowCrop(JNIEnv* env, jclass clazz, jlong transactionObj,
jlong nativeObject,
jint l, jint t, jint r, jint b) {
(void*)nativeSetColor },
{"nativeSetMatrix", "(JJFFFF)V",
(void*)nativeSetMatrix },
+ {"nativeSetColorTransform", "(JJ[F[F)V",
+ (void*)nativeSetColorTransform },
{"nativeSetFlags", "(JJII)V",
(void*)nativeSetFlags },
{"nativeSetWindowCrop", "(JJIIII)V",