gvrender_polygon(job, a, 4, 1);
a[0] = p;
a[1] = q;
- gvrender_polylinef(job, a, 2);
+ gvrender_polyline(job, a, 2);
}
static void arrow_type_box(GVJ_t * job, pointf p, pointf u, int flag)
gvrender_polygon(job, a, 4, !(flag & ARR_MOD_OPEN));
a[0] = m;
a[1] = q;
- gvrender_polylinef(job, a, 2);
+ gvrender_polyline(job, a, 2);
}
static void arrow_type_diamond(GVJ_t * job, pointf p, pointf u, int flag)
static void emit_attachment(GVJ_t * job, textlabel_t * lp, splines * spl)
{
- point sz, A[3];
+ pointf sz, AF[3];
+ point p;
unsigned char *s;
for (s = (unsigned char *) (lp->text); *s; s++) {
if (*s == 0)
return;
- PF2P(lp->dimen, sz);
- A[0] = pointof(lp->p.x + sz.x / 2, lp->p.y - sz.y / 2);
- A[1] = pointof(A[0].x - sz.x, A[0].y);
- A[2] = dotneato_closest(spl, lp->p);
+ sz = lp->dimen;
+ AF[0] = pointfof((double)(lp->p.x) + sz.x / 2., (double)(lp->p.y) - sz.y / 2.);
+ AF[1] = pointfof(AF[0].x - sz.x, AF[0].y);
+ p = dotneato_closest(spl, lp->p);
+ P2PF(p,AF[2]);
/* Don't use edge style to draw attachment */
gvrender_set_style(job, job->gvc->defaultlinestyle);
/* Use font color to draw attachment
- defaults to black for html-like labels
*/
gvrender_set_pencolor(job, lp->fontcolor);
- gvrender_polyline(job, A, 3);
+ gvrender_polyline(job, AF, 3);
}
#if 0
return rv;
}
+pointf pointfof(double x, double y)
+{
+ pointf rv;
+ rv.x = x, rv.y = y;
+ return rv;
+}
+
point cvt2pt(pointf p)
{
point rv;
#endif
extern point pointof(int, int);
+extern pointf pointfof(double, double);
+
extern pointf cvt2ptf(point);
extern point cvt2pt(pointf);
+
extern point add_points(point, point);
extern pointf add_pointfs(pointf, pointf);
+
extern point sub_points(point, point);
extern pointf sub_pointfs(pointf, pointf);
+
extern point exch_xy(point p);
extern pointf exch_xyf(pointf p);
extern box boxof(int llx, int lly, int urx, int ury);
extern boxf boxfof(double llx, double lly, double urx, double ury);
+
extern box mkbox(point, point);
extern boxf mkboxf(pointf, pointf);
+
extern box box_bb(box, box);
extern boxf boxf_bb(boxf, boxf);
+
extern box box_intersect(box, box);
extern boxf boxf_intersect(boxf, boxf);
+
extern bool box_overlap(box, box);
extern bool boxf_overlap(boxf, boxf);
+
extern bool box_contains(box, box);
extern bool boxf_contains(boxf, boxf);
+
extern box flip_rec_box(box b, point p);
extern double ptToLine2 (pointf l1, pointf l2, pointf p);
+
extern int lineToBox(pointf p1, pointf p2, boxf b);
extern point ccwrotatep(point p, int ccwrot);
extern pointf ccwrotatepf(pointf p, int ccwrot);
+
extern point cwrotatep(point p, int cwrot);
extern pointf cwrotatepf(pointf p, int cwrot);
static void Mcircle_hack(GVJ_t * job, node_t * n)
{
double x, y;
- point A[2], p;
+ pointf AF[2], p, coord;
y = .7500;
x = .6614; /* x^2 + y^2 = 1.0 */
p.y = y * ND_ht_i(n) / 2.0;
p.x = ND_rw_i(n) * x; /* assume node is symmetric */
- A[0] = add_points(p, ND_coord_i(n));
- A[1].y = A[0].y;
- A[1].x = A[0].x - 2 * p.x;
- gvrender_polyline(job, A, 2);
- A[0].y -= 2 * p.y;
- A[1].y = A[0].y;
- gvrender_polyline(job, A, 2);
+ P2PF(ND_coord_i(n), coord);
+ AF[0] = add_pointfs(p, coord);
+ AF[1].y = AF[0].y;
+ AF[1].x = AF[0].x - 2 * p.x;
+ gvrender_polyline(job, AF, 2);
+ AF[0].y -= 2 * p.y;
+ AF[1].y = AF[0].y;
+ gvrender_polyline(job, AF, 2);
}
static pointf interpolate(double t, pointf p0, pointf p1)
}
gvrender_set_pencolor(job, penc);
for (seg = 0; seg < sides; seg++) {
- gvrender_polylinef(job, B + 4 * seg + 1, 2);
+ gvrender_polyline(job, B + 4 * seg + 1, 2);
gvrender_beziercurve(job, B + 4 * seg + 2, 4, FALSE, FALSE, FALSE);
}
} else { /* diagonals are weird. rewrite someday. */
#ifdef NOTDEF
C[0] = B[3 * seg];
C[1] = B[3 * seg + 3];
- gvrender_polylinef(job, C, 2);
+ gvrender_polyline(job, C, 2);
#endif
C[0] = B[3 * seg + 2];
C[1] = B[3 * seg + 4];
- gvrender_polylinef(job, C, 2);
+ gvrender_polyline(job, C, 2);
}
}
free(B);
{
int i;
double cx, cy;
- point A[2];
+ pointf AF[2], coord;
if (f->lp) {
cx = (f->b.LL.x + f->b.UR.x) / 2.0 + ND_coord_i(n).x;
for (i = 0; i < f->n_flds; i++) {
if (i > 0) {
if (f->LR) {
- A[0] = f->fld[i]->b.LL;
- A[1].x = A[0].x;
- A[1].y = f->fld[i]->b.UR.y;
+ P2PF(f->fld[i]->b.LL, AF[0]);
+ AF[1].x = AF[0].x;
+ AF[1].y = (double)(f->fld[i]->b.UR.y);
} else {
- A[1] = f->fld[i]->b.UR;
- A[0].x = f->fld[i]->b.LL.x;
- A[0].y = A[1].y;
+ P2PF(f->fld[i]->b.UR, AF[1]);
+ AF[0].x = (double)(f->fld[i]->b.LL.x);
+ AF[0].y = AF[1].y;
}
- A[0] = add_points(A[0], ND_coord_i(n));
- A[1] = add_points(A[1], ND_coord_i(n));
- gvrender_polyline(job, A, 2);
+ P2PF(ND_coord_i(n), coord);
+ AF[0] = add_pointfs(AF[0], coord);
+ AF[1] = add_pointfs(AF[1], coord);
+ gvrender_polyline(job, AF, 2);
}
gen_fields(job, n, f->fld[i]);
}
extern void gvrender_box(GVJ_t * job, boxf BF, bool filled);
extern void gvrender_beziercurve(GVJ_t * job, pointf * AF, int n,
int arrow_at_start, int arrow_at_end, bool filled);
- extern void gvrender_polyline(GVJ_t * job, point * A, int n);
- extern void gvrender_polylinef(GVJ_t * job, pointf * AF, int n);
+ extern void gvrender_polyline(GVJ_t * job, pointf * AF, int n);
extern void gvrender_comment(GVJ_t * job, char *str);
extern void gvrender_usershape(GVJ_t * job, char *name, pointf * AF, int n, bool filled);
return AF;
}
-static pointf gvrender_pt(GVJ_t *job, point p)
-{
- pointf pf;
-
- P2PF(p, pf);
- return gvrender_ptf(job, pf);
-}
-
static int gvrender_comparestr(const void *s1, const void *s2)
{
return strcmp(*(char **) s1, *(char **) s2);
#endif
}
-void gvrender_polylinef(GVJ_t * job, pointf * af, int n)
+void gvrender_polyline(GVJ_t * job, pointf * af, int n)
{
gvrender_engine_t *gvre = job->render.engine;
#endif
}
-void gvrender_polyline(GVJ_t * job, point * a, int n)
-{
- gvrender_engine_t *gvre = job->render.engine;
-
- if (gvre && gvre->polyline) {
- if (job->style->pen != PEN_NONE) {
- int i;
- if (sizeAF < n) {
- sizeAF = n+10;
- AF = grealloc(AF, sizeAF * sizeof(pointf));
- }
- if (job->flags & GVRENDER_DOES_TRANSFORM) {
- for (i = 0; i < n; i++) {
- P2PF(a[i],AF[i]);
- }
- }
- else {
- for (i = 0; i < n; i++)
- AF[i] = gvrender_pt(job, a[i]);
- }
- gvre->polyline(job, AF, n);
- }
- }
-#ifdef WITH_CODEGENS
- else {
- codegen_t *cg = job->codegen;
-
- if (cg && cg->polyline)
- cg->polyline(a, n);
- }
-#endif
-}
-
void gvrender_comment(GVJ_t * job, char *str)
{
gvrender_engine_t *gvre = job->render.engine;
fprintf(job->output_file, "%% %s\n", obj->sg->name);
- if (obj->url) {
+ if (obj->url && obj->url_map_p) {
fprintf(job->output_file, "[ /Rect [ %g %g %g %g ]\n",
obj->url_map_p[0].x, obj->url_map_p[0].y,
obj->url_map_p[1].x, obj->url_map_p[1].y);
{
obj_state_t *obj = job->obj;
- if (obj->url) {
+ if (obj->url && obj->url_map_p) {
fprintf(job->output_file, "[ /Rect [ %g %g %g %g ]\n",
obj->url_map_p[0].x, obj->url_map_p[0].y,
obj->url_map_p[1].x, obj->url_map_p[1].y);
{
obj_state_t *obj = job->obj;
- if (obj->url) {
+ if (obj->url && obj->url_map_p) {
fprintf(job->output_file, "[ /Rect [ %g %g %g %g ]\n",
obj->url_map_p[0].x, obj->url_map_p[0].y,
obj->url_map_p[1].x, obj->url_map_p[1].y);
"/ANN pdfmark\n",
ps_string(obj->url, isLatin1));
}
- if (obj->tailurl) {
+ if (obj->tailurl && obj->tailurl_map_p) {
fprintf(job->output_file, "[ /Rect [ %g %g %g %g ]\n",
obj->tailurl_map_p[0].x, obj->tailurl_map_p[0].y,
obj->tailurl_map_p[1].x, obj->tailurl_map_p[1].y);
"/ANN pdfmark\n",
ps_string(obj->tailurl, isLatin1));
}
- if (obj->headurl) {
+ if (obj->headurl && obj->headurl_map_p) {
fprintf(job->output_file, "[ /Rect [ %g %g %g %g ]\n",
obj->headurl_map_p[0].x, obj->headurl_map_p[0].y,
obj->headurl_map_p[1].x, obj->headurl_map_p[1].y);
"/ANN pdfmark\n",
ps_string(obj->headurl, isLatin1));
}
- if (obj->tailurl) {
+ if (obj->tailurl && obj->tailendurl_map_p) {
fprintf(job->output_file, "[ /Rect [ %g %g %g %g ]\n",
obj->tailendurl_map_p[0].x, obj->tailendurl_map_p[0].y,
obj->tailendurl_map_p[1].x, obj->tailendurl_map_p[1].y);
"/ANN pdfmark\n",
ps_string(obj->tailurl, isLatin1));
}
- if (obj->headurl) {
+ if (obj->headurl && obj->headendurl_map_p) {
fprintf(job->output_file, "[ /Rect [ %g %g %g %g ]\n",
obj->headendurl_map_p[0].x, obj->headendurl_map_p[0].y,
obj->headendurl_map_p[1].x, obj->headendurl_map_p[1].y);