Package jahuwaldt.j3d
Class BGFGCanvas3D
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Canvas
-
- org.jogamp.java3d.Canvas3D
-
- jahuwaldt.j3d.ImageCaptureCanvas3D
-
- jahuwaldt.j3d.BGFGCanvas3D
-
- All Implemented Interfaces:
java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,javax.accessibility.Accessible
- Direct Known Subclasses:
GeomSSCanvas3D
public class BGFGCanvas3D extends ImageCaptureCanvas3D
BGFGCanvas3D is aCanvas3D
that renders an list of arbitrary 2DBGFGImage
objects either behind or over top of the 3D scene. This canvas also provides a callback that allows you to capture the contents of the canvas and write out the image information.Modified by: Joseph A.Huwaldt
- Version:
- June 4, 2023
- Author:
- Joseph A. Huwaldt, Date: April 9, 2009
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BGFGCanvas3D(java.awt.GraphicsConfiguration gconfig)
Constructs and initializes a new BGFGCanvas3D object that Java 3D can render into.BGFGCanvas3D(java.awt.GraphicsConfiguration gconfig, boolean offscreen)
Constructs and initializes a new BGFGCanvas3D object that Java 3D can render into.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBackground(BGFGImage background)
Adds the specified background to this canvas.void
addOverlay(BGFGImage overlay)
Adds the specified overlay to this canvas.void
clearBackgrounds()
Removes all the backgrounds from this canvas.void
clearOverlays()
Removes all the overlays from this canvas.BGFGImage
getBackground(int index)
Return the specified background used by this canvas.int
getNumberBackgrounds()
Returns the number of background images associated with this canvas.int
getNumberOverlays()
Returns the number of overlays/foregrounds associated with this canvas.BGFGImage
getOverlay(int index)
Return the specified overlay used by this canvas.void
postRender()
This routine is called by the Java 3D rendering loop after completing all rendering to the canvas for this frame and before the buffer swap.void
preRender()
This routine is called by the Java 3D rendering loop after clearing the canvas and before any rendering has been done for this frame.BGFGImage
removeBackground(int index)
Removes the specified background from this canvas.boolean
removeBackground(BGFGImage background)
Removes the specified background from this canvas.BGFGImage
removeOverlay(int index)
Removes the specified overlay from this canvas.boolean
removeOverlay(BGFGImage overlay)
Removes the specified overlay from this canvas.BGFGImage
setBackground(int index, BGFGImage background)
Set the specified background for use for this canvas.BGFGImage
setOverlay(int index, BGFGImage overlay)
Set the specified overlay for use for this canvas.-
Methods inherited from class jahuwaldt.j3d.ImageCaptureCanvas3D
addCaptureObserver, postSwap, removeCaptureObserver
-
Methods inherited from class org.jogamp.java3d.Canvas3D
addNotify, getCenterEyeInImagePlate, getDoubleBufferAvailable, getDoubleBufferEnable, getGraphics2D, getGraphicsContext3D, getImagePlateToVworld, getInverseVworldProjection, getLeftEyeInImagePlate, getLeftManualEyeInImagePlate, getLocationOnScreen, getMonoscopicViewPolicy, getOffScreenBuffer, getOffScreenLocation, getOffScreenLocation, getPhysicalHeight, getPhysicalWidth, getPixelHeight, getPixelLocationFromImagePlate, getPixelLocationInImagePlate, getPixelLocationInImagePlate, getPixelWidth, getRightEyeInImagePlate, getRightManualEyeInImagePlate, getSceneAntialiasingAvailable, getScreen3D, getStereoAvailable, getStereoEnable, getView, getVworldProjection, getVworldToImagePlate, isOffScreen, isRendererRunning, isShadingLanguageSupported, paint, queryProperties, removeNotify, renderField, renderOffScreenBuffer, setDoubleBufferEnable, setLeftManualEyeInImagePlate, setMonoscopicViewPolicy, setOffScreenBuffer, setOffScreenLocation, setOffScreenLocation, setRightManualEyeInImagePlate, setStereoEnable, startRenderer, stopRenderer, swap, waitForOffScreenRendering
-
Methods inherited from class java.awt.Canvas
createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, update
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setMixingCutoutShape, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
-
-
-
-
Constructor Detail
-
BGFGCanvas3D
public BGFGCanvas3D(java.awt.GraphicsConfiguration gconfig)
Constructs and initializes a new BGFGCanvas3D object that Java 3D can render into.- Parameters:
gconfig
- A valid GraphicsConfiguration object that will be used to create the canvas. May not be null.- Throws:
java.lang.IllegalArgumentException
- if the specified GraphicsConfiguration does not support 3D rendering
-
BGFGCanvas3D
public BGFGCanvas3D(java.awt.GraphicsConfiguration gconfig, boolean offscreen)
Constructs and initializes a new BGFGCanvas3D object that Java 3D can render into.- Parameters:
gconfig
- A valid GraphicsConfiguration object that will be used to create the canvas. May not be null.offscreen
- A flag that indicates whether this canvas is an off-screen 3D rendering canvas. Note that if offScreen is set to true, this Canvas3D object cannot be used for normal rendering; it should not be added to any Container object.- Throws:
java.lang.IllegalArgumentException
- if the specified GraphicsConfiguration does not support 3D rendering
-
-
Method Detail
-
getNumberBackgrounds
public int getNumberBackgrounds()
Returns the number of background images associated with this canvas.- Returns:
- The number of background images.
-
getBackground
public BGFGImage getBackground(int index)
Return the specified background used by this canvas.- Parameters:
index
- The index of the background image to retrieve.- Returns:
- The background image at the specified index.
-
setBackground
public BGFGImage setBackground(int index, BGFGImage background)
Set the specified background for use for this canvas.- Parameters:
index
- The index for the background to set.background
- The background image to set at the specified index. May not be null.- Returns:
- The image that was at the specified index location.
-
addBackground
public void addBackground(BGFGImage background)
Adds the specified background to this canvas.- Parameters:
background
- The background to add to this canvas. May not be null.
-
removeBackground
public BGFGImage removeBackground(int index)
Removes the specified background from this canvas.- Parameters:
index
- The index for the background to remove.- Returns:
- The image that used to be at the specified index.
-
removeBackground
public boolean removeBackground(BGFGImage background)
Removes the specified background from this canvas.- Parameters:
background
- The background to remove from this canvas. May not be null.- Returns:
- true if this canvas contained the specified background image.
-
clearBackgrounds
public void clearBackgrounds()
Removes all the backgrounds from this canvas.
-
getNumberOverlays
public int getNumberOverlays()
Returns the number of overlays/foregrounds associated with this canvas.- Returns:
- The number of overlays.
-
getOverlay
public BGFGImage getOverlay(int index)
Return the specified overlay used by this canvas.- Parameters:
index
- The index of the overlay (foreground) to return.- Returns:
- The overlay/foreground image at the specified index.
-
setOverlay
public BGFGImage setOverlay(int index, BGFGImage overlay)
Set the specified overlay for use for this canvas.- Parameters:
index
- The index for the overlay to set.overlay
- The overlay to set at the specified index location. May not be null.- Returns:
- The image that was at the specified index location.
-
addOverlay
public void addOverlay(BGFGImage overlay)
Adds the specified overlay to this canvas.- Parameters:
overlay
- The overlay to add. May not be null.
-
removeOverlay
public BGFGImage removeOverlay(int index)
Removes the specified overlay from this canvas.- Parameters:
index
- The index for the overlay to remove.- Returns:
- The image that used to be at the specified index.
-
removeOverlay
public boolean removeOverlay(BGFGImage overlay)
Removes the specified overlay from this canvas.- Parameters:
overlay
- The overlay image to remove from this canvas. May not be null.- Returns:
- true if this canvas contained the specified overlay/foreground image.
-
clearOverlays
public void clearOverlays()
Removes all the overlays from this canvas.
-
preRender
public void preRender()
This routine is called by the Java 3D rendering loop after clearing the canvas and before any rendering has been done for this frame. This implementation renders any background images onto the canvas. Note that BGFGImage.getImage() is always called before getImageX() or getImageY().- Overrides:
preRender
in classorg.jogamp.java3d.Canvas3D
-
postRender
public void postRender()
This routine is called by the Java 3D rendering loop after completing all rendering to the canvas for this frame and before the buffer swap. This implementation renders any overlay images onto the canvas. Note that BGFGImage.getImage() is always called before getImageX() or getImageY().- Overrides:
postRender
in classorg.jogamp.java3d.Canvas3D
-
-