Code

Make all tools consider full parent transform (up to document, not just up to root)
[inkscape.git] / src / desktop-affine.cpp
1 #define __SP_DESKTOP_AFFINE_C__
3 /*
4  * Editable view and widget implementation
5  *
6  * Author:
7  *   Lauris Kaplinski <lauris@kaplinski.com>
8  *
9  * Copyright (C) 1999-2002 Lauris Kaplinski
10  * Copyright (C) 2000-2001 Ximian, Inc.
11  *
12  * Released under GNU GPL, read the file 'COPYING' for more information
13  */
15 #include "desktop.h"
16 //#include "document.h"
17 //#include "sp-root.h"
18 //#include "libnr/nr-matrix-ops.h"
20 Geom::Matrix const sp_desktop_dt2doc_affine (SPDesktop const *dt)
21 {
22     return dt->doc2dt().inverse();
23 }
25 Geom::Point sp_desktop_dt2doc_xy_point(SPDesktop const *dt, Geom::Point const p)
26 {
27     return p * sp_desktop_dt2doc_affine(dt);
28 }
30 #if 0
31 Geom::Matrix const sp_desktop_root2dt_affine (SPDesktop const *dt)
32 {
33         SPRoot const *root = SP_ROOT(SP_DOCUMENT_ROOT(dt->doc()));
34         return root->c2p * dt->doc2dt();
35 }
37 Geom::Matrix const sp_desktop_dt2root_affine (SPDesktop const *dt)
38 {
39         return sp_desktop_root2dt_affine(dt).inverse();
40 }
42 Geom::Point sp_desktop_root2dt_xy_point(SPDesktop const *dt, Geom::Point const p)
43 {
44         return p * sp_desktop_root2dt_affine(dt);
45 }
47 Geom::Point sp_desktop_dt2root_xy_point(SPDesktop const *dt, Geom::Point const p)
48 {
49         return p * sp_desktop_dt2root_affine(dt);
50 }
51 #endif