
-----Original Message----- From: Engelen, J.B.C. (Johan) Sent: woensdag 6 augustus 2008 22:10 To: inkscape-devel@lists.sourceforge.net Subject: RE: [Inkscape-devel] mass conversion to Geom::Point
I could really use some help with this. Please help converting NR:: to Geom:: for the following types:
NR::Point => Geom::Point NR::Matrix => Geom::Matrix NR::scale => Geom::Scale NR::translate => Geom::Translate NR::rotate => Geom::Rotate NR::Rect => Geom::Rect NR::Coord => Geom::Coord NR::Dim2 => Geom::Dim2 and perhaps some other types as well. (*not* NR::IRect, NR::Filter*)
I use the attached script. (replaces 'NR::' with 'Geom::') I tweak it a bit to then convert some things back to NR. (like Geom::Filter back to NR::Filter)
The conversion work is pretty simple (read: dumb) work. Run the script, then try to compile and fix all errors that pop up. Usually fixing an error involves adding the right include files, or adding to_2geom or from_2geom. Note the capital for scale, translate and rotate (the Geom::Scale and friends are found in <2geom/transforms.h>
Often it is not needed to add to_2geom/from_2geom, so please don't! The conversion goes automatically between NR::Point <=> Geom::Point and NR::Matrix <=> Geom::Matrix. Only ambiguities need a little more guideance: void some_function(NR::Point nr) Geom::Point geom; Geom::Point ambiguous = nr - geom;
Possible fix:
Geom::Point ambiguous = to_2geom(nr) - geom;
But, if the type of nr changes to Geom::Point, we have to edit this line again to remove the "to_2geom". So it is better to do:
Geom::Point ambiguous = (Geom::Point)nr - geom;
Thanks!
Johan