Loading...
Searching...
No Matches
MyPaintRectangle Struct Reference

Representation of a rectangle, integer values: (x, y, w, h). More...

`#include <mypaint-rectangle.h>`

## Public Member Functions

void | mypaint_rectangle_expand_to_include_point (MyPaintRectangle *r, int x, int y)
| Minimally expand a rectangle so that it contains a given point (x, y).
void | mypaint_rectangle_expand_to_include_rect (MyPaintRectangle *r, MyPaintRectangle *other)
| Minimally expand a rectangle so that it fully contains another.
MyPaintRectangle * | mypaint_rectangle_copy (MyPaintRectangle *r)
| Create a copy of the given rectangle.

## Data Fields

int | x
| The x-coordinate of the rectangle's top-left corner.
int | y
| The x-coordinate of the rectangle's top-left corner.
int | width
| The width of the rectangle.
int | height
| The height of the rectangle.

## Detailed Description

Representation of a rectangle, integer values: (x, y, w, h).

Rectangles are only used for registering areas that have been affected by brush strokes - the units of the parameters are pixels.

## Member Function Documentation

## mypaint_rectangle_copy()

MyPaintRectangle * mypaint_rectangle_copy | ( | MyPaintRectangle * | r | ) |

Create a copy of the given rectangle.

Allocates a new MyPaintRectangle, copies the input rectangle to it, and returns its address. If the allocation fails, NULL is returned.

Parameters

  r | A pointer to the rectangle to copy.

Returns
  A pointer to a new copy of r, or NULL.

## mypaint_rectangle_expand_to_include_point()

void mypaint_rectangle_expand_to_include_point | ( | MyPaintRectangle * | r,
|  | int | x,
|  | int | y )

Minimally expand a rectangle so that it contains a given point (x, y).

Parameters

  [out] | r | The rectangle that may be expanded
  | x,y | The coordinates of the point to expand to

If the point (x, y) lies outside of the given rectangle pointed to by r, the rectangle is expanded the minimum amount needed for the point to lie within its new boundaries.

## mypaint_rectangle_expand_to_include_rect()

void mypaint_rectangle_expand_to_include_rect | ( | MyPaintRectangle * | r,
|  | MyPaintRectangle * | other )

Minimally expand a rectangle so that it fully contains another.

Parameters

  [out] | r | The rectangle that may be expanded
  | other | The rectangle to expand r to

If r does not completely contain other, r is expanded the minimum amount needed for other to lie fully within r's boundaries.

## Field Documentation

## height

int MyPaintRectangle::height

The height of the rectangle.

## width

int MyPaintRectangle::width

The width of the rectangle.

## x

int MyPaintRectangle::x

The x-coordinate of the rectangle's top-left corner.

## y

int MyPaintRectangle::y

The x-coordinate of the rectangle's top-left corner.

The documentation for this struct was generated from the following file:

- mypaint-rectangle.h