android.graphics.Matrix.getValues()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(225)

本文整理了Java中android.graphics.Matrix.getValues()方法的一些代码示例,展示了Matrix.getValues()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.getValues()方法的具体详情如下:
包路径:android.graphics.Matrix
类名称:Matrix
方法名:getValues

Matrix.getValues介绍

暂无

代码示例

代码示例来源:origin: chrisbanes/PhotoView

/**
 * Helper method that 'unpacks' a Matrix and returns the required value
 *
 * @param matrix     Matrix to unpack
 * @param whichValue Which value from Matrix.M* to return
 * @return returned value
 */
private float getValue(Matrix matrix, int whichValue) {
  matrix.getValues(mMatrixValues);
  return mMatrixValues[whichValue];
}

代码示例来源:origin: jdamcd/android-crop

protected float getValue(Matrix matrix, int whichValue) {
  matrix.getValues(matrixValues);
  return matrixValues[whichValue];
}

代码示例来源:origin: wangdan/AisenWeiBo

/**
 * Helper method that 'unpacks' a Matrix and returns the required value
 *
 * @param matrix     - Matrix to unpack
 * @param whichValue - Which value from Matrix.M* to return
 * @return float - returned value
 */
private float getValue(Matrix matrix, int whichValue) {
  matrix.getValues(mMatrixValues);
  return mMatrixValues[whichValue];
}

代码示例来源:origin: jiangqqlmj/FastDev4Android

/**
 * Helper method that 'unpacks' a Matrix and returns the required value
 * 
 * @param matrix
 *            - Matrix to unpack
 * @param whichValue
 *            - Which value from Matrix.M* to return
 * @return float - returned value
 */
private float getValue(Matrix matrix, int whichValue) {
  matrix.getValues(mMatrixValues);
  return mMatrixValues[whichValue];
}

代码示例来源:origin: wangdan/AisenWeiBo

/**
 * Helper method that 'unpacks' a Matrix and returns the required value
 *
 * @param matrix     - Matrix to unpack
 * @param whichValue - Which value from Matrix.M* to return
 * @return float - returned value
 */
private float getValue(Matrix matrix, int whichValue) {
  matrix.getValues(mMatrixValues);
  return mMatrixValues[whichValue];
}

代码示例来源:origin: steelkiwi/cropiwa

public float getXTranslation(Matrix mat) {
  mat.getValues(outValues);
  return outValues[Matrix.MTRANS_X];
}

代码示例来源:origin: sephiroth74/ImageViewZoom

protected float getValue(Matrix matrix, int whichValue) {
  matrix.getValues(mMatrixValues);
  return mMatrixValues[whichValue];
}

代码示例来源:origin: steelkiwi/cropiwa

public float getScaleX(Matrix mat) {
  mat.getValues(outValues);
  return outValues[Matrix.MSCALE_X];
}

代码示例来源:origin: steelkiwi/cropiwa

public float getYTranslation(Matrix mat) {
  mat.getValues(outValues);
  return outValues[Matrix.MTRANS_Y];
}

代码示例来源:origin: Yalantis/uCrop

/**
 * This method returns Matrix value for given index.
 *
 * @param matrix     - valid Matrix object
 * @param valueIndex - index of needed value. See {@link Matrix#MSCALE_X} and others.
 * @return - matrix value for index
 */
protected float getMatrixValue(@NonNull Matrix matrix, @IntRange(from = 0, to = MATRIX_VALUES_COUNT) int valueIndex) {
  matrix.getValues(mMatrixValues);
  return mMatrixValues[valueIndex];
}

代码示例来源:origin: MikeOrtiz/TouchImageView

private void printMatrixInfo() {
    float[] n = new float[9];
    matrix.getValues(n);
    Log.d(DEBUG, "Scale: " + n[Matrix.MSCALE_X] + " TransX: " + n[Matrix.MTRANS_X] + " TransY: " + n[Matrix.MTRANS_Y]);
  }
}

代码示例来源:origin: jeasonlzy/ImagePicker

