smile.plot
Class Graphics
- java.lang.Object
-
- smile.plot.Graphics
-
public class Graphics extends java.lang.ObjectGraphics 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 voidclearClip()Clear the restriction of the draw area.voidclip()Restrict the draw area to the valid base coordinate space.voiddrawLine(double[]... coord)Draw poly line.voiddrawLineBaseRatio(double[]... coord)Draw poly line.voiddrawPoint(char dot, double... coord)Draw a dot with given pattern.voiddrawPoint(double... coord)Draw a dot.voiddrawPolygon(double[]... coord)Draw polygon.voiddrawRect(double[] topLeft, double[] rightBottom)Draw the outline of the specified rectangle.voiddrawRectBaseRatio(double[] topLeft, double[] rightBottom)Draw the outline of the specified rectangle.voiddrawText(java.lang.String label, double[] coord)Draw a string.voiddrawText(java.lang.String label, double rotation, double[] coord)Draw a string with given rotation angle.voiddrawText(java.lang.String label, double horizontalReference, double verticalReference, double[] coord)Draw a string with given reference point.voiddrawText(java.lang.String label, double horizontalReference, double verticalReference, double rotation, double[] coord)Draw a string with given reference point and rotation angle.voiddrawTextBaseRatio(java.lang.String label, double[] coord)Draw a string with given rotation angle.voiddrawTextBaseRatio(java.lang.String label, double rotation, double[] coord)Draw a string with given rotation angle.voiddrawTextBaseRatio(java.lang.String label, double horizontalReference, double verticalReference, double[] coord)Draw a string with given reference point.voiddrawTextBaseRatio(java.lang.String label, double horizontalReference, double verticalReference, double rotation, double[] coord)Draw a string with given reference point and rotation angle.voidfillPolygon(double[]... coord)Fill polygon.voidfillPolygon(float alpha, double[]... coord)Fill polygon.voidfillRect(double[] topLeft, double[] rightBottom)Fill the specified rectangle.voidfillRectBaseRatio(double[] topLeft, double[] rightBottom)Fill the specified rectangle.java.awt.ColorgetColor()Get the current color.java.awt.FontgetFont()Get the current font.java.awt.Graphics2DgetGraphics()Returns the Java2D graphics object.double[]getLowerBound()Returns the lower bounds of coordinate space.java.awt.PaintgetPaint()Get the current paint object.java.awt.StrokegetStroke()Get the current stroke.double[]getUpperBound()Returns the upper bounds of coordinate space.voidrotate(double x, double y)Rotate the 3D view based on the changes on mouse position.GraphicssetColor(java.awt.Color color)Set the color.GraphicssetFont(java.awt.Font font)Set the font.voidsetGraphics(java.awt.Graphics2D g2d)Set the Java2D graphics object.GraphicssetPaint(java.awt.Paint paint)Set the paint object.GraphicssetStroke(java.awt.Stroke stroke)Set the stroke.
-
-
-
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