I have EMF import now mostly working when there are images present, at least for a first pass. Trying to get the reciprocal operation going, which means this needs to be implemented:
unsigned int PrintEmfWin32::image(Inkscape::Extension::Print * /*module*/,
unsigned char *px,
unsigned int w,
unsigned int h,
unsigned int rs,
Geom::Affine const &transform,
SPStyle const *style)
This method is working also, but only to the extent that all images found are written in one corner of the EMF. w,h passed in are the size of the image in pixels, but its bounding box information is obviously not directly on the parameter list. My guess is that it is somewhere under SPObject, for which there is a link inside SPStyle. Or is it through the transform? In any case, poked around for 15 minutes and could not find it.
By the way, does anybody actually read this subforum? Questions asked here are rarely answered. Is there a more appropriate place to ask programming questions? Not post bugs, but just general questions about how the code is organized?
Thanks.
Where in an SPObject is the bounding box???
Re: Where in an SPObject is the bounding box???
Well, I found a way to do this, but I'm not sure how kosher it is.
Apparently this pulls the fields out of the XML somehow. It has the distinct advantage that one can look at the SVG file with a text editor, find the object in question, and see immediately what all of its fields are.
Code: Select all
double x1,x2,y1,y2;
x1= atof(style->object->getAttribute("x"));
y1= atof(style->object->getAttribute("y"));
x2=x1 + atof(style->object->getAttribute("width"));
y2=y1 + atof(style->object->getAttribute("height"));
Apparently this pulls the fields out of the XML somehow. It has the distinct advantage that one can look at the SVG file with a text editor, find the object in question, and see immediately what all of its fields are.