public PathFillTypes (Context context) : base (context) { mPath = new Path (); mPath.addCircle (40, 40, 45, Path.Direction.CCW); mPath.addCircle (80, 80, 45, Path.Direction.CCW); }
protected void OnKeyPressEvent (KeyPressEventArgs e) { if (e.KeyChar == 'f') { mPath = makeFollowPath (); invalidate (); } }
void showPath (Canvas canvas, int x, int y, Path.FillType ft, Paint paint) { canvas.save (); canvas.translate (x, y); canvas.clipRect (0, 0, 120, 120); canvas.drawColor (Color.WHITE); mPath.setFillType (ft); canvas.drawPath (mPath, paint); canvas.restore (); }
static Path makeFollowPath () { Path p = new Path (); p.moveTo (0, 0); Random random = new Random (); for (int i = 1; i <= 15; i++) { p.lineTo (i * 20, (float)random.NextDouble () * 35); } return p; }
public Clipping (Context context) : base (context) { mPaint = new Paint (); mPaint.setAntiAlias (true); mPaint.setStrokeWidth (6); mPaint.setTextSize (16); mPaint.setTextAlign (Paint.Align.RIGHT); mPath = new Path (); }
public PathEffects (Context context) : base (context) { mPaint = new Paint (Paint.ANTI_ALIAS_FLAG); mPaint.setStyle (Paint.Style.STROKE); mPaint.setStrokeWidth (6); mPath = makeFollowPath (); mEffects = new PathEffect[6]; mColors = new int[] { Color.BLACK, Color.RED, Color.BLUE, Color.GREEN, Color.MAGENTA, Color.BLACK }; }
static Path makePathDash () { Path p = new Path (); p.moveTo (4, 0); p.lineTo (0, -4); p.lineTo (8, -4); p.lineTo (12, 0); p.lineTo (8, 4); p.lineTo (0, 4); return p; }