Package com.ms.fx |
![]() Previous |
![]() Contents |
![]() Index |
![]() Next |
public class FxTexture extends FxFill implements ImageObserver { // Fields public final static int STRETCH_NONE; public final static int STRETCH_MIDDLE; public final static int STRETCH_OUTER; public final static int STRETCH_ALL; public final static int REPEAT_PIN; public final static int SNAP_EDGES; // Constructors public FxTexture(Image i, int s, int l, int t, int r, int b, boolean p, int red, int green, int blue); public FxTexture(Image i, int s, int l, int t, int r, int b, boolean p); public FxTexture(Image i, int s, int l, int t, int r, int b, boolean p, FxFill f); // Methods public boolean fillRectCallback(FxGraphics g, int xStart, int yStart, int width, int height); public Dimension size(); public Rectangle getInner(); public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height); public int getStretch(); public void setStretch(int s); public Image getImage(); public boolean drawScanLinesCallback(FxGraphics g, boolean xChanging, int points[], int offset, int nPoints); public void setPinOrigin(boolean b); public boolean getPinOrigin(); public void setSnapDraw(boolean b); public boolean getSnapDraw(); public boolean fillRoundRectCallback(FxGraphics g, int x, int y, int width, int height, int arcWidth, int arcHeight); public boolean fillPolygonCallback(FxGraphics g, int xPoints[], int yPoints[], int nPoints); public boolean fillArcCallback(FxGraphics g, int x, int y, int width, int height, int startAngle, int arcAngle); public boolean fillOvalCallback(FxGraphics g, int x, int y, int width, int height); }
A class that encapsulates an extended fill method, using an image to fill a shape.
The Microsoft com.ms.fx Java package is more powerful and more flexible than other graphics packages because it uses extensible objects.
public FxTexture(Image i, int s, int l, int t, int r, int b, boolean p, int red, int green, int blue);Constructs a texture with a specific default color.
Parameter Description i The image object. s The value that handles image stretching. l The left boundary. t The top boundary. r The right boundary. b The bottom boundary. p The value that determines if the image should be pinned. red The amount of red in the color. green The amount of green in the color. blue The amount of blue in the color.
public FxTexture(Image i, int s, int l, int t, int r, int b, boolean p);Constructs a texture.
Parameter Description i The image object. s The value that handles image stretching. l The left boundary. t The top boundary. r The right boundary. b The bottom boundary. p The value that determines if the image should be pinned.
public FxTexture(Image i, int s, int l, int t, int r, int b, boolean p, FxFill f);Constructs a texture.
Parameter Description i The image object. s The value that handles image stretching. l The left boundary. t The top boundary. r The right boundary. b The bottom boundary. p The value that determines if the image should be pinned. f The fill object to use.
public boolean fillRectCallback(FxGraphics g, int xStart, int yStart, int width, int height);This method is used by an FxGraphics object to draw a filled rectangle.
Return Value:
Returns true if successful; otherwise, returns false.
Parameter Description g The graphics object to use. xStart The x coordinate of the starting position. yStart The y coordinate of the starting position. width The width of the rectangle. height The height of the rectangle. Remarks:
This method is used by an FxGraphics object if the current color of the object is a texture. It is not intended to be called by applications. It is made public so that derived classes may extend the callback functionality.
public Dimension size();Retrieves the size of the image that is associated with the texture.
Return Value:
Returns the Dimension of the image.
public Rectangle getInner();Retrieves the bounds of the inner rectangle of the texture.
Return Value:
Returns the inner Rectangle of the texture.
public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height);Determines when an image may be drawn.
Return Value:
Returns true if the image can be drawn; otherwise, returns false.
Parameter Description img The image object. infoflags The flags controlling the method. x The x coordinate of the image's starting point. y The y coordinate of the image's starting point. width The width of the image. height The height of the image. Remarks:
Method from ImageObserver.
public int getStretch();Checks if the image is stretched across the surface, instead of being repeated.
Return Value:
Returns a value that determines if the image can be stretched.
public void setStretch(int s);Sets the stretch or the repeat value.
Return Value:
No return value.
Parameter Description s The value that determines if the image is stretched or repeated.
public Image getImage();Retrieves the image.
Return Value:
Returns the image if there is one.
public boolean drawScanLinesCallback(FxGraphics g, boolean xChanging, int points[], int offset, int nPoints);This method is called by an FxGraphics object to draw a set of scan lines using this texture.
Return Value:
Returns true if successful; otherwise, returns false.
Parameter Description g The graphics object to use. xChanging The direction the line should be drawn, either horizontally or vertically. points An array of points. offset The offset to use. nPoints The number of points in the array. Remarks:
This method is used by an FxGraphics object if the current color of the object is a texture. It is not intended to be called by applications. It is made public so that derived classes may extend the callback functionality.
public void setPinOrigin(boolean b);Sets whether the image should be pinned.
Return Value:
No return value.
Parameter Description b The boolean value that determines whether the image should be pinned.
public boolean getPinOrigin();Checks whether the image is pinned.
Return Value:
Returns a true if the image is pinned; otherwise, returns false.
public void setSnapDraw(boolean b);Determines whether partial images should be repeated.
Return Value:
No return value.
Parameter Description b The Boolean value that determines whether partial images should be repeated.
public boolean getSnapDraw();Checks whether partial images should be repeated.
Return Value:
Returns true if partial images should be repeated; otherwise, returns false.
public boolean fillRoundRectCallback(FxGraphics g, int x, int y, int width, int height, int arcWidth, int arcHeight);This method is called by an FxGraphics object to draw a filled, rounded rectangle.
Return Value:
Currently returns false.
Remarks:
This method is used internally and is not intended to be called by applications. It is made public so that derived classes may extend the callback functionality.
public boolean fillPolygonCallback(FxGraphics g, int xPoints[], int yPoints[], int nPoints);This method is called by an FxGraphics object to draw a filled polygon.
Return Value:
Currently returns false.
Remarks:
This method is used by an FxGraphics object if the current color of the object is a texture. It is not intended to be called by applications. It is made public so that derived classes may extend the callback functionality.
public boolean fillArcCallback(FxGraphics g, int x, int y, int width, int height, int startAngle, int arcAngle);This method is called by an FxGraphics object to draw a filled arc. The result is a pie-shaped object.
Return Value:
Currently returns false.
Remarks:
This method is used by an FxGraphics object if the current color of the object is a texture. It is not intended to be called by applications. It is made public so that derived classes may extend the callback functionality.
public boolean fillOvalCallback(FxGraphics g, int x, int y, int width, int height);This method is called by an FxGraphics object to draw a filled oval.
Return Value:
Currently returns false.
Remarks:
This method is used by an FxGraphics object if the current color of the object is a texture. It is not intended to be called by applications. It is made public so that derived classes may extend the callback functionality.
© 1997 Microsoft Corporation. All rights reserved. Legal Notices.