Skip to content

Instantly share code, notes, and snippets.

@ZirconCode
Created October 16, 2014 08:00
Show Gist options
  • Save ZirconCode/59cae1e2615279eafb29 to your computer and use it in GitHub Desktop.
Save ZirconCode/59cae1e2615279eafb29 to your computer and use it in GitHub Desktop.

Revisions

  1. ZirconCode created this gist Oct 16, 2014.
    18 changes: 18 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    public void drawTriangle(Point p1, Point p2, Point p3, int clr, Canvas c)
    {
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);

    paint.setStrokeWidth(1);
    paint.setColor(clr);
    paint.setStyle(Paint.Style.FILL_AND_STROKE);
    paint.setAntiAlias(true);

    Path path = new Path();
    path.setFillType(Path.FillType.EVEN_ODD);
    path.moveTo(p1.x,p1.y);
    path.lineTo(p2.x,p2.y);
    path.lineTo(p3.x,p3.y);
    path.close();

    c.drawPath(path, paint);
    }