Parsware
All articles

Graphic Designer

Groups and boolean shapes

Keeping shapes together as a group, combining them into one shape, and using one shape to frame another. Trying each, we fixed three things: double-click now reaches a shape inside a group, and a combined shape stays in its frame with its rounded corners.

A grouped contact card, a pill joined to a circle, a square with a bite taken out, two overlapping circles cut two ways and striped bars inside a circle, on the Graphic Designer canvas, next to the title "Groups and boolean shapes"

A card is several shapes: a background, a picture, a couple of lines of text. You want to move it as one thing, and sometimes you want a shape no tool draws, such as a rounded button with a circle joined onto its end. This article covers the three ways to put shapes together: groups, boolean operations and masks.

We worked in a 760 by 420 frame on an empty part of the Starter app sample's canvas, without saving.

Groups

We drew a card: a pale rounded rectangle, a circle for the picture and two bars for the text. Then we selected all four by dragging a box round them and pressed Ctrl+G. Layers now shows a group with the four shapes inside it. We renamed it Contact card by double-clicking its name.

The card selected on the canvas, and in Layers a group called Contact card holding Card, Avatar and Name bar

A group is for moving and arranging things together. It has no fill or size of its own. It is just the box around what is in it.

  • One click on any shape in the group selects the whole group. Drag it, nudge it with the arrow keys or press Ctrl+D, and all of it goes.
  • Double-click a shape to select just that shape, say to recolour the picture:

The avatar circle alone selected inside the card, with its own handles

  • Ctrl+Shift+G ungroups, leaving the shapes where they are.
  • Grouping a group puts one group inside another.

Everything here is also on the right-click menu, along with the commands further down:

The right-click menu on the card: Select layer, the four stacking commands, Group, Ungroup, Use as mask, Flip, Union, Subtract, Intersect, Exclude, Create component, Lock, Duplicate and Delete

New: double-click reaches inside. The double-click used to select the shape and then widen straight back to the whole group, so a shape in a group could only be reached from Layers. It stays selected now. Pressing anywhere afterwards goes back to selecting groups whole.

Boolean operations

Select two or more shapes and the Path menu in the toolbar offers four ways to combine them into one. The same four are on the right-click menu.

Operation What you get
Union Both shapes as one outline
Subtract The bottom shape with the ones above it cut out
Intersect Only the part where they overlap
Exclude Everything except the part where they overlap

The result replaces the shapes you started with. It is a path, and it takes its colour, outline, shadow and name from the bottom shape.

Here is a rounded Pill with a circle overlapping its end, before and after Union:

A blue rounded bar and an orange circle overlapping its right end, both selected

One blue shape: the bar with a round bulge at its right end

Subtract cuts the upper shapes out of the bottom one. A red circle over the corner of a green tile takes a bite out of it:

A green rounded square with a red circle over its top right corner

The green square with a round bite missing from its top right corner

Two overlapping circles, combined two ways. Intersect leaves the lens in the middle, and Exclude leaves the two crescents:

On the left, a purple lens shape. On the right, two purple crescents with the shape of the lens missing between them

Booleans work on rectangles, ellipses, triangles and paths, including the result of an earlier one. Text, frames and images can't be combined. The menu says Select 2 or more shapes until the selection is right.

Curves come out as many short straight lines. You can't see them at screen size, but you can't reshape the result by its curves afterwards. Keep the original shapes if you may want to change them. Ctrl+D them first, or undo with Ctrl+Z.

New: three fixes found trying it.

  • A rounded rectangle came out of a boolean with square corners, because its outline was taken as its box. The Pill above kept its round ends only because of this fix.
  • The result left the frame the shapes were drawn in and landed at the top level of the drawing. It stays in the same frame now.
  • It was named Path 1 and lost its shadow. It takes the bottom shape's name and shadow now.

Masks

A mask shows another shape only inside its own outline. It's how you put a photo in a circle. We drew three coloured stripes and a dark circle over them:

Three horizontal stripes, orange, red and blue, with a dark circle drawn over the middle

Then we selected all four, right-clicked and chose Use as mask. The top shape becomes the mask and everything below it is clipped to it:

The stripes now showing only inside a circle

The mask and the shapes it clips are put in a group so they move together. Unlike a boolean, nothing is lost. Release mask on the right-click menu gives you the stripes back, whole.

A group or a frame?

A group and a frame both hold shapes, and they are easy to mix up. They do different jobs:

Group Frame
Has its own fill, outline, corner radius No: it is only the box around its contents Yes
Can clip what sticks out No Yes, with Clip content
Can arrange its contents in a row or column No Yes, with auto layout
Has constraints of its own, and passes them to its contents Its contents keep their own Yes
Can say what it is on the Screen tab, such as a card or a list item It is a loose collection Yes
Good for Moving several shapes as one while you draw Anything that is part of the screen's structure

So the contact card above is a good group while you are sketching it, and a better frame once it is real: a frame with a pale fill and a corner radius replaces the background rectangle, holds the picture and the text, can arrange them with auto layout, and can be told it is a list item so a screen reader announces it properly. When the sketch becomes the design, draw a frame round it and move the shapes inside.

Booleans for icons and badges

Boolean operations are at their best for small marks that no single tool draws:

  • A notification badge: a circle subtracted from the corner of an icon's square, leaving a gap for a dot that sits there.
  • A speech bubble: a rounded rectangle united with a small triangle for its tail.
  • A ring: a small circle subtracted from a larger one, for a done marker.
  • A crescent or a shadow edge: two circles, excluded, keeping only the parts that don't overlap.

Before building one, look in the icon library: an icon is quicker, consistent with the rest of the screen, and takes the theme's colour by itself. Fills, gradients and icons shows the library. Booleans are for the marks the library doesn't have.

Masks for pictures

A mask is how a square photo becomes a round avatar, or a wide banner image is cropped to a card's rounded corners. Draw the shape you want the picture to show through, place it above the picture, select both and choose Use as mask. The picture is clipped, not cut: release the mask and the whole picture is still there, so you can move the crop later.

Keeping the originals

Of the three, only a boolean changes your shapes for good. Some habits that save redrawing:

  • Duplicate before combining with Ctrl+D, and keep the copy hidden or parked off the screen.
  • Name the result if the bottom shape's name doesn't describe it: Badge, not Circle.
  • Undo is there: Ctrl+Z puts the original shapes back straight after a boolean.

Questions that come up

Can I edit a boolean result's points? It is a path, so its points can be moved, but curves came out as many short lines, so smooth reshaping isn't practical. Rebuild from the originals instead.

Does a mask hide things from a screen reader? A mask is about what is drawn. What a screen reader announces is decided on the Screen tab, so a decorative masked picture can be left without a role, and a meaningful one given a description.

Which one to use

  • To move things together, group them.
  • To make a new outline that no tool draws, use a boolean. It is one shape afterwards.
  • To show part of something, such as a picture cut to a circle, use a mask.

Try it

Draw a card from a rectangle, a circle and two bars, group it with Ctrl+G and double-click the circle to recolour it. Draw a rounded rectangle and a circle overlapping its end, select both and choose Path → Union. Then draw a square and a circle over its corner and try Subtract.

Next: text and rich text.