Package snap.swing

Class J2DPainter

java.lang.Object
snap.gfx.Painter
snap.swing.J2DPainter

public class J2DPainter extends Painter
A Painter implementation that uses Java2D (Graphics2D).
  • Constructor Details

    • J2DPainter

      public J2DPainter(Graphics aGr)
      Creates a new J2DPainter.
  • Method Details

    • getPaint

      public Paint getPaint()
      Returns the current paint.
      Specified by:
      getPaint in class Painter
    • setPaint

      public void setPaint(Paint aPaint)
      Sets the paint in painter.
      Specified by:
      setPaint in class Painter
    • getStroke

      public Stroke getStroke()
      Returns the current stroke.
      Specified by:
      getStroke in class Painter
    • setStroke

      public void setStroke(Stroke aStroke)
      Sets the stroke in painter.
      Specified by:
      setStroke in class Painter
    • getOpacity

      public double getOpacity()
      Returns the opacity.
      Specified by:
      getOpacity in class Painter
    • setOpacity

      public void setOpacity(double aValue)
      Sets the opacity in painter.
      Specified by:
      setOpacity in class Painter
    • getComposite

      public Painter.Composite getComposite()
      Returns the Composite.
      Overrides:
      getComposite in class Painter
    • setComposite

      public void setComposite(Painter.Composite aComp)
      Sets the composite mode.
      Overrides:
      setComposite in class Painter
    • getFont

      public Font getFont()
      Returns the current font.
      Specified by:
      getFont in class Painter
    • setFont

      public void setFont(Font aFont)
      Sets the font in painter.
      Specified by:
      setFont in class Painter
    • clearRect

      public void clearRect(double aX, double aY, double aW, double aH)
      Clears a rect.
      Overrides:
      clearRect in class Painter
    • draw

      public void draw(Shape aShape)
      Draws a shape in painter.
      Specified by:
      draw in class Painter
    • fill

      public void fill(Shape aShape)
      Fills a shape in painter.
      Specified by:
      fill in class Painter
    • drawImage

      public void drawImage(Image anImg, Transform xform)
      Draw image with transform.
      Overrides:
      drawImage in class Painter
    • drawImage

      public void drawImage(Image img, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh)
      Draw image in rect.
      Specified by:
      drawImage in class Painter
    • drawString

      public void drawString(String aStr, double aX, double aY, double cs)
      Draw string at location.
      Overrides:
      drawString in class Painter
    • getStringBounds

      public Rect getStringBounds(String aStr)
      Return string bounds.
    • getTransform

      public Transform getTransform()
      Returns the current transform.
      Specified by:
      getTransform in class Painter
    • setTransform

      public void setTransform(Transform aTrans)
      Sets the current transform.
      Specified by:
      setTransform in class Painter
    • transform

      public void transform(Transform aTrans)
      Transform painter.
      Specified by:
      transform in class Painter
    • getClip

      public Shape getClip()
      Return clip shape.
      Specified by:
      getClip in class Painter
    • clip

      public void clip(Shape s)
      Clip by shape.
      Specified by:
      clip in class Painter
    • isAntialiasing

      public boolean isAntialiasing()
      Returns whether antialiasing.
    • setAntialiasing

      public boolean setAntialiasing(boolean aValue)
      Sets whether antialiasing.
      Overrides:
      setAntialiasing in class Painter
    • isAntialiasingText

      public boolean isAntialiasingText()
      Returns whether antialiasing.
    • setAntialiasingText

      public boolean setAntialiasingText(boolean aValue)
      Sets whether antialiasing.
    • isFractionalTextMetrics

      public boolean isFractionalTextMetrics()
      Returns whether using fractional text metrics.
    • setFractionalMetrics

      public boolean setFractionalMetrics(boolean aValue)
      Sets whether using fractional text metrics.
    • setImageQuality

      public void setImageQuality(double aValue)
      Sets image rendering quality.
      Overrides:
      setImageQuality in class Painter
    • setStrokePure

      public void setStrokePure(boolean aValue)
      Sets whether stroke is rounded to nearest pixel.
      Overrides:
      setStrokePure in class Painter
    • save

      public void save()
      Standard clone implementation.
      Specified by:
      save in class Painter
    • restore

      public void restore()
      Disposes of the painter.
      Specified by:
      restore in class Painter
    • getNative

      public Graphics2D getNative()
      Returns the Graphics.
      Overrides:
      getNative in class Painter