Yes, I read W3 specifications and representations for C and A command but, I try to make a Borland Delphi (pascal) code to draw a svg file source in windows canvas.
I have not the source code from pascal library I use for drawing so, I need make some changes to svg original rect data for use in my code. The pascal library have not a good function for draw a round rectangle with transformation matrix, for that, I need convert a round rectangle with transformation applied to the path data. Scenario: The pascal library have a function for to apply a transformation matrix to the path data but, don´t have a equivalent function for rounded rectangle so, I need convert rounded rectangle to a path equivalent data for apply the transformation. The same problem I have with A command, the library don´t draw A command correctly, the better way is the C command. I know how to convert squard rectangle to C command, no problem but, my principal problem is calc the control points from two reference points and correspond x and y radious. I read many info about use of tangent and angle calculations for get the intermediate control points but, there is not a good example for make a calculations step by step with sample data. Your reference is very good for another aproach I have, my investigation continue... many thanks, best regards. --- In [email protected], "ddailey" <ddai...@...> wrote: > > Well, it's not real easy to explain but I'd suggest reading the parts of the > C and A subcommands of <path> at > http://www.w3.org/Graphics/SVG/IG/resources/svgprimer.html#path > > The inkscape code seems to be an approximation to what it really is. What I > think a rounded rect really is a path that moves > linearly to the right sorta like this > M 10,0 L 90 0 > and then it arcs down to the right and ending up at 100, 10 sorta like this > A 10 10 0 0 1 100 10 > and then it repeats that for each of the four rounded corners. I've used > integers instead of crazy-bignums since finite integers have such a nice feel > to them > > Here's something that turns the first two corners for you: > <svg xmlns="http://www.w3.org/2000/svg" > xmlns:xlink="http://www.w3.org/1999/xlink" > width="100%" height="100%" viewBox="-10 -10 200 200" > > > <path d="M 10,0 L 90 0 A 10 10 0 0 1 100 10 > L 100 90 A 10 10 0 0 1 90 100 > " > stroke="red" stroke-width="4"/> > </svg> > > Draw it out on graph paper and you should be able to see what's going on. The > Inkscape code seems to use the fact that cubic beziers are pretty good > approximations to most curves including elliptical arcs. But since <path> > already owns elliptical arcs, why do it that way when you can do it a better > and easier way? The only hassle with elliptical arcs is that there are a few > different ones between two given points as the illustration in the book > points out. > > hope this helps > David > > ----- Original Message ----- > From: fi...@... > To: [email protected] > Sent: Wednesday, October 20, 2010 7:46 AM > Subject: [svg-developers] How to convert svg rect to path > > > > Anybody can help me with svg rect convertion to svg path? I need know the > steps to convert rect parameters to path commands. > > Example, I have: > > rect: > height 2.8569181 > width 90.898613 > x 20.280216 > y 838.27399 > rx 0.9670065 > ry 1.2499017 > > Inkscape make this: > > m 21.247223,838.27399 88.964597,0 c 0.53572,0 0.96701,0.55745 > 0.96701,1.2499 l 0,0.35711 c 0,0.69245 -0.43129,1.2499 -0.96701,1.2499 l > -88.964597,0 c -0.535722,0 -0.967007,-0.55745 -0.967007,-1.2499 l 0,-0.35711 > c 0,-0.69245 0.431285,-1.2499 0.967007,-1.2499 z > > My problem is with c command control points. > > Best regards. > > > > > > [Non-text portions of this message have been removed] > ------------------------------------ ----- To unsubscribe send a message to: [email protected] -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ----Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/svg-developers/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/svg-developers/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

