Sometimes using an Image will limit you in adding an effect on it, especially if you’re working on animations or a game application. So to give an example I tried creating a playing card suit shapes using the Path class and the Path elements.

Here is the code snippet of the Spade I made:

Path spade = new Path();
spade.getElements().add(new MoveTo(25.0f, 0.0f));
spade.getElements().add(new LineTo(45.0f, 30.0f));
spade.getElements().add(QuadCurveToBuilder.create()
.controlX(40.0f)
.controlY(50.0f)
.x(27.0f)
.y(30.0f)
.build());
spade.getElements().add(QuadCurveToBuilder.create()
.controlX(28.0f)
.controlY(35.0f)
.x(35.0f)
.y(50.0f)
.build());
spade.getElements().add(new LineTo(15.0f, 50.0f));
spade.getElements().add(QuadCurveToBuilder.create()
.controlX(22.0f)
.controlY(35.0f)
.x(23.0f)
.y(30.0f)
.build());
spade.getElements().add(QuadCurveToBuilder.create()
.controlX(10.0f)
.controlY(50.0f)
.x(5.0f)
.y(30.0f).build());
spade.getElements().add(new LineTo(25.0f, 0.0f));


About these ads