本文整理了Java中android.graphics.Matrix.postSkew()
方法的一些代码示例,展示了Matrix.postSkew()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.postSkew()
方法的具体详情如下:
包路径:android.graphics.Matrix
类名称:Matrix
方法名:postSkew
暂无
代码示例来源:origin: robolectric/robolectric
@Test
public void postOperationsAreQueued() {
Matrix m = new Matrix();
m.postRotate(4, 8, 15);
m.postTranslate(16, 23);
m.postSkew(42, 108);
assertThat(shadowOf(m).getPostOperations()).containsExactly(
"rotate 4.0 8.0 15.0",
"translate 16.0 23.0",
"skew 42.0 108.0"
);
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testPostSkew() {
final Matrix matrix1 = new Matrix();
matrix1.postSkew(2.0f, 2.0f);
assertPointsEqual(mapPoint(matrix1, 1.0f, 1.0f), new PointF(3.0f, 3.0f));
matrix1.postSkew(2.0f, 2.0f);
assertPointsEqual(mapPoint(matrix1, 1.0f, 1.0f), new PointF(9.0f, 9.0f));
final Matrix matrix2 = new Matrix();
matrix2.postSkew(2.0f, 2.0f, 1.0f, 1.0f);
assertPointsEqual(mapPoint(matrix2, 1.0f, 1.0f), new PointF(1.0f, 1.0f));
matrix2.setTranslate(1.0f, 2.0f);
matrix2.postSkew(2.0f, 2.0f, 1.0f, 1.0f);
assertPointsEqual(mapPoint(matrix2, 1.0f, 1.0f), new PointF(6.0f, 5.0f));
}
代码示例来源:origin: luhaoaimama1/zone-sdk
private void skew(Canvas canvas, RectF rect,float kx, float ky,int color) {
canvas.save();
Matrix skaw=new Matrix();
// skaw.postTranslate(100,0);
//Xnew=考虑坐标系远点变换,最后加上(xT,yT) +(xT*ky,yT*kx)
//Ynew=Yold+tY+kx*tY;
skaw.postSkew(kx,ky);
canvas.concat(skaw);
paintStorke.setColor(color);
paintStorke.setAlpha(255/2);
canvas.drawRect(rect,paintStorke);
canvas.restore();
}
代码示例来源:origin: windrunnerlihuan/DogCamera
/**
* 偏移效果
*
* @param origin 原图
* @return 偏移后的bitmap
*/
public static Bitmap skewBitmap(Bitmap origin) {
if (origin == null) {
return null;
}
int width = origin.getWidth();
int height = origin.getHeight();
Matrix matrix = new Matrix();
matrix.postSkew(-0.6f, -0.3f);
Bitmap newBM = Bitmap.createBitmap(origin, 0, 0, width, height, matrix, false);
if (newBM.equals(origin)) {
return newBM;
}
origin.recycle();
return newBM;
}
代码示例来源:origin: hencoder/PracticeDraw4
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
int bitmapWidth = bitmap.getWidth();
int bitmapHeight = bitmap.getHeight();
canvas.save();
matrix.reset();
matrix.postSkew(0, 0.5f, point1.x + bitmapWidth / 2, point1.y + bitmapHeight / 2);
canvas.concat(matrix);
canvas.drawBitmap(bitmap, point1.x, point1.y, paint);
canvas.restore();
canvas.save();
matrix.reset();
matrix.postSkew(-0.5f, 0, point2.x + bitmapWidth / 2, point2.y + bitmapHeight / 2);
canvas.concat(matrix);
canvas.drawBitmap(bitmap, point2.x, point2.y, paint);
canvas.restore();
}
}
代码示例来源:origin: samlss/Bloom
float deltaY = particle.getDrawY() - particle.getInitialY();
mDrawMatrix.postSkew(particle.getSkew(), particle.getSkew(), particle.getInitialX(),
particle.getInitialY());
内容来源于网络,如有侵权,请联系作者删除!