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

# tickit\_pen\_new(3)

create a new pen instance

## NAME

tickit\_pen\_new - create a new pen instance

## SYNOPSIS

```
#include <tickit.h>

TickitPen *tickit_pen_new(void);
TickitPen *tickit_pen_new_attrs(...);
TickitPen *tickit_pen_clone(const TickitPen *orig);
```

Link with *-ltickit*.

## DESCRIPTION

**tickit\_pen\_new**() creates a new **TickitPen** instance. It initially has no attributes set.

**tickit\_pen\_new\_attrs**() creates a new **TickitPen** instance and populates it with a given list of attribute values. The attributes are given as pairs; first a **TickitPenAttr** then an integer giving its value, terminated by a final 0 or -1.

Two additional attribute types are recognised here, **TICKIT\_PEN\_FG\_DESC** and **TICKIT\_PEN\_BG\_DESC**. These will expect to receive a string argument value, which will be parsed as for [**tickit\_pen\_set\_colour\_attr\_desc**(3)](/tickit_pen_set_colour_attr_desc/3.md).

**tickit\_pen\_clone**() creates a new **TickitPen** instance. It initially has the same attributes values set as the one given by *orig*.

The reference count of a newly-constructed pen instance will be one. This can be incremented or decremented using [**tickit\_pen\_ref**(3)](/tickit_pen_ref/3.md) and [**tickit\_pen\_unref**(3)](/tickit_pen_unref/3.md). When its reference count reaches zero it is destroyed.

## RETURN VALUE

If successful, **tickit\_pen\_new**(), **tickit\_pen\_new\_attrs**() and **tickit\_pen\_clone**() return a pointer to the new instance. On failure, **NULL** is returned with *errno* set to indicate the failure.

## SEE ALSO

[**tickit\_pen\_ref**(3)](/tickit_pen_ref/3.md), [**tickit\_pen\_unref**(3)](/tickit_pen_unref/3.md), [**tickit\_pen\_bind\_event**(3)](/tickit_pen_bind_event/3.md), [**tickit\_pen**(7)](/tickit_pen/7.md), [**tickit**(7)](/tickit/7.md)
