O'Reilly logo

JavaFX 1.2 Application Development Cookbook by Vladimir Vivien

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating shapes with constructive area geometry

JavaFX offers a rich set of tools for creating basic and complex shapes. Sometimes, though, those drawing tools alone are not enough to express intricate and delicate shapes. In this recipe, we will show you how to use the notion of constructive geometry to create new shapes from the combination of existing shapes.

Getting ready

The approach covered in this recipe is known as Constructive Area Geometry (CAG). It uses Boolean operations to create new shapes from existing sets of shapes. Given shapes (or sets of shapes) represented by circles A and B, JavaFX supports the following CAG Boolean operations:

Operation

Description

Shape

A OR B

(A union B)

Returns the shaded area formed by both shapes ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required