From 179fa413b047bede6e32109e2ce82437c5fb8d34 Mon Sep 17 00:00:00 2001 From: MenTaLguY Date: Mon, 16 Jan 2006 02:36:01 +0000 Subject: moving trunk for module inkscape (bzr r1) --- src/desktop-affine.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/desktop-affine.cpp (limited to 'src/desktop-affine.cpp') diff --git a/src/desktop-affine.cpp b/src/desktop-affine.cpp new file mode 100644 index 000000000..7ad2c7bfe --- /dev/null +++ b/src/desktop-affine.cpp @@ -0,0 +1,40 @@ +#define __SP_DESKTOP_AFFINE_C__ + +/* + * Editable view and widget implementation + * + * Author: + * Lauris Kaplinski + * + * Copyright (C) 1999-2002 Lauris Kaplinski + * Copyright (C) 2000-2001 Ximian, Inc. + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "desktop.h" +#include "document.h" +#include "sp-root.h" +#include "libnr/nr-matrix-ops.h" + +NR::Matrix const sp_desktop_root2dt_affine (SPDesktop const *dt) +{ + SPRoot const *root = SP_ROOT(SP_DOCUMENT_ROOT(dt->doc())); + return root->c2p * dt->doc2dt(); +} + +NR::Matrix const sp_desktop_dt2root_affine (SPDesktop const *dt) +{ + return sp_desktop_root2dt_affine(dt).inverse(); +} + +NR::Point sp_desktop_root2dt_xy_point(SPDesktop const *dt, NR::Point const p) +{ + return p * sp_desktop_root2dt_affine(dt); +} + +NR::Point sp_desktop_dt2root_xy_point(SPDesktop const *dt, NR::Point const p) +{ + return p * sp_desktop_dt2root_affine(dt); +} + -- cgit v1.2.3