| 1 | /* |
| 2 | * Copyright 2020 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ANDROID_GRAPHICS_MATRIX_H |
| 18 | #define ANDROID_GRAPHICS_MATRIX_H |
| 19 | |
| 20 | #include <jni.h> |
| 21 | #include <cutils/compiler.h> |
| 22 | #include <sys/cdefs.h> |
| 23 | |
| 24 | __BEGIN_DECLS |
| 25 | |
| 26 | /** |
| 27 | * Returns an array of floats that represents the 3x3 matrix of the java object. |
| 28 | * @param values The 9 values of the 3x3 matrix in the following order. |
| 29 | * values[0] = scaleX values[1] = skewX values[2] = transX |
| 30 | * values[3] = skewY values[4] = scaleY values[5] = transY |
| 31 | * values[6] = persp0 values[7] = persp1 values[8] = persp2 |
| 32 | * @return true if the values param was populated and false otherwise. |
| 33 | |
| 34 | */ |
| 35 | ANDROID_API bool AMatrix_getContents(JNIEnv* env, jobject matrixObj, float values[9]); |
| 36 | |
| 37 | /** |
| 38 | * Returns a new Matrix jobject that contains the values passed in as initial values. |
| 39 | * @param values The 9 values of the 3x3 matrix in the following order. |
| 40 | * values[0] = scaleX values[1] = skewX values[2] = transX |
| 41 | * values[3] = skewY values[4] = scaleY values[5] = transY |
| 42 | * values[6] = persp0 values[7] = persp1 values[8] = persp2 |
| 43 | * @return The matrix jobject |
| 44 | */ |
| 45 | ANDROID_API jobject AMatrix_newInstance(JNIEnv* env, float values[9]); |
| 46 | |
| 47 | __END_DECLS |
| 48 | |
| 49 | #endif // ANDROID_GRAPHICS_MATRIX_H |