Example #1
0
static void
emit_html_cell(GVJ_t * job, htmlcell_t * cp, htmlenv_t * env)
{
    htmlmap_data_t saved;
    boxf pts = cp->data.box;
    pointf pos = env->pos;
    int inAnchor, doAnchor = (cp->data.href || cp->data.target);

    pts.LL.x += pos.x;
    pts.UR.x += pos.x;
    pts.LL.y += pos.y;
    pts.UR.y += pos.y;

    if (doAnchor && !(job->flags & EMIT_CLUSTERS_LAST))
	inAnchor = initAnchor(job, env, &cp->data, pts, &saved, 1);
    else
	inAnchor = 0;

    if (cp->data.bgcolor) {
	char* clrs[2];
	int filled = setFill (job, cp->data.bgcolor, cp->data.gradientangle, cp->data.style, clrs);
	gvrender_box(job, pts, filled);
	free (clrs[0]);
    }

    if (cp->data.border)
	doBorder(job, cp->data.pencolor, cp->data.border, pts);

    if (cp->child.kind == HTML_TBL)
	emit_html_tbl(job, cp->child.u.tbl, env);
    else if (cp->child.kind == HTML_IMAGE)
	emit_html_img(job, cp->child.u.img, env);
    else
	emit_html_txt(job, cp->child.u.txt, env);

    if (inAnchor)
	endAnchor (job, &saved, 1);

    if (doAnchor && (job->flags & EMIT_CLUSTERS_LAST)) {
	if (initAnchor(job, env, &cp->data, pts, &saved, 0))
	    endAnchor (job, &saved, 0);
    }
}
Example #2
0
static void
emit_html_cell(GVJ_t * job, htmlcell_t * cp, htmlenv_t * env)
{
    box pts = cp->data.box;
    point p = env->p;

    pts.LL.x += p.x;
    pts.UR.x += p.x;
    pts.LL.y += p.y;
    pts.UR.y += p.y;

    /* gvrender_begin_context(); */

    if (cp->data.href) {
	emit_map_rect(job, pts.LL, pts.UR);
	doAnchorStart(job, &cp->data);
    }

    if (cp->data.bgcolor)
	doFill(job, cp->data.bgcolor, pts);

    if (cp->child.kind == HTML_TBL)
	emit_html_tbl(job, cp->child.u.tbl, env);
    else if (cp->child.kind == HTML_IMAGE)
	emit_html_img(job, cp->child.u.img, env);
    else
	emit_html_txt(job, cp->child.u.txt, env);

    if (cp->data.border)
	doBorder(job, cp->data.pencolor, cp->data.border, pts);

    if (cp->data.href)
	doAnchorEnd(job);

    /* gvrender_end_context(); */
}