SwfdecRectangle

SwfdecRectangle — handling regions on the screen

Functions

Types and Values

Includes

#include <swfdec/swfdec.h>

Description

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.

Functions

swfdec_rectangle_contains ()

gboolean
swfdec_rectangle_contains (const SwfdecRectangle *container,
                           const SwfdecRectangle *content);

Checks if container contains the whole rectangle content .

Parameters

container

the supposedly bigger rectangle

 

content

the supposedly smaller rectangle

 

Returns

TRUE if container contains content .


swfdec_rectangle_contains_point ()

gboolean
swfdec_rectangle_contains_point (const SwfdecRectangle *rectangle,
                                 int x,
                                 int y);

Checks if the given point is inside the given rectangle.

Parameters

rectangle

a rectangle

 

x

x coordinate of point to check

 

y

y coordinate of point to check

 

Returns

TRUE if the point is inside the rectangle


swfdec_rectangle_init_empty ()

void
swfdec_rectangle_init_empty (SwfdecRectangle *rectangle);

Initializes the rectangle as empty.

Parameters

rectangle

rectangle to initialize

 

swfdec_rectangle_intersect ()

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 .

Parameters

dest

the rectangle to take the result or NULL

 

a

first rectangle to intersect

 

b

second rectangle to intersect

 

Returns

TRUE if the intersection is not empty.


swfdec_rectangle_is_empty ()

gboolean
swfdec_rectangle_is_empty (const SwfdecRectangle *rectangle);

Checks if the given rectangle is empty.

Parameters

rectangle

rectangle to check

 

Returns

TRUE if the rectangle is emtpy


swfdec_rectangle_union ()

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 .

Parameters

dest

destination to take the union

 

a

first rectangle to union

 

b

second rectangle to union

 

Types and Values

struct SwfdecRectangle

struct SwfdecRectangle {
  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 */
};

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.

Members

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