-
-
Save christianwimmer/470e350d719f212349492c1d6bf22af4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Graphics2DPlotter { | |
final SVGGraphics2D g2d = new SVGGraphics2D(...); | |
byte[] plotAsSVG(String function, double xmin, double xmax) { | |
... /* Use g2d instance for rendering. */ | |
} | |
} | |
class PlotterSingletonFeature implements Feature { | |
@Override | |
public void afterRegistration(AfterRegistrationAccess access) { | |
/* This code runs during image generation. */ | |
ImageSingletons.add(Graphics2DPlotter.class, new Graphics2DPlotter()); | |
} | |
} | |
/* At run time, look up the singleton object that was created during image generation. */ | |
ImageSingletons.lookup(Graphics2DPlotter.class).plotAsSVG(function, xmin, xmax); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment