Package org.opensourcephysics.display
Class InteractiveImage
java.lang.Object
org.opensourcephysics.display.AbstractInteractive
org.opensourcephysics.display.InteractiveShape
org.opensourcephysics.display.InteractiveImage
- All Implemented Interfaces:
ImageObserver
,Drawable
,Interactive
,Measurable
An image is bounded by hot spots for dragging and resizing.
- Version:
- 1.0
- Author:
- W. Christian
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opensourcephysics.display.InteractiveShape
InteractiveShape.InteractiveShapeLoader
-
Field Summary
FieldsFields inherited from class org.opensourcephysics.display.InteractiveShape
edgeColor, height, pixelPt, pixelSized, shape, shapeClass, theta, toPixels, trIS, width, xoff, yoff
Fields inherited from class org.opensourcephysics.display.AbstractInteractive
color, x, y
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
ConstructorsConstructorDescriptionInteractiveImage
(Image image, double x, double y) Constructs an interactive image centered at the given location. -
Method Summary
Modifier and TypeMethodDescriptionvoid
draw
(DrawingPanel panel, Graphics g) Draws the image.boolean
imageUpdate
(Image img, int infoflags, int x, int y, int width, int height) boolean
isInside
(DrawingPanel panel, int xpix, int ypix) Determines if the shape is enabled and if the given pixel coordinates are within the image.Methods inherited from class org.opensourcephysics.display.InteractiveShape
contains, createArrow, createCenteredArrow, createCircle, createEllipse, createImage, createRectangle, createSquare, createTextLine, createTriangle, getHeight, getLoader, getPixelPt, getRotateInstance, getRotateInstance, getScaleInstance, getShape, getTranslateInstance, getWidth, getXMax, getXMin, getYMax, getYMin, isMeasured, setHeight, setMarkerColor, setMeasured, setOffset, setPixelSized, setTheta, setWidth, setX, setXY, setY, toString, tranform, transform
Methods inherited from class org.opensourcephysics.display.AbstractInteractive
findInteractive, getX, getY, isEnabled, setEnabled
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opensourcephysics.display.Interactive
isInteractive
-
Field Details
-
image
-
-
Constructor Details
-
InteractiveImage
Constructs an interactive image centered at the given location.- Parameters:
x
- doubley
- doubleimage
- Image
-
-
Method Details
-
isInside
Determines if the shape is enabled and if the given pixel coordinates are within the image.- Overrides:
isInside
in classInteractiveShape
- Parameters:
panel
- DrawingPanelxpix
- intypix
- int- Returns:
- boolean
-
draw
Draws the image.- Specified by:
draw
in interfaceDrawable
- Overrides:
draw
in classInteractiveShape
- Parameters:
panel
- the world in which the image is viewedg
- the graphics context upon which to draw
-
imageUpdate
- Specified by:
imageUpdate
in interfaceImageObserver
-