回覆列表
  • 1 # 使用者7828327405237

    原來是android.graphics.Path這個類,實現的。Api裡的描述如下:

    The Path class encapsulates compound (multiple contour) geometric paths consisting of straight line segments, quadratic curves, and cubic curves. It can be drawn with canvas.drawPath(path, paint), either filled or stroked (based on the paint"s Style), or it can be used for clipping or to draw text on a path.

    它大概的意思是說path類包含了多種元件,比如直線段,二次曲線,三次曲線,它可以在畫布上繪製,無論是填充或筆畫。下面舉例說明:

    [java] view plain copy

    package cn.lgl.draw;

    import android.content.Context;

    import android.graphics.Canvas;

    import android.graphics.Color;

    import android.graphics.LinearGradient;

    import android.graphics.Paint;

    import android.graphics.Path;

    import android.graphics.RectF;

    import android.graphics.Shader;

    import android.view.View;

    public class MyView extends View {

    public MyView(Context context) {

    super(context);

    // TODO Auto-generated constructor stub

    }

    @Override

    protected void onDraw(Canvas canvas)

  • 中秋節和大豐收的關聯?
  • 口紅不沾杯的方法是什麼?