---
name: "lqr_carver_new_ext"
section: "3"
platform: "linux"
package: "liblqr-1-0-dev"
version: "0.4.1-2"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/lqr_carver_new"
---

# lqr\_carver\_new\_ext(3)

the LqrCarver object constructors

Part of [lqr\_carver\_new(3)](/lqr_carver_new/3.md).

## NAME

lqr\_carver\_new, lqr\_carver\_new\_ext - the LqrCarver object constructors

## SYNOPSIS

```
#include <lqr.h>
```

**LqrCarver\* lqr\_carver\_new(guchar\*** *buffer***, gint** *width***, gint** *height***, gint** *channels***);**

**LqrCarver\* lqr\_carver\_new\_ext(void\*** *buffer***, gint** *width***, gint** *height***, gint** *channels***, LqrColDepth** *colour\_depth***);**

## DESCRIPTION

The functions **lqr\_carver\_new** and **lqr\_carver\_new\_ext** create a new LqrCarver object from an image of size *width* \* *height* with *channels* colour channels.

The image must be stored in *buffer* as a plain array of unsigned chars (for **lqr\_carver\_new**) or the appropriate type cast to void (for **lqr\_carver\_new\_ext**), ordered by row, then by column, then by colour channel.

In the extended constructor **lqr\_carver\_new\_ext**, the additional parameter *colour\_depth* is required to specify the colour depth of the buffer (see [**LqrColDepth**(3)](/LqrColDepth/3.md) for more information).

After calling the function, the buffer will be owned by the LqrCarver object and must not be accessed any more, unless you subsequently call the [**lqr\_carver\_set\_preserve\_input\_image**(3)](/lqr_carver_set_preserve_input_image/3.md) function.

The image type is et automatically from the value of *channels* according to this table:

**Table 3.1. Image types assigned by default**

| | |
| --- | --- |
| **channels** | **type** |
| 1 | LQR\_GREY\_IMAGE |
| 2 | LQR\_GREYA\_IMAGE |
| 3 | LQR\_RGB\_IMAGE |
| 4 | LQR\_RGBA\_IMAGE |
| 5 | LQR\_CMYKA\_IMAGE |
| \>5 | LQR\_CUSTOM\_IMAGE |

## RETURN VALUE

The return value is the address of the newly created LqrCarver object, or NULL in case of failure (insufficient memory).

## SEE ALSO

[**LqrColDepth**(3)](/LqrColDepth/3.md), [**LqrImageType**(3)](/LqrImageType/3.md), [**lqr\_carver\_destroy**(3)](/lqr_carver_destroy/3.md), [**lqr\_carver\_init**(3)](/lqr_carver_init/3.md), [**lqr\_carver\_set\_preserve\_input\_image**(3)](/lqr_carver_set_preserve_input_image/3.md)

## COPYRIGHT

Copyright © 2007-2009 Carlo Baldassi\
