ChafaPlacement: Chafa Reference Manual

## ChafaPlacement ChafaPlacement — Placement of a ChafaImage on a ChafaCanvas |

## Functions

ChafaPlacement * | chafa_placement_new ()
void | chafa_placement_ref ()
void | chafa_placement_unref ()
ChafaTuck | chafa_placement_get_tuck ()
void | chafa_placement_set_tuck ()
ChafaAlign | chafa_placement_get_halign ()
void | chafa_placement_set_halign ()
ChafaAlign | chafa_placement_get_valign ()
void | chafa_placement_set_valign ()

## Types and Values

enum | ChafaTuck
enum | ChafaAlign
typedef | ChafaPlacement

## Description

A ChafaPlacement describes how an image is placed on a ChafaCanvas. It contains information about the image, its alignment and tucking policy.

## Functions

### chafa_placement_new ()

    ChafaPlacement *
    chafa_placement_new (ChafaImage *image,
                         gint id);

Creates a new ChafaPlacement.

#### Parameters

image | The image to place on the canvas |
id | An ID to assign to the placement, or <= 0 to assign one automatically |

#### Returns

The new placement

Since: 1.14

### chafa_placement_ref ()

    void
    chafa_placement_ref (ChafaPlacement *placement);

Adds a reference to `placement` .

#### Parameters

placement | Placement to add a reference to |

Since: 1.14

### chafa_placement_unref ()

    void
    chafa_placement_unref (ChafaPlacement *placement);

Removes a reference from `placement` . When remaining references drops to zero, the placement is freed and can no longer be used.

#### Parameters

placement | Placement to remove a reference from |

Since: 1.14

### chafa_placement_get_tuck ()

    ChafaTuck
    chafa_placement_get_tuck (ChafaPlacement *placement);

Gets the tucking policy of `placement` . This describes how the image is resized to fit `placement` 's extents, and defaults to CHAFA_TUCK_STRETCH.

#### Parameters

placement | A ChafaPlacement |

#### Returns

The tucking policy of `placement`

Since: 1.14

### chafa_placement_set_tuck ()

    void
    chafa_placement_set_tuck (ChafaPlacement *placement,
                              ChafaTuck tuck);

Sets the tucking policy for `placement` to `tuck` . This describes how the image is resized to fit `placement` 's extents, and defaults to CHAFA_TUCK_STRETCH.

#### Parameters

placement | A ChafaPlacement |
tuck | Desired tucking policy |

Since: 1.14

### chafa_placement_get_halign ()

    ChafaAlign
    chafa_placement_get_halign (ChafaPlacement *placement);

Gets the horizontal alignment of `placement` . This determines how any padding added by the tucking policy is distributed, and defaults to CHAFA_ALIGN_START.

#### Parameters

placement | A ChafaPlacement |

#### Returns

The horizontal alignment of `placement`

Since: 1.14

### chafa_placement_set_halign ()

    void
    chafa_placement_set_halign (ChafaPlacement *placement,
                                ChafaAlign align);

Sets the horizontal alignment of `placement` . This determines how any padding added by the tucking policy is distributed, and defaults to CHAFA_ALIGN_START.

#### Parameters

placement | A ChafaPlacement |
align | Desired horizontal alignment |

Since: 1.14

### chafa_placement_get_valign ()

    ChafaAlign
    chafa_placement_get_valign (ChafaPlacement *placement);

Gets the vertical alignment of `placement` . This determines how any padding added by the tucking policy is distributed, and defaults to CHAFA_ALIGN_START.

#### Parameters

placement | A ChafaPlacement |

#### Returns

The vertical alignment of `placement`

Since: 1.14

### chafa_placement_set_valign ()

    void
    chafa_placement_set_valign (ChafaPlacement *placement,
                                ChafaAlign align);

Sets the vertical alignment of `placement` . This determines how any padding added by the tucking policy is distributed.

#### Parameters

placement | A ChafaPlacement |
align | Desired vertical alignment |

Since: 1.14

## Types and Values

### enum ChafaTuck

Resizing options when placing an element within an area. Usually used in conjunction with ChafaAlign to control the padding.

#### Members

CHAFA_TUCK_STRETCH | Resize element to fit the area exactly, changing its aspect ratio. |
CHAFA_TUCK_FIT | Resize element to fit the area, preserving its aspect ratio by adding padding. |
CHAFA_TUCK_SHRINK_TO_FIT | Like `CHAFA_TUCK_FIT` , but prohibit enlargement. |
CHAFA_TUCK_MAX | Last supported tucking policy, plus one. |

Since: 1.14

### enum ChafaAlign

Alignment options when placing an element within an area.

#### Members

CHAFA_ALIGN_START | Align flush with beginning of the area (top or left in LTR locales). |
CHAFA_ALIGN_END | Align flush with end of the area (bottom or right in LTR locales). |
CHAFA_ALIGN_CENTER | Align in the middle of the area. |
CHAFA_ALIGN_MAX | Last supported alignment, plus one. |

Since: 1.14

### ChafaPlacement

    typedef struct ChafaPlacement ChafaPlacement;