org.jzy3d.plot3d.rendering.view
Class ImageViewport

java.lang.Object
  extended by org.jzy3d.plot3d.rendering.view.ImageViewport
Direct Known Subclasses:
Legend

public class ImageViewport
extends java.lang.Object

A ImageViewport allows displaying a 2d Image within an OpenGL viewport.

Author:
Martin Pernollet

Constructor Summary
ImageViewport()
           
 
Method Summary
 java.awt.Image getImage()
          Return the image rendered by the ImageViewport
 java.awt.Dimension getMinimumSize()
          Return the minimum size for this graphic.
 java.awt.Dimension getPreferedSize()
          Return the prefered size for this graphic.
 java.awt.Rectangle getRectangle()
          Returns the (x,y) offset that was applied to make this AbstractViewport stand in the appropriate canvas part.
 boolean getStretchToFill()
           
 void render(javax.media.opengl.GL gl, javax.media.opengl.glu.GLU glu)
          Renders the picture into the window, according to the viewport settings.
 void setImage(java.awt.Image image)
           
 void setImage(java.awt.Image image, int width, int height)
          Set the Image that will be displayed by the layer.
 void setImage(java.awt.Image image, int width, int height, java.nio.ByteBuffer buffer)
           
 void setScreenGridDisplayed(boolean status)
          Set the status of the screen grid.
 void setStretchToFill(boolean status)
          Set the status of the stretching mode (activated or not).
 void setViewPort(int width, int height)
          Set the view port (size of the renderer).
 void setViewPort(int width, int height, float left, float right)
          Set the view port (size of the renderer).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageViewport

public ImageViewport()
Method Detail

render

public void render(javax.media.opengl.GL gl,
                   javax.media.opengl.glu.GLU glu)
Renders the picture into the window, according to the viewport settings. If the picture is bigger than the viewport, it is simply centered in it, otherwise, it is scaled in order to fit into the viewport.

Parameters:
gl -
glu -

setImage

public void setImage(java.awt.Image image,
                     int width,
                     int height)
Set the Image that will be displayed by the layer.

Parameters:
image -

setImage

public void setImage(java.awt.Image image,
                     int width,
                     int height,
                     java.nio.ByteBuffer buffer)

setImage

public void setImage(java.awt.Image image)

getImage

public java.awt.Image getImage()
Return the image rendered by the ImageViewport


getMinimumSize

public java.awt.Dimension getMinimumSize()
Return the minimum size for this graphic.


getPreferedSize

public java.awt.Dimension getPreferedSize()
Return the prefered size for this graphic.


setStretchToFill

public void setStretchToFill(boolean status)
Set the status of the stretching mode (activated or not). Stretching consist in displaying the projection into the full screen slice (i.e. viewport).

Parameters:
status -

getStretchToFill

public boolean getStretchToFill()

setViewPort

public void setViewPort(int width,
                        int height)
Set the view port (size of the renderer).

Parameters:
width - the width of the target window.
height - the height of the target window.

setViewPort

public void setViewPort(int width,
                        int height,
                        float left,
                        float right)
Set the view port (size of the renderer).

Parameters:
width - the width of the target window.
height - the height of the target window.
left - the width's ratio where this subscreen starts in the target window.
right - the width's ratio where this subscreen stops in the target window.
Throws:
an - IllegalArgumentException if right is not greater than left.

getRectangle

public java.awt.Rectangle getRectangle()
Returns the (x,y) offset that was applied to make this AbstractViewport stand in the appropriate canvas part. and the actual width and height of the viewport. Only relevant after a call to applyViewPort.


setScreenGridDisplayed

public void setScreenGridDisplayed(boolean status)
Set the status of the screen grid.

Parameters:
status - the grid is displayed if status is set to true