本文整理了Java中android.graphics.Path.transform()
方法的一些代码示例,展示了Path.transform()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Path.transform()
方法的具体详情如下:
包路径:android.graphics.Path
类名称:Path
方法名:transform
暂无
代码示例来源:origin: PhilJay/MPAndroidChart
/**
* transform a path with all the given matrices VERY IMPORTANT: keep order
* to value-touch-offset
*
* @param path
*/
public void pathValueToPixel(Path path) {
path.transform(mMatrixValueToPx);
path.transform(mViewPortHandler.getMatrixTouch());
path.transform(mMatrixOffset);
}
代码示例来源:origin: siyamed/android-shape-imageview
public void transform(Matrix matrix, Path dst) {
path.transform(matrix, dst);
}
}
代码示例来源:origin: tarek360/RichPath
public static void setPathScaleX(Path path, float scale, float px, float py) {
Matrix matrix = new Matrix();
matrix.setScale(scale, 1, px, py);
path.transform(matrix);
}
代码示例来源:origin: tarek360/RichPath
public static void setPathScaleY(Path path, float scale, float px, float py) {
Matrix matrix = new Matrix();
matrix.setScale(1, scale, px, py);
path.transform(matrix);
}
代码示例来源:origin: tarek360/RichPath
public static void setPathTranslationX(Path path, float translationX) {
Matrix matrix = new Matrix();
matrix.postTranslate(translationX, 0);
path.transform(matrix);
}
代码示例来源:origin: andkulikov/Transitions-Everywhere
@Override
@NonNull
public Path getPath(float startX, float startY, float endX, float endY) {
double dx = endX - startX;
double dy = endY - startY;
float length = (float) Math.hypot(dx, dy);
double angle = Math.atan2(dy, dx);
mTempMatrix.setScale(length, length);
mTempMatrix.postRotate((float) Math.toDegrees(angle));
mTempMatrix.postTranslate(startX, startY);
Path path = new Path();
mPatternPath.transform(mTempMatrix, path);
return path;
}
代码示例来源:origin: DreaminginCodeZH/MaterialProgressBar
@Override
protected void onDraw(@NonNull Canvas canvas, int width, int height, @NonNull Paint paint) {
// Drawing the transformed path makes rendering much less blurry than using canvas transform
// directly. See https://stackoverflow.com/a/16091390 .
RectF bound = mUseIntrinsicPadding ? RECT_PADDED_BOUND : RECT_PROGRESS_BOUND;
mMatrix.setScale(width / bound.width(), height / bound.height());
mMatrix.preTranslate(-bound.left, -bound.top);
PATH_PROGRESS.transform(mMatrix, mPath);
canvas.drawPath(mPath, paint);
}
}
代码示例来源:origin: tarek360/RichPath
public static void setPathTranslationY(Path path, float translationY) {
Matrix matrix = new Matrix();
matrix.setTranslate(0, translationY);
path.transform(matrix);
}
代码示例来源:origin: scwang90/SmartRefreshLayout
mMount1.lineTo(0, HEIGHT);
mMount1.close();
mMount1.transform(mTransMatrix);
mMount2.lineTo(0, HEIGHT);
mMount2.close();
mMount2.transform(mTransMatrix);
mMount3.lineTo(0, height / mScaleY);
mMount3.close();
mMount3.transform(mTransMatrix);
代码示例来源:origin: tarek360/RichPath
public static void setPathRotation(Path path, float rotation, float px, float py) {
Matrix matrix = new Matrix();
matrix.setRotate(rotation, px, py);
path.transform(matrix);
}
代码示例来源:origin: scwang90/SmartRefreshLayout
public static List<Path> transformScale(float ratioWidth, float ratioHeight, List<Path> originPaths, List<String> orginSvgs) {
Matrix matrix = new Matrix();
matrix.setScale(ratioWidth, ratioHeight);
List<Path> paths = new ArrayList<>();
if (Build.VERSION.SDK_INT > 16) {
for (Path path : originPaths) {
Path nPath = new Path();
path.transform(matrix, nPath);
paths.add(nPath);
}
} else {
for (String svgPath : orginSvgs) {
Path path = new Path();
PathDataNode[] nodes = createNodesFromPathData(svgPath);
transformScaleNodes(ratioWidth, ratioHeight, nodes);
PathDataNode.nodesToPath(nodes, path);
paths.add(path);
}
}
return paths;
}
代码示例来源:origin: tarek360/RichPath
public static void setPathWidth(Path path, float width) {
RectF src = new RectF();
path.computeBounds(src, true);
Matrix resizeMatrix = new Matrix();
RectF bounds = new RectF(src.left, src.top, src.left + width, src.bottom);
resizeMatrix.setRectToRect(src, bounds, Matrix.ScaleToFit.FILL);
path.transform(resizeMatrix);
}
代码示例来源:origin: tarek360/RichPath
public static void resizePath(Path path, float width, float height) {
RectF bounds = new RectF(0, 0, width, height);
RectF src = new RectF();
path.computeBounds(src, true);
Matrix resizeMatrix = new Matrix();
resizeMatrix.setRectToRect(src, bounds, Matrix.ScaleToFit.FILL);
path.transform(resizeMatrix);
}
代码示例来源:origin: tarek360/RichPath
public static void setPathHeight(Path path, float height) {
RectF src = new RectF();
path.computeBounds(src, true);
Matrix resizeMatrix = new Matrix();
RectF bounds = new RectF(src.left, src.top, src.right, src.top + height);
resizeMatrix.setRectToRect(src, bounds, Matrix.ScaleToFit.FILL);
path.transform(resizeMatrix);
}
代码示例来源:origin: airbnb/lottie-android
for (int j = pathList.size() - 1; j >= 0; j--) {
Path path = pathList.get(j).getPath();
path.transform(((ContentGroup) content).getTransformationMatrix());
this.remainderPath.addPath(path);
for (int j = 0; j < pathList.size(); j++) {
Path path = pathList.get(j).getPath();
path.transform(((ContentGroup) lastContent).getTransformationMatrix());
this.firstPath.addPath(path);
代码示例来源:origin: tarek360/RichPath
void mapToMatrix(Matrix matrix) {
matrices.add(matrix);
transform(matrix);
originalPath.transform(matrix);
mapPoints(matrix);
updateOriginalDimens();
}
代码示例来源:origin: airbnb/lottie-android
Path maskPath = maskAnimation.getValue();
path.set(maskPath);
path.transform(matrix);
代码示例来源:origin: airbnb/lottie-android
private void drawCharacterAsGlyph(
FontCharacter character,
Matrix parentMatrix,
float fontScale,
DocumentData documentData,
Canvas canvas) {
List<ContentGroup> contentGroups = getContentsForCharacter(character);
for (int j = 0; j < contentGroups.size(); j++) {
Path path = contentGroups.get(j).getPath();
path.computeBounds(rectF, false);
matrix.set(parentMatrix);
matrix.preTranslate(0, (float) -documentData.baselineShift * Utils.dpScale());
matrix.preScale(fontScale, fontScale);
path.transform(matrix);
if (documentData.strokeOverFill) {
drawGlyph(path, fillPaint, canvas);
drawGlyph(path, strokePaint, canvas);
} else {
drawGlyph(path, strokePaint, canvas);
drawGlyph(path, fillPaint, canvas);
}
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void transform() {
Path path = new Path();
assertThat(path.isEmpty()).isTrue();
Path dst = new Path();
path.addRect(new RectF(LEFT, TOP, RIGHT, BOTTOM), Path.Direction.CW);
path.transform(new Matrix(), dst);
assertThat(dst.isEmpty()).isFalse();
}
代码示例来源:origin: airbnb/lottie-android
Path maskPath = maskAnimation.getValue();
path.set(maskPath);
path.transform(matrix);
BaseKeyframeAnimation<Integer, Integer> opacityAnimation =
this.mask.getOpacityAnimations().get(i);
内容来源于网络,如有侵权,请联系作者删除!