Code example for Matrix

Methods: getValues, setScale, setValues

0
			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);
		values[Matrix.MTRANS_X] = (width - bx) / 2;
		values[Matrix.MTRANS_Y] = (height - by) / 2;
		matrix.setValues(values);
	} 
 
	public void setImageBitmap(Bitmap bm) {
		super.setImageBitmap(bm);
		this.bm = bm;