## GwyLayerQuad

GwyLayerQuad — Data view layer for quadrilateral selections

## Functions

GwyVectorLayer * | gwy_layer_quad_new ()
gint | gwy_layer_quad_get_n_lines ()
void | gwy_layer_quad_set_n_lines ()
gboolean | gwy_layer_quad_get_convex ()
void | gwy_layer_quad_set_convex ()

## Properties

gboolean | convex | Read / Write
guint | n-lines | Read / Write

## Types and Values

struct | GwyLayerQuad
struct | GwyLayerQuadClass

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GwyDataViewLayer
                ╰── GwyVectorLayer
                    ╰── GwyLayerQuad

## Includes

    #include <libgwyui/gwyui.h>

## Description

GwyLayerQuad allows selection of general quadrilaterals. It uses GwySelectionQuad selection type.

When it represents a projective transformation of a rectangle, it should be convex and GwyLayerQuad:n-lines can be used to give a more refined view of the perspective transformation using subdivision lines. For the selection of arbitrary quadrilaterals, GwyLayerQuad:n-lines should be zero.

The quadrilateral selection needs to be initialised. The layer can only edit a quadrilateral selection; it cannot create one from scratch.

## Functions

### gwy_layer_quad_new()

    GwyVectorLayer *
    gwy_layer_quad_new (void);

Creates a new quadrilateral vector layer.

#### Returns

A newly created quadrilateral vector layer.

### gwy_layer_quad_get_n_lines()

    gint
    gwy_layer_quad_get_n_lines (GwyLayerQuad *layer);

Gets the number of refinement lines of a quadrilateral vector layer.

#### Parameters

layer | A quadrilateral vector layer. |

#### Returns

The number of lines.

### gwy_layer_quad_set_n_lines()

    void
    gwy_layer_quad_set_n_lines (GwyLayerQuad *layer,
                                gint n_lines);

Sets the number of refinement lines of a quadrilateral vector layer.

The perimeter is always drawn. If `n_lines` is zero nothing else is drawn. Otherwise `n_lines` extra lines are drawn in the interior between opposite sides, corresponding to the refinement of the quadrilateral as if it was the result of a projective transformation of a rectangle.

#### Parameters

layer | A quadrilateral vector layer. |
n_lines | Number of lines. |

### gwy_layer_quad_get_convex()

    gboolean
    gwy_layer_quad_get_convex (GwyLayerQuad *layer);

Reports whether a quadrilateral vector layer has visibly convex quads.

#### Parameters

layer | A quadrilateral vector layer. |

#### Returns

`TRUE` if quad numbers are shown; `FALSE` if quad numbers are not shown.

### gwy_layer_quad_set_convex()

    void
    gwy_layer_quad_set_convex (GwyLayerQuad *layer,
                               gboolean convex);

Sets whether a quadrilateral vector layer only allows convex quadrilaterals.

If `convex` is set to `TRUE` the selection should not contain non-convex quadrilaterals. If it does, the behaviour is undefined.

#### Parameters

layer | A quadrilateral vector layer. |
convex | `TRUE` to only allow convex quadrilaterals; `FALSE` to allow any. |

## Types and Values

### struct GwyLayerQuad

    struct GwyLayerQuad;

### struct GwyLayerQuadClass

    struct GwyLayerQuadClass {
        GwyVectorLayerClass parent_class;
    };

## Property Details

### The `“convex”` property

      “convex”                   gboolean

Allow only convex quadrilaterals.

Owner: GwyLayerQuad

Flags: Read / Write

Default value: TRUE

### The `“n-lines”` property

      “n-lines”                  guint

Number of subdivision lines to draw inside the quadrilateral.

Owner: GwyLayerQuad

Flags: Read / Write

Allowed values: <= 1024

Default value: 0