Java Code Examples for android.graphics.Matrix#MPERSP_1
The following examples show how to use
android.graphics.Matrix#MPERSP_1 .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MatrixUtils.java From libcommon with Apache License 2.0 | 6 votes |
/** * android.graphics.Matrixの3x3行列をOpenGLの4x4(列優先)行列に変換する * (アフィン変換のみ) * |a11 a12 a13| |0 1 2| |a11 a12 0 a13| |0 4 8 12| * |a21 a22 a23| |3 4 5| |a21 a22 0 a23| |1 5 9 13| * |a31 a32 a33| |6 7 8| => | 0 0 1 0| |2 6 10 14| * |a31 a32 0 a33| |3 7 11 15| * @param transform * @param result * @return */ @NonNull @Size(min=16) public static float[] toGLMatrix(@NonNull final Matrix transform, @NonNull @Size(min=16) final float[] result, @NonNull @Size(min=9) final float[] aMatrix) { transform.getValues(aMatrix); result[ 0] = aMatrix[Matrix.MSCALE_X]; result[ 1] = aMatrix[Matrix.MSKEW_Y]; result[ 2] = 0; result[ 3] = aMatrix[Matrix.MPERSP_0]; result[ 4] = aMatrix[Matrix.MSKEW_X]; result[ 5] = aMatrix[Matrix.MSCALE_Y]; result[ 6] = 0; result[ 7] = aMatrix[Matrix.MPERSP_1]; result[ 8] = 0; result[ 9] = 0; result[10] = 1; result[11] = 0; result[12] = aMatrix[Matrix.MTRANS_X]; result[13] = aMatrix[Matrix.MTRANS_Y]; result[14] = 0; result[15] = aMatrix[Matrix.MPERSP_2]; return result; }
Example 2
Source File: MatrixUtils.java From libcommon with Apache License 2.0 | 6 votes |
/** * OpenGLの4x4(列優先)行列をandroid.graphics.Matrixの3x3行列に変換する * (アフィン変換のみ) * @param transform * @param result * @param aMatrix * @return */ public static Matrix toAndroidMatrix( @NonNull @Size(min=16)final float[] transform, @NonNull final Matrix result, @NonNull @Size(min=9) final float[] aMatrix) { aMatrix[Matrix.MSCALE_X] = transform[ 0]; aMatrix[Matrix.MSKEW_Y] = transform[ 1]; aMatrix[Matrix.MPERSP_0] = transform[ 3]; aMatrix[Matrix.MSKEW_X] = transform[ 4]; aMatrix[Matrix.MSCALE_Y] = transform[ 5]; aMatrix[Matrix.MPERSP_1] = transform[ 7]; aMatrix[Matrix.MTRANS_X] = transform[12]; aMatrix[Matrix.MTRANS_Y] = transform[13]; aMatrix[Matrix.MPERSP_2] = transform[15]; result.setValues(aMatrix); return result; }
Example 3
Source File: CoupleChartGestureListener.java From shinny-futures-android with GNU General Public License v3.0 | 5 votes |
private void syncCharts() { Matrix srcMatrix; float[] srcVals = new float[9]; Matrix dstMatrix; float[] dstVals = new float[9]; // get src chart translation matrix: srcMatrix = srcChart.getViewPortHandler().getMatrixTouch(); srcMatrix.getValues(srcVals); // apply X axis scaling and position to dst charts: for (Chart dstChart : dstCharts) { dstMatrix = dstChart.getViewPortHandler().getMatrixTouch(); dstMatrix.getValues(dstVals); dstVals[Matrix.MSCALE_X] = srcVals[Matrix.MSCALE_X]; dstVals[Matrix.MSKEW_X] = srcVals[Matrix.MSKEW_X]; dstVals[Matrix.MTRANS_X] = srcVals[Matrix.MTRANS_X]; dstVals[Matrix.MSKEW_Y] = srcVals[Matrix.MSKEW_Y]; dstVals[Matrix.MSCALE_Y] = srcVals[Matrix.MSCALE_Y]; dstVals[Matrix.MTRANS_Y] = srcVals[Matrix.MTRANS_Y]; dstVals[Matrix.MPERSP_0] = srcVals[Matrix.MPERSP_0]; dstVals[Matrix.MPERSP_1] = srcVals[Matrix.MPERSP_1]; dstVals[Matrix.MPERSP_2] = srcVals[Matrix.MPERSP_2]; dstMatrix.setValues(dstVals); dstChart.getViewPortHandler().refresh(dstMatrix, dstChart, true); } }
Example 4
Source File: CoupleChartGestureListener.java From StockChart-MPAndroidChart with MIT License | 5 votes |
public void syncCharts() { if (dstCharts == null) { return; } Matrix srcMatrix; float[] srcVals = new float[9]; Matrix dstMatrix; float[] dstVals = new float[9]; // get src chart translation matrix: srcMatrix = srcChart.getViewPortHandler().getMatrixTouch(); srcMatrix.getValues(srcVals); // apply X axis scaling and position to dst charts: for (Chart dstChart : dstCharts) { if (dstChart.getVisibility() == View.VISIBLE) { dstMatrix = dstChart.getViewPortHandler().getMatrixTouch(); dstMatrix.getValues(dstVals); dstVals[Matrix.MSCALE_X] = srcVals[Matrix.MSCALE_X]; dstVals[Matrix.MSKEW_X] = srcVals[Matrix.MSKEW_X]; dstVals[Matrix.MTRANS_X] = srcVals[Matrix.MTRANS_X]; dstVals[Matrix.MSKEW_Y] = srcVals[Matrix.MSKEW_Y]; dstVals[Matrix.MSCALE_Y] = srcVals[Matrix.MSCALE_Y]; dstVals[Matrix.MTRANS_Y] = srcVals[Matrix.MTRANS_Y]; dstVals[Matrix.MPERSP_0] = srcVals[Matrix.MPERSP_0]; dstVals[Matrix.MPERSP_1] = srcVals[Matrix.MPERSP_1]; dstVals[Matrix.MPERSP_2] = srcVals[Matrix.MPERSP_2]; dstMatrix.setValues(dstVals); dstChart.getViewPortHandler().refresh(dstMatrix, dstChart, true); } } }
Example 5
Source File: CoupleChartGestureListener.java From android-kline with Apache License 2.0 | 5 votes |
public void syncCharts() { Matrix srcMatrix; float[] srcVals = new float[9]; Matrix dstMatrix; float[] dstVals = new float[9]; // get src chart translation matrix: srcMatrix = srcChart.getViewPortHandler().getMatrixTouch(); srcMatrix.getValues(srcVals); // apply X axis scaling and position to dst charts: for (Chart dstChart : dstCharts) { dstMatrix = dstChart.getViewPortHandler().getMatrixTouch(); dstMatrix.getValues(dstVals); dstVals[Matrix.MSCALE_X] = srcVals[Matrix.MSCALE_X]; dstVals[Matrix.MSKEW_X] = srcVals[Matrix.MSKEW_X]; dstVals[Matrix.MTRANS_X] = srcVals[Matrix.MTRANS_X]; dstVals[Matrix.MSKEW_Y] = srcVals[Matrix.MSKEW_Y]; dstVals[Matrix.MSCALE_Y] = srcVals[Matrix.MSCALE_Y]; dstVals[Matrix.MTRANS_Y] = srcVals[Matrix.MTRANS_Y]; dstVals[Matrix.MPERSP_0] = srcVals[Matrix.MPERSP_0]; dstVals[Matrix.MPERSP_1] = srcVals[Matrix.MPERSP_1]; dstVals[Matrix.MPERSP_2] = srcVals[Matrix.MPERSP_2]; dstMatrix.setValues(dstVals); dstChart.getViewPortHandler().refresh(dstMatrix, dstChart, true); } }
Example 6
Source File: ImageViewUtil.java From PhotoViewCropper with Apache License 2.0 | 4 votes |
public static float getPers1(Matrix matrix){ float[] f = new float[9]; matrix.getValues(f); return f[Matrix.MPERSP_1]; }