本文整理了Java中android.graphics.Matrix.invert()
方法的一些代码示例,展示了Matrix.invert()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.invert()
方法的具体详情如下:
包路径:android.graphics.Matrix
类名称:Matrix
方法名:invert
暂无
代码示例来源:origin: PhilJay/MPAndroidChart
public Matrix getPixelToValueMatrix() {
getValueToPixelMatrix().invert(mMBuffer2);
return mMBuffer2;
}
}
代码示例来源:origin: PhilJay/MPAndroidChart
/**
* Transforms the given array of touch positions (pixels) (x, y, x, y, ...)
* into values on the chart.
*
* @param pixels
*/
public void pixelsToValue(float[] pixels) {
Matrix tmp = mPixelToValueMatrixBuffer;
tmp.reset();
// invert all matrixes to convert back to the original value
mMatrixOffset.invert(tmp);
tmp.mapPoints(pixels);
mViewPortHandler.getMatrixTouch().invert(tmp);
tmp.mapPoints(pixels);
mMatrixValueToPx.invert(tmp);
tmp.mapPoints(pixels);
}
代码示例来源:origin: andkulikov/Transitions-Everywhere
private void setMatricesForParent(TransitionValues startValues, TransitionValues endValues) {
Matrix endParentMatrix = (Matrix) endValues.values.get(PROPNAME_PARENT_MATRIX);
endValues.view.setTag(R.id.parentMatrix, endParentMatrix);
Matrix toLocal = mTempMatrix;
toLocal.reset();
endParentMatrix.invert(toLocal);
Matrix startLocal = (Matrix) startValues.values.get(PROPNAME_MATRIX);
if (startLocal == null) {
startLocal = new Matrix();
startValues.values.put(PROPNAME_MATRIX, startLocal);
}
Matrix startParentMatrix = (Matrix) startValues.values.get(PROPNAME_PARENT_MATRIX);
startLocal.postConcat(startParentMatrix);
startLocal.postConcat(toLocal);
}
代码示例来源:origin: alexvasilkov/GestureViews
protected void applyState(State state) {
state.get(matrix);
matrix.invert(matrixInverse);
invalidate();
}
代码示例来源:origin: ArthurHub/Android-Image-Cropper
/**
* Gets the 4 points of crop window's position relative to the source Bitmap (not the image
* displayed in the CropImageView) using the original image rotation.<br>
* Note: the 4 points may not be a rectangle if the image was rotates to NOT stright angle (!=
* 90/180/270).
*
* @return 4 points (x0,y0,x1,y1,x2,y2,x3,y3) of cropped area boundaries
*/
public float[] getCropPoints() {
// Get crop window position relative to the displayed image.
RectF cropWindowRect = mCropOverlayView.getCropWindowRect();
float[] points =
new float[] {
cropWindowRect.left,
cropWindowRect.top,
cropWindowRect.right,
cropWindowRect.top,
cropWindowRect.right,
cropWindowRect.bottom,
cropWindowRect.left,
cropWindowRect.bottom
};
mImageMatrix.invert(mImageInverseMatrix);
mImageInverseMatrix.mapPoints(points);
for (int i = 0; i < points.length; i++) {
points[i] *= mLoadedSampleSize;
}
return points;
}
代码示例来源:origin: siyamed/android-shape-imageview
matrix.invert(pathMatrix);
path.transform(pathMatrix);
代码示例来源:origin: ArthurHub/Android-Image-Cropper
mImageMatrix.invert(mImageInverseMatrix);
mImageInverseMatrix.mapRect(BitmapUtils.RECT);
代码示例来源:origin: alexvasilkov/GestureViews
private void selectItem(float eventX, float eventY) {
// Getting first item (in backward order) which contains given click event
for (int i = items.size() - 1; i >= 0; i--) {
Item item = items.get(i);
item.getState().get(matrix);
matrix.invert(inverseMatrix);
// Taking item's rotation into account
point[0] = eventX;
point[1] = eventY;
inverseMatrix.mapPoints(point);
int newX = Math.round(point[0]);
int newY = Math.round(point[1]);
// Checking if click event is within item's bounds
Rect bounds = images.get(item.getImageId()).getBounds();
if (bounds.contains(newX, newY)) {
selectItem(item);
return;
}
}
selectItem(null);
}
代码示例来源:origin: robolectric/robolectric
private static void checkInverse(Matrix matrix) {
final Matrix inverse = new Matrix();
assertThat(matrix.invert(inverse))
.isTrue();
matrix.postConcat(inverse);
assertThat(matrix.isIdentity())
.isTrue();
}
}
代码示例来源:origin: alexvasilkov/GestureViews
public static void computeNewPosition(@Size(2) float[] point,
State initialState, State finalState) {
initialState.get(tmpMatrix);
tmpMatrix.invert(tmpMatrixInverse);
tmpMatrixInverse.mapPoints(point);
finalState.get(tmpMatrix);
tmpMatrix.mapPoints(point);
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testInvert() {
final Matrix matrix = new Matrix();
final Matrix inverse = new Matrix();
matrix.setScale(0.0f, 1.0f);
assertThat(matrix.invert(inverse))
.isFalse();
matrix.setScale(1.0f, 0.0f);
assertThat(matrix.invert(inverse))
.isFalse();
matrix.setScale(1.0f, 1.0f);
checkInverse(matrix);
matrix.setScale(-3.0f, 5.0f);
checkInverse(matrix);
matrix.setTranslate(5.0f, 2.0f);
checkInverse(matrix);
matrix.setScale(-3.0f, 5.0f);
matrix.postTranslate(5.0f, 2.0f);
checkInverse(matrix);
matrix.setScale(-3.0f, 5.0f);
matrix.postRotate(-30f, 1.0f, 2.0f);
matrix.postTranslate(5.0f, 2.0f);
checkInverse(matrix);
}
代码示例来源:origin: ArthurHub/Android-Image-Cropper
mImageMatrix.invert(mImageInverseMatrix);
代码示例来源:origin: ArthurHub/Android-Image-Cropper
if (mBitmap != null && width > 0 && height > 0) {
mImageMatrix.invert(mImageInverseMatrix);
RectF cropRect = mCropOverlayView.getCropWindowRect();
mImageInverseMatrix.mapRect(cropRect);
代码示例来源:origin: DaxiaK/MyDiary
/**
* Maps point from view-absolute to image-relative coordinates.
* This takes into account the zoomable transformation.
*/
public PointF mapViewToImage(PointF viewPoint) {
float[] points = mTempValues;
points[0] = viewPoint.x;
points[1] = viewPoint.y;
mActiveTransform.invert(mActiveTransformInverse);
mActiveTransformInverse.mapPoints(points, 0, points, 0, 1);
mapAbsoluteToRelative(points, points, 1);
return new PointF(points[0], points[1]);
}
代码示例来源:origin: guolindev/giffun
mImageMatrix.invert(mImageInverseMatrix);
mImageInverseMatrix.mapRect(BitmapUtils.RECT);
代码示例来源:origin: guolindev/giffun
/**
* Gets the 4 points of crop window's position relative to the source Bitmap (not the image
* displayed in the CropImageView) using the original image rotation.<br>
* Note: the 4 points may not be a rectangle if the image was rotates to NOT stright angle (!=
* 90/180/270).
*
* @return 4 points (x0,y0,x1,y1,x2,y2,x3,y3) of cropped area boundaries
*/
public float[] getCropPoints() {
// Get crop window position relative to the displayed image.
RectF cropWindowRect = mCropOverlayView.getCropWindowRect();
float[] points =
new float[] {
cropWindowRect.left,
cropWindowRect.top,
cropWindowRect.right,
cropWindowRect.top,
cropWindowRect.right,
cropWindowRect.bottom,
cropWindowRect.left,
cropWindowRect.bottom
};
mImageMatrix.invert(mImageInverseMatrix);
mImageInverseMatrix.mapPoints(points);
for (int i = 0; i < points.length; i++) {
points[i] *= mLoadedSampleSize;
}
return points;
}
代码示例来源:origin: guolindev/giffun
mImageMatrix.invert(mImageInverseMatrix);
代码示例来源:origin: guolindev/giffun
if (mBitmap != null && width > 0 && height > 0) {
mImageMatrix.invert(mImageInverseMatrix);
RectF cropRect = mCropOverlayView.getCropWindowRect();
mImageInverseMatrix.mapRect(cropRect);
代码示例来源:origin: WallaceXiao/StockChart-MPAndroidChart
public Matrix getPixelToValueMatrix() {
getValueToPixelMatrix().invert(mMBuffer2);
return mMBuffer2;
}
}
代码示例来源:origin: fookwood/Launcher3
private float[] mapPointFromParentToView(View v, float x, float y) {
sTmpPoint[0] = x - v.getLeft();
sTmpPoint[1] = y - v.getTop();
v.getMatrix().invert(sTmpInvMatrix);
sTmpInvMatrix.mapPoints(sTmpPoint);
return sTmpPoint;
}
内容来源于网络,如有侵权,请联系作者删除!