## MetaRectangle MetaRectangle — Simple box operations |

## Synopsis

    struct              MetaRectangle;
    struct              MetaStrut;
    enum                MetaEdgeType;
    struct              MetaEdge;
    MetaRectangle *     meta_rectangle_copy                 (const MetaRectangle *rect);
    void                meta_rectangle_free                 (MetaRectangle *rect);
    MetaRectangle       meta_rect                           (int x,
                                                             int y,
                                                             int width,
                                                             int height);
    int                 meta_rectangle_area                 (const MetaRectangle *rect);
    gboolean            meta_rectangle_intersect            (const MetaRectangle *src1,
                                                             const MetaRectangle *src2,
                                                             MetaRectangle *dest);
    gboolean            meta_rectangle_equal                (const MetaRectangle *src1,
                                                             const MetaRectangle *src2);
    void                meta_rectangle_union                (const MetaRectangle *rect1,
                                                             const MetaRectangle *rect2,
                                                             MetaRectangle *dest);
    gboolean            meta_rectangle_overlap              (const MetaRectangle *rect1,
                                                             const MetaRectangle *rect2);
    gboolean            meta_rectangle_vert_overlap         (const MetaRectangle *rect1,
                                                             const MetaRectangle *rect2);
    gboolean            meta_rectangle_horiz_overlap        (const MetaRectangle *rect1,
                                                             const MetaRectangle *rect2);
    gboolean            meta_rectangle_could_fit_rect       (const MetaRectangle *outer_rect,
                                                             const MetaRectangle *inner_rect);
    gboolean            meta_rectangle_contains_rect        (const MetaRectangle *outer_rect,
                                                             const MetaRectangle *inner_rect);

## Object Hierarchy

      GBoxed
       +----MetaRectangle

## Description

## Details

### struct MetaRectangle

    struct MetaRectangle {
      int x;
      int y;
      int width;
      int height;
    };

int `x`; | X coordinate of the top-left corner
int `y`; | Y coordinate of the top-left corner
int `width`; | Width of the rectangle
int `height`; | Height of the rectangle

### struct MetaStrut

    struct MetaStrut {
      MetaRectangle rect;
      MetaSide side;
    };

MetaRectangle `rect`; | MetaRectangle the MetaStrut is on
MetaSide `side`; | MetaSide the MetaStrut is on

### enum MetaEdgeType

    typedef enum {
      META_EDGE_WINDOW,
      META_EDGE_MONITOR,
      META_EDGE_SCREEN
    } MetaEdgeType;

`META_EDGE_WINDOW` | Whether the edge belongs to a window
`META_EDGE_MONITOR` | Whether the edge belongs to a monitor
`META_EDGE_SCREEN` | Whether the edge belongs to a screen

### struct MetaEdge

    struct MetaEdge {
      MetaRectangle rect;      /* width or height should be 1 */
      MetaSide side_type;
      MetaEdgeType  edge_type;
    };

MetaRectangle `rect`; | MetaRectangle with the bounds of the edge
MetaSide `side_type`; | Side
MetaEdgeType `edge_type`; | To what belongs the edge

### meta_rectangle_copy ()

    MetaRectangle *     meta_rectangle_copy                 (const MetaRectangle *rect);

### meta_rectangle_free ()

    void                meta_rectangle_free                 (MetaRectangle *rect);

### meta_rect ()

    MetaRectangle       meta_rect                           (int x,
                                                             int y,
                                                             int width,
                                                             int height);

### meta_rectangle_area ()

    int                 meta_rectangle_area                 (const MetaRectangle *rect);

### meta_rectangle_intersect ()

    gboolean            meta_rectangle_intersect            (const MetaRectangle *src1,
                                                             const MetaRectangle *src2,
                                                             MetaRectangle *dest);

`src1` : | a MetaRectangle
`src2` : | another MetaRectangle
`dest` : | an empty MetaRectangle, to be filled with the coordinates of the intersection. [out caller-allocates]
Returns : | TRUE is some intersection exists and is not degenerate, FALSE otherwise.

### meta_rectangle_equal ()

    gboolean            meta_rectangle_equal                (const MetaRectangle *src1,
                                                             const MetaRectangle *src2);

### meta_rectangle_union ()

    void                meta_rectangle_union                (const MetaRectangle *rect1,
                                                             const MetaRectangle *rect2,
                                                             MetaRectangle *dest);

`rect1` : | a MetaRectangle
`rect2` : | another MetaRectangle
`dest` : | an empty MetaRectangle, to be filled with the coordinates of the bounding box. [out caller-allocates]

### meta_rectangle_overlap ()

    gboolean            meta_rectangle_overlap              (const MetaRectangle *rect1,
                                                             const MetaRectangle *rect2);

### meta_rectangle_vert_overlap ()

    gboolean            meta_rectangle_vert_overlap         (const MetaRectangle *rect1,
                                                             const MetaRectangle *rect2);

### meta_rectangle_horiz_overlap ()

    gboolean            meta_rectangle_horiz_overlap        (const MetaRectangle *rect1,
                                                             const MetaRectangle *rect2);

### meta_rectangle_could_fit_rect ()

    gboolean            meta_rectangle_could_fit_rect       (const MetaRectangle *outer_rect,
                                                             const MetaRectangle *inner_rect);

### meta_rectangle_contains_rect ()

    gboolean            meta_rectangle_contains_rect        (const MetaRectangle *outer_rect,
                                                             const MetaRectangle *inner_rect);