| Summary: | SVG images : add a parameter to control scaling of images | ||
|---|---|---|---|
| Product: | SDL_image | Reporter: | Sylvain <sylvain.becker> |
| Component: | misc | Assignee: | Sam Lantinga <slouken> |
| Status: | NEW --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | danintheshed |
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | All | ||
|
Description
Sylvain
2018-02-08 09:28:21 UTC
The current behaviour of SVG is a little odd, it seems to create the surface size based on the values defined in the svg files 'width' and 'height' parameters. e.g. <?xml version="1.0"?> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 30" preserveAspectRatio="none" width="240" height="120"> <clipPath id="s"> <path d="M0,0 v30 h60 v-30 z"/> </clipPath> <clipPath id="t"> <path d="M30,15 h30 v15 z v15 h-30 z h-30 v-15 z v-15 h30 z"/> </clipPath> <g clip-path="url(#s)"> <path d="M0,0 v30 h60 v-30 z" fill="#012169"/> <path d="M0,0 L60,30 M60,0 L0,30" stroke="#fff" stroke-width="6"/> <path d="M0,0 L60,30 M60,0 L0,30" clip-path="url(#t)" stroke="#C8102E" stroke-width="4"/> <path d="M30,0 v30 M0,15 h60" stroke="#fff" stroke-width="10"/> <path d="M30,0 v30 M0,15 h60" stroke="#C8102E" stroke-width="6"/> </g> </svg> The SVG file will load onto a surface that is 240x120 pixels, but the image of the flag it contains will only be 60x30 pixels I think a more useful default behaviour here would be to scale the flag's width to match the surface's width in the rasterize step. Unless I'm getting something wrong - I am loading at a remove via pygame. |