## GwyLayerRectangle

GwyLayerRectangle — Data view layer for rectangular selections

## Functions

GwyVectorLayer * | gwy_layer_rectangle_new ()
gboolean | gwy_layer_rectangle_get_draw_as_crop ()
void | gwy_layer_rectangle_set_draw_as_crop ()
gboolean | gwy_layer_rectangle_get_draw_reflection ()
void | gwy_layer_rectangle_set_draw_reflection ()
gboolean | gwy_layer_rectangle_get_snap_to_center ()
void | gwy_layer_rectangle_set_snap_to_center ()

## Properties

gboolean | draw-as-crop | Read / Write
gboolean | draw-reflection | Read / Write
gboolean | snap-to-center | Read / Write

## Types and Values

struct | GwyLayerRectangle
struct | GwyLayerRectangleClass

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GwyDataViewLayer
                ╰── GwyVectorLayer
                    ╰── GwyLayerRectangle

## Includes

    #include <libgwyui/gwyui.h>

## Description

GwyLayerRectangle allows selection of rectangles oriented along the cardinal axes, corresponding to rectangular image areas which can be passed to GwyField functions. It uses GwySelectionRectangle selection type.

## Functions

### gwy_layer_rectangle_new()

    GwyVectorLayer *
    gwy_layer_rectangle_new (void);

Creates a new rectangle vector layer.

#### Returns

A newly created rectangle vector layer.

### gwy_layer_rectangle_get_draw_as_crop()

    gboolean
    gwy_layer_rectangle_get_draw_as_crop (GwyLayerRectangle *layer);

Reports whether a rectangle vector layer is drawn in the crop style.

#### Parameters

layer | A rectangle vector layer. |

#### Returns

`TRUE` if rectangles are drawn with crop lines from the borders; `FALSE` for normal rectangles.

### gwy_layer_rectangle_set_draw_as_crop()

    void
    gwy_layer_rectangle_set_draw_as_crop (GwyLayerRectangle *layer,
                                          gboolean draw_as_crop);

Sets whether a rectangle vector layer is drawn in the crop style.

#### Parameters

layer | A rectangle vector layer. |
draw_as_crop | `TRUE` to draw the rectangles with crop lines from the borders; `FALSE` for normal rectangles. |

### gwy_layer_rectangle_get_draw_reflection()

    gboolean
    gwy_layer_rectangle_get_draw_reflection
                                   (GwyLayerRectangle *layer);

Reports whether a rectangle vector layer is drawn with reflection.

#### Parameters

layer | A rectangle vector layer. |

#### Returns

`TRUE` if second rectangles are drawn, reflected about the image centre; `FALSE` for normal rectangles.

### gwy_layer_rectangle_set_draw_reflection()

    void
    gwy_layer_rectangle_set_draw_reflection
                                   (GwyLayerRectangle *layer,
                                    gboolean draw_reflection);

Sets whether a rectangle vector layer is drawn with a reflection.

#### Parameters

layer | A rectangle vector layer. |
draw_reflection | `TRUE` to draw second rectangles, reflected about the image centre; `FALSE` for normal rectangles. |

### gwy_layer_rectangle_get_snap_to_center()

    gboolean
    gwy_layer_rectangle_get_snap_to_center
                                   (GwyLayerRectangle *layer);

Reports whether a rectangle vector layer has the centre fixed to the image centre.

#### Parameters

layer | A rectangle vector layer. |

#### Returns

`TRUE` if rectangle centres are fixed to the centre; `FALSE` if they are unconstrained.

### gwy_layer_rectangle_set_snap_to_center()

    void
    gwy_layer_rectangle_set_snap_to_center
                                   (GwyLayerRectangle *layer,
                                    gboolean snap_to_center);

Sets whether a rectangle vector layer has the centre fixed to the image centre.

#### Parameters

layer | A rectangle vector layer. |
snap_to_center | `TRUE` to fix orectangles centres to the image centre; `FALSE` to leave them unconstrained. |

## Types and Values

### struct GwyLayerRectangle

    struct GwyLayerRectangle;

### struct GwyLayerRectangleClass

    struct GwyLayerRectangleClass {
        GwyVectorLayerClass parent_class;
    };

## Property Details

### The `“draw-as-crop”` property

      “draw-as-crop”             gboolean

Whether the selection is drawn crop-style with lines from border to border instead of plain rectangle.

Owner: GwyLayerRectangle

Flags: Read / Write

Default value: FALSE

### The `“draw-reflection”` property

      “draw-reflection”          gboolean

Whether central reflection of selection should be drawn too.

Owner: GwyLayerRectangle

Flags: Read / Write

Default value: FALSE

### The `“snap-to-center”` property

      “snap-to-center”           gboolean

Whether the selection centre should be fixed to the image centre.

Owner: GwyLayerRectangle

Flags: Read / Write

Default value: FALSE