Created
October 12, 2017 15:17
-
-
Save grkvlt/aa385d50d6d08260bb1e6a65555519ec to your computer and use it in GitHub Desktop.
Exploring Iterated Function Systems
This file contains hidden or 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
/** Perform an {@link Consumer action} with a disposable {@link Graphics2D graphics context}. */ | |
public static void context(BiConsumer<Throwable,String> handler, | |
Graphics graphics, Consumer<Graphics2D> action) { | |
Graphics2D g = (Graphics2D) graphics.create(); | |
try { | |
action.accept(g); | |
} catch (Throwable t) { | |
handler.accept(t, "Error executing graphics context action"); | |
} finally { | |
g.dispose(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment