Package snap.gfx
Class ImagePaint
java.lang.Object
snap.gfx.ImagePaint
- All Implemented Interfaces:
Paint
,XMLArchiver.Archivable
A paint implementation to fill shapes with an image pattern.
-
Constructor Summary
ConstructorDescriptionCreates a new ImagePaint.ImagePaint
(Image anImage) Creates a new ImagePaint.ImagePaint
(Image anImage, double aX, double aY, double aW, double aH, boolean isAbs) Creates a new ImagePaint.ImagePaint
(Image anImage, Rect aRect) Creates a new ImagePaint.ImagePaint
(Image anImage, Rect aRect, boolean isAbs) Creates a new ImagePaint. -
Method Summary
Modifier and TypeMethodDescriptioncopyForColor
(Color aColor) Returns a copy of this paint modified for given color.copyForRect
(Rect aRect) Returns an absolute paint for given bounds of primitive to be filled.copyForRectAndTile
(Rect aRect, boolean isAbs) Returns an paint for given bounds and absolute flag.copyForScale
(double aScaleX, double aScaleY) Creates a new image fill identical to this image fill, but with new value for given attribute.copyTiled
(boolean isTiled) Creates a new image fill identical to this image fill, but with new value for given attribute.boolean
Standard equals implementation.fromXML
(XMLArchiver anArchiver, XMLElement anElement) XML unarchival.Returns the bounds.getColor()
Returns the closest color approximation of this paint.double
Returns the bounds height.getImage()
Returns the image.double
Returns the scale x of the image fill image.double
Returns the scale y of the image fill image.double
getWidth()
Returns the bounds width.double
getX()
Returns the bounds x.double
getY()
Returns the bounds y.boolean
Returns whether paint is defined in terms independent of primitive to be filled.boolean
isOpaque()
Returns whether paint is opaque.boolean
isTiled()
Returns whether paint is defined in terms independent of primitive to be filled.toString()
Standard toString implementation.toXML
(XMLArchiver anArchiver) XML archival.
-
Constructor Details
-
ImagePaint
public ImagePaint()Creates a new ImagePaint. -
ImagePaint
Creates a new ImagePaint. -
ImagePaint
Creates a new ImagePaint. -
ImagePaint
Creates a new ImagePaint. -
ImagePaint
Creates a new ImagePaint.
-
-
Method Details
-
getImage
Returns the image. -
getX
public double getX()Returns the bounds x. -
getY
public double getY()Returns the bounds y. -
getWidth
public double getWidth()Returns the bounds width. -
getHeight
public double getHeight()Returns the bounds height. -
getBounds
Returns the bounds. -
getScaleX
public double getScaleX()Returns the scale x of the image fill image. -
getScaleY
public double getScaleY()Returns the scale y of the image fill image. -
isTiled
public boolean isTiled()Returns whether paint is defined in terms independent of primitive to be filled. -
isAbsolute
public boolean isAbsolute()Returns whether paint is defined in terms independent of primitive to be filled.- Specified by:
isAbsolute
in interfacePaint
-
isOpaque
public boolean isOpaque()Returns whether paint is opaque. -
getColor
Returns the closest color approximation of this paint. -
copyForColor
Returns a copy of this paint modified for given color.- Specified by:
copyForColor
in interfacePaint
-
copyForRect
Returns an absolute paint for given bounds of primitive to be filled.- Specified by:
copyForRect
in interfacePaint
-
copyForRectAndTile
Returns an paint for given bounds and absolute flag. -
copyTiled
Creates a new image fill identical to this image fill, but with new value for given attribute. -
copyForScale
Creates a new image fill identical to this image fill, but with new value for given attribute. -
equals
Standard equals implementation. -
toXML
XML archival.- Specified by:
toXML
in interfaceXMLArchiver.Archivable
-
fromXML
XML unarchival.- Specified by:
fromXML
in interfaceXMLArchiver.Archivable
-
toString
Standard toString implementation.
-