Package com.github.weisj.jsvg.util
Class GraphicsResetHelper
- java.lang.Object
-
- com.github.weisj.jsvg.util.GraphicsResetHelper
-
- All Implemented Interfaces:
Output.SafeState
public class GraphicsResetHelper extends java.lang.Object implements Output.SafeState
A utility class that holds aGraphics2D
object and is able to reset it back to its original configuration, as this is often more efficient than creating a new graphics instance.This class does not track what parameters have been modified, nor does it reset all configuration parameters. Which parameters are reset should be expanded as needed.
-
-
Field Summary
Fields Modifier and Type Field Description private java.awt.Graphics2D
graphics
private java.awt.Composite
originalComposite
private java.awt.Paint
originalPaint
private java.awt.Stroke
originalStroke
private java.awt.geom.AffineTransform
originalTransform
-
Constructor Summary
Constructors Constructor Description GraphicsResetHelper(@NotNull java.awt.Graphics2D graphics)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull java.awt.Graphics2D
graphics()
void
restore()
-
-
-
Field Detail
-
graphics
private final java.awt.Graphics2D graphics
-
originalComposite
private final java.awt.Composite originalComposite
-
originalPaint
private final java.awt.Paint originalPaint
-
originalStroke
private final java.awt.Stroke originalStroke
-
originalTransform
private final java.awt.geom.AffineTransform originalTransform
-
-
Method Detail
-
graphics
@NotNull public @NotNull java.awt.Graphics2D graphics()
-
restore
public void restore()
- Specified by:
restore
in interfaceOutput.SafeState
-
-