API Review: ImagePattern

Josh Marinacci joshua at marinacci.org
Tue May 8 19:45:58 PDT 2012


Incidentally, this is a far superior solution to drawing a grid than trying to do it with tons of line objects.

-- 
Josh Marinacci
joshondesign.com


On Tuesday, May 8, 2012 at 4:16 PM, joe andresen wrote:

> 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