|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umd.cs.piccolo.PNode
edu.umd.cs.piccolo.nodes.PImage
public class PImage
PImage is a wrapper around a java.awt.Image. If this node is copied or serialized that image will be converted into a BufferedImage if it is not already one.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class edu.umd.cs.piccolo.PNode |
---|
PNode.PSceneGraphDelegate |
Field Summary | |
---|---|
static int |
PROPERTY_CODE_IMAGE
The property code that identifies a change of this node's image (see getImage ). |
static String |
PROPERTY_IMAGE
The property name that identifies a change of this node's image (see getImage ). |
Fields inherited from interface java.awt.print.Printable |
---|
NO_SUCH_PAGE, PAGE_EXISTS |
Constructor Summary | |
---|---|
PImage()
Constructs a PImage without a java.awt.Image attached. |
|
PImage(Image image)
Construct a new PImage wrapping the given java.awt.Image. |
|
PImage(String fileName)
Construct a new PImage by loading the given fileName and wrapping the resulting java.awt.Image. |
|
PImage(URL url)
Construct a new PImage by loading the given url and wrapping the resulting java.awt.Image. |
Method Summary | |
---|---|
Image |
getImage()
Returns the image that is shown by this node, or null if none. |
protected void |
paint(PPaintContext paintContext)
Renders the wrapped Image, stretching it appropriately if the bounds of this PImage doesn't match the bounds of the image. |
void |
setImage(Image newImage)
Set the image that is wrapped by this PImage node. |
void |
setImage(String fileName)
Set the image that is wrapped by this PImage node. |
static BufferedImage |
toBufferedImage(Image image,
boolean alwaysCreateCopy)
Converts the provided image into a BufferedImage. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PROPERTY_IMAGE
getImage
). Both old and new value will be set correctly
to Image objects in any property change event.
public static final int PROPERTY_CODE_IMAGE
getImage
). Both old and new value will be set correctly
to Image objects in any property change event.
Constructor Detail |
---|
public PImage()
public PImage(String fileName)
fileName
- of the image to wrappublic PImage(Image image)
image
- image that this PImage will wrappublic PImage(URL url)
null
, create an
empty PImage; this behaviour is useful when fetching resources that may
be missing.
url
- URL of image resource to loadMethod Detail |
---|
public Image getImage()
public void setImage(String fileName)
fileName
- file to be wrapped by this PImagepublic void setImage(Image newImage)
newImage
- image to be displayed by this PImageprotected void paint(PPaintContext paintContext)
paint
in class PNode
paintContext
- context into which the rendering will occurpublic static BufferedImage toBufferedImage(Image image, boolean alwaysCreateCopy)
image
- the image to be convertedalwaysCreateCopy
- if true, will create a copy even if image is
already a BufferedImage
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |