libmypaint  1.6.0
Public Member Functions | Data Fields
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). More...
 
void mypaint_rectangle_expand_to_include_rect (MyPaintRectangle *r, MyPaintRectangle *other)
 Minimally expand a rectangle so that it fully contains another. More...
 
MyPaintRectanglemypaint_rectangle_copy (MyPaintRectangle *r)
 Create a copy of the given rectangle. More...
 

Data Fields

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

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
rA 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]rThe rectangle that may be expanded
x,yThe 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]rThe rectangle that may be expanded
otherThe 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: