Documentation of 'smile.plot.Graphics' Java class
Graphics
smile.plot

Class Graphics



  • public class Graphics
    extends java.lang.Object
    Graphics provides methods to draw graphical primitives in logical/mathematical coordinates. The mathematical coordinates are translated into Java2D coordinates based on suitiabel projection method. Both 2D and 3D shapes are supported.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void clearClip()
      Clear the restriction of the draw area.
      void clip()
      Restrict the draw area to the valid base coordinate space.
      void drawLine(double[]... coord)
      Draw poly line.
      void drawLineBaseRatio(double[]... coord)
      Draw poly line.
      void drawPoint(char dot, double... coord)
      Draw a dot with given pattern.
      void drawPoint(double... coord)
      Draw a dot.
      void drawPolygon(double[]... coord)
      Draw polygon.
      void drawRect(double[] topLeft, double[] rightBottom)
      Draw the outline of the specified rectangle.
      void drawRectBaseRatio(double[] topLeft, double[] rightBottom)
      Draw the outline of the specified rectangle.
      void drawText(java.lang.String label, double[] coord)
      Draw a string.
      void drawText(java.lang.String label, double rotation, double[] coord)
      Draw a string with given rotation angle.
      void drawText(java.lang.String label, double horizontalReference, double verticalReference, double[] coord)
      Draw a string with given reference point.
      void drawText(java.lang.String label, double horizontalReference, double verticalReference, double rotation, double[] coord)
      Draw a string with given reference point and rotation angle.
      void drawTextBaseRatio(java.lang.String label, double[] coord)
      Draw a string with given rotation angle.
      void drawTextBaseRatio(java.lang.String label, double rotation, double[] coord)
      Draw a string with given rotation angle.
      void drawTextBaseRatio(java.lang.String label, double horizontalReference, double verticalReference, double[] coord)
      Draw a string with given reference point.
      void drawTextBaseRatio(java.lang.String label, double horizontalReference, double verticalReference, double rotation, double[] coord)
      Draw a string with given reference point and rotation angle.
      void fillPolygon(double[]... coord)
      Fill polygon.
      void fillPolygon(float alpha, double[]... coord)
      Fill polygon.
      void fillRect(double[] topLeft, double[] rightBottom)
      Fill the specified rectangle.
      void fillRectBaseRatio(double[] topLeft, double[] rightBottom)
      Fill the specified rectangle.
      java.awt.Color getColor()
      Get the current color.
      java.awt.Font getFont()
      Get the current font.
      java.awt.Graphics2D getGraphics()
      Returns the Java2D graphics object.
      double[] getLowerBound()
      Returns the lower bounds of coordinate space.
      java.awt.Paint getPaint()
      Get the current paint object.
      java.awt.Stroke getStroke()
      Get the current stroke.
      double[] getUpperBound()
      Returns the upper bounds of coordinate space.
      void rotate(double x, double y)
      Rotate the 3D view based on the changes on mouse position.
      Graphics setColor(java.awt.Color color)
      Set the color.
      Graphics setFont(java.awt.Font font)
      Set the font.
      void setGraphics(java.awt.Graphics2D g2d)
      Set the Java2D graphics object.
      Graphics setPaint(java.awt.Paint paint)
      Set the paint object.
      Graphics setStroke(java.awt.Stroke stroke)
      Set the stroke.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getGraphics

        public java.awt.Graphics2D getGraphics()
        Returns the Java2D graphics object.
      • setGraphics

        public void setGraphics(java.awt.Graphics2D g2d)
        Set the Java2D graphics object.
      • getLowerBound

        public double[] getLowerBound()
        Returns the lower bounds of coordinate space.
      • getUpperBound

        public double[] getUpperBound()
        Returns the upper bounds of coordinate space.
      • getFont

        public java.awt.Font getFont()
        Get the current font.
      • setFont

        public Graphics setFont(java.awt.Font font)
        Set the font.
      • getColor

        public java.awt.Color getColor()
        Get the current color.
      • setColor

        public Graphics setColor(java.awt.Color color)
        Set the color.
      • getPaint

        public java.awt.Paint getPaint()
        Get the current paint object.
      • setPaint

        public Graphics setPaint(java.awt.Paint paint)
        Set the paint object.
      • getStroke

        public java.awt.Stroke getStroke()
        Get the current stroke.
      • setStroke

        public Graphics setStroke(java.awt.Stroke stroke)
        Set the stroke.
      • clip

        public void clip()
        Restrict the draw area to the valid base coordinate space.
      • clearClip

        public void clearClip()
        Clear the restriction of the draw area.
      • drawText

        public void drawText(java.lang.String label,
                             double[] coord)
        Draw a string. Reference point is the center of string. The coordinates are logical coordinates.
      • drawText

        public void drawText(java.lang.String label,
                             double rotation,
                             double[] coord)
        Draw a string with given rotation angle. Reference point is the center of string. The coordinates are logical coordinates. The angle of rotation is in radians.
      • drawText

        public void drawText(java.lang.String label,
                             double horizontalReference,
                             double verticalReference,
                             double[] coord)
        Draw a string with given reference point. (0.5, 0.5) is center, (0, 0) is lower left, (0, 1) is upper left, etc. The coordinates are logical coordinates.
      • drawText

        public void drawText(java.lang.String label,
                             double horizontalReference,
                             double verticalReference,
                             double rotation,
                             double[] coord)
        Draw a string with given reference point and rotation angle. (0.5, 0.5) is center, (0, 0) is lower left, (0, 1) is upper left, etc. The angle of rotation is in radians. The coordinates are logical coordinates.
      • drawTextBaseRatio

        public void drawTextBaseRatio(java.lang.String label,
                                      double[] coord)
        Draw a string with given rotation angle. Reference point is the center of string. The logical coordinates are proportional to the base coordinates.
      • drawTextBaseRatio

        public void drawTextBaseRatio(java.lang.String label,
                                      double rotation,
                                      double[] coord)
        Draw a string with given rotation angle. Reference point is the center of string. The angle of rotation is in radians. The logical coordinates are proportional to the base coordinates.
      • drawTextBaseRatio

        public void drawTextBaseRatio(java.lang.String label,
                                      double horizontalReference,
                                      double verticalReference,
                                      double[] coord)
        Draw a string with given reference point. (0.5, 0.5) is center, (0, 0) is lower left, (0, 1) is upper left, etc. The logical coordinates are proportional to the base coordinates.
      • drawTextBaseRatio

        public void drawTextBaseRatio(java.lang.String label,
                                      double horizontalReference,
                                      double verticalReference,
                                      double rotation,
                                      double[] coord)
        Draw a string with given reference point and rotation angle. (0.5, 0.5) is center, (0, 0) is lower left, (1, 0) is upper left, etc. The angle of rotation is in radians. The logical are proportional to the base coordinates.
      • drawLine

        public void drawLine(double[]... coord)
        Draw poly line. The coordinates are in logical coordinates.
      • drawLineBaseRatio

        public void drawLineBaseRatio(double[]... coord)
        Draw poly line. The logical coordinates are proportional to the base coordinates.
      • drawPoint

        public void drawPoint(double... coord)
        Draw a dot. The coordinates are in logical coordinates.
      • drawPoint

        public void drawPoint(char dot,
                              double... coord)
        Draw a dot with given pattern. The coordinates are in logical coordinates.
        Parameters:
        dot - the pattern of dot:
        • . : dot
        • + : cross
        • - : -
        • | : |
        • * : star
        • x : x
        • o : circle
        • O : large circle
        • @ : solid circle
        • # : large sollid circle
        • s : square
        • S : large square
        • q : solid square
        • Q : large solid square
      • drawPolygon

        public void drawPolygon(double[]... coord)
        Draw polygon. The coordinates are in logical coordinates.
      • fillPolygon

        public void fillPolygon(double[]... coord)
        Fill polygon. The coordinates are in logical coordinates.
      • fillPolygon

        public void fillPolygon(float alpha,
                                double[]... coord)
        Fill polygon. The coordinates are in logical coordinates. This also supports basic alpha compositing rules for combining source and destination colors to achieve blending and transparency effects with graphics and images.
        Parameters:
        alpha - the constant alpha to be multiplied with the alpha of the source. alpha must be a floating point number in the inclusive range [0.0, 1.0].
      • drawRect

        public void drawRect(double[] topLeft,
                             double[] rightBottom)
        Draw the outline of the specified rectangle.
      • drawRectBaseRatio

        public void drawRectBaseRatio(double[] topLeft,
                                      double[] rightBottom)
        Draw the outline of the specified rectangle. The logical coordinates are proportional to the base coordinates.
      • fillRect

        public void fillRect(double[] topLeft,
                             double[] rightBottom)
        Fill the specified rectangle.
      • fillRectBaseRatio

        public void fillRectBaseRatio(double[] topLeft,
                                      double[] rightBottom)
        Fill the specified rectangle. The logical coordinates are proportional to the base coordinates.
      • rotate

        public void rotate(double x,
                           double y)
        Rotate the 3D view based on the changes on mouse position.
        Parameters:
        x - changes of mouse position on the x axis.
        y - changes on mouse position on the y axis.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.