## uta uta |

## Synopsis

    EogUta *            uta_ensure_size                     (EogUta *uta,
                                                             int x1,
                                                             int y1,
                                                             int x2,
                                                             int y2);
    EogUta *            uta_add_rect                        (EogUta *uta,
                                                             int x1,
                                                             int y1,
                                                             int x2,
                                                             int y2);
    void                uta_remove_rect                     (EogUta *uta,
                                                             int x1,
                                                             int y1,
                                                             int x2,
                                                             int y2);
    void                uta_find_first_glom_rect            (EogUta *uta,
                                                             EogIRect *rect,
                                                             int max_width,
                                                             int max_height);
    void                uta_copy_area                       (EogUta *uta,
                                                             int src_x,
                                                             int src_y,
                                                             int dest_x,
                                                             int dest_y,
                                                             int width,
                                                             int height);

## Description

## Details

### uta_ensure_size ()

    EogUta *            uta_ensure_size                     (EogUta *uta,
                                                             int x1,
                                                             int y1,
                                                             int x2,
                                                             int y2);

Ensures that the size of a microtile array is big enough to fit the specified microtile coordinates. If it is not big enough, the specified `uta` will be freed and a new one will be returned. Otherwise, the original `uta` will be returned. If a new microtile array needs to be created, this function will copy the `uta`'s contents to the new array.

Note that the specified coordinates must have already been scaled down by the ART_UTILE_SHIFT factor.

`uta` : | A microtile array.
`x1` : | Left microtile coordinate that must fit in new array.
`y1` : | Top microtile coordinate that must fit in new array.
`x2` : | Right microtile coordinate that must fit in new array.
`y2` : | Bottom microtile coordinate that must fit in new array.
Returns : | The same value as `uta` if the original microtile array was big enough to fit the specified microtile coordinates, or a new array if it needed to be grown. In the second case, the original `uta` will be freed automatically.

### uta_add_rect ()

    EogUta *            uta_add_rect                        (EogUta *uta,
                                                             int x1,
                                                             int y1,
                                                             int x2,
                                                             int y2);

Adds the specified rectangle to a microtile array. The array is grown to fit the rectangle if necessary.

`uta` : | A microtile array, or NULL if a new array should be created.
`x1` : | Left coordinate of rectangle.
`y1` : | Top coordinate of rectangle.
`x2` : | Right coordinate of rectangle.
`y2` : | Bottom coordinate of rectangle.
Returns : | The original `uta`, or a new microtile array if the original one needed to be grown to fit the specified rectangle. In the second case, the original `uta` will be freed automatically.

### uta_remove_rect ()

    void                uta_remove_rect                     (EogUta *uta,
                                                             int x1,
                                                             int y1,
                                                             int x2,
                                                             int y2);

Removes a rectangular region from the specified microtile array. Due to the way microtile arrays represent regions, the tiles at the edge of the rectangle may not be clipped exactly.

`uta` : | A microtile array.
`x1` : | Left coordinate of rectangle.
`y1` : | Top coordinate of rectangle.
`x2` : | Right coordinate of rectangle.
`y2` : | Bottom coordinate of rectangle.

### uta_find_first_glom_rect ()

    void                uta_find_first_glom_rect            (EogUta *uta,
                                                             EogIRect *rect,
                                                             int max_width,
                                                             int max_height);

`uta` : |
`rect` : |
`max_width` : |
`max_height` : |

### uta_copy_area ()

    void                uta_copy_area                       (EogUta *uta,
                                                             int src_x,
                                                             int src_y,
                                                             int dest_x,
                                                             int dest_y,
                                                             int width,
                                                             int height);

Copies a rectangular region within a microtile array. The array will not be expanded if the destination area does not fit within it; rather only the area that fits will be copied. The source rectangle must be completely contained within the microtile array.

`uta` : | A microtile array.
`src_x` : | Left coordinate of source rectangle.
`src_y` : | Top coordinate of source rectangle.
`dest_x` : | Left coordinate of destination.
`dest_y` : | Top coordinate of destination.
`width` : | Width of region to copy.
`height` : | Height of region to copy.