Home
Categories
Dictionary
Download
Project Details
FAQ
License

SVGImageRegion



The SVGImage is a Group class. As a Group has no size by itself, it can not be integrated efficiently in a Layout containers (such as a BorderPane)[1]
a Group is not directly resizable
.

To overcomme this problem and allow to integrate a SVGImage in a Layout container, you can use the SVGImage.createRegion() which will create a SVGImageRegion wrapping the SVGImage.

As the SVGImageRegion is a Region, it can be resized and be fully integrated in a Layout container.

Image conformity

The only specific method of the SVGImageRegion is the SVGImageRegion.setConform(boolean) which allow to force the result of the resize to always keep the SVH Image conform (by default the conformity of the result will not be enforced).

Example

The following example integrates the SVGImage in a BorderPane. The SVGImage will shrink or expand when the stage is resized:
   SVGImage svgImg = SVGLoader.load(<my SVG file>);
   SVGImageRegion region = svgImg.createRegion();
   BorderPane borderPane = new BorderPane();
   borderPane.setCenter(region);
   stage.setScene(new Scene(borderPane, 300, 250));
   stage.show();   

Notes

  1. ^ a Group is not directly resizable

See also


Categories: fromsvg

Copyright 2021-2022 Herve Girod. All Rights Reserved. Documentation and source under the BSD-3-Clause License