weisJ/jsvg

Rendering to BufferedImage example

JohnCaboose opened this issue · 1 comments

Hello, you mention in the README that you can "render to a BufferedImage". Can you include a code example for this? You seem to require a reference to a JComponent for the render methods and I don't understand how I can get a BufferedImage object without it.

My purpose would ultimately be to get an ImageIcon that simply takes the BufferedImage as a constructor parameter. Thanks for your time and attention.

weisJ commented

The JComponent parameter is indicated as a nullable parameter:

public void render(@Nullable JComponent component, @NotNull Graphics2D g) {

Henc you can simply pass null to it.