Swfdec Reference Manual | ||||
---|---|---|---|---|
#include <swfdec/swfdec.h> SwfdecRectangle; gboolean swfdec_rectangle_contains (const SwfdecRectangle *container, const SwfdecRectangle *content); gboolean swfdec_rectangle_contains_point (const SwfdecRectangle *rectangle, int x, int y); void swfdec_rectangle_init_empty (SwfdecRectangle *rectangle); gboolean swfdec_rectangle_intersect (SwfdecRectangle *dest, const SwfdecRectangle *a, const SwfdecRectangle *b); gboolean swfdec_rectangle_is_empty (const SwfdecRectangle *rectangle); void swfdec_rectangle_union (SwfdecRectangle *dest, const SwfdecRectangle *a, const SwfdecRectangle *b);
This section describes how regions are handled in Swfdec. Regions are important when tracking which parts of the screen have been invalidated and need to be repainted. See SwfdecPlayer::invalidate for an example.
typedef struct { int x; /* x coordinate of top-left point */ int y; /* y coordinate of top left point */ int width; /* width of rectangle or 0 for empty */ int height; /* height of rectangle or 0 for empty */ } SwfdecRectangle;
This structure represents a rectangular region. It is identical to the
GdkRectangle structure, so you can cast freely between them. The only
difference is that Gdk does not allow empty rectangles, while Swfdec does.
You can use swfdec_rectangle_is_empty()
to check for this.
int |
x coordinate of top-left point |
int |
y coordinate of top-left point |
int |
width of rectangle or 0 for empty |
int |
height of rectangle or 0 for empty |
gboolean swfdec_rectangle_contains (const SwfdecRectangle *container, const SwfdecRectangle *content);
Checks if container
contains the whole rectangle content
.
|
the supposedly bigger rectangle |
|
the supposedly smaller rectangle |
Returns : |
TRUE if container contains content .
|
gboolean swfdec_rectangle_contains_point (const SwfdecRectangle *rectangle, int x, int y);
Checks if the given point is inside the given rectangle.
|
a rectangle |
|
x coordinate of point to check |
|
y coordinate of point to check |
Returns : |
TRUE if the point is inside the rectangle
|
void swfdec_rectangle_init_empty (SwfdecRectangle *rectangle);
Initializes the rectangle as empty.
|
rectangle to initialize |
gboolean swfdec_rectangle_intersect (SwfdecRectangle *dest, const SwfdecRectangle *a, const SwfdecRectangle *b);
Intersects the rectangles a
and b
and puts the result into dest
. It is
allowed if dest
is the same as a
or b
.
gboolean swfdec_rectangle_is_empty (const SwfdecRectangle *rectangle);
Checks if the given rectangle
is empty.
|
rectangle to check |
Returns : |
TRUE if the rectangle is emtpy
|
void swfdec_rectangle_union (SwfdecRectangle *dest, const SwfdecRectangle *a, const SwfdecRectangle *b);
Computes the smallest rectangle that contains both a
and b
and puts it in
dest
.
|
destination to take the union |
|
first rectangle to union |
|
second rectangle to union |