本文整理了Java中android.graphics.Matrix.setPolyToPoly()
方法的一些代码示例,展示了Matrix.setPolyToPoly()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.setPolyToPoly()
方法的具体详情如下:
包路径:android.graphics.Matrix
类名称:Matrix
方法名:setPolyToPoly
暂无
代码示例来源:origin: vondear/RxTool
final int height = getHeight();
matrix.setPolyToPoly(
new float[]{
0.f, 0.f, // top left
代码示例来源:origin: google/cameraview
final int height = getHeight();
matrix.setPolyToPoly(
new float[]{
0.f, 0.f, // top left
代码示例来源:origin: davemorrissey/subsampling-scale-image-view
setMatrixArray(dstArray, tile.vRect.left, tile.vRect.bottom, tile.vRect.left, tile.vRect.top, tile.vRect.right, tile.vRect.top, tile.vRect.right, tile.vRect.bottom);
matrix.setPolyToPoly(srcArray, 0, dstArray, 0, 4);
canvas.drawBitmap(tile.bitmap, matrix, bitmapPaint);
if (debug) {
代码示例来源:origin: InnoFang/Android-Code-Demos
private void resetPolyMatrix(int pointCount) {
mMatrix.reset();
mMatrix.setPolyToPoly(mSrc, 0, mDst, 0, pointCount);
}
代码示例来源:origin: luhaoaimama1/zone-sdk
private void ployOne(Canvas canvas) {
canvas.save();
float[] src = {0, 0, // 左上
bt.getWidth(), 0, // 右上
bt.getWidth(), bt.getHeight(), // 右下
0, bt.getHeight()}; // 左下
float[] dst = {0+100, 0, // 左上
bt.getWidth(),50, // 右上
bt.getWidth(), bt.getHeight() -50, // 右下
0, bt.getHeight()}; // 左下
Matrix ploy=new Matrix();
ploy.setPolyToPoly(src,0,dst,0,1);
canvas.drawBitmap(bt,ploy, paint);
canvas.restore();
}
代码示例来源:origin: luhaoaimama1/zone-sdk
private void ploy(Canvas canvas,int number) {
canvas.save();
float[] src = {0, 0, // 左上
bt.getWidth(), 0, // 右上
bt.getWidth(), bt.getHeight(), // 右下
0, bt.getHeight()}; // 左下
float[] dst = {0, 0, // 左上
bt.getWidth(),50, // 右上
bt.getWidth(), bt.getHeight() -50, // 右下
0, bt.getHeight()}; // 左下
Matrix ploy=new Matrix();
ploy.setPolyToPoly(src,0,dst,0,number);
canvas.drawBitmap(bt,ploy, paint);
canvas.restore();
}
private void ployTWO(Canvas canvas) {
代码示例来源:origin: luhaoaimama1/zone-sdk
private void ployTWO(Canvas canvas) {
canvas.save();
float[] src = {0, 0, // 左上
bt.getWidth(), 0, // 右上
bt.getWidth(), bt.getHeight(), // 右下
0, bt.getHeight()}; // 左下
float[] dst = {0, 0, // 左上
bt.getWidth(),50, // 右上
bt.getWidth(), bt.getHeight() -50, // 右下
0, bt.getHeight()}; // 左下
Matrix ploy=new Matrix();
ploy.setPolyToPoly(src,0,dst,0,2);
canvas.drawBitmap(bt,ploy, paint);
canvas.restore();
}
private void ployOne(Canvas canvas) {
代码示例来源:origin: qiubiteme/android_api_demos
private void doDraw(Canvas canvas, float src[], float dst[]) {
canvas.save();
mMatrix.setPolyToPoly(src, 0, dst, 0, src.length >> 1);
canvas.concat(mMatrix);
mPaint.setColor(Color.GRAY);
mPaint.setStyle(Paint.Style.STROKE);
canvas.drawRect(0, 0, 64, 64, mPaint);
canvas.drawLine(0, 0, 64, 64, mPaint);
canvas.drawLine(0, 64, 64, 0, mPaint);
mPaint.setColor(Color.RED);
mPaint.setStyle(Paint.Style.FILL);
// how to draw the text center on our square
// centering in X is easy... use alignment (and X at midpoint)
float x = 64/2;
// centering in Y, we need to measure ascent/descent first
float y = 64/2 - (mFontMetrics.ascent + mFontMetrics.descent)/2;
canvas.drawText(src.length/2 + "", x, y, mPaint);
canvas.restore();
}
代码示例来源:origin: THEONE10211024/ApiDemos
private void doDraw(Canvas canvas, float src[], float dst[]) {
canvas.save();
mMatrix.setPolyToPoly(src, 0, dst, 0, src.length >> 1);
canvas.concat(mMatrix);
mPaint.setColor(Color.GRAY);
mPaint.setStyle(Paint.Style.STROKE);
canvas.drawRect(0, 0, 64, 64, mPaint);
canvas.drawLine(0, 0, 64, 64, mPaint);
canvas.drawLine(0, 64, 64, 0, mPaint);
mPaint.setColor(Color.RED);
mPaint.setStyle(Paint.Style.FILL);
// how to draw the text center on our square
// centering in X is easy... use alignment (and X at midpoint)
float x = 64/2;
// centering in Y, we need to measure ascent/descent first
float y = 64/2 - (mFontMetrics.ascent + mFontMetrics.descent)/2;
canvas.drawText(src.length/2 + "", x, y, mPaint);
canvas.restore();
}
代码示例来源:origin: InnoFang/Android-Code-Demos
private void initUMR() {
mUMRBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.umr);
mUMRMatrix = new Matrix();
float[] src = {
0, 0, // 左上
mUMRBitmap.getWidth(), 0, // 右上
mUMRBitmap.getWidth(), mUMRBitmap.getHeight(), // 右下
0, mUMRBitmap.getHeight(), // 左下
};
float[] dst = {
0, 0, // 左上
mUMRBitmap.getWidth(), -200, // 右上
mUMRBitmap.getWidth(), mUMRBitmap.getHeight() + 100, // 右下
0, mUMRBitmap.getHeight(), // 左下
};
mUMRMatrix.setPolyToPoly(src, 0, dst, 0, src.length >> 1);
mUMRMatrix.postScale(0.5f, 0.5f);
mUMRMatrix.postTranslate(100, 830);
}
代码示例来源:origin: saki4510t/libcommon
/**
*
* @param src (x,y) pair, 4 pairs (4 points) = float[8]
* @param dst (x,y) pair, 4 pairs (4 points) = float[8]
*/
public void calcPerspectiveTransform(final float[] src, final float[] dst) {
// if (DEBUG) Log.v(TAG, "calcPerspectiveTransform:");
mat.reset(); // これはいらん?
mat.setPolyToPoly(src, 0, dst, 0, 4);
mat.getValues(m);
((MediaEffectTexProjectionDrawer)mDrawer).setTexProjection(m);
}
代码示例来源:origin: Kalabasa/FreeformGestureDetector
private void applyUpdate(MotionEvent ev) {
int n = pointerLocations.size();
for (int i = 0; i
PointF point = pointerLocations.get(pointerId);
record[n * 2 + i * 2] = point.x;
record[n * 2 + i * 2 + 1] = point.y;
}
for (int i = Math.min(maxPointers, n); i > 0; i--) {
if (tmpMatrix.setPolyToPoly(record, 0, record, n * 2, i)) {
matrix.postConcat(tmpMatrix);
if (pastSlop) sendTransform(ev);
break;
}
}
}
代码示例来源:origin: InnoFang/Android-Code-Demos
private void init() {
mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.umr);
float[] src = {
0, 0,
mBitmap.getWidth(), 0,
mBitmap.getWidth(), mBitmap.getHeight(),
0, mBitmap.getHeight()
};
mSrc = src.clone();
mDst = src.clone();
mPointPaint = new Paint();
mPointPaint.setAntiAlias(true);
mPointPaint.setStrokeWidth(50);
mPointPaint.setColor(Color.RED);
mPointPaint.setStrokeCap(Paint.Cap.ROUND);
mMatrix = new Matrix();
mMatrix.setPolyToPoly(mSrc, 0, mDst, 0, 4);
}
代码示例来源:origin: InnoFang/Android-Code-Demos
private void initBitmapAndMatrix() {
mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.meizhi);
mPolyMatrix = new Matrix();
float[] src = {
0, 0, // 左上
mBitmap.getWidth(), 0, // 右上
mBitmap.getWidth(), mBitmap.getHeight(), // 右下
0, mBitmap.getHeight(), // 左下
};
float[] dst = {
0, 0, // 左上
mBitmap.getWidth(), 200, // 右上
mBitmap.getWidth(), mBitmap.getHeight() - 400, // 右下
0, mBitmap.getHeight(), // 左下
};
// 核心要点
mPolyMatrix.setPolyToPoly(
src, /*原始数组,存储内容为一组点*/
0, /*原始数组开始位置*/
dst, /*目标数组,存储内容为一组点*/
0, /*目标数组开始位置*/
src.length >> 1); /*测控点的数量,取值范围是:0到4*/
mPolyMatrix.postScale(0.26f, 0.26f);
mPolyMatrix.postTranslate(50, 10);
}
代码示例来源:origin: luhaoaimama1/zone-sdk
private void prepare() {
mFlodWidth = Math.round(bt.getWidth() / clipNums);
mFlodTransalteWidth = Math.round(bt.getWidth() * foldProgress / clipNums);
//纵轴减小的那个高度,用勾股定理计算下
int depth = (int) ((Math.sqrt(mFlodWidth * mFlodWidth
- mFlodTransalteWidth * mFlodTransalteWidth)) * depthFactor);
//1.所有的变形matrix
for (int i = 0; i
matrixs[i].reset();
else
matrixs[i] = new Matrix();
float[] src = MatrixUtils.getVertices(i * mFlodWidth, 0,
(i + 1) * mFlodWidth, bt.getHeight());
float[] dst = MatrixUtils.getVertices(i * mFlodTransalteWidth, 0,
(i + 1) * mFlodTransalteWidth, bt.getHeight());
if (i % 2 == 0) {//右边下坠
dst[3] += depth;
dst[5] -= depth;
} else {//左边下坠
dst[1] += depth;
dst[7] -= depth;
}
matrixs[i].setPolyToPoly(src, 0, dst, 0, 4);
}
}
代码示例来源:origin: luhaoaimama1/zone-sdk
dst[7] -= depth;
matrixs[i].setPolyToPoly(src, 0, dst, 0, 4);
代码示例来源:origin: Android500/AwesomeDrawer
mMatrix[x].setPolyToPoly(mSrc, 0, mDst, 0, NUM_OF_POLY_POINTS / 2);
代码示例来源:origin: Android500/AwesomeDrawer
mMatrix[x].setPolyToPoly(mSrc, 0, mDst, 0, NUM_OF_POLY_POINTS / 2);
代码示例来源:origin: duanhong169/Camera
final int height = getHeight();
matrix.setPolyToPoly(
new float[]{
0.f, 0.f, // top left
代码示例来源:origin: RameshBhupathi/ImagePicker-OLX
final int height = getHeight();
matrix.setPolyToPoly(
new float[]{
0.f, 0.f, // top left