---
name: "tickit_rect_subtract"
section: "3"
platform: "linux"
package: "libtickit-dev"
version: "0.4.3-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/tickit_rect_subtract"
---

# tickit\_rect\_subtract(3)

obtain the difference of two rectangles

## NAME

tickit\_rect\_subtract - obtain the difference of two rectangles

## SYNOPSIS

```
#include <tickit.h>

int tickit_rect_subtract(TickitRect dst[4],
    const TickitRect *orig, const TickitRect *hole);
```

Link with *-ltickit*.

## DESCRIPTION

**tickit\_rect\_subtract**() initialises the rectangle structures given by *dst* (which must be an array capable of containing at least four rectangle structures) with a set of non-overlapping rectangles covering the same area as that given by *orig* without covering *hole*. Depending on the geometry of the given rectangles it will create from zero to four resultant rectangles. It returns the number of rectangular regions initialised into the result array.

If *hole* completely covers *orig* then the result will contain no rectangles. If they do not intersect then just *orig* will be returned. Otherwise, the result will contain non-overlapping horizontal stripes of *orig* without *hole*.

## RETURN VALUE

**tickit\_rect\_subtract**() returns the number of rectangles written to *dst*.

## SEE ALSO

[**tickit\_rect\_init\_sized**(3)](/tickit_rect_init_sized/3.md), [**tickit\_rect\_init\_bounded**(3)](/tickit_rect_init_bounded/3.md), [**tickit\_rect\_intersect**(3)](/tickit_rect_intersect/3.md), [**tickit\_rect\_add**(3)](/tickit_rect_add/3.md), [**tickit\_rect**(7)](/tickit_rect/7.md), [**tickit**(7)](/tickit/7.md)
