On Wed, 2014-02-12 at 12:54 -0800, mathog wrote:
On 12-Feb-2014 11:42, Tavmjong Bah wrote:
On Tue, 2014-02-11 at 11:19 -0800, mathog wrote:
On 11-Feb-2014 10:44, mathog wrote:
And LaTeX doesn't handle images at all... so I can't use LaTeX output to test changes to SPImage::print.
Which in this case has the upside that my changes could not have broken it!
Cairo seems to ignore this aspect stuff totally.
? I don't understand what you mean here. AFAICT Cairo (both interactive and cairo-renderer) is doing the correct thing.
I didn't say that well.
Class SPImage carries these 4 values around:
double sx, sy; double ox, oy;
These values already reflect the preserveAspectRatio settings when the image gets into SPImage::Print. So there is no need to put in cases for all the preserveAspectRatio settings in the print output because they have already been handled appropriately. Cairo doesn't use these 4 values, instead it calls calculatePreserveAspectRatio() during the output phase in sp_image_render() in cairo-renderer.cpp. In other words, it reinvents the wheel and repeats the aspect calculation. (I just checked this in the debugger for PDF output.)
The on-screen Cairo renderer does use sx, sy, ox, oy... via sp_image_update_canvas_image() which calls sp_image_update_arenaitem()
I think these 4 values are being set in SPViewBox::apply_viewbox(). Unless there is some execution path that bypasses that method, a possibility that at this point I have no way of excluding, no other section of the code should need to explicitly look at this->aspect_align.
They are being set from c2p (Geom::affine) which is calculated in apply_viewbox().
Our file output system is a complete mess. It's hard to figure out what is outputting what. And the lack of comments in the code isn't very helpful.
Yup.
There are two major kinds of lengths in SVG, those based on the bounding box of an object and those based on user units. The calculation of lengths that are defined as a percentage of the viewport (i.e user units) is not well supported in Inkscape. The easiest place to calculate them is in the sp-xxx classes. Bounding box percentages seemed to be calculated at a later point. I would like to eventually get all the lengths calculated in the sp-xxx classes. I think this makes sense as then we are not reinventing the wheel for each new renderer.
Tav