Documentation of 'org.jplot2d.util.LineHatchPaint' Java class
LineHatchPaint
org.jplot2d.util

Class LineHatchPaint

  • All Implemented Interfaces:
    java.awt.Paint, java.awt.Transparency


    public class LineHatchPaint
    extends java.lang.Object
    implements java.awt.Paint
    The LineHatchPaint class provides a way to fill a Shape with line hatch pattern. Because Java require instances of classes implementing Paint must be read-only, this class is more like a factory to create paint instance for renderer threads.
    • Field Summary

      • Fields inherited from interface java.awt.Transparency

        BITMASK, OPAQUE, TRANSLUCENT
    • Constructor Summary

      Constructors 
      Constructor and Description
      LineHatchPaint(java.awt.Color color, java.awt.BasicStroke stroke, double angle, double spacing)
      Construct a LineHatchPaint with given arguments.
      LineHatchPaint(double angle)
      Construct a LineHatchPaint with the given angle.
      LineHatchPaint(float width, double angle, double spacing)
      Construct a LineHatchPaint with the given angle.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      static boolean approxBetween(double a, double b, double v) 
      static java.awt.geom.Line2D[] calcHatchLinesClipped(LineHatchPaint lhp, java.awt.geom.Rectangle2D clip, double scale) 
      java.awt.Shape[] calcHatchShapes(java.awt.Shape shape, java.awt.geom.Rectangle2D clip, double scale)
      Calculate hatch shapes to fill the given shape.
      java.awt.PaintContext createContext(java.awt.image.ColorModel cm, java.awt.Rectangle deviceBounds, java.awt.geom.Rectangle2D userBounds, java.awt.geom.AffineTransform xform, java.awt.RenderingHints hints) 
      double getAngle() 
      java.awt.Color getColor() 
      double getSpacing() 
      java.awt.BasicStroke getStroke() 
      int getTransparency() 
      static boolean intersectLines(java.awt.geom.Line2D line, double x3, double y3, double x4, double y4, double[] point)
      The method checks up if line and line (x3, y3) - (x4, y4) intersect.
      • Methods inherited from class java.lang.Object

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

      • LineHatchPaint

        public LineHatchPaint(double angle)
        Construct a LineHatchPaint with the given angle. The default values:
        • color: BLACK
        • line width: 0.0
        • line style: solid
        • line spacing: 6pt
        Parameters:
        angle - the counterclockwise angle in degrees from horizontal
      • LineHatchPaint

        public LineHatchPaint(float width,
                              double angle,
                              double spacing)
        Construct a LineHatchPaint with the given angle. The default values:
        • color: BLACK
        • line style: solid
        Parameters:
        width - the line width
        angle - the counterclockwise angle in degrees from horizontal
        spacing - the spacing, in point(1/72 inch), between the parallel lines
      • LineHatchPaint

        public LineHatchPaint(java.awt.Color color,
                              java.awt.BasicStroke stroke,
                              double angle,
                              double spacing)
        Construct a LineHatchPaint with given arguments.
        Parameters:
        width - the line width
        dash - the dash array. null means solid line
        angle - the counterclockwise angle in degrees from horizontal
        spacing - the spacing, in point(1/72 inch), between the parallel lines
    • Method Detail

      • getColor

        public java.awt.Color getColor()
      • getStroke

        public java.awt.BasicStroke getStroke()
      • getAngle

        public double getAngle()
      • getSpacing

        public double getSpacing()
      • createContext

        public java.awt.PaintContext createContext(java.awt.image.ColorModel cm,
                                                   java.awt.Rectangle deviceBounds,
                                                   java.awt.geom.Rectangle2D userBounds,
                                                   java.awt.geom.AffineTransform xform,
                                                   java.awt.RenderingHints hints)
        Specified by:
        createContext in interface java.awt.Paint
      • getTransparency

        public int getTransparency()
        Specified by:
        getTransparency in interface java.awt.Transparency
      • calcHatchShapes

        public java.awt.Shape[] calcHatchShapes(java.awt.Shape shape,
                                                java.awt.geom.Rectangle2D clip,
                                                double scale)
        Calculate hatch shapes to fill the given shape.
        Parameters:
        shape - the shape to hatch
        clip - the clip
        scale -
        Returns:
        hatch shapes
      • calcHatchLinesClipped

        public static java.awt.geom.Line2D[] calcHatchLinesClipped(LineHatchPaint lhp,
                                                                   java.awt.geom.Rectangle2D clip,
                                                                   double scale)
      • intersectLines

        public static boolean intersectLines(java.awt.geom.Line2D line,
                                             double x3,
                                             double y3,
                                             double x4,
                                             double y4,
                                             double[] point)
        The method checks up if line and line (x3, y3) - (x4, y4) intersect. If lines intersect then the result parameters are saved to point array. The size of array point must be at least 2. Note the algorithm is not symmetric. The given line is the primary line.
        Parameters:
        line - the primary line
        x3 -
        y3 -
        x4 -
        y4 -
        point -
        Returns:
        true if two lines intersect
      • approxBetween

        public static boolean approxBetween(double a,
                                            double b,
                                            double v)

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.