Bob Jamison wrote:
Also note that the coordinates were flipped in the Y-direction, so I fixed it manually.
I fixed this, I think. I think the general trick of: 1) flipping in Y 2) shifting by document height 3) scaling to ODF's cm-units ...will work in general.
NR::Matrix tf = sp_item_i2d_affine(item); NR::Rect bbox = sp_item_bbox_desktop(item);
//Flip Y into document coordinates double doc_Height = sp_document_height(SP_ACTIVE_DOCUMENT); NR::Matrix doc2dt_tf = NR::Matrix(NR::scale(1, -1)); doc2dt_tf = doc2dt_tf * NR::Matrix(NR::translate(0, doc_height)); tf = tf * doc2dt_tf; bbox = bbox * doc2dt_tf;
double x = pxToCm * bbox.min()[NR::X]; double y = pxToCm * bbox.min()[NR::Y]; double width = pxToCm * ( bbox.max()[NR::X] - bbox.min()[NR::X] ); double height = pxToCm * ( bbox.max()[NR::Y] - bbox.min()[NR::Y] );
4) And apply this transform to all of the points of an SPCurve.
The bounding box and point sets both must be done, because of the silly requirement in ODF that everything sits on its own rectangular frame.
Anyway, here is the first build to have this at least partially working: http://inkscape.modevia.com/win32-snap/Inkscape0604141337.zip
bob