Browse Source

add matrixUtil

lihao1 3 years ago
parent
commit
ec7bf40668

+ 21 - 0
sybotan-android-graphy/src/main/java/com/sybotan/android/graphy/utils/MatrixUtil.kt

@@ -0,0 +1,21 @@
+package com.sybotan.android.graphy.utils
+
+import android.graphics.Matrix
+import android.graphics.PointF
+
+object MatrixUtil {
+
+    /**
+     *
+     */
+    fun matrixTransform(mat: Matrix,x : Float, y : Float ) : PointF {
+        val pointF = PointF()
+        val src = kotlin.floatArrayOf(0f, 1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f)
+        mat.getValues(src)
+        pointF.x = x * src[0] + y * src[1] + src[2];
+        pointF.y = x * src[3] + y * src[4] + src[5];
+        return pointF;
+    }
+
+
+}