Class Graphics2DOutput

  • All Implemented Interfaces:
    Output

    public class Graphics2DOutput
    extends java.lang.Object
    implements Output
    • Nested Class Summary

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.awt.Graphics2D g  
    • Constructor Summary

      Constructors 
      Constructor Description
      Graphics2DOutput​(@NotNull java.awt.Graphics2D g)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void applyClip​(@NotNull java.awt.Shape clipShape)  
      void applyOpacity​(float opacity)  
      void applyTransform​(@NotNull java.awt.geom.AffineTransform transform)  
      @NotNull java.awt.geom.Rectangle2D clipBounds()  
      java.util.Optional<java.lang.Float> contextFontSize()  
      @NotNull Output createChild()  
      float currentOpacity()  
      void debugPaint​(@NotNull java.util.function.Consumer<java.awt.Graphics2D> painter)  
      void dispose()  
      void drawImage​(@NotNull java.awt.image.BufferedImage image)  
      void drawImage​(@NotNull java.awt.Image image, @NotNull java.awt.geom.AffineTransform at, @Nullable java.awt.image.ImageObserver observer)  
      void drawImage​(@NotNull java.awt.Image image, @Nullable java.awt.image.ImageObserver observer)  
      void drawShape​(@NotNull java.awt.Shape shape)  
      void fillShape​(@NotNull java.awt.Shape shape)  
      @NotNull java.awt.Graphics2D graphics()  
      boolean hasMaskedPaint()  
      @Nullable java.lang.Object renderingHint​(@NotNull java.awt.RenderingHints.Key key)  
      @NotNull java.awt.RenderingHints renderingHints()  
      void rotate​(double angle)  
      @NotNull Output.SafeState safeState()  
      void scale​(double sx, double sy)  
      void setClip​(@Nullable java.awt.Shape shape)  
      void setPaint​(@NotNull Provider<java.awt.Paint> paintProvider)
      Set the paint used for the output.
      void setPaint​(@NotNull java.awt.Paint paint)  
      void setRenderingHint​(@NotNull java.awt.RenderingHints.Key key, @Nullable java.lang.Object value)  
      void setStroke​(@NotNull java.awt.Stroke stroke)  
      void setTransform​(@NotNull java.awt.geom.AffineTransform affineTransform)  
      @NotNull java.awt.Stroke stroke()  
      boolean supportsColors()  
      boolean supportsFilters()  
      @NotNull java.awt.geom.AffineTransform transform()  
      void translate​(double dx, double dy)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • g

        private final java.awt.Graphics2D g
    • Constructor Detail

      • Graphics2DOutput

        public Graphics2DOutput​(@NotNull
                                @NotNull java.awt.Graphics2D g)
    • Method Detail

      • graphics

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

        public void fillShape​(@NotNull
                              @NotNull java.awt.Shape shape)
        Specified by:
        fillShape in interface Output
      • drawShape

        public void drawShape​(@NotNull
                              @NotNull java.awt.Shape shape)
        Specified by:
        drawShape in interface Output
      • drawImage

        public void drawImage​(@NotNull
                              @NotNull java.awt.image.BufferedImage image)
        Specified by:
        drawImage in interface Output
      • drawImage

        public void drawImage​(@NotNull
                              @NotNull java.awt.Image image,
                              @Nullable
                              @Nullable java.awt.image.ImageObserver observer)
        Specified by:
        drawImage in interface Output
      • drawImage

        public void drawImage​(@NotNull
                              @NotNull java.awt.Image image,
                              @NotNull
                              @NotNull java.awt.geom.AffineTransform at,
                              @Nullable
                              @Nullable java.awt.image.ImageObserver observer)
        Specified by:
        drawImage in interface Output
      • setPaint

        public void setPaint​(@NotNull
                             @NotNull java.awt.Paint paint)
        Specified by:
        setPaint in interface Output
      • setPaint

        public void setPaint​(@NotNull
                             @NotNull Provider<java.awt.Paint> paintProvider)
        Description copied from interface: Output
        Set the paint used for the output. Use this version if computing the paint is expensive. Outputs which don't support paints can avoid the computation.
        Specified by:
        setPaint in interface Output
        Parameters:
        paintProvider - The paint provider.
      • setStroke

        public void setStroke​(@NotNull
                              @NotNull java.awt.Stroke stroke)
        Specified by:
        setStroke in interface Output
      • stroke

        @NotNull
        public @NotNull java.awt.Stroke stroke()
        Specified by:
        stroke in interface Output
      • applyClip

        public void applyClip​(@NotNull
                              @NotNull java.awt.Shape clipShape)
        Specified by:
        applyClip in interface Output
      • setClip

        public void setClip​(@Nullable
                            @Nullable java.awt.Shape shape)
        Specified by:
        setClip in interface Output
      • contextFontSize

        public java.util.Optional<java.lang.Float> contextFontSize()
        Specified by:
        contextFontSize in interface Output
      • dispose

        public void dispose()
        Specified by:
        dispose in interface Output
      • debugPaint

        public void debugPaint​(@NotNull
                               @NotNull java.util.function.Consumer<java.awt.Graphics2D> painter)
        Specified by:
        debugPaint in interface Output
      • clipBounds

        @NotNull
        public @NotNull java.awt.geom.Rectangle2D clipBounds()
        Specified by:
        clipBounds in interface Output
      • renderingHints

        @NotNull
        public @NotNull java.awt.RenderingHints renderingHints()
        Specified by:
        renderingHints in interface Output
      • renderingHint

        @Nullable
        public @Nullable java.lang.Object renderingHint​(@NotNull java.awt.RenderingHints.Key key)
        Specified by:
        renderingHint in interface Output
      • setRenderingHint

        public void setRenderingHint​(@NotNull java.awt.RenderingHints.Key key,
                                     @Nullable
                                     @Nullable java.lang.Object value)
        Specified by:
        setRenderingHint in interface Output
      • transform

        @NotNull
        public @NotNull java.awt.geom.AffineTransform transform()
        Specified by:
        transform in interface Output
      • setTransform

        public void setTransform​(@NotNull
                                 @NotNull java.awt.geom.AffineTransform affineTransform)
        Specified by:
        setTransform in interface Output
      • applyTransform

        public void applyTransform​(@NotNull
                                   @NotNull java.awt.geom.AffineTransform transform)
        Specified by:
        applyTransform in interface Output
      • rotate

        public void rotate​(double angle)
        Specified by:
        rotate in interface Output
      • scale

        public void scale​(double sx,
                          double sy)
        Specified by:
        scale in interface Output
      • translate

        public void translate​(double dx,
                              double dy)
        Specified by:
        translate in interface Output
      • applyOpacity

        public void applyOpacity​(float opacity)
        Specified by:
        applyOpacity in interface Output
      • hasMaskedPaint

        public boolean hasMaskedPaint()
        Specified by:
        hasMaskedPaint in interface Output
      • supportsColors

        public boolean supportsColors()
        Specified by:
        supportsColors in interface Output