File: shape.h

package info (click to toggle)
graphviz 1.7.16-2
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 11,124 kB
  • ctags: 12,650
  • sloc: ansic: 131,002; sh: 7,483; makefile: 1,954; tcl: 1,760; yacc: 1,758; perl: 253; awk: 150; lex: 96
file content (49 lines) | stat: -rw-r--r-- 1,399 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef ILSHAPE_H
#define ILSHAPE_H
#include <assert.h>
#include <incr.h>		/* import base types */

#if HAVE_VMALLOC || HAVE_AST
#include	<vmalloc.h>
#else
#include	<stdlib.h>
typedef struct _vmalloc_s Vmalloc_t;
#define vmalloc(arena,request) malloc(request)
#define vmfree(arena,ptr) free(ptr)
#define vmregion(ptr) 0
#endif

typedef enum ilcurvetype_e { IL_SPLINE, IL_POLYLINE, IL_NOCURVE } ilcurvetype_t;

typedef enum ilshapetype_e {
	IL_POLYGON, IL_CIRCLE, IL_ELLIPSE, IL_SPLINEGON, IL_NOSHAPE
} ilshapetype_t;

struct ilcurve_s {
	ilcurvetype_t	type;
	int				n;		/* must be > 0 */
	ilcoord_t		*p;
} ;

struct ilshape_s {
	ilshapetype_t	type;
	union {
			/* this should be ilcurve_t*, but too much code depends ..*/
		ilcurve_t		curve;	/* if polygon, splinegon */
		struct {double radius_a, radius_b;} ellipse;
	} def;
	struct ilshape_s *next;
} ;

ilcoord_t	ilcoord(double x, double y);
ilcurve_t 	*il_newcurve(Vmalloc_t *arena, ilcurvetype_t kind, int npts);
void		il_freecurve(Vmalloc_t *arena, ilcurve_t *curve);

ilshape_t	*il_newshape(Vmalloc_t *arena, ilcurve_t *contents, ilshape_t *link);
ilshape_t	*il_copyshape(Vmalloc_t *arena, ilshape_t *shape);
void		il_freeshape(Vmalloc_t *arena, ilshape_t *shape);

ilcurve_t	*il_get_bounding_poly(ilshape_t *shape);
ilrect_t	il_get_bounding_rect(ilshape_t *shape);
int			il_inshape(ilshape_t *shape, ilcoord_t pt);	/* 0,1 predicate */
#endif