Matrix setValues - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Matrix setValues method.

This code example shows how to use the following methods:setValues
	 * @param m12 MTRANS_Y 
	 */ 
	public static void setMatValues(Matrix mat, float m00, float m01, float m10, float m11, float m02, float m12) {
	   	float[] fs = {m00, m10, m02, m01, m11, m12, 0,0,1};
//	   	float[] fs = {m00, m01, m02, m10, m11, m12, 0,0,1}; 
	   	mat.setValues(fs);
	} 
 
	public static void setMatValues(Matrix mat, float[] m6) {
		setMatValues(mat, m6[0], m6[1], m6[2], m6[3], m6[4], m6[5]);
	} 
	 
	public static Matrix createMatrix(float m00, float m01, float m10, float m11, float m02, float m12) {
		Matrix result = new Matrix();
		setMatValues(result, m00,m01,m10,m11,m02,m12);
		return result;
	} 
	public static Matrix createMatrix(float[] m6) {
		return createMatrix(m6[0], m6[1], m6[2], m6[3], m6[4], m6[5]);
	} 
7
CodeRank
This code example shows how to use the following methods:getValues, postScale, postTranslate, set, setScale
    	ImageView view = (ImageView) v;
    	if (started == false)
    		{initImage(view);
    		started = true;
    		} 
    	mootrix.getValues(matrixArray);
 
 
    	 
    	switch(event.getAction() & MotionEvent.ACTION_MASK)
    	{ 
    	case MotionEvent.ACTION_DOWN:
    		savedMootrix.set(mootrix);
    		stoort.set(event.getX(), event.getY());
    		moved = false;
    		MODE = DRAG;
    		Log.d(TAG, "MODE=DRAG");
    		break; 
    	case MotionEvent.ACTION_POINTER_UP:
    		MODE = DRAG;

6
CodeRank
This code example shows how to use the following methods:getValues, set, setScale, setValues
	} 
 
	public void zoomImageToWindow() { 
		if (bm.getWidth() < width && bm.getHeight() < height) {
			// matrix.reset(); 
			matrix.setScale(1f, 1f);
			bx = bm.getWidth();
			by = bm.getHeight();
		} else { 
			float scale = Math.min((float) width / (float) bm.getWidth(),
					(float) height / (float) bm.getHeight());
			FLog.d("scale=" + scale);
			matrix.setScale(scale, scale);
			bx = bm.getWidth() * scale;
			by = bm.getHeight() * scale;
		} 
 
		// 画像をView中央にセット 
		float[] values = new float[9];
		matrix.getValues(values);

6
CodeRank
This code example shows how to use the following methods:getValues, postScale, set, setValues
				mMatrix.postTranslate(event.getX() - mStartPoint.x, event.getY() - mStartPoint.y);
 
			} else if (mMode == ZOOM) {
				float postGap = pointGapSpace(event);
				if (postGap > 5f) {
					mMatrix.set(mPreMatrix);
					float scale = postGap / mPreGap;
					mMatrix.postScale(scale, scale, mCenterPoint.x, mCenterPoint.y);
				} 
			} 
			break; 
		} 
		updateMatrix(mMatrix);
		setImageMatrix(mMatrix);
		return super.onTouchEvent(event);
	} 
	 
	private void disallowInterceptTouch(){ 
        float[] values = new float[9];
        mCurMatrix.getValues(values);

6
CodeRank
This code example shows how to use the following methods:postTranslate, preTranslate, reset, setValues
This code example shows how to use the following methods:setValues
  /** Buffer. */ 
  private static Bitmap bufferBM = Bitmap.createBitmap(1, 1, Config.ARGB_8888);
  /** Buffer. */ 
  private static Canvas bufferCanvas = new Canvas(bufferBM);
  /** Transformation matrix. */ 
  private static final Matrix T = new Matrix();
  /** Initial state. */ 
  private static final float[] T_INIT = new float[] {
    1, 0, 0, 
    0, 1, 0, 
    0, 0, 1 
  }; 
  static { T.setValues(T_INIT); }
 
  /** 
   * @param bg drawable 
   * @param x coordinate 
   * @param y coordinate 
   * @return color of pixel at (x, y) 
   */ 
6
CodeRank
This code example shows how to use the following methods:postTranslate, preTranslate, reset, setValues
This code example shows how to use the following methods:getValues, postScale, set, setScale, setValues
		setImageMatrix(matrix);
	} 
 
	private void fixScale() { 
		float p[] = new float[9];
		matrix.getValues(p);
		float curScale = Math.abs(p[0]) + Math.abs(p[1]);
 
		float minScale = Math.min((float) viewW / (float) rotatedImageW,
				(float) viewH / (float) rotatedImageH);
		if (curScale < minScale) {
			if (curScale > 0) {
				double scale = minScale / curScale;
				p[0] = (float) (p[0] * scale);
				p[1] = (float) (p[1] * scale);
				p[3] = (float) (p[3] * scale);
				p[4] = (float) (p[4] * scale);
				matrix.setValues(p);
			} else { 
				matrix.setScale(minScale, minScale);

5
CodeRank
This code example shows how to use the following methods:postTranslate, preTranslate, reset, setValues
This code example shows how to use the following methods:setValues
	} 
	 
	private void restoreImageMatrix(Bundle savedInstanceState) {
		if (savedInstanceState != null) {
			float[] imageMatrixValues = savedInstanceState.getFloatArray(IMAGE_MATRIX_BUNDLE_KEY);
			imageViewModel.validateAndSetImageMatrix(getMatrixFromValues(imageMatrixValues));
		} 
	} 
 
	private Matrix getMatrixFromValues(float[] values) {
		Matrix matrix = new Matrix();
		matrix.setValues(values);
		return matrix;
	} 
 
} 
5
CodeRank
setValues Method Overview
Copy 9 values from the array into the matrix.
See Code Examples for other Android Matrix Methods: