API Review: ImagePattern

joe andresen joseph.andresen at oracle.com
Tue May 8 16:16:45 PDT 2012


Hello All,

I propose to add a new paint class in the javafx.scene.paint package 
called ImagePattern. Many of you familiar with Java2D TexturePaint will 
be familiar with this class. ImagePattern allows developers to add an 
image as a paint to primitives in JavaFX. The developer may specify the 
anchor rectangle, which defines the position, width, and height of the 
image relative to the upper left corner of the shape. If the shape is 
larger than the anchor rectangle, the image is tiled.

-Joe

Jira: http://javafx-jira.kenai.com/browse/RT-6917

A list of the methods can be found below.

public class ImagePattern extends Paint

public ImagePattern(Image image);
public ImagePattern(Image image, double x, double y, double width, 
double height, boolean proportional);

/**
      * The image to be used as a pattern.
      */
     public final Image getImage();

/**
      * The x origin of the anchor rectangle.
      *
      * @default 0.0
      */
     public final double getX();

/**
      * The y origin of the anchor rectangle.
      *
      * @default 0.0
      */
     public final double getY() ;

/**
      * The width of the anchor rectangle.
      *
      * @default 1.0
      */
     public final double getWidth() {
         return width;
     }

**
      * The height of the anchor rectangle.
      *
      * @default 1.0
      */
     public final double getHeight();

/**
      * Indicates whether start and end locations are proportional or 
absolute.
      * If this flag is true, the two end points are defined in a 
coordinate
      * space where coordinates in the range {@code [0..1]} are scaled 
to map
      * onto the bounds of the shape that the pattern fills.
      * If this flag is false, then the coordinates are specified in the 
local
      * coordinate system of the node.
      *
      * @defaultValue true
      */
     public final boolean isProportional();



More information about the openjfx-dev mailing list