/** 获取当前图片允许的最大缩放比 */
private float maxPostScale() {
  float imageMatrixValues[] = new float[9];
  matrix.getValues(imageMatrixValues);
  float curScale = Math.abs(imageMatrixValues[0]) + Math.abs(imageMatrixValues[1]);
  return mMaxScale / curScale;
}

代码示例来源:origin: PhilJay/MPAndroidChart

/**
 * Resets all zooming and dragging and makes the chart fit exactly it's
 * bounds.  Output Matrix is available for those who wish to cache the object.
 */
public void fitScreen(Matrix outputMatrix) {
  mMinScaleX = 1f;
  mMinScaleY = 1f;
  outputMatrix.set(mMatrixTouch);
  float[] vals = valsBufferForFitScreen;
  for (int i = 0; i < 9; i++) {
    vals[i] = 0;
  }
  outputMatrix.getValues(vals);
  // reset all translations and scaling
  vals[Matrix.MTRANS_X] = 0f;
  vals[Matrix.MTRANS_Y] = 0f;
  vals[Matrix.MSCALE_X] = 1f;
  vals[Matrix.MSCALE_Y] = 1f;
  outputMatrix.setValues(vals);
}

代码示例来源:origin: andkulikov/Transitions-Everywhere

@Override
  @Nullable
  public Matrix evaluate(float fraction, @NonNull Matrix startValue, @NonNull Matrix endValue) {
    startValue.getValues(mTempStartValues);
    endValue.getValues(mTempEndValues);
    for (int i = 0; i < 9; i++) {
      float diff = mTempEndValues[i] - mTempStartValues[i];
      mTempEndValues[i] = mTempStartValues[i] + (fraction * diff);
    }
    mTempMatrix.setValues(mTempEndValues);
    return mTempMatrix;
  }
}

代码示例来源:origin: ArthurHub/Android-Image-Cropper

public void setEndState(float[] boundPoints, Matrix imageMatrix) {
 System.arraycopy(boundPoints, 0, mEndBoundPoints, 0, 8);
 mEndCropWindowRect.set(mCropOverlayView.getCropWindowRect());
 imageMatrix.getValues(mEndImageMatrix);
}

代码示例来源:origin: PhilJay/MPAndroidChart

matrix.getValues(matrixBuffer);

代码示例来源:origin: ArthurHub/Android-Image-Cropper

public void setStartState(float[] boundPoints, Matrix imageMatrix) {
 reset();
 System.arraycopy(boundPoints, 0, mStartBoundPoints, 0, 8);
 mStartCropWindowRect.set(mCropOverlayView.getCropWindowRect());
 imageMatrix.getValues(mStartImageMatrix);
}

代码示例来源:origin: MikeOrtiz/TouchImageView

@Override
public boolean canScrollVertically(int direction) {
  matrix.getValues(m);
  float y = m[Matrix.MTRANS_Y];
  if (getImageHeight() < viewHeight) {
    return false;
  } else if (y >= -1 && direction < 0) {
    return false;
  } else if (Math.abs(y) + viewHeight + 1 >= getImageHeight() && direction > 0) {
    return false;
  }
  return true;
}

代码示例来源:origin: MikeOrtiz/TouchImageView

@Override
public boolean canScrollHorizontally(int direction) {
  matrix.getValues(m);
  float x = m[Matrix.MTRANS_X];
  if (getImageWidth() < viewWidth) {
    return false;
  } else if (x >= -1 && direction < 0) {
    return false;
  } else if (Math.abs(x) + viewWidth + 1 >= getImageWidth() && direction > 0) {
    return false;
  }
  return true;
}

代码示例来源:origin: robolectric/robolectric

@Test
public void testGetSetValues() {
 final Matrix matrix = new Matrix();
 final float[] values = { 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
 matrix.setValues(values);
 final float[] matrixValues = new float[9];
 matrix.getValues(matrixValues);
 assertThat(matrixValues)
   .isEqualTo(values);
}

相关文章