Primitives

Primitives — Primitive shape API

Synopsis




            GfLine;
            GfPoint;
            GfRectangle;
            GfSegment;
gboolean    gf_rectangle_intersect          (const GfRectangle *src1,
                                             const GfRectangle *src2,
                                             GfRectangle *dest);
void        gf_rectangle_union              (const GfRectangle *src1,
                                             const GfRectangle *src2,
                                             GfRectangle *dest);

Description

To aid in user interface abstraction, we need common way to look at basic shapes. This API is designed to accomidate that.

Details

GfLine

typedef struct {
	gint x1;
	gint y1;
	gint x2;
	gint y2;
} GfLine;

A Line

gint x1; The x-coordinate of the start point.
gint y1; The y-coordinate of the start point.
gint x2; The x-coordinate of the end point.
gint y2; The y-coordinate of the end point.

GfPoint

typedef struct {
	gint x;
	gint y;
} GfPoint;

A Point

gint x; The x-coordinate.
gint y; The y-coordinate.

GfRectangle

typedef struct {
	gint x;
	gint y;
	gint width;
	gint height;
} GfRectangle;

A Rectangle

gint x; The x-coordinate of the rectangle.
gint y; The y-coordinate of the rectangle.
gint width; The width of the rectangle.
gint height; The height of the rectangle.

GfSegment

typedef struct {
	gint x1;
	gint y1;
	gint x2;
	gint y2;
} GfSegment;

A Segment

gint x1; The x-coordinate of the start point.
gint y1; The y-coordinate of the start point.
gint x2; The x-coordinate of the end point.
gint y2; The y-coordinate of the end point.

gf_rectangle_intersect ()

gboolean    gf_rectangle_intersect          (const GfRectangle *src1,
                                             const GfRectangle *src2,
                                             GfRectangle *dest);

Calculates the intersection of src1 and src2.

src1 : A GfRectangle.
src2 : A GfRectangle.
dest : The return address for the intersection of src1 and src2.
Returns : TRUE if src1 and src2 intersect, FALSE if they don't.

gf_rectangle_union ()

void        gf_rectangle_union              (const GfRectangle *src1,
                                             const GfRectangle *src2,
                                             GfRectangle *dest);

Calculates the smallest GfRectangle that includes src1 and src2.

src1 : A GfRectangle.
src2 : A GfRectangle.
dest : The return address for the union of src1 and src2.