libmypaint
1.6.0
|
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... | |
MyPaintRectangle * | mypaint_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... | |
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.
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.
r | A pointer to the rectangle to copy. |
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).
[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.
void mypaint_rectangle_expand_to_include_rect | ( | MyPaintRectangle * | r, |
MyPaintRectangle * | other | ||
) |
Minimally expand a rectangle so that it fully contains another.
[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.
int MyPaintRectangle::height |
The height of the rectangle.
int MyPaintRectangle::width |
The width of the rectangle.
int MyPaintRectangle::x |
The x-coordinate of the rectangle's top-left corner.
int MyPaintRectangle::y |
The x-coordinate of the rectangle's top-left corner.