You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey Angus, me again, here's what your help for Img32.Fmt.SVG says:
If you need an image rendered at the SVG image's native size, then make sure the TImage32 object is empty (ie zero width and height) before calling its load method.
Unfortunately I couldn't get this to work as announced, the image was always created in (defaultSvgWidth, defaultSvgHeight). After taking a look at your code I figured out that there couldn't be a proper solution unless checking for both the img32 object and the viewbox being empty, so here's the code I'm now using on lines 395/396 in Img32.Fmt.SVG:
if **r.IsEmpty and** img32.IsEmpty then
img32.SetSize(defaultSvgWidth, defaultSvgHeight);
I hope I didn't get anything wrong, if so please correct me ...
img32.BeginUpdate;
try
if img32.IsEmpty and not r.IsEmpty then
img32.SetSize(Round(r.Width), Round(r.Height))
else if not r.IsEmpty then
begin
//then scale the SVG to fit image
w := r.Width;
h := r.Height;
sx := img32.Width / w;
sy := img32.Height / h;
if sy < sx then sx := sy;
if not(SameValue(sx, 1, 0.00001)) then
begin
w := w * sx;
h := h * sx;
end;
img32.SetSize(Round(w), Round(h));
end
else
img32.SetSize(defaultSvgWidth, defaultSvgHeight);
//draw the SVG image to fit inside the canvas
DrawImage(img32, True);
finally
img32.EndUpdate;
end;
Hey Angus, me again, here's what your help for Img32.Fmt.SVG says:
Unfortunately I couldn't get this to work as announced, the image was always created in (defaultSvgWidth, defaultSvgHeight). After taking a look at your code I figured out that there couldn't be a proper solution unless checking for both the img32 object and the viewbox being empty, so here's the code I'm now using on lines 395/396 in Img32.Fmt.SVG:
I hope I didn't get anything wrong, if so please correct me ...
--
PGP Key ID (RSA 2048): 0xC45D831B
IERenderer's Home https://www.pmpgp.de/renderer/History.htm
S/MIME Fingerprint: 94C6B471 0C623088 A5B27701 742B8666 3B7E657C
The text was updated successfully, but these errors were encountered: