Class GraphicsResetHelper

  • All Implemented Interfaces:
    Output.SafeState

    public class GraphicsResetHelper
    extends java.lang.Object
    implements Output.SafeState
    A utility class that holds a Graphics2D 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.

    • 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()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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
    • Constructor Detail

      • GraphicsResetHelper

        public GraphicsResetHelper​(@NotNull
                                   @NotNull java.awt.Graphics2D graphics)
    • Method Detail

      • graphics

        @NotNull
        public @NotNull java.awt.Graphics2D graphics()