Skip to content

Need to calculate viewboxWH (width/height) after loading svg image #133

Closed
@carloBarazzetta

Description

@carloBarazzetta

Hello, at 6 Jan 2025 I need to change my code of Image32SVGFactory from:
vbox := fSvgReader.RootElement.GetViewbox;
to
vbox := fSvgReader.RootElement.viewboxWH;
because GetViewbox was removed from source of Img32.SVG.Reader, but it is also mentioned in a comment line... ;-)

Now the problem is that, after loading an svg file RootElement.viewboxWH is not initialized, so I need to make a change to source code of Img32.SVG.Reader adding a new public method "CalcViewBoxOfRootElement" like this:

procedure TSvgReader.CalcViewBoxOfRootElement;
begin
  fRootElement.viewboxWH.Width := fRootElement.elRectWH.width.GetValue(defaultSvgWidth, 0);
  fRootElement.viewboxWH.height := fRootElement.elRectWH.height.GetValue(defaultSvgHeight, 0);
end;

Or something else that give me a chance to read the viewbox size, after loading file stream or source stream...
Thanks....
Carlo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions