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"
19 Geom::Matrix const sp_desktop_dt2doc_affine (SPDesktop const *dt)
20 {
21 return dt->doc2dt().inverse();
22 }
24 Geom::Point sp_desktop_dt2doc_xy_point(SPDesktop const *dt, Geom::Point const p)
25 {
26 return p * sp_desktop_dt2doc_affine(dt);
27 }
29 #if 0
30 Geom::Matrix const sp_desktop_root2dt_affine (SPDesktop const *dt)
31 {
32 SPRoot const *root = SP_ROOT(SP_DOCUMENT_ROOT(dt->doc()));
33 return root->c2p * dt->doc2dt();
34 }
36 Geom::Matrix const sp_desktop_dt2root_affine (SPDesktop const *dt)
37 {
38 return sp_desktop_root2dt_affine(dt).inverse();
39 }
41 Geom::Point sp_desktop_root2dt_xy_point(SPDesktop const *dt, Geom::Point const p)
42 {
43 return p * sp_desktop_root2dt_affine(dt);
44 }
46 Geom::Point sp_desktop_dt2root_xy_point(SPDesktop const *dt, Geom::Point const p)
47 {
48 return p * sp_desktop_dt2root_affine(dt);
49 }
50 #endif