Class CalligraphyStroke

  • All Implemented Interfaces:
    Stroke


    public class CalligraphyStroke
    extends Object
    implements Stroke
    This Stroke resembles calligraphy.

    The angle of the pen (or nib) is fixed.

    • Field Summary

      Fields

      Modifier and Type Field and Description
      float theta
      The angle of the pen in radians.
      float width
      The width of this stroke in pixels.
    • Constructor Summary

      Constructors

      Constructor and Description
      CalligraphyStroke(float width)
      Create a simple CalligraphyStroke with an angle of 3*pi/4.
      CalligraphyStroke(float width, float angle)
      Creates a new CalligraphyStroke
    • Field Detail

      • width

        public final float width
        The width of this stroke in pixels.
      • theta

        public final float theta
        The angle of the pen in radians.
    • Constructor Detail

      • CalligraphyStroke

        public CalligraphyStroke(float width)
        Create a simple CalligraphyStroke with an angle of 3*pi/4.
        Parameters:
        width - the width of the stroke (in pixels).
      • CalligraphyStroke

        public CalligraphyStroke(float width,
                                 float angle)
        Creates a new CalligraphyStroke
        Parameters:
        width - the width of the pen (in pixels)
        angle - the angle of the pen (in radians)
    • Method Detail

      • getWidth

        public float getWidth()
        Returns the width of this stroke.
        Returns:
        the width of this stroke.
      • getTheta

        public float getTheta()
        Returns the angle of the pen (in radians).
        Returns:
        the angle of the pen (in radians).
      • createStrokedShape

        public Shape createStrokedShape(Shape p)
        Creates the calligraphic outline of the argument shape.