# Clip Class

> A clipping path is used to mark an area within a page to be highlighted or removed.

- Product: Adobe PDF Library 21
- Language: Modern C++
- Version: 21.4.0
- HTML page: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Clip
- Version index: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/llms.txt

```cpp
class Clip
```

**Namespace:** `datalogics_interface`

## Description

A clipping path is used to mark an area within a page to be highlighted or removed.

The clipping path clips out part of the design. A clip can also be used with text.

The clipping path defines an area within a page (text or graphic) that will be highlighted or removed. For example, a clipping path could be used to remove the background in a photograph, to highlight a person or object in front, or to super-impose text over an image. Only part of the image appears through a shape created with the clipping path.

The Clip class is made up of a list of path and text elements. Any element can have a clip associated with it, and clip objects can hold arbitrary levels of nested container and group objects.

If a group object is inside a clip object, and the clip object also contains at least one text object and no path objects, the group object has a special meaning. All text objects contained in a group object like this are considered to be part of the same BT/ET block. This means that the union of these text objects makes up a single clipping path. The text objects do not intersect.

**Referenced by:** [`Clip`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Clip.md), [`Container`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Container.md), [`Element`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Element.md), [`Form`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Form.md), [`Group`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Group.md), [`Image`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Image.md), [`Path`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Path.md), [`Text`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Text.md)

**Uses types:** [`Clip`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Clip.md)

## Constructors

### Clip

```cpp
datalogics_interface::Clip::Clip()
```

*constructor*

Creates an empty Clip object. This represents a clipping object that has no effect on elements that refer to it.

### Clip

```cpp
datalogics_interface::Clip::Clip(Clip &&) noexcept
```

*constructor*

**Parameters**

- (unnamed) ([`Clip &&`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Clip.md))

### ~Clip

```cpp
datalogics_interface::Clip::~Clip()
```

*destructor*

## Methods

### add_element

```cpp
void datalogics_interface::Clip::add_element(Element &element)
```

**Parameters**

- `element` ([`Element &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Element.md)): - The Element to add to the Clip.

**Returns:** `void`

Adds an Element to a Clip path, after the Element index specified.

### add_element

```cpp
void datalogics_interface::Clip::add_element(Element &element, int add_after)
```

**Parameters**

- `element` ([`Element &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Element.md)): - The Element to add to the Clip.
- `add_after` (`int`): - The index after which this Element will be added to the Clip's list of Elements. If omitted, it will be added as index 0, i.e., the first Element.

**Returns:** `void`

Adds an Element to a Clip path, after the Element index specified.

### clone

```cpp
std::unique_ptr< Clip > datalogics_interface::Clip::clone() const
```

**Returns:** [`std::unique_ptr< Clip >`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Clip.md)

A new clip object deep copy

Makes a new deep copy of this Clip object in memory.

### num_elements

```cpp
int datalogics_interface::Clip::num_elements() const
```

**Returns:** `int`

- The number of top-level Elements in the Clip.

Gets the number of top-level Elements in a Clip object.

### operator=

```cpp
Clip & datalogics_interface::Clip::operator=(Clip &&) noexcept
```

**Parameters**

- (unnamed) ([`Clip &&`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Clip.md))

**Returns:** [`Clip &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Clip.md)

### remove_elements

```cpp
void datalogics_interface::Clip::remove_elements(int index)
```

**Parameters**

- `index` (`int`): - The index of the Element to remove.

**Returns:** `void`

Removes an Element from a Clip object.

### remove_elements

```cpp
void datalogics_interface::Clip::remove_elements(int index, int count)
```

**Parameters**

- `index` (`int`): - The index of the Element to remove.
- `count` (`int`)

**Returns:** `void`

Removes an Element from a Clip object.

### to_string

```cpp
std::string datalogics_interface::Clip::to_string() const
```

**Returns:** `std::string`

A clipping path is used to mark an area within a page to be highlighted or removed.

The clipping path clips out part of the design. A clip can also be used with text.

The clipping path defines an area within a page (text or graphic) that will be highlighted or removed. For example, a clipping path could be used to remove the background in a photograph, to highlight a person or object in front, or to super-impose text over an image. Only part of the image appears through a shape created with the clipping path.

The Clip class is made up of a list of path and text elements. Any element can have a clip associated with it, and clip objects can hold arbitrary levels of nested container and group objects.

If a group object is inside a clip object, and the clip object also contains at least one text object and no path objects, the group object has a special meaning. All text objects contained in a group object like this are considered to be part of the same BT/ET block. This means that the union of these text objects makes up a single clipping path. The text objects do not intersect.
