static int
gnome_print_multipage_image (GnomePrintContext *pc, const gdouble *affine, const guchar *px, gint w, gint h, gint rowstride, gint ch)
{
	GnomePrintMultipage *mp;
	gdouble a[6];

	mp = GNOME_PRINT_MULTIPAGE(pc);

	art_affine_multiply (a, affine, mp->subpage->data);

	return gnome_print_image_transform (mp->subpc, a, px, w, h, rowstride, ch);
}
static int
gnome_print_multipage_glyphlist (GnomePrintContext *pc, const gdouble *affine, GnomeGlyphList *gl)
{
	GnomePrintMultipage *mp;
	gdouble a[6];

	mp = GNOME_PRINT_MULTIPAGE(pc);

	art_affine_multiply (a, affine, mp->subpage->data);

	return gnome_print_glyphlist_transform (mp->subpc, a, gl);
}
/* This is copied from mate-canvas.c since it is declared static */
static void
invoke_update (MateCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
{
	int child_flags;
	double *child_affine;
        double i2w[6], w2c[6], i2c[6];

	child_flags = flags;
	if (!(item->object.flags & MATE_CANVAS_ITEM_VISIBLE))
		child_flags &= ~MATE_CANVAS_UPDATE_IS_VISIBLE;

	/* Apply the child item's transform */
        mate_canvas_item_i2w_affine (item, i2w);
        mate_canvas_w2c_affine (item->canvas, w2c);
        art_affine_multiply (i2c, i2w, w2c);
        child_affine = i2c;

	/* apply object flags to child flags */

	child_flags &= ~MATE_CANVAS_UPDATE_REQUESTED;

	if (item->object.flags & MATE_CANVAS_ITEM_NEED_UPDATE)
		child_flags |= MATE_CANVAS_UPDATE_REQUESTED;

	if (item->object.flags & MATE_CANVAS_ITEM_NEED_AFFINE)
		child_flags |= MATE_CANVAS_UPDATE_AFFINE;

	if (item->object.flags & MATE_CANVAS_ITEM_NEED_CLIP)
		child_flags |= MATE_CANVAS_UPDATE_CLIP;

	if (item->object.flags & MATE_CANVAS_ITEM_NEED_VIS)
		child_flags |= MATE_CANVAS_UPDATE_VISIBILITY;

	if ((child_flags & (MATE_CANVAS_UPDATE_REQUESTED
			    | MATE_CANVAS_UPDATE_AFFINE
			    | MATE_CANVAS_UPDATE_CLIP
			    | MATE_CANVAS_UPDATE_VISIBILITY))
	    && MATE_CANVAS_ITEM_GET_CLASS (item)->update)
		(* MATE_CANVAS_ITEM_GET_CLASS (item)->update) (
			item, child_affine, clip_path, child_flags);
}
Example #4
0
static double
gnome_canvas_item_invoke_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
				GnomeCanvasItem **actual_item)
{
#ifdef HACKISH_AFFINE
	double i2w[6], w2c[6], i2c[6], c2i[6];
	ArtPoint c, i;
#endif

#ifdef HACKISH_AFFINE
	gnome_canvas_item_i2w_affine (item, i2w);
	gnome_canvas_w2c_affine (item->canvas, w2c);
	art_affine_multiply (i2c, i2w, w2c);
	art_affine_invert (c2i, i2c);
	c.x = cx;
	c.y = cy;
	art_affine_point (&i, &c, c2i);
	x = i.x;
	y = i.y;
#endif

	return (* GNOME_CANVAS_ITEM_CLASS (GTK_OBJECT_GET_CLASS (item))->point) (
		item, x, y, cx, cy, actual_item);
}
Example #5
0
static void
test_affine (void) {
    double src[6];
    double dst[6];
    double src2[6];
    char str[128];
    int i;
    ArtPoint ps, pd, ptmp;

    for (i = 0; i < 6; i++)
    {
        src[i] = (rand () * 2.0 / RAND_MAX) - 1.0;
        src2[i] = (rand () * 2.0 / RAND_MAX) - 1.0;
    }
#if 0
    src[0] = 0.9999999;
    src[1] = -0.000001;
    src[2] = 0.000001;
    src[3] = 0.9999999;
    src[4] = 0;
    src[5] = 0;
#if 1
    src[0] = 0.98480775;
    src[1] = -0.17364818;
    src[2] = 0.17364818;
    src[3] = 0.98480775;
#endif

    src2[0] = 0.98480775;
    src2[1] = -0.17364818;
    src2[2] = 0.17364818;
    src2[3] = 0.98480775;
#endif


    ps.x = rand() * 100.0 / RAND_MAX;
    ps.y = rand() * 100.0 / RAND_MAX;

    art_affine_point (&pd, &ps, src);
    art_affine_invert (dst, src);
    art_affine_point (&ptmp, &pd, dst);
    art_affine_to_string (str, src);
    printf ("src = %s\n", str);
    art_affine_to_string (str, dst);
    printf ("dst = %s\n", str);
    printf ("point (%g, %g) -> (%g, %g) -> (%g, %g)\n",
            ps.x, ps.y, pd.x, pd.y, ptmp.x, ptmp.y);

    art_affine_point (&ptmp, &ps, src);
    art_affine_point (&pd, &ptmp, src2);
    art_affine_to_string (str, src2);
    printf ("src2 = %s\n", str);
    printf ("point (%g, %g) -> (%g, %g) -> (%g, %g)\n",
            ps.x, ps.y, ptmp.x, ptmp.y, pd.x, pd.y);
    art_affine_multiply (dst, src, src2);
    art_affine_to_string (str, dst);
    printf ("dst = %s\n", str);
    art_affine_point (&pd, &ps, dst);
    printf ("point (%g, %g) -> (%g, %g)\n",
            ps.x, ps.y, pd.x, pd.y);

}