Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preserveAspectRatio is not supported #22

Closed
gabelerner opened this issue Dec 7, 2014 · 7 comments
Closed

preserveAspectRatio is not supported #22

gabelerner opened this issue Dec 7, 2014 · 7 comments
Labels

Comments

@gabelerner
Copy link
Member

From codedr...@gmail.com on April 04, 2010 18:16:09

should render a blue circle. canvg renders a blue ellipse.

Original issue: http://code.google.com/p/canvg/issues/detail?id=22

@gabelerner
Copy link
Member Author

From gabelerner@gmail.com on April 04, 2010 16:27:00

Let's discuss since I believe that I implemented viewBox correctly per the spec
( http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute ). svg has a "width" and
"height" property which determine the canvas size. if not provided, you can fake them
on the test page (1000,600 by default) using the boxes. if in this example you set the
width/height property to 400,400 then you will get a circle. otherwise it does the
"stretch to fit" described in the spec. so either type width="600" height="600" into
the svg element or put 600,600 into the text boxes and you should see a circle.

p.s. cool android.svg :)

@gabelerner
Copy link
Member Author

From codedr...@gmail.com on April 04, 2010 16:30:05

ah, I believe you are right, this is really about preserveAspectRatio, see http://www.w3.org/TR/SVG/coords.html#PreserveAspectRatioAttribute since the default
value for preserveAspectRatio is midXMidY.

Take a look at the image in any browser (other than IE9)

Summary: preserveAspectRatio is not supported

@gabelerner
Copy link
Member Author

From gabelerner@gmail.com on April 04, 2010 16:32:42

got it, thanks for the clarification! will add matrix transforms first (might refactor
that whole section) then look at this eventually so grab it if you want (set status to
started if you do).

@gabelerner
Copy link
Member Author

From gabelerner@gmail.com on April 06, 2010 12:17:10

I'm made some decent progress on this yesterday night and today during lunch. I have
to support nested svg's and changing view ports which is taking a while but I'm close
to have the smiley face example working. Should be checked in tonight.

Status: Started
Owner: gabelerner

@gabelerner
Copy link
Member Author

From codedr...@gmail.com on April 06, 2010 12:21:08

Excellent news - you move fast!

@gabelerner
Copy link
Member Author

From gabelerner@gmail.com on April 06, 2010 23:34:21

finally fixed in r37 check out the last example on the test page (same exact svg as in spec) and let me know
if you see any regressions!

Status: Fixed

@pasestars
Copy link

I render a circle image using pattern, but it render not right.
<svg width="500" height="500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <pattern viewBox="0 0 1 1" patternContentUnits="objectBoundingBox" width="100%" height="100%" id="pattern"> <image id="svg_4" xlink:href="https://i.ibb.co/31PYDX5/maou.jpg" preserveAspectRatio="xMidYMid slice" width="1" height="1"/> </pattern> </defs> <circle id="sd" r="100" cy="100" cx="100" fill="url(#pattern)" /> </svg>
example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants