G'day guys,
Whenever I have needed to transform a vector Illustration along a perspective I've had to go through the horrible process of:
- importing my svg as paths into gimp - exporting and opening in inkscape - re-drawing all colours, stroke preferences and gradients to suit the new angle. with the transformed rasterisation from gimp as a reference..
free-transform is a feature that I and no doubt many more artists are desperate for within inkscape. Without it creates a limit to the range of artwork produceable from within inkscape
While i was visiting PJRM & NJH in melbourne I discussed this process and how it would be sweet if we could grab some of the gimp code to allow inkscape to do a perspective transform.
PJRM made an awesome modification a while ago where after transforming a group in some way, all ungrouped objects are no longer stuck with a transform matrix applied to each object. The location of all things are now converted into each shape's coords. So that now saves bloat and to my understanding also helped solve one massive problem with inkscape files being rendered in rsvg and transform matricies not being taken into account.
Below is a convo I had with neo on #gimp on irc.gimp.org.
when in melb NJH was eventually convinced that the method for perspective-transforming vectors could be borrowed from the gimps transform method. neo warned me that their transform method is completley different to the method described in the svg spec which is probably what inkscape uses.....
------------ Convo ---------------------
AndyFitz: hi is anyone here familiar with the freetransform code in gimp ( and how it relates to the paths code )
neo_: AndyFitz: what do you want to know?
neo_ is now known as neo
AndyFitz: neo, I'm wondering if its easy to extract the coord translation code for use inkscape ( currently anything I do that requires a perspective transform is done with gimp and imported svg paths then exported to paths again. )
mitch: AndyFitz: how do you do rotation and stuff?
neo: AndyFitz: huh?
neo: AndyFitz: inkscape got to have this code
mitch: AndyFitz: it's all the same in gimp, just matrix transforms. i'm pretty sure it's the same in inkscape
neo: AndyFitz: it's a prerequisite for implementing an SVG parser
AndyFitz: mitch, I rotate the object in inkscape.
neo: no, you apply a transform matrix
AndyFitz: yes you can apply a transform matrix within inkscape but it doesnt yet support free transforms .
mitch: huh?
neo: it is an SVG editor
mitch: you can apply a matrix, so you can do any transform
AndyFitz: in inkscape you can rotate skew stretch etc
neo: you can do exactly what's defined here: http://www.w3.org/TR/SVG/coords.html
neo: you can't do all the things the perspective tool can do
AndyFitz: not all of the svg spec is supported by inkscape yet
neo: it does non-affine transformations
neo: well, transforms are the most basic thing
neo: that's what you implement first
neo: but, as I said, you can't describe all possible transformations in SVG
yakk is now known as yakkGone
AndyFitz: yeah I'm only aware that gimp has code to apply the transform correctly.. right now the transform matrix is only partly implemented by inkscape
AndyFitz: theres no on-canvas way of doing this .. infact inkscape won't render svg with the appropriate transform matrix
neo: you don't seem to understand
neo: gimp does a projective transform
neo: that's a non-affine transformation
neo: which is not defined in SVG
neo: have a look at the transform matrices in SVG, the last row is always 0 0 1
neo: the transform matrix in inkscape is fully implemented, to the extent defined by SVG transformations
AndyFitz: sorry, yes you are right. I'm looking for a way to appropriately transform plain vectors not apply a transformation matrix
Tommer [~tomr@...702...] entered the room.
neo: where's the difference ?
neo: to transform a vector, you apply a transform matrix on it
neo: or rather, you apply it on each point
neo: transforming a path in gimp boils down to calling gimp_matrix3_transform_point() on each of the anchor points
neo: whatever transformation you are doing, doesn't matter
neo: even if a flip is implemented that way
neo: s/if//
AndyFitz: so are the svg spec transform matrix features different to those in the gimp transform matrix ?
AndyFitz: damn I gotta go
AndyFitz: thanks for the great info neo & mitch
neo: AndyFitz: yes, and I already explained you how they are different
AndyFitz: neo yes and I'm totally clueless as to what needs to be done with inkscapes code. thanks for letting me know about gimp_matrix3_transform_point()
AndyFitz: will discuss this on inkscape mailing list and see where we should go
AndyFitz: thanks again, seeya
neo: you can't do what you want to do
neo: you wouldn't be able to save the result to SVG
AndyFitz: hopefully we can with a bit of abstraction. we don't have to work straight to svg only make sure the end result is valid svg. while applying the transform it could be doing anything ... well I hope but its good to have a reality check
neo: AndyFitz: I suggest you read a little about affine and non-affine transformations