To compute the intersection of two regions, use XIntersectRegion().
To compute the union of two regions, use XUnionRegion().
To create a union of a source region and a rectangle, use XUnionRectWithRegion().
To subtract two regions, use XSubtractRegion().
To calculate the difference between the union and intersection of two regions, use XXorRegion().