有人可以解释我android.Graphics.Path和它的使用给我吗? [英] Can someone explain me android.Graphics.Path and its use to me?

查看:158
本文介绍了有人可以解释我android.Graphics.Path和它的使用给我吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个自定义视图,实现像圆形菜单捕获应用程序。花费了大量的时间后,我已经取得了一点进步,已完成外半圆色彩多重。现在,读为他查询的用户提供的捕捉应用程序开发人员的回答,我碰到了类路径。谷歌Android开发者页面没有提供足够的材料,被理解和熟悉路径。所以,请 ?有人吗?

I am working on a Custom View that implements Catch application like Circular Menu. After spending a lot of time, I have made a bit of progress, completed outer semi-circle with multile colors. Now, reading an answer provided by developer of Catch application to an user for his query, I came across the class Path. Google Android Developer page does not provides enough material to be understood and to be familiar with Path. so, Please ? Anyone ?

在此先感谢。

推荐答案

您可以用它在画布上画线。路径基本上是行的集合。你可以用它来创建形状是不标准的。例如。有大量的函数来创建一些默认的形状:

You can use it to draw lines on a canvas. A path is basically a collection of lines. You can use it to create shapes that are not standard. E.g. there a lots of functions to create some default shapes:

canvas.drawRect();
canvas.drawArc(RectF oval, float startAngle, float sweepAngle, boolean useCenter, Paint paint);
canvas.drawCircle(float cx, float cy, float radius, Paint paint);
canvas.drawLine(float startX, float startY, float stopX, float stopY, Paint paint);
canvas.drawOval(RectF oval, Paint paint);
canvas.drawRect(float left, float top, float right, float bottom, Paint paint);

但是,如果你想要的东西的习惯,你可以创建一个路径,并通过调用

But if you want something custom, you can create a path, and by calling

// Set the beginning of the next contour to the point (x,y).
void     moveTo(float x, float y)

// Add a line from the last point to the specified point (x,y).
void     lineTo(float x, float y)

您有一个吸引你的路径的线条铅笔的控制权。 这里有一个很好的教程

You have control of the pencil that draws the lines of your path. Here's a nice tutorial

这篇关于有人可以解释我android.Graphics.Path和它的使用给我吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