Class NineRegionsScalingBuilder<T>

java.lang.Object
org.jhotdraw8.geom.AbstractPathBuilder<T>
org.jhotdraw8.geom.NineRegionsScalingBuilder<T>
Type Parameters:
T - the product type
All Implemented Interfaces:
PathBuilder<T>

public class NineRegionsScalingBuilder<T> extends AbstractPathBuilder<T>
This builder slices the input path into 9 regions, and scales them by the specified scale factor and pivot.

The builder takes a four values minx, miny, maxx, maxy as input, or a rectangle and insets from which these four values are computed.

The coordinate space is split along minx, miny, maxx, maxy into 9 pieces: top-left, top-right, bottom-right, bottom-left, top, right, bottom, left, center.

  • the top left piece is translated by the scaled distance from the left and the top inset to the pivot.
  • similar translations are applied to the top right, bottom right and bottom left pieces.
  • the top piece is translated by the scaled distance from the top inset to the pivot,and scaled by the sx-factor of the scaling.
  • similar transformations are applied to the right, bottom and left pieces.
  • the piece in the center is scaled by the scale factor around the pivot
Author:
Werner Randelshofer
  • Constructor Details

    • NineRegionsScalingBuilder

      public NineRegionsScalingBuilder(@NonNull PathBuilder<T> dest, @NonNull javafx.geometry.Bounds srcBounds, @NonNull javafx.geometry.Insets srcInsets, @NonNull javafx.geometry.Bounds destBounds)
      Creates a new instance.
      Parameters:
      dest - The destination (target) of the builder.
      srcBounds - The bounds of the source image.
      srcInsets - The nine regions in the bounds of the source image.
      destBounds - The bounds of the destination image.
  • Method Details

    • doClosePath

      protected void doClosePath(double lastX, double lastY, double lastMoveToX, double lastMoveToY)
      Specified by:
      doClosePath in class AbstractPathBuilder<T>
    • doCurveTo

      protected void doCurveTo(double lastX, double lastY, double x1, double y1, double x2, double y2, double x3, double y3)
      Specified by:
      doCurveTo in class AbstractPathBuilder<T>
    • doLineTo

      protected void doLineTo(double lastX, double lastY, double x, double y)
      Specified by:
      doLineTo in class AbstractPathBuilder<T>
    • doMoveTo

      protected void doMoveTo(double x, double y)
      Specified by:
      doMoveTo in class AbstractPathBuilder<T>
    • doQuadTo

      protected void doQuadTo(double lastX, double lastY, double x1, double y1, double x2, double y2)
      Specified by:
      doQuadTo in class AbstractPathBuilder<T>
    • doPathDone

      protected void doPathDone()
      Specified by:
      doPathDone in class AbstractPathBuilder<T>
    • build

      public @Nullable T build()
      Description copied from interface: PathBuilder
      Builds something.

      Some implementations may guarantee a non-null return value.