---
name: "dtk_create_line"
section: "3"
platform: "linux"
package: "libdrawtk-dev"
version: "2.0-2.1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/dtk_create_line"
---

# dtk\_create\_line(3)

Create and modify line shape

## NAME

dtk\_create\_line - Create and modify line shape

## SYNOPSIS

**#include \<drawtk.h\>**

**dtk\_hshape dtk\_create\_line(dtk\_hshape** *shp***,**\
                 **float** *x1***, float** *y1***, float** *x2***, float** *y2***,**\
                 **const float \****color***);**\

## DESCRIPTION

**dtk\_create\_line**() creates a line between the points (*x1*,*y1*) and (*x2*,*y2*).

*shp* and *color* have the same usage and meaning as for other shape creation function:

- \*

  *shp* can be used to modify a previously created shape. If it is non-null, the handle will be used to modify the shape referenced by *shp*: no new shape is created and the returned value is ensured to be *shp* in case of success, *NULL* otherwise. If *shp* is *NULL*, the function will attempt to create a new shape.

- \*

  *color* should point to a 4 float array containing a normalized RGBA value (i.e. each component is between 0.0 and 1.0).

## RETURN VALUE

In case of success these functions return the handle to the newly created or modified shape. If the *shp* argument is non-null, the handle returned is the same value. In case of error, *NULL* is returned.

## SEE ALSO

[**dtk\_destroy\_shape**(3)](/dtk_destroy_shape/3.md)
